Changeset 30f2815 for src/Parser
- Timestamp:
- Apr 17, 2013, 6:55:54 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:
- 69f38a
- Parents:
- a676f9
- git-author:
- Frederik Heber <heber@…> (03/14/13 08:38:23)
- git-committer:
- Frederik Heber <heber@…> (04/17/13 18:55:54)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/MpqcParser.cpp
ra676f9 r30f2815 54 54 #include "molecule.hpp" 55 55 #include "MoleculeListClass.hpp" 56 #include "Parser/Exceptions.hpp" 56 57 #include "World.hpp" 57 58 … … 85 86 bool MoleculeSection = false; 86 87 bool GeometrySection = false; 88 bool GeometrySection_n = false; 87 89 bool BasisSection = false; 88 90 bool AuxBasisSection = false; … … 94 96 boost::char_separator<char> whitesep(" \t"); 95 97 ConvertTo<double> toDouble; 98 int old_n = -1; // note down the last parsed "n" to ascertain it's ascending 96 99 97 100 molecule *newmol = World::getInstance().createMolecule(); … … 102 105 file->getline(line, MAXSTRINGSIZE-1); 103 106 std::string linestring(line); 104 if ((linestring.find("atoms geometry") == string::npos) && (linestring.find("}") != string::npos)) { 107 if (((linestring.find("atoms") == string::npos) 108 || (linestring.find("geometry") == string::npos)) 109 && (linestring.find("}") != string::npos)) { 105 110 GeometrySection = false; 106 111 } … … 113 118 if (MoleculeSection) { 114 119 if (GeometrySection) { // we have an atom 120 // LOG(2, "DEBUG: Full line is '" << linestring << "'."); 121 // separate off [..] part 115 122 tokenizer tokens(linestring, sep); 116 // if (tokens.size() != 2) 117 // throw MpqcParseException; 118 tokenizer::iterator tok_iter = tokens.begin(); 119 ASSERT(tok_iter != tokens.end(), 120 "FormatParser< mpqc >::load() - missing token for MoleculeSection in line "+linestring+"!"); 121 std::stringstream whitespacefilter(*tok_iter++); 123 // split part prior to [..] into tokens 124 std::string prior_part(*tokens.begin()); 125 tokenizer prefixtokens(prior_part, whitesep); 126 tokenizer::iterator tok_iter = prefixtokens.begin(); 127 // LOG(2, "DEBUG: Current tok_iter is " << *tok_iter << "."); 128 if (GeometrySection_n) { 129 ASSERT(tok_iter != prefixtokens.end(), 130 "FormatParser< mpqc >::load() - missing n entry for MoleculeSection in line " 131 +linestring+"!"); 132 // if additional n is given, parse and check but discard eventually 133 int n; 134 std::stringstream whitespacefilter(*tok_iter++); 135 whitespacefilter >> ws >> n; 136 if ((old_n != -1) && ((n-1) != old_n)) 137 ELOG(2, "n index is not simply ascending by one but " 138 << n-old_n << ", specific ids are lost!"); 139 if (old_n >= n) { 140 ELOG(1, "n index is not simply ascending, coordinates might get mixed!"); 141 throw ParserException(); 142 } 143 old_n = n; 144 } 145 ASSERT(tok_iter != prefixtokens.end(), 146 "FormatParser< mpqc >::load() - missing atoms entry for MoleculeSection in line " 147 +linestring+"!"); 148 // LOG(2, "DEBUG: Current tok_iter is " << *tok_iter << "."); 122 149 std::string element; 123 whitespacefilter >> ws >> element; 124 ASSERT(tok_iter != tokens.end(), 125 "FormatParser< mpqc >::load() - missing token for MoleculeSection in line "+linestring+"!"); 126 std::string vector = *tok_iter; 150 { 151 std::stringstream whitespacefilter(*tok_iter++); 152 whitespacefilter >> ws >> element; 153 } 154 // split [..] part and parse 155 tok_iter = (++tokens.begin()); 156 ASSERT (tok_iter != tokens.end(), 157 "FormatParser< mpqc >::load() - missing geometry entry for MoleculeSection in line " 158 +linestring+"!"); 159 // LOG(2, "DEBUG: Current tok_iter is " << *tok_iter << "."); 160 std::string vector(*tok_iter); 127 161 tokenizer vectorcomponents(vector, whitesep); 128 162 Vector X; 129 //if (vectorcomponents.size() != NDIM)130 // throw MpqcParseException;163 // if (vectorcomponents.size() != NDIM) 164 // throw ParserException(); 131 165 tok_iter = vectorcomponents.begin(); 132 166 for (int i=0; i<NDIM; ++i) { 167 // LOG(2, "DEBUG: Current tok_iter is " << *tok_iter << "."); 133 168 X[i] = toDouble(*tok_iter++); 134 169 } … … 220 255 MoleculeSection = true; 221 256 } 222 if (linestring.find("atoms geometry") != string::npos) { 257 if ((linestring.find("atoms") != string::npos) 258 && (linestring.find("geometry") != string::npos)) { 223 259 GeometrySection = true; 260 if (linestring.find("n") != string::npos) // neither atoms nor geometry contains a letter n 261 GeometrySection_n = true; 224 262 } 225 263 if ((linestring.find("basis<GaussianBasisSet>:") != string::npos) && ((linestring.find("abasis<") == string::npos))) {
Note:
See TracChangeset
for help on using the changeset viewer.