Changeset 61d69a4
- Timestamp:
- Feb 7, 2011, 10:43:35 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:
- 44fce5
- Parents:
- 9cff8b
- git-author:
- Frederik Heber <heber@…> (02/03/11 11:56:26)
- git-committer:
- Frederik Heber <heber@…> (02/07/11 10:43:35)
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/Makefile.am
r9cff8b r61d69a4 12 12 FormatParserStorage.cpp \ 13 13 MpqcParser.cpp \ 14 MpqcParser_Parameters.cpp \ 14 15 PcpParser.cpp \ 15 16 PdbAtomInfoContainer.cpp \ … … 24 25 FormatParserStorage.hpp \ 25 26 MpqcParser.hpp \ 27 MpqcParser_Parameters.hpp \ 26 28 PcpParser.hpp \ 27 29 PdbAtomInfoContainer.hpp \ -
src/Parser/MpqcParser.cpp
r9cff8b r61d69a4 41 41 * 42 42 */ 43 MpqcParser::MpqcParser() : 44 HessianPresent(false), 45 theory(MBPT2) 43 MpqcParser::MpqcParser() 46 44 {} 47 45 … … 115 113 for (vector<atom *>::iterator runner = allatoms.begin();runner != allatoms.end(); ++runner) 116 114 center += (*runner)->getPosition(); 117 center.Scale(1./ allatoms.size());115 center.Scale(1./(double)allatoms.size()); 118 116 119 117 // first without hessian … … 123 121 *file << "% Created by MoleCuilder" << endl; 124 122 *file << "mpqc: (" << endl; 125 *file << "\tsavestate = no"<< endl;126 *file << "\tdo_gradient = yes"<< endl;127 if ( HessianPresent) {123 *file << "\tsavestate = " << params.getString(MpqcParser_Parameters::savestateParam) << endl; 124 *file << "\tdo_gradient = " << params.getString(MpqcParser_Parameters::do_gradientParam) << endl; 125 if (params.getBool(MpqcParser_Parameters::HessianParam)) { 128 126 *file << "\tfreq<MolecularFrequencies>: (" << endl; 129 127 *file << "\t\tmolecule=$:molecule" << endl; 130 128 *file << "\t)" << endl; 131 129 } 132 switch (theory) { 133 case CLHF: 134 *file << "\tmole<CLHF>: (" << endl; 135 *file << "\t\tmolecule = $:molecule" << endl; 136 *file << "\t\tbasis = $:basis" << endl; 137 *file << "\t\tmemory = 16000000" << endl; 138 *file << "\t)" << endl; 139 break; 140 case CLKS: 141 *file << "\tmole<CLKS>: (" << endl; 130 switch (params.getTheory()) { 131 case MpqcParser_Parameters::CLHF: 132 *file << "\tmole<" << params.getString(MpqcParser_Parameters::theoryParam) << ">: (" << endl; 133 *file << "\t\tmolecule = $:molecule" << endl; 134 *file << "\t\tbasis = $:basis" << endl; 135 *file << "\t\tmaxiter = " << toString(params.getInt(MpqcParser_Parameters::maxiterParam))<< endl; 136 *file << "\t\tmemory = " << toString(params.getInt(MpqcParser_Parameters::memoryParam)) << endl; 137 *file << "\t)" << endl; 138 break; 139 case MpqcParser_Parameters::CLKS: 140 *file << "\tmole<" << params.getString(MpqcParser_Parameters::theoryParam) << ">: (" << endl; 142 141 *file << "\t\tfunctional<StdDenFunctional>:(name=B3LYP)" << endl; 143 142 *file << "\t\tmolecule = $:molecule" << endl; 144 143 *file << "\t\tbasis = $:basis" << endl; 145 *file << "\t\tmemory = 16000000" << endl; 146 *file << "\t)" << endl; 147 break; 148 case MBPT2: 149 *file << "\tmole<MBPT2>: (" << endl; 150 *file << "\t\tbasis = $:basis" << endl; 151 *file << "\t\tmolecule = $:molecule" << endl; 144 *file << "\t\tmaxiter = " << toString(params.getInt(MpqcParser_Parameters::maxiterParam))<< endl; 145 *file << "\t\tmemory = " << toString(params.getInt(MpqcParser_Parameters::memoryParam)) << endl; 146 *file << "\t)" << endl; 147 break; 148 case MpqcParser_Parameters::MBPT2: 149 *file << "\tmole<" << params.getString(MpqcParser_Parameters::theoryParam) << ">: (" << endl; 150 *file << "\t\tbasis = $:basis" << endl; 151 *file << "\t\tmolecule = $:molecule" << endl; 152 *file << "\t\tmemory = " << toString(params.getInt(MpqcParser_Parameters::memoryParam)) << endl; 152 153 *file << "\t\treference<CLHF>: (" << endl; 153 *file << "\t\t\tmaxiter = 1000"<< endl;154 *file << "\t\t\tmaxiter = " << toString(params.getInt(MpqcParser_Parameters::maxiterParam))<< endl; 154 155 *file << "\t\t\tbasis = $:basis" << endl; 155 156 *file << "\t\t\tmolecule = $:molecule" << endl; 157 *file << "\t\t\tmemory = " << toString(params.getInt(MpqcParser_Parameters::memoryParam)) << endl; 156 158 *file << "\t\t)" << endl; 157 159 *file << "\t)" << endl; 158 160 break; 159 case M BPT2_R12:160 *file << "\tmole< MBPT2_R12>: (" << endl;161 case MpqcParser_Parameters::MBPT2_R12: 162 *file << "\tmole<" << params.getString(MpqcParser_Parameters::theoryParam) << ">: (" << endl; 161 163 *file << "\t\tmolecule = $:molecule" << endl; 162 164 *file << "\t\tbasis = $:basis" << endl; 163 165 *file << "\t\taux_basis = $:abasis" << endl; 164 *file << "\t\tstdapprox = \" A'\"" << endl;165 *file << "\t\tnfzc = 1"<< endl;166 *file << "\t\tmemory = 16000000"<< endl;166 *file << "\t\tstdapprox = \"" << params.getString(MpqcParser_Parameters::stdapproxParam) << "\"" << endl; 167 *file << "\t\tnfzc = " << toString(params.getInt(MpqcParser_Parameters::nfzcParam)) << endl; 168 *file << "\t\tmemory = " << toString(params.getInt(MpqcParser_Parameters::memoryParam)) << endl; 167 169 *file << "\t\tintegrals<IntegralCints>:()" << endl; 168 170 *file << "\t\treference<CLHF>: (" << endl; 169 171 *file << "\t\t\tmolecule = $:molecule" << endl; 170 172 *file << "\t\t\tbasis = $:basis" << endl; 171 *file << "\t\t\tmaxiter = 1000"<< endl;172 *file << "\t\t\tmemory = 16000000"<< endl;173 *file << "\t\t\tintegrals< IntegralCints>:()" << endl;173 *file << "\t\t\tmaxiter = " << toString(params.getInt(MpqcParser_Parameters::maxiterParam)) << endl; 174 *file << "\t\t\tmemory = " << toString(params.getInt(MpqcParser_Parameters::memoryParam)) << endl; 175 *file << "\t\t\tintegrals<" << params.getString(MpqcParser_Parameters::integrationParam) << ">:()" << endl; 174 176 *file << "\t\t)" << endl; 175 177 *file << "\t)" << endl; … … 191 193 *file << ")" << endl; 192 194 *file << "basis<GaussianBasisSet>: (" << endl; 193 *file << "\tname = \"" << World::getInstance().getConfig()->basis<< "\"" << endl;195 *file << "\tname = \"" << params.getString(MpqcParser_Parameters::basisParam) << "\"" << endl; 194 196 *file << "\tmolecule = $:molecule" << endl; 195 197 *file << ")" << endl; 196 if ( theory ==MBPT2_R12) {198 if (params.getTheory() == MpqcParser_Parameters::MBPT2_R12) { 197 199 *file << "% auxiliary basis set specification" << endl; 198 200 *file << "\tabasis<GaussianBasisSet>: (" << endl; 199 *file << "\tname = \" aug-cc-pVDZ\"" << endl;201 *file << "\tname = \"" << params.getString(MpqcParser_Parameters::aux_basisParam) << "\"" << endl; 200 202 *file << "\tmolecule = $:molecule" << endl; 201 203 *file << ")" << endl; … … 204 206 } 205 207 206 /** Sets whether hessian is desired or not207 * \param hessian statement208 */209 void MpqcParser::setHessian(bool hessian)210 {211 HessianPresent = hessian;212 }213 214 /** Sets the desired level of solving theory to use215 * \param _theory shorthand of the theory216 */217 void MpqcParser::setTheory(enum Theory _theory)218 {219 theory = _theory;220 } -
src/Parser/MpqcParser.hpp
r9cff8b r61d69a4 16 16 17 17 #include "FormatParser.hpp" 18 #include "MpqcParser_Parameters.hpp" 18 19 19 20 #include <iosfwd> … … 24 25 class MpqcParser : public FormatParser 25 26 { 27 friend class ParserMpqcUnitTest; 26 28 public: 27 28 enum Theory { CLHF, CLKS, MBPT2, MBPT2_R12, unknown };29 29 30 30 MpqcParser(); … … 33 33 void save(std::ostream* file, const std::vector<atom *> &atoms); 34 34 35 void setHessian(bool hessian);36 void setTheory(enum Theory _theory);37 38 35 private: 39 // whether output with computing hessian is desired. 40 bool HessianPresent; 41 enum Theory theory; 42 43 void saveSimple(std::ostream *file, const std::vector<atom *> &atoms); 44 void saveHessian(std::ostream *file, const std::vector<atom *> &atoms); 36 MpqcParser_Parameters params; 45 37 }; 46 38 39 47 40 #endif /* MPQCPARSER_HPP_ */ -
src/Parser/unittests/ParserMpqcUnitTest.cpp
r9cff8b r61d69a4 24 24 #include <cppunit/ui/text/TestRunner.h> 25 25 26 #include "Parser/MpqcParser.hpp" 26 #include <boost/any.hpp> 27 27 28 #include "World.hpp" 28 29 #include "atom.hpp" … … 47 48 \t\tmolecule = $:molecule\n\ 48 49 \t\tbasis = $:basis\n\ 50 \t\tmaxiter = 1000\n\ 49 51 \t\tmemory = 16000000\n\ 50 52 \t)\n\ … … 70 72 \t\tmolecule = $:molecule\n\ 71 73 \t\tbasis = $:basis\n\ 74 \t\tmaxiter = 1000\n\ 72 75 \t\tmemory = 16000000\n\ 73 76 \t)\n\ … … 92 95 \t\tbasis = $:basis\n\ 93 96 \t\tmolecule = $:molecule\n\ 97 \t\tmemory = 16000000\n\ 94 98 \t\treference<CLHF>: (\n\ 95 99 \t\t\tmaxiter = 1000\n\ 96 100 \t\t\tbasis = $:basis\n\ 97 101 \t\t\tmolecule = $:molecule\n\ 102 \t\t\tmemory = 16000000\n\ 98 103 \t\t)\n\ 99 104 \t)\n\ … … 151 156 152 157 void ParserMpqcUnitTest::setUp() { 158 mpqc = new MpqcParser(); 159 153 160 World::getInstance(); 154 161 … … 161 168 162 169 void ParserMpqcUnitTest::tearDown() { 170 delete mpqc; 163 171 ChangeTracker::purgeInstance(); 164 172 World::purgeInstance(); … … 167 175 /************************************ tests ***********************************/ 168 176 177 void ParserMpqcUnitTest::ParameterTypeTest() { 178 // check types in boost::any map 179 CPPUNIT_ASSERT(mpqc->params.params[MpqcParser_Parameters::HessianParam].type() == typeid(bool)); 180 CPPUNIT_ASSERT(mpqc->params.params[MpqcParser_Parameters::HessianParam].type() != typeid(int)); 181 CPPUNIT_ASSERT(mpqc->params.params[MpqcParser_Parameters::savestateParam].type() == typeid(bool)); 182 CPPUNIT_ASSERT(mpqc->params.params[MpqcParser_Parameters::do_gradientParam].type() == typeid(bool)); 183 CPPUNIT_ASSERT(mpqc->params.params[MpqcParser_Parameters::maxiterParam].type() == typeid(int)); 184 CPPUNIT_ASSERT(mpqc->params.params[MpqcParser_Parameters::memoryParam].type() == typeid(int)); 185 CPPUNIT_ASSERT(mpqc->params.params[MpqcParser_Parameters::stdapproxParam].type() == typeid(std::string)); 186 CPPUNIT_ASSERT(mpqc->params.params[MpqcParser_Parameters::nfzcParam].type() == typeid(int)); 187 CPPUNIT_ASSERT(mpqc->params.params[MpqcParser_Parameters::basisParam].type() == typeid(std::string)); 188 CPPUNIT_ASSERT(mpqc->params.params[MpqcParser_Parameters::aux_basisParam].type() == typeid(std::string)); 189 CPPUNIT_ASSERT(mpqc->params.params[MpqcParser_Parameters::integrationParam].type() == typeid(MpqcParser_Parameters::IntegralCints)); 190 CPPUNIT_ASSERT(mpqc->params.params[MpqcParser_Parameters::theoryParam].type() == typeid(MpqcParser_Parameters::MBPT2)); 191 } 192 193 void ParserMpqcUnitTest::ParameterDefaultTest() { 194 // check default values 195 CPPUNIT_ASSERT(mpqc->params.getString(MpqcParser_Parameters::HessianParam) == "no"); 196 CPPUNIT_ASSERT(!mpqc->params.getBool(MpqcParser_Parameters::HessianParam)); 197 CPPUNIT_ASSERT(mpqc->params.getString(MpqcParser_Parameters::savestateParam) == "no"); 198 CPPUNIT_ASSERT(!mpqc->params.getBool(MpqcParser_Parameters::savestateParam)); 199 CPPUNIT_ASSERT(mpqc->params.getString(MpqcParser_Parameters::do_gradientParam) == "yes"); 200 CPPUNIT_ASSERT(mpqc->params.getBool(MpqcParser_Parameters::do_gradientParam)); 201 CPPUNIT_ASSERT(mpqc->params.getInt(MpqcParser_Parameters::maxiterParam) == 1000); 202 CPPUNIT_ASSERT(mpqc->params.getInt(MpqcParser_Parameters::memoryParam) == 16000000); 203 CPPUNIT_ASSERT(mpqc->params.getString(MpqcParser_Parameters::stdapproxParam) == "A'"); 204 CPPUNIT_ASSERT(mpqc->params.getInt(MpqcParser_Parameters::nfzcParam) == 1); 205 CPPUNIT_ASSERT(mpqc->params.getString(MpqcParser_Parameters::basisParam) == "3-21G"); 206 CPPUNIT_ASSERT(mpqc->params.getString(MpqcParser_Parameters::aux_basisParam) == "aug-cc-pVDZ"); 207 CPPUNIT_ASSERT(mpqc->params.getString(MpqcParser_Parameters::integrationParam) == "IntegralCints"); 208 CPPUNIT_ASSERT(mpqc->params.getString(MpqcParser_Parameters::theoryParam) == "MBPT2"); 209 CPPUNIT_ASSERT(mpqc->params.getTheory() == MpqcParser_Parameters::MBPT2); 210 CPPUNIT_ASSERT(mpqc->params.getIntegration() == MpqcParser_Parameters::IntegralCints); 211 212 // check that values are not removed 213 CPPUNIT_ASSERT(!mpqc->params.params[MpqcParser_Parameters::theoryParam].empty()); 214 215 // check throw, for the moment aren't, are caught in getInt() 216 //CPPUNIT_ASSERT_THROW(mpqc->params.getInt(MpqcParser_Parameters::integrationParam), boost::bad_any_cast); 217 //CPPUNIT_ASSERT_THROW(mpqc->params.getInt(MpqcParser_Parameters::theoryParam), boost::bad_any_cast); 218 219 } 220 169 221 void ParserMpqcUnitTest::readMpqcTest() { 170 222 stringstream input(waterMpqc_CLHF); 171 MpqcParser* testParser = new MpqcParser(); 172 testParser->setTheory(MpqcParser::CLHF); 173 testParser->load(&input); 223 mpqc->params.setTheory(MpqcParser_Parameters::CLHF); 224 mpqc->load(&input); 174 225 175 226 CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms()); … … 194 245 // create two stringstreams, one stored, one created 195 246 196 MpqcParser* testParser = new MpqcParser();197 247 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 198 248 { 199 249 // compare both configs for CLHF 200 250 stringstream output; 201 testParser->setTheory(MpqcParser::CLHF);202 testParser->save(&output, atoms);251 mpqc->params.setTheory(MpqcParser_Parameters::CLHF); 252 mpqc->save(&output, atoms); 203 253 stringstream input(waterMpqc_CLHF); 204 254 for (; std::getline(input, first) && std::getline(output, second); ) { … … 210 260 // compare both configs for CLKS 211 261 stringstream output; 212 testParser->setTheory(MpqcParser::CLKS);213 testParser->save(&output, atoms);262 mpqc->params.setTheory(MpqcParser_Parameters::CLKS); 263 mpqc->save(&output, atoms); 214 264 stringstream input(waterMpqc_CLKS); 215 265 for (; std::getline(input, first) && std::getline(output, second); ) { … … 221 271 // compare both configs for MBPT2 222 272 stringstream output; 223 testParser->setTheory(MpqcParser::MBPT2);224 testParser->save(&output, atoms);273 mpqc->params.setTheory(MpqcParser_Parameters::MBPT2); 274 mpqc->save(&output, atoms); 225 275 stringstream input(waterMpqc_MBPT2); 226 276 for (; std::getline(input, first) && std::getline(output, second); ) { … … 232 282 // compare both configs for MBPT2_R12 233 283 stringstream output; 234 testParser->setTheory(MpqcParser::MBPT2_R12);235 testParser->save(&output, atoms);284 mpqc->params.setTheory(MpqcParser_Parameters::MBPT2_R12); 285 mpqc->save(&output, atoms); 236 286 stringstream input(waterMpqc_MBPT2_R12); 237 287 for (; std::getline(input, first) && std::getline(output, second); ) { -
src/Parser/unittests/ParserMpqcUnitTest.hpp
r9cff8b r61d69a4 13 13 #endif 14 14 15 #include "Parser/MpqcParser.hpp" 15 16 16 17 #include <cppunit/extensions/HelperMacros.h> … … 20 21 { 21 22 CPPUNIT_TEST_SUITE( ParserMpqcUnitTest ) ; 23 CPPUNIT_TEST ( ParameterTypeTest ); 24 CPPUNIT_TEST ( ParameterDefaultTest ); 25 CPPUNIT_TEST ( readMpqcTest ); 22 26 CPPUNIT_TEST ( writeMpqcTest ); 23 CPPUNIT_TEST ( readMpqcTest );24 27 CPPUNIT_TEST_SUITE_END(); 25 28 … … 28 31 void tearDown(); 29 32 33 void ParameterTypeTest(); 34 void ParameterDefaultTest(); 30 35 void readMpqcTest(); 31 36 void writeMpqcTest(); 37 38 private: 39 MpqcParser *mpqc; 32 40 }; 33 41 -
tests/regression/Atoms/Add/post/test.in
r9cff8b r61d69a4 6 6 basis = $:basis 7 7 molecule = $:molecule 8 memory = 16000000 8 9 reference<CLHF>: ( 9 10 maxiter = 1000 10 11 basis = $:basis 11 12 molecule = $:molecule 13 memory = 16000000 12 14 ) 13 15 ) -
tests/regression/Atoms/Remove/post/test.in
r9cff8b r61d69a4 6 6 basis = $:basis 7 7 molecule = $:molecule 8 memory = 16000000 8 9 reference<CLHF>: ( 9 10 maxiter = 1000 10 11 basis = $:basis 11 12 molecule = $:molecule 13 memory = 16000000 12 14 ) 13 15 ) -
tests/regression/Parser/Mpqc/post/test.in
r9cff8b r61d69a4 6 6 basis = $:basis 7 7 molecule = $:molecule 8 memory = 16000000 8 9 reference<CLHF>: ( 9 10 maxiter = 1000 10 11 basis = $:basis 11 12 molecule = $:molecule 13 memory = 16000000 12 14 ) 13 15 )
Note:
See TracChangeset
for help on using the changeset viewer.