- Timestamp:
- Dec 14, 2012, 1:02:50 PM (12 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:
- 3b75c2
- Parents:
- 05e2ed
- git-author:
- Frederik Heber <heber@…> (10/25/12 08:40:00)
- git-committer:
- Frederik Heber <heber@…> (12/14/12 13:02:50)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/TremoloParser.cpp
r05e2ed rfc41df 629 629 ASSERT(tokens.begin() != tokens.end(), 630 630 "FormatParser< tremolo >::readAtomDataLine - empty string, need at least ' '!"); 631 tokenizer:: iterator tok_iter = tokens.begin();631 tokenizer::const_iterator tok_iter = tokens.begin(); 632 632 // then associate each token to each file 633 for (usedFields_t::const_iterator it = usedFields_load.begin(); it <usedFields_load.end(); it++) {633 for (usedFields_t::const_iterator it = usedFields_load.begin(); it != usedFields_load.end(); it++) { 634 634 const std::string keyName = it->substr(0, it->find("=")); 635 635 currentField = knownKeys[keyName]; 636 const std::string word = *tok_iter; 636 ASSERT(tok_iter != tokens.end(), 637 "FormatParser< tremolo >::readAtomDataLine - too few entries in line '"+line+"'!"); 638 const std::string &word = *tok_iter; 637 639 LOG(4, "INFO: Parsing key " << keyName << " with remaining data " << word); 638 640 switch (currentField) { … … 641 643 for (int i=0;i<NDIM;i++) { 642 644 ASSERT(tok_iter != tokens.end(), "FormatParser< tremolo >::readAtomDataLine() - no value for x["+toString(i)+"]!"); 643 LOG(4, "INFO: Parsing key " << keyName << " with next token " << *tok_iter);644 newAtom->set(i, toDouble( *tok_iter));645 LOG(4, "INFO: Parsing key " << keyName << " with next token " << word); 646 newAtom->set(i, toDouble(word)); 645 647 tok_iter++; 646 648 } … … 650 652 for (int i=0;i<NDIM;i++) { 651 653 ASSERT(tok_iter != tokens.end(), "FormatParser< tremolo >::readAtomDataLine() - no value for u["+toString(i)+"]!"); 652 LOG(4, "INFO: Parsing key " << keyName << " with next token " << *tok_iter);653 tempVector[i] = toDouble( *tok_iter);654 LOG(4, "INFO: Parsing key " << keyName << " with next token " << word); 655 tempVector[i] = toDouble(word); 654 656 tok_iter++; 655 657 } … … 660 662 for (int i=0;i<NDIM;i++) { 661 663 ASSERT(tok_iter != tokens.end(), "FormatParser< tremolo >::readAtomDataLine() - no value for F["+toString(i)+"]!"); 662 LOG(4, "INFO: Parsing key " << keyName << " with next token " << *tok_iter);663 tempVector[i] = toDouble( *tok_iter);664 LOG(4, "INFO: Parsing key " << keyName << " with next token " << word); 665 tempVector[i] = toDouble(word); 664 666 tok_iter++; 665 667 } … … 669 671 { 670 672 ASSERT(tok_iter != tokens.end(), "FormatParser< tremolo >::readAtomDataLine() - no value for "+keyName+"!"); 671 LOG(4, "INFO: Parsing key " << keyName << " with next token " << *tok_iter);673 LOG(4, "INFO: Parsing key " << keyName << " with next token " << word); 672 674 std::string element; 673 675 try { 674 element = knownTypes.getType( *tok_iter);676 element = knownTypes.getType(word); 675 677 } catch(IllegalParserKeyException) { 676 678 // clean up 677 679 World::getInstance().destroyAtom(newAtom); 678 680 // give an error 679 ELOG(0, "TremoloParser: I do not understand the element token " << *tok_iter << "."); 681 ELOG(0, "TremoloParser: I do not understand the element token " << word << "."); 682 return; 680 683 } 681 684 // put type name into container for later use 682 atomInfo->set(currentField, *tok_iter);683 LOG(4, "INFO: Parsing element " << ( *tok_iter) << " as " << element << " according to KnownTypes.");685 atomInfo->set(currentField, word); 686 LOG(4, "INFO: Parsing element " << (word) << " as " << element << " according to KnownTypes."); 684 687 tok_iter++; 685 688 newAtom->setType(World::getInstance().getPeriode()->FindElement(element)); … … 689 692 case TremoloKey::Id : 690 693 ASSERT(tok_iter != tokens.end(), "FormatParser< tremolo >::readAtomDataLine() - no value for "+keyName+"!"); 691 LOG(4, "INFO: Parsing key " << keyName << " with next token " << *tok_iter);692 associateLocaltoGlobalId(toInt( *tok_iter), atomid);694 LOG(4, "INFO: Parsing key " << keyName << " with next token " << word); 695 associateLocaltoGlobalId(toInt(word), atomid); 693 696 tok_iter++; 694 697 break; … … 696 699 for (int i=0;i<atoi(it->substr(it->find("=") + 1, 1).c_str());i++) { 697 700 ASSERT(tok_iter != tokens.end(), "FormatParser< tremolo >::readAtomDataLine() - no value for "+keyName+"!"); 698 LOG(4, "INFO: Parsing key " << keyName << " with next token " << *tok_iter);699 lineStream << *tok_iter<< "\t";701 LOG(4, "INFO: Parsing key " << keyName << " with next token " << word); 702 lineStream << word << "\t"; 700 703 tok_iter++; 701 704 } … … 705 708 case TremoloKey::charge : 706 709 ASSERT(tok_iter != tokens.end(), "FormatParser< tremolo >::readAtomDataLine() - no value for "+keyName+"!"); 707 LOG(4, "INFO: Parsing key " << keyName << " with next token " << *tok_iter);708 atomInfo->set(currentField, *tok_iter);709 newAtom->setCharge(boost::lexical_cast<double>( *tok_iter));710 LOG(4, "INFO: Parsing key " << keyName << " with next token " << word); 711 atomInfo->set(currentField, word); 712 newAtom->setCharge(boost::lexical_cast<double>(word)); 710 713 tok_iter++; 711 714 break; 712 715 default : 713 716 ASSERT(tok_iter != tokens.end(), "FormatParser< tremolo >::readAtomDataLine() - no value for "+keyName+"!"); 714 LOG(4, "INFO: Parsing key " << keyName << " with next token " << *tok_iter);715 atomInfo->set(currentField, *tok_iter);717 LOG(4, "INFO: Parsing key " << keyName << " with next token " << word); 718 atomInfo->set(currentField, word); 716 719 tok_iter++; 717 720 break;
Note:
See TracChangeset
for help on using the changeset viewer.