Changeset f758dd
- 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:
- 7f570c
- Parents:
- 154a45
- git-author:
- Frederik Heber <heber@…> (10/05/11 15:46:00)
- git-committer:
- Frederik Heber <heber@…> (10/17/11 16:56:37)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/unittests/ParserPsi3UnitTest.cpp
r154a45 rf758dd 176 176 177 177 void ParserPsi3UnitTest::ParameterSetterTest() { 178 // // test a string 179 // { 180 // std::stringstream setvalue("theory = CLHF"); 181 // setvalue >> parser->getParams(); 182 //// std::cout << "integration method is " 183 //// << params->getString(Psi3Parser_Parameters::theoryParam) << std::endl; 184 // CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::theoryParam) == std::string("CLHF")); 185 // } 186 // // test a bool 187 // { 188 // std::stringstream setvalue("Hessian = yes"); 189 // setvalue >> parser->getParams(); 190 //// std::cout << "Hessian is " 191 //// << params->getString(Psi3Parser_Parameters::hessianParam) << std::endl; 192 // CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::hessianParam) == std::string("yes")); 193 // } 194 // // test int 195 // { 196 // std::stringstream setvalue("maxiter = 500"); 197 // setvalue >> parser->getParams(); 198 //// std::cout << "maxiter is " 199 //// << params->getString(Psi3Parser_Parameters::maxiterParam) << std::endl; 200 // CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::maxiterParam) == std::string("500")); 201 // } 202 // // test whether unknown key fails 203 // std::cout << "The following Assertion warning is desired and does not indicate a failure of the test." << std::endl; 204 // { 205 // std::stringstream setvalue("hessian = no"); 206 //#ifndef NDEBUG 207 // ASSERT_DO(Assert::Throw); 208 // CPPUNIT_ASSERT_THROW(setvalue >> parser->getParams(), Assert::AssertionFailure); 209 //#else 210 // setvalue >> parser->getParams(); 211 //#endif 212 //// std::cout << "Hessian is still " 213 //// << params->getString(Psi3Parser_Parameters::hessianParam) << std::endl; 214 // CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::hessianParam) == std::string("yes")); 215 // } 178 // test a jobtype 179 { 180 std::stringstream setvalue( 181 params->ParamNames[Psi3Parser_Parameters::jobtypeParam] 182 +" = "+params->ValidJobtypes[Psi3Parser_Parameters::OPT] 183 ); 184 setvalue >> *params; 185 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::jobtypeParam) == params->ValidJobtypes[Psi3Parser_Parameters::OPT]); 186 } 187 // test a wavefunction 188 { 189 std::stringstream setvalue( 190 params->ParamNames[Psi3Parser_Parameters::wavefunctionParam] 191 +" = "+params->ValidWavefunction[Psi3Parser_Parameters::MP2] 192 ); 193 setvalue >> *params; 194 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::wavefunctionParam) == params->ValidWavefunction[Psi3Parser_Parameters::MP2]); 195 } 196 // test a reference 197 { 198 std::stringstream setvalue( 199 params->ParamNames[Psi3Parser_Parameters::referenceParam] 200 +" = "+params->ValidReference[Psi3Parser_Parameters::ROHF] 201 ); 202 setvalue >> *params; 203 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::referenceParam) == params->ValidReference[Psi3Parser_Parameters::ROHF]); 204 } 205 // test a unique_axis 206 { 207 std::stringstream setvalue( 208 params->ParamNames[Psi3Parser_Parameters::unique_axisParam] 209 +" = "+params->ValidUniqueAxis[Psi3Parser_Parameters::Y] 210 ); 211 setvalue >> *params; 212 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::unique_axisParam) == params->ValidUniqueAxis[Psi3Parser_Parameters::Y]); 213 } 214 // test a units 215 { 216 std::stringstream setvalue( 217 params->ParamNames[Psi3Parser_Parameters::unitsParam] 218 +" = "+params->ValidUnits[Psi3Parser_Parameters::bohr] 219 ); 220 setvalue >> *params; 221 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::unitsParam) == params->ValidUnits[Psi3Parser_Parameters::bohr]); 222 } 223 // test a dertype 224 { 225 std::stringstream setvalue( 226 params->ParamNames[Psi3Parser_Parameters::dertypeParam] 227 +" = "+params->ValidDerivativeType[Psi3Parser_Parameters::NONE] 228 ); 229 setvalue >> *params; 230 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::dertypeParam) == params->ValidDerivativeType[Psi3Parser_Parameters::NONE]); 231 } 232 // test a freeze_core 233 { 234 std::stringstream setvalue( 235 params->ParamNames[Psi3Parser_Parameters::freeze_coreParam] 236 +" = "+params->ValidFreezeCore[Psi3Parser_Parameters::LARGE] 237 ); 238 setvalue >> *params; 239 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::freeze_coreParam) == params->ValidFreezeCore[Psi3Parser_Parameters::LARGE]); 240 } 241 // test int 242 { 243 std::stringstream setvalue( 244 params->ParamNames[Psi3Parser_Parameters::maxiterParam] 245 +" = 500" 246 ); 247 setvalue >> *params; 248 // std::cout << "maxiter is " 249 // << params->getString(Psi3Parser_Parameters::maxiterParam) << std::endl; 250 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::maxiterParam) == std::string("500")); 251 } 252 // test whether unknown key fails 253 std::cout << "The following Assertion warning is desired and does not indicate a failure of the test." << std::endl; 254 { 255 std::stringstream setvalue("sd = no"); 256 #ifndef NDEBUG 257 ASSERT_DO(Assert::Throw); 258 CPPUNIT_ASSERT_THROW(setvalue >> *params, Assert::AssertionFailure); 259 #else 260 setvalue >> *params; 261 #endif 262 // std::cout << "Hessian is still " 263 // << params->getString(Psi3Parser_Parameters::hessianParam) << std::endl; 264 CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::jobtypeParam) == params->ValidJobtypes[Psi3Parser_Parameters::OPT]); 265 } 216 266 } 217 267
Note:
See TracChangeset
for help on using the changeset viewer.