Changeset 154a45
- Timestamp:
- Oct 17, 2011, 4:56:37 PM (13 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:
- f758dd
- Parents:
- 1bef07
- git-author:
- Frederik Heber <heber@…> (10/05/11 15:17:27)
- git-committer:
- Frederik Heber <heber@…> (10/17/11 16:56:37)
- Location:
- src/Parser/unittests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/unittests/ParserPsi3UnitTest.cpp
r1bef07 r154a45 125 125 parser = new FormatParser<psi3>(); 126 126 127 params = &parser->getParams(); 128 127 129 World::getInstance(); 128 130 … … 135 137 void ParserPsi3UnitTest::tearDown() 136 138 { 139 params = NULL; 137 140 delete parser; 138 141 ChangeTracker::purgeInstance(); … … 143 146 144 147 void ParserPsi3UnitTest::ParameterDefaultTest() { 145 Psi3Parser_Parameters ¶ms = parser->getParams();146 148 // check default values 147 CPPUNIT_ASSERT(params .getParameter(Psi3Parser_Parameters::labelParam) == std::string("unknown job"));148 CPPUNIT_ASSERT(params .getParameter(Psi3Parser_Parameters::jobtypeParam) == params.ValidJobtypes[Psi3Parser_Parameters::SP]);149 CPPUNIT_ASSERT(params .getParameter(Psi3Parser_Parameters::wavefunctionParam) == params.ValidWavefunction[Psi3Parser_Parameters::SCF]);150 CPPUNIT_ASSERT(params .getParameter(Psi3Parser_Parameters::maxiterParam) == std::string("80"));151 CPPUNIT_ASSERT(params .getParameter(Psi3Parser_Parameters::referenceParam) == params.ValidReference[Psi3Parser_Parameters::RHF]);152 CPPUNIT_ASSERT(params .getParameter(Psi3Parser_Parameters::basisParam) == std::string("cc-pVTZ"));153 CPPUNIT_ASSERT(params .getParameter(Psi3Parser_Parameters::freeze_coreParam) == params.ValidFreezeCore[Psi3Parser_Parameters::YES]);154 CPPUNIT_ASSERT(params .getParameter(Psi3Parser_Parameters::unitsParam) == params.ValidUnits[Psi3Parser_Parameters::angstrom]);155 CPPUNIT_ASSERT(params .getParameter(Psi3Parser_Parameters::dertypeParam) == params.ValidDerivativeType[Psi3Parser_Parameters::NONE]);156 CPPUNIT_ASSERT(params .getParameter(Psi3Parser_Parameters::originParam) == std::string("(0.0\t0.0\t0.0)"));157 CPPUNIT_ASSERT(params .getParameter(Psi3Parser_Parameters::multipParam) == std::string("1"));158 CPPUNIT_ASSERT(params .getParameter(Psi3Parser_Parameters::chargeParam) == std::string("0"));159 CPPUNIT_ASSERT(params .getParameter(Psi3Parser_Parameters::soccParam) == std::string("()"));160 CPPUNIT_ASSERT(params .getParameter(Psi3Parser_Parameters::doccParam) == std::string("()"));161 CPPUNIT_ASSERT(params .getParameter(Psi3Parser_Parameters::subgroupParam) == std::string(""));162 CPPUNIT_ASSERT(params .getParameter(Psi3Parser_Parameters::unique_axisParam) == params.ValidUniqueAxis[Psi3Parser_Parameters::X]);149 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::labelParam) == std::string("unknown job")); 150 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::jobtypeParam) == params->ValidJobtypes[Psi3Parser_Parameters::SP]); 151 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::wavefunctionParam) == params->ValidWavefunction[Psi3Parser_Parameters::SCF]); 152 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::maxiterParam) == std::string("80")); 153 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::referenceParam) == params->ValidReference[Psi3Parser_Parameters::RHF]); 154 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::basisParam) == std::string("cc-pVTZ")); 155 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::freeze_coreParam) == params->ValidFreezeCore[Psi3Parser_Parameters::YES]); 156 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::unitsParam) == params->ValidUnits[Psi3Parser_Parameters::angstrom]); 157 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::dertypeParam) == params->ValidDerivativeType[Psi3Parser_Parameters::NONE]); 158 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::originParam) == std::string("(0.0\t0.0\t0.0)")); 159 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::multipParam) == std::string("1")); 160 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::chargeParam) == std::string("0")); 161 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::soccParam) == std::string("()")); 162 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::doccParam) == std::string("()")); 163 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::subgroupParam) == std::string("")); 164 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::unique_axisParam) == params->ValidUniqueAxis[Psi3Parser_Parameters::X]); 163 165 } 164 166 165 167 void ParserPsi3UnitTest::ParameterCloneTest() { 166 FormatParser_Parameters *clone = par ser->getParams().clone();167 // CPPUNIT_ASSERT(parser->getParams().getParameter(Psi3Parser_Parameters::theoryParam) == std::string("MBPT2"));168 // std::stringstream setvalue("theory = CLHF");169 // setvalue >> parser->getParams();170 // CPPUNIT_ASSERT(parser->getParams().getParameter(Psi3Parser_Parameters::theoryParam) == std::string("CLHF"));171 // parser->getParams().makeClone(*clone);172 // CPPUNIT_ASSERT(parser->getParams().getParameter(Psi3Parser_Parameters::theoryParam) == std::string("MBPT2"));168 FormatParser_Parameters *clone = params->clone(); 169 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::jobtypeParam) == params->ValidJobtypes[Psi3Parser_Parameters::SP]); 170 std::stringstream setvalue(params->ParamNames[Psi3Parser_Parameters::jobtypeParam]+"="+params->ValidJobtypes[Psi3Parser_Parameters::OPT]); 171 setvalue >> *params; 172 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::jobtypeParam) == params->ValidJobtypes[Psi3Parser_Parameters::OPT]); 173 params->makeClone(*clone); 174 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::jobtypeParam) == params->ValidJobtypes[Psi3Parser_Parameters::SP]); 173 175 } 174 176 … … 179 181 // setvalue >> parser->getParams(); 180 182 //// std::cout << "integration method is " 181 //// << par ser->getParams().getString(Psi3Parser_Parameters::theoryParam) << std::endl;182 // CPPUNIT_ASSERT(par ser->getParams().getParameter(Psi3Parser_Parameters::theoryParam) == std::string("CLHF"));183 //// << params->getString(Psi3Parser_Parameters::theoryParam) << std::endl; 184 // CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::theoryParam) == std::string("CLHF")); 183 185 // } 184 186 // // test a bool … … 187 189 // setvalue >> parser->getParams(); 188 190 //// std::cout << "Hessian is " 189 //// << par ser->getParams().getString(Psi3Parser_Parameters::hessianParam) << std::endl;190 // CPPUNIT_ASSERT(par ser->getParams().getParameter(Psi3Parser_Parameters::hessianParam) == std::string("yes"));191 //// << params->getString(Psi3Parser_Parameters::hessianParam) << std::endl; 192 // CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::hessianParam) == std::string("yes")); 191 193 // } 192 194 // // test int … … 195 197 // setvalue >> parser->getParams(); 196 198 //// std::cout << "maxiter is " 197 //// << par ser->getParams().getString(Psi3Parser_Parameters::maxiterParam) << std::endl;198 // CPPUNIT_ASSERT(par ser->getParams().getParameter(Psi3Parser_Parameters::maxiterParam) == std::string("500"));199 //// << params->getString(Psi3Parser_Parameters::maxiterParam) << std::endl; 200 // CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::maxiterParam) == std::string("500")); 199 201 // } 200 202 // // test whether unknown key fails … … 209 211 //#endif 210 212 //// std::cout << "Hessian is still " 211 //// << par ser->getParams().getString(Psi3Parser_Parameters::hessianParam) << std::endl;212 // CPPUNIT_ASSERT(par ser->getParams().getParameter(Psi3Parser_Parameters::hessianParam) == std::string("yes"));213 //// << params->getString(Psi3Parser_Parameters::hessianParam) << std::endl; 214 // CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::hessianParam) == std::string("yes")); 213 215 // } 214 216 } … … 216 218 void ParserPsi3UnitTest::readPsi3Test() { 217 219 // stringstream input(waterPsi3_CLHF); 218 // par ser->getParams().setParameter(220 // params->setParameter( 219 221 // Psi3Parser_Parameters::theoryParam, 220 // par ser->getParams().getTheoryName(Psi3Parser_Parameters::CLHF)222 // params->getTheoryName(Psi3Parser_Parameters::CLHF) 221 223 // ); 222 224 // parser->load(&input); … … 247 249 // // compare both configs for CLHF 248 250 // stringstream output; 249 // par ser->getParams().setParameter(251 // params->setParameter( 250 252 // Psi3Parser_Parameters::theoryParam, 251 // par ser->getParams().getTheoryName(Psi3Parser_Parameters::CLHF)253 // params->getTheoryName(Psi3Parser_Parameters::CLHF) 252 254 // ); 253 255 // parser->save(&output, atoms); … … 261 263 // // compare both configs for CLKS 262 264 // stringstream output; 263 // par ser->getParams().setParameter(265 // params->setParameter( 264 266 // Psi3Parser_Parameters::theoryParam, 265 // par ser->getParams().getTheoryName(Psi3Parser_Parameters::CLKS)267 // params->getTheoryName(Psi3Parser_Parameters::CLKS) 266 268 // ); 267 269 // stringstream input(waterPsi3_CLKS); … … 274 276 // // compare both configs for MBPT2 275 277 // stringstream output; 276 // par ser->getParams().setParameter(278 // params->setParameter( 277 279 // Psi3Parser_Parameters::theoryParam, 278 // par ser->getParams().getTheoryName(Psi3Parser_Parameters::MBPT2)280 // params->getTheoryName(Psi3Parser_Parameters::MBPT2) 279 281 // ); 280 282 // stringstream input(waterPsi3_MBPT2); … … 287 289 // // compare both configs for MBPT2_R12 288 290 // stringstream output; 289 // par ser->getParams().setParameter(291 // params->setParameter( 290 292 // Psi3Parser_Parameters::theoryParam, 291 // par ser->getParams().getTheoryName(Psi3Parser_Parameters::MBPT2_R12)293 // params->getTheoryName(Psi3Parser_Parameters::MBPT2_R12) 292 294 // ); 293 295 // stringstream input(waterPsi3_MBPT2_R12); -
src/Parser/unittests/ParserPsi3UnitTest.hpp
r1bef07 r154a45 17 17 #include <cppunit/extensions/HelperMacros.h> 18 18 #include <string> 19 20 class Psi3Parser_Parameters; 19 21 20 22 class ParserPsi3UnitTest : public CppUnit::TestFixture … … 40 42 private: 41 43 FormatParser<psi3> *parser; 44 Psi3Parser_Parameters *params; 42 45 }; 43 46
Note:
See TracChangeset
for help on using the changeset viewer.