Changeset 4cbca0
- Timestamp:
- Feb 7, 2011, 10:45:43 AM (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:
- 1a6bda, 311da7b
- Parents:
- 963321a
- git-author:
- Frederik Heber <heber@…> (02/04/11 14:03:06)
- git-committer:
- Frederik Heber <heber@…> (02/07/11 10:45:43)
- Files:
-
- 9 added
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/MpqcParser.cpp
r963321a r4cbca0 55 55 void MpqcParser::load(istream *file) 56 56 { 57 bool GeometryFollows = false; 57 bool MpqcSection = false; 58 bool MoleculeSection = false; 59 bool GeometrySection = false; 60 bool BasisSection = false; 61 bool AuxBasisSection = false; 58 62 char line[MAXSTRINGSIZE]; 59 63 typedef boost::tokenizer<boost::char_separator<char> > tokenizer; 60 64 boost::char_separator<char> sep("[]"); 65 boost::char_separator<char> angularsep("<>"); 66 boost::char_separator<char> equalitysep("="); 61 67 boost::char_separator<char> whitesep(" \t"); 62 68 ConvertTo<double> toDouble; … … 64 70 molecule *newmol = World::getInstance().createMolecule(); 65 71 newmol->ActiveFlag = true; 72 // TODO: Remove the insertion into molecule when saving does not depend on them anymore. Also, remove molecule.hpp include 73 World::getInstance().getMolecules()->insert(newmol); 66 74 while (file->good()) { 67 75 file->getline(line, MAXSTRINGSIZE-1); 68 76 std::string linestring(line); 69 77 if ((linestring.find("atoms geometry") == string::npos) && (linestring.find("}") != string::npos)) { 70 GeometryFollows = false; 71 } 72 if (GeometryFollows) { // we have an atom 73 tokenizer tokens(linestring, sep); 74 // if (tokens.size() != 2) 75 // throw MpqcParseException; 78 GeometrySection = false; 79 } 80 if ((linestring.find(")") != string::npos)) { // ends a section which do not overlap 81 MpqcSection = false; 82 MoleculeSection = false; 83 BasisSection = false; 84 AuxBasisSection = false; 85 } 86 if (MoleculeSection) { 87 if (GeometrySection) { // we have an atom 88 tokenizer tokens(linestring, sep); 89 // if (tokens.size() != 2) 90 // throw MpqcParseException; 91 tokenizer::iterator tok_iter = tokens.begin(); 92 std::stringstream whitespacefilter(*tok_iter++); 93 std::string element; 94 whitespacefilter >> element; 95 std::string vector = *tok_iter; 96 tokenizer vectorcomponents(vector, whitesep); 97 Vector X; 98 // if (vectorcomponents.size() != NDIM) 99 // throw MpqcParseException; 100 tok_iter = vectorcomponents.begin(); 101 for (int i=0; i<NDIM; ++i) { 102 X[i] = toDouble(*tok_iter++); 103 } 104 // create atom 105 atom *newAtom = World::getInstance().createAtom(); 106 newAtom->setType(World::getInstance().getPeriode()->FindElement(element)); 107 newAtom->setPosition(X); 108 newmol->AddAtom(newAtom); 109 DoLog(1) && (Log() << Verbose(1) << "Adding atom " << *newAtom << std::endl); 110 } 111 } 112 if (MpqcSection) { 113 tokenizer tokens(linestring, equalitysep); 76 114 tokenizer::iterator tok_iter = tokens.begin(); 77 115 std::stringstream whitespacefilter(*tok_iter++); 78 std::string element; 79 whitespacefilter >> element; 80 std::string vector = *tok_iter; 81 tokenizer vectorcomponents(vector, whitesep); 82 Vector X; 83 // if (vectorcomponents.size() != NDIM) 84 // throw MpqcParseException; 85 tok_iter = vectorcomponents.begin(); 86 for (int i=0; i<NDIM; ++i) { 87 X[i] = toDouble(*tok_iter++); 88 } 89 // create atom 90 atom *newAtom = World::getInstance().createAtom(); 91 newAtom->setType(World::getInstance().getPeriode()->FindElement(element)); 92 newAtom->setPosition(X); 93 newmol->AddAtom(newAtom); 94 DoLog(1) && (Log() << Verbose(1) << "Adding atom " << *newAtom << std::endl); 116 std::string key(*tok_iter++); 117 if (params.haveParam(key)) { 118 std::stringstream linestream(linestring); 119 linestream >> params; 120 } else if (linestring.find("mole<") != string::npos) { // get theory 121 tokenizer tokens(linestring, angularsep); 122 tokenizer::iterator tok_iter = tokens.begin(); 123 std::string value(*(++tok_iter)); 124 std::stringstream linestream("theory = "+value); 125 linestream >> params; 126 } else if (linestring.find("integrals<") != string::npos) { // get theory 127 tokenizer tokens(linestring, angularsep); 128 tokenizer::iterator tok_iter = tokens.begin(); 129 std::string value(*(++tok_iter)); 130 std::stringstream linestream("integration = "+value); 131 linestream >> params; 132 } 133 } 134 if (BasisSection) { 135 tokenizer tokens(linestring, equalitysep); 136 tokenizer::iterator tok_iter = tokens.begin(); 137 std::string key(*tok_iter++); 138 std::string value(*tok_iter); 139 // TODO: use exception instead of ASSERT 140 ASSERT(tok_iter == tokens.end(), 141 "MpqcParser::load() - more than (key = value) on line "+linestring+"."); 142 if (key == "name") { 143 std::stringstream linestream("basis = "+value); 144 linestream >> params; 145 } 146 } 147 if (AuxBasisSection) { 148 tokenizer tokens(linestring, equalitysep); 149 tokenizer::iterator tok_iter = tokens.begin(); 150 std::string key(*tok_iter++); 151 std::string value(*tok_iter); 152 // TODO: use exception instead of ASSERT 153 ASSERT(tok_iter == tokens.end(), 154 "MpqcParser::load() - more than (key = value) on line "+linestring+"."); 155 if (key == "name") { 156 std::stringstream linestream("aux_basis = "+value); 157 linestream >> params; 158 } 95 159 } 96 160 // set some scan flags 161 if (linestring.find("mpqc:") != string::npos) { 162 MpqcSection = true; 163 } 164 if (linestring.find("molecule<Molecule>:") != string::npos) { 165 MoleculeSection = true; 166 } 97 167 if (linestring.find("atoms geometry") != string::npos) { 98 GeometryFollows = true; 168 GeometrySection = true; 169 } 170 if ((linestring.find("basis<GaussianBasisSet>:") != string::npos) && ((linestring.find("abasis<") == string::npos))) { 171 BasisSection = true; 172 } 173 if (linestring.find("abasis<") != string::npos) { 174 AuxBasisSection = true; 99 175 } 100 176 } -
tests/regression/Parser/Mpqc-SetParameters/testsuite-parser-mpqc-set-parameters.at
r963321a r4cbca0 4 4 AT_KEYWORDS([options]) 5 5 AT_CHECK([pwd],[ignore],[ignore]) 6 AT_CHECK([../../molecuilder -i test.conf -o mpqc -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Mpqc /pre/test.xyz -v 1 --set-mpqc-parameters "basis = 4-31G"], 0, [stdout], [ignore])6 AT_CHECK([../../molecuilder -i test.conf -o mpqc -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Mpqc-SetParameters/pre/test.xyz -v 1 --set-mpqc-parameters "basis = 4-31G"], 0, [stdout], [ignore]) 7 7 AT_CHECK([fgrep "name = \"4-31G\"" test.in], 0, [ignore], [ignore]) 8 8 AT_CLEANUP … … 11 11 AT_KEYWORDS([options]) 12 12 AT_CHECK([pwd],[ignore],[ignore]) 13 AT_CHECK([../../molecuilder -i test.conf -o mpqc -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Mpqc /pre/test.xyz -v 1 --set-mpqc-parameters "maxiter = 499"], 0, [stdout], [ignore])13 AT_CHECK([../../molecuilder -i test.conf -o mpqc -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Mpqc-SetParameters/pre/test.xyz -v 1 --set-mpqc-parameters "maxiter = 499"], 0, [stdout], [ignore]) 14 14 AT_CHECK([fgrep "maxiter = 499" test.in], 0, [ignore], [ignore]) 15 15 AT_CLEANUP … … 18 18 AT_KEYWORDS([options]) 19 19 AT_CHECK([pwd],[ignore],[ignore]) 20 AT_CHECK([../../molecuilder -i test.conf -o mpqc -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Mpqc /pre/test.xyz -v 1 --set-mpqc-parameters "theory=CLKS"], 0, [stdout], [ignore])20 AT_CHECK([../../molecuilder -i test.conf -o mpqc -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Mpqc-SetParameters/pre/test.xyz -v 1 --set-mpqc-parameters "theory=CLKS"], 0, [stdout], [ignore]) 21 21 AT_CHECK([fgrep "<CLKS>" test.in], 0, [ignore], [ignore]) 22 22 AT_CLEANUP 23 24 AT_SETUP([Parser - MPQC - check in file]) 25 AT_KEYWORDS([options]) 26 AT_CHECK([pwd],[ignore],[ignore]) 27 AT_CHECK([../../molecuilder -i ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Mpqc-SetParameters/pre/testCLHF.in -v 1 --set-mpqc-parameters "basis = 4-31G;maxiter=499;theory=CLKS;"], 0, [stdout], [ignore]) 28 AT_CHECK([file=testCLHF.in; diff -I '%.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Mpqc-SetParameters/post/$file], 0, [ignore], [ignore]) 29 AT_CLEANUP 30 -
tests/regression/Parser/Mpqc/post/testMBPT2.in
r963321a r4cbca0 1 % Created by MoleCuilder2 1 mpqc: ( 3 2 savestate = no … … 6 5 basis = $:basis 7 6 molecule = $:molecule 7 memory = 16000000 8 8 reference<CLHF>: ( 9 9 maxiter = 1000 10 10 basis = $:basis 11 11 molecule = $:molecule 12 memory = 16000000 12 13 ) 13 14 ) … … 16 17 unit = angstrom 17 18 { atoms geometry } = { 18 H [ 0 0 0 ] 19 O [ -0.505735 0 0 ] 20 H [ 0.252867 0 0.504284 ] 21 H [ 0.252867 0 -0.504284 ] 19 22 } 20 23 ) -
tests/regression/Parser/Mpqc/testsuite-parser-mpqc.at
r963321a r4cbca0 3 3 AT_SETUP([Parser - loading mpqc file]) 4 4 AT_KEYWORDS([parser,mpqc]) 5 AT_XFAIL_IF([/bin/true]) 6 AT_CHECK([../../molecuilder -i test.in -o mpqc -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Mpqc/pre/test.in], 0, [ignore], [ignore]) 7 AT_CHECK([file=test.in; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Mpqc/post/$file], 0, [ignore], [ignore]) 5 AT_CHECK([../../molecuilder -i ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Mpqc/pre/testCLHF.in] -o mpqc, 0, [ignore], [ignore]) 6 AT_CHECK([file=testCLHF.in; diff -I '%.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Mpqc/post/$file], 0, [ignore], [ignore]) 7 AT_CHECK([../../molecuilder -i ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Mpqc/pre/testCLKS.in] -o mpqc, 0, [ignore], [ignore]) 8 AT_CHECK([file=testCLKS.in; diff -I '%.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Mpqc/post/$file], 0, [ignore], [ignore]) 9 AT_CHECK([../../molecuilder -i ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Mpqc/pre/testMBPT2.in] -o mpqc, 0, [ignore], [ignore]) 10 AT_CHECK([file=testMBPT2.in; diff -I '%.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Mpqc/post/$file], 0, [ignore], [ignore]) 11 AT_CHECK([../../molecuilder -i ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Mpqc/pre/testMBPT2_R12.in] -o mpqc, 0, [ignore], [ignore]) 12 AT_CHECK([file=testMBPT2_R12.in; diff -I '%.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Parser/Mpqc/post/$file], 0, [ignore], [ignore]) 8 13 AT_CLEANUP 9 14
Note:
See TracChangeset
for help on using the changeset viewer.