Changeset fcac72
- Timestamp:
- Feb 24, 2011, 7:48:13 PM (14 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 9dba5f
- Parents:
- 6a465e
- git-author:
- Frederik Heber <heber@…> (02/24/11 12:48:45)
- git-committer:
- Frederik Heber <heber@…> (02/24/11 19:48:13)
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/PcpParser.cpp
r6a465e rfcac72 548 548 *file << "#Ion_TypeNr._Nr.R[0] R[1] R[2] MoveType (0 MoveIon, 1 FixedIon)" << endl; 549 549 map<int, int> ZtoCountMap; 550 map<atom *, int> AtomtoCountMap; 550 551 pair < map<int, int>::iterator, bool > Inserter; 551 int nr = 0; 552 for (vector<atom *>::const_iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) { 553 Inserter = ZtoCountMap.insert( pair<int, int>((*AtomRunner)->getType()->getAtomicNumber(), 1) ); 554 if (!Inserter.second) 555 Inserter.first->second += 1; 556 const int Z = (*AtomRunner)->getType()->getAtomicNumber(); 557 *file << "Ion_Type" << ZtoIndexMap[Z] << "_" << ZtoCountMap[Z] << "\t" << fixed << setprecision(9) << showpoint; 558 *file << (*AtomRunner)->at(0) << "\t" << (*AtomRunner)->at(1) << "\t" << (*AtomRunner)->at(2); 559 *file << "\t" << (int)((*AtomRunner)->getFixedIon()); 560 if ((*AtomRunner)->getAtomicVelocity().Norm() > MYEPSILON) 561 *file << "\t" << scientific << setprecision(6) << (*AtomRunner)->getAtomicVelocity()[0] << "\t" << (*AtomRunner)->getAtomicVelocity()[1] << "\t" << (*AtomRunner)->getAtomicVelocity()[2] << "\t"; 562 *file << " # molecule nr " << nr++ << endl; 563 } 552 bool ContinueStatus = true; 553 bool AddNewLine = false; 554 size_t step = 0; 555 do { 556 int nr = 0; 557 ContinueStatus = false; 558 for (vector<atom *>::const_iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) { 559 if ((*AtomRunner)->getTrajectorySize() > step) { 560 if (step == 0) { // fill list only on first step 561 Inserter = ZtoCountMap.insert( pair<int, int>((*AtomRunner)->getType()->getAtomicNumber(), 1) ); 562 if (!Inserter.second) 563 Inserter.first->second += 1; 564 AtomtoCountMap.insert( make_pair((*AtomRunner), Inserter.first->second) ); 565 } 566 if (AddNewLine) { 567 AddNewLine = false; 568 *file << endl; 569 } 570 const int Z = (*AtomRunner)->getType()->getAtomicNumber(); 571 *file << "Ion_Type" << ZtoIndexMap[Z] << "_" << AtomtoCountMap[(*AtomRunner)] << "\t" << fixed << setprecision(9) << showpoint; 572 *file << (*AtomRunner)->atStep(0, step) 573 << "\t" << (*AtomRunner)->atStep(1,step) 574 << "\t" << (*AtomRunner)->atStep(2,step); 575 *file << "\t" << (int)((*AtomRunner)->getFixedIon()); 576 if ((*AtomRunner)->getAtomicVelocityAtStep(step).Norm() > MYEPSILON) 577 *file << "\t" << scientific << setprecision(6) 578 << (*AtomRunner)->getAtomicVelocityAtStep(step)[0] << "\t" 579 << (*AtomRunner)->getAtomicVelocityAtStep(step)[1] << "\t" 580 << (*AtomRunner)->getAtomicVelocityAtStep(step)[2] << "\t"; 581 *file << " # molecule nr " << nr++ << endl; 582 ContinueStatus = true; // as long as a single atom still has trajectory points, continue 583 } 584 } 585 ++step; 586 if (ContinueStatus) 587 AddNewLine = true; 588 } while (ContinueStatus); 564 589 } 565 590 -
src/config.cpp
r6a465e rfcac72 461 461 const element *elementhash[MAX_ELEMENTS]; 462 462 char name[MAXSTRINGSIZE]; 463 char keyword[MAXSTRINGSIZE];464 463 int Z = -1; 465 464 int No[MAX_ELEMENTS]; … … 497 496 return; 498 497 } 499 FileBuffer->CurrentLine++; 500 //Log() << Verbose(0) << FileBuffer->buffer[ FileBuffer->LineMapping[FileBuffer->CurrentLine]];498 499 FileBuffer->CurrentLine++; // skip to next line 501 500 FileBuffer->MapIonTypesInBuffer(NoAtoms); 502 501 for (int i=FileBuffer->CurrentLine; i<FileBuffer->NoLines;++i) { 503 Log() << Verbose(0) << FileBuffer->buffer[ FileBuffer->LineMapping[i] ];502 DoLog(4) && (Log() << Verbose(4) << FileBuffer->buffer[ FileBuffer->LineMapping[i] ]); 504 503 } 505 504 … … 535 534 neues = World::getInstance().createAtom(); 536 535 AtomList[i][j] = neues; 537 std::cout << "filling LinearList [ (FileBuffer->LineMapping[" << FileBuffer->CurrentLine << "]) = " << FileBuffer->LineMapping[FileBuffer->CurrentLine] << " with " << neues << endl;536 DoLog(4) && (Log() << Verbose(4) << "Filling LinearList [ (FileBuffer->LineMapping[" << FileBuffer->CurrentLine << "]) = " << FileBuffer->LineMapping[FileBuffer->CurrentLine] << " with " << neues << endl); 538 537 LinearList[ FileBuffer->LineMapping[FileBuffer->CurrentLine] ] = neues; 539 538 neues->setType(elementhash[i]); // find element type … … 547 546 DoLog(3) && (Log() << Verbose(3) << "INFO: Line contains " << tokens_size << " tokens." << std::endl); 548 547 // and parse 548 tempVector.Zero(); 549 549 if (tokens_size >= 5) { // only AtomicPosition and FixedIon 550 550 DoLog(3) && (Log() << Verbose(3) << "INFO: Parsing AtomicPosition and FixedIon" << std::endl); … … 555 555 neues->setFixedIon(_fixedion == 1); 556 556 } 557 tempVector.Zero(); 557 558 if (tokens_size >= 8) { // AtomicVelocity 558 559 DoLog(3) && (Log() << Verbose(3) << "INFO: Parsing AtomicVelocity" << std::endl); 559 560 for (int i=0;i<NDIM;++i) 560 561 tempVector[i] = toDouble(*tok_iter++); 561 neues->setAtomicVelocityAtStep(step, tempVector);562 562 } 563 neues->setAtomicVelocityAtStep(step, tempVector); 564 tempVector.Zero(); 563 565 if (tokens_size >= 11) { // AtomicForce 564 566 DoLog(3) && (Log() << Verbose(3) << "INFO: Parsing AtomicForce" << std::endl); 565 567 for (int i=0;i<NDIM;++i) 566 568 tempVector[i] = toDouble(*tok_iter++); 567 neues->setAtomicForceAtStep(step, tempVector);568 569 } 570 neues->setAtomicForceAtStep(step, tempVector); 569 571 std::stringstream output; 570 572 output << "Parsed position of step " << (step+1) << ": "; … … 597 599 } 598 600 599 // if (!FastParsing) {600 // // parse in trajectories601 // bool status = true;602 // while (status) {603 // DoLog(0) && (Log() << Verbose(0) << "Currently checking on MD step " << repetition+1 << "." << endl);604 // for (int i=0; i < MaxTypes; i++) {605 // sprintf(name,"Ion_Type%i",i+1);606 // for(int j=0;j<No[i];j++) {607 // sprintf(keyword,"%s_%i",name, j+1);608 // DoLog(3) && (Log() << Verbose(3) << "Looking for " << keyword << " of " << (repetition) << " repetition." << std::endl);609 // DoLog(3) && (Log() << Verbose(3) << "INFO: Parsing AtomicPosition." << std::endl);610 // for (int k=0;k<NDIM;++k) { // repetition=1 is correct, as we advance eventually by sequential=1!611 // status = status && ParseForParameter(verbose,FileBuffer, (const char*)keyword, 0, 1+k, 1, double_type, &tempVector[k], 1, (repetition == 0) ? critical : optional);612 // }613 // if (!status)614 // break;615 //616 // if (repetition == 0) {617 // neues = World::getInstance().createAtom();618 // AtomList[i][j] = neues;619 // std::cout << "filling LinearList [ (FileBuffer->LineMapping[" << FileBuffer->CurrentLine << "]) = " << FileBuffer->LineMapping[FileBuffer->CurrentLine] << " with " << neues << endl;620 // LinearList[ FileBuffer->LineMapping[FileBuffer->CurrentLine] ] = neues;621 // neues->setType(elementhash[i]); // find element type622 // } else623 // neues = AtomList[i][j];624 //625 // DoLog(3) && (Log() << Verbose(3) << "INFO: Parsing FixedIon." << std::endl);626 // status = status && ParseForParameter(verbose,FileBuffer, (const char*)keyword, 0, 4, 1, int_type, &_fixedion, 1, (repetition == 0) ? critical : optional);627 // neues->setFixedIon(_fixedion == 1);628 //629 // // check size of vectors630 // if (neues->getTrajectorySize() <= (unsigned int)(repetition)) {631 // neues->ResizeTrajectory(repetition+10);632 // //Log() << Verbose(0) << "Increasing size for trajectory array of " << keyword << " to " << (repetition+10) << "." << endl;633 // }634 //635 // // put into trajectories list636 // neues->setPosition(repetition, tempVector);637 //638 // // parse velocities if present639 // DoLog(3) && (Log() << Verbose(3) << "INFO: Parsing AtomicVelocity." << std::endl);640 // bool velocityStatus = true;641 // for (int k=0;k<NDIM;++k)642 // velocityStatus = velocityStatus && ParseForParameter(verbose,FileBuffer, (const char*)keyword, 0, 5+k, 1, double_type, &tempVector[k], 1,optional);643 // if (!velocityStatus) {644 // neues->setAtomicVelocity(repetition, zeroVec);645 // } else646 // neues->setAtomicVelocity(repetition, tempVector);647 //648 // // parse forces if present649 // DoLog(3) && (Log() << Verbose(3) << "INFO: Parsing AtomicForce." << std::endl);650 // bool forceStatus = true;651 // for (int k=0;k<NDIM;++k)652 // forceStatus = forceStatus && ParseForParameter(verbose,FileBuffer, (const char*)keyword, (k==(NDIM-1)) ? 1 : 0, 8+k, 1, double_type, &tempVector[k], 1,optional);653 // if (!forceStatus) {654 // ++FileBuffer->CurrentLine; // as above sequential=1 did not apply due to end of file655 // neues->setAtomicForce(repetition, zeroVec);656 // } else {657 // neues->setAtomicForce(repetition, tempVector);658 // }659 //660 // std::stringstream output;661 // output << "Parsed position of step " << (repetition+1) << ": ";662 // output << neues->getPosition(repetition); // next step663 // output << "\t";664 // output << (neues->getFixedIon() ? "true" : "false");665 // output << "\t";666 // output << neues->getAtomicVelocity(repetition); // next step667 // output << "\t";668 // output << neues->getAtomicForce(repetition); // next step669 // DoLog(2) && (Log() << Verbose(2) << output.str() << endl);670 // }671 // }672 // repetition++;673 // }674 // repetition--;675 // if (repetition <= 1) // if onyl one step, desactivate use of trajectories676 // mol->MDSteps = 0;677 // else {678 // DoLog(0) && (Log() << Verbose(0) << "Found " << repetition+1 << " trajectory step(s)." << endl);679 // mol->MDSteps = repetition;680 // }681 // } else {682 // // find the maximum number of MD steps so that we may parse last one (Ion_Type1_1 must always be present, because is the first atom)683 // repetition = 0;684 // while ( ParseForParameter(verbose,FileBuffer, "Ion_Type1_1", 0, 1, 1, double_type, &value[0], repetition, (repetition == 0) ? critical : optional) &&685 // ParseForParameter(verbose,FileBuffer, "Ion_Type1_1", 0, 2, 1, double_type, &value[1], repetition, (repetition == 0) ? critical : optional) &&686 // ParseForParameter(verbose,FileBuffer, "Ion_Type1_1", 0, 3, 1, double_type, &value[2], repetition, (repetition == 0) ? critical : optional))687 // repetition++;688 // DoLog(0) && (Log() << Verbose(0) << "I found " << repetition << " times the keyword Ion_Type1_1." << endl);689 // // parse in molecule coordinates690 // for (int i=0; i < MaxTypes; i++) {691 // sprintf(name,"Ion_Type%i",i+1);692 // for(int j=0;j<No[i];j++) {693 // sprintf(keyword,"%s_%i",name, j+1);694 // if (repetition == 0) {695 // neues = World::getInstance().createAtom();696 // AtomList[i][j] = neues;697 // LinearList[ FileBuffer->LineMapping[FileBuffer->CurrentLine] ] = neues;698 // neues->setType(elementhash[i]); // find element type699 // } else700 // neues = AtomList[i][j];701 // // then parse for each atom the coordinates as often as present702 // ParseForParameter(verbose,FileBuffer, keyword, 0, 1, 1, double_type, &tempVector[0], repetition,critical);703 // ParseForParameter(verbose,FileBuffer, keyword, 0, 2, 1, double_type, &tempVector[1], repetition,critical);704 // ParseForParameter(verbose,FileBuffer, keyword, 0, 3, 1, double_type, &tempVector[2], repetition,critical);705 // neues->setPosition(tempVector);706 // bool _fixedion;707 // ParseForParameter(verbose,FileBuffer, keyword, 0, 4, 1, int_type, &_fixedion, repetition,critical);708 // neues->setFixedIon(_fixedion);709 // bool velocityStatus = true;710 // velocityStatus = velocityStatus &&711 // ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &tempVector[0], repetition,optional) &&712 // ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &tempVector[1], repetition,optional) &&713 // ParseForParameter(verbose,FileBuffer, keyword, 1, 7, 1, double_type, &tempVector[2], repetition,optional);714 // if (!velocityStatus)715 // neues->setAtomicVelocity(zeroVec);716 // else717 // neues->setAtomicVelocity(tempVector);718 //719 // // here we don't care if forces are present (last in trajectories is always equal to current position)720 // neues->setType(elementhash[i]); // find element type721 // mol->AddAtom(neues);722 // }723 // }724 // }725 601 // put atoms into the molecule in their original order 726 602 for(map<int, atom*>::iterator runner = LinearList.begin(); runner != LinearList.end(); ++runner) { -
tests/regression/Parser/Pcp/testsuite-parser-pcp.at
r6a465e rfcac72 12 12 AT_CHECK([diff store.conf ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Pcp/post/test.conf], 0, [ignore], [ignore]) 13 13 AT_CLEANUP 14 15 AT_SETUP([Parser - loading with multiple time steps]) 16 AT_KEYWORDS([parser,pcp]) 17 AT_CHECK([../../molecuilder -i testmulti.conf -o pcp -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Pcp/pre/testmulti.conf], 0, [ignore], [ignore]) 18 AT_CHECK([file=testmulti.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Pcp/post/$file], 0, [ignore], [ignore]) 19 AT_CLEANUP
Note:
See TracChangeset
for help on using the changeset viewer.