- Timestamp:
- May 18, 2016, 10:03:03 PM (9 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, 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_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, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, 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:
- 2fe4a5
- Parents:
- 045228
- git-author:
- Frederik Heber <heber@…> (03/16/16 10:20:02)
- git-committer:
- Frederik Heber <heber@…> (05/18/16 22:03:03)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/TremoloParser.cpp
r045228 r740f9f 50 50 #include "Element/periodentafel.hpp" 51 51 #include "LinearAlgebra/RealSpaceMatrix.hpp" 52 #include "Potentials/Particles/ParticleRegistry.hpp" 52 53 #include "molecule.hpp" 53 54 #include "World.hpp" … … 702 703 ConvertTo<int> toInt; 703 704 Vector tempVector; 705 const ParticleRegistry& registry = ParticleRegistry::getConstInstance(); 706 const periodentafel& periode = *World::getInstance().getPeriode(); 704 707 705 708 // setup tokenizer, splitting up white-spaced entries … … 753 756 ASSERT(tok_iter != tokens.end(), "FormatParser< tremolo >::readAtomDataLine() - no value for "+keyName+"!"); 754 757 LOG(4, "INFO: Parsing key " << keyName << " with next token " << word); 755 std::string element; 756 try { 757 element = knownTypes.getType(word); 758 } catch(IllegalParserKeyException) { 759 // clean up 760 World::getInstance().destroyAtom(newAtom); 761 // give an error 762 ELOG(0, "TremoloParser: I do not understand the element token " << word << "."); 763 return; 758 std::string elementname; 759 const element * elem = NULL; 760 if (!registry.isPresentByName(word)) { 761 std::string lowercase_word(word); 762 std::transform(word.begin()+1, word.end(), lowercase_word.begin()+1, ::tolower); 763 elem = periode.FindElement(lowercase_word); 764 if (elem == NULL) { 765 // clean up 766 World::getInstance().destroyAtom(newAtom); 767 // give an error 768 ELOG(0, "TremoloParser: tokens " << word << "/" << lowercase_word 769 << " is unknown to neither ParticleRegistry nor Periodentafel."); 770 return; 771 } else { 772 elementname = elem->getSymbol(); 773 } 774 } else { 775 const Particle * const p = registry.getByName(word); 776 elementname = p->getElement(); 777 elem = periode.FindElement(elementname); 764 778 } 765 779 // put type name into container for later use 766 780 atomInfo->set(currentField, word); 767 LOG(4, "INFO: Parsing element " << (word) << " as " << element << " according to KnownTypes.");781 LOG(4, "INFO: Parsing element " << (word) << " as " << elementname << " according to KnownTypes."); 768 782 tok_iter++; 769 newAtom->setType( World::getInstance().getPeriode()->FindElement(element));783 newAtom->setType(elem); 770 784 ASSERT(newAtom->getType(), "Type was not set for this atom"); 771 785 break;
Note:
See TracChangeset
for help on using the changeset viewer.