Changeset d640ea for src/Parser/unittests/ParserPsi3UnitTest.cpp
- Timestamp:
- Oct 18, 2011, 8:23:11 AM (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:
- 752bb4
- Parents:
- 9011c1
- git-author:
- Frederik Heber <heber@…> (10/06/11 13:55:45)
- git-committer:
- Frederik Heber <heber@…> (10/18/11 08:23:11)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/unittests/ParserPsi3UnitTest.cpp
r9011c1 rd640ea 53 53 \tbasis = \"cc-pVTZ\"\n\ 54 54 \tfreeze_core = no\n\ 55 \tunits = bohr\n\55 \tunits = angstrom\n\ 56 56 \tgeometry = (\n\ 57 \t \t( H 0.0000 0.0000 0.0)\n\58 \t \t( H 0.0000 0.0000 0.74)\n\57 \t( H\t0\t0\t-0.37 )\n\ 58 \t( H\t0\t0\t0.37 )\n\ 59 59 \t)\n\ 60 \torigin = (0.0 0.00.0)\n\60 \torigin = (0.0\t0.0\t0.0)\n\ 61 61 )\n"; // tested with ??? 62 62 … … 70 70 \tbasis = \"cc-pVTZ\"\n\ 71 71 \tfreeze_core = no\n\ 72 \tunits = bohr\n\72 \tunits = angstrom\n\ 73 73 \tgeometry = (\n\ 74 \t \t( H 0.0000 0.0000 0.0)\n\75 \t \t( H 0.0000 0.0000 0.74)\n\74 \t( H\t0\t0\t-0.37 )\n\ 75 \t( H\t0\t0\t0.37 )\n\ 76 76 \t)\n\ 77 \torigin = (0.0 0.00.0)\n\77 \torigin = (0.0\t0.0\t0.0)\n\ 78 78 )\n"; // tested with ??? 79 79 … … 87 87 \tbasis = \"cc-pVTZ\"\n\ 88 88 \tmultp = 2\n\ 89 \t %charge = 2\n\89 \tcharge = 2\n\ 90 90 \tfreeze_core = no\n\ 91 \tunits = bohr\n\91 \tunits = angstrom\n\ 92 92 \tgeometry = (\n\ 93 \t \t( H 0.0000 0.0000 0.0)\n\94 \t \t( H 0.0000 0.0000 0.74)\n\93 \t( H\t0\t0\t-0.37 )\n\ 94 \t( H\t0\t0\t0.37 )\n\ 95 95 \t)\n\ 96 \torigin = (0.0 0.00.0)\n\96 \torigin = (0.0\t0.0\t0.0)\n\ 97 97 )\n"; // tested with ??? 98 98 … … 103 103 \twfn = scf\n\ 104 104 \tmaxiter = 80\n\ 105 \treference = TWOCON\n\105 \treference = twocon\n\ 106 106 \tbasis = \"cc-pVTZ\"\n\ 107 107 \tmultp = 1\n\ 108 \t%charge = 2\n\ 109 \tsocc = ( 1 1 0 0 0 0 0 0)\n\ 110 \tdocc = (0 0 0 0 0 0 0 0)\n\ 108 \tcharge = 2\n\ 109 \tsocc = ( 1 1 0 0 0 0 0 0 )\n\ 110 \tdocc = ( 0 0 0 0 0 0 0 0 )\n\ 111 \tsubgroup = c2v\n\ 112 \tunique_axis = x\n\ 111 113 \tfreeze_core = no\n\ 112 \tunits = bohr\n\114 \tunits = angstrom\n\ 113 115 \tgeometry = (\n\ 114 \t \t( H 0.0000 0.0000 0.0)\n\115 \t \t( H 0.0000 0.0000 0.74)\n\116 \t( H\t0\t0\t-0.37 )\n\ 117 \t( H\t0\t0\t0.37 )\n\ 116 118 \t)\n\ 117 \torigin = (0.0 0.00.0)\n\119 \torigin = (0.0\t0.0\t0.0)\n\ 118 120 )\n"; // tested with ??? 119 121 … … 286 288 ++iter) 287 289 PositionSum += (*iter)->getPosition(); 288 CPPUNIT_ASSERT_EQUAL( PositionSum, Vector(0 ,0,0.74) );290 CPPUNIT_ASSERT_EQUAL( PositionSum, Vector(0.,0.,0.) ); 289 291 } 290 292 291 293 void ParserPsi3UnitTest::writePsi3Test() { 292 // // build up water molecule 293 // string first; 294 // string second; 295 // atom *Walker = NULL; 296 // Walker = World::getInstance().createAtom(); 297 // Walker->setType(8); 298 // Walker->setPosition(Vector(0,0,0)); 299 // Walker = World::getInstance().createAtom(); 300 // Walker->setType(1); 301 // Walker->setPosition(Vector(0.758602,0,0.504284)); 302 // Walker = World::getInstance().createAtom(); 303 // Walker->setType(1); 304 // Walker->setPosition(Vector(0.758602,0,-0.504284)); 305 // CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms()); 306 // 307 // // create two stringstreams, one stored, one created 308 // 309 // std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 310 // { 311 // // compare both configs for CLHF 312 // stringstream output; 313 // params->setParameter( 314 // Psi3Parser_Parameters::theoryParam, 315 // params->getTheoryName(Psi3Parser_Parameters::CLHF) 316 // ); 317 // parser->save(&output, atoms); 318 // stringstream input(waterPsi3_CLHF); 319 // for (; std::getline(input, first) && std::getline(output, second); ) { 320 // //std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl; 321 // CPPUNIT_ASSERT(first == second); 322 // } 323 // } 324 // { 325 // // compare both configs for CLKS 326 // stringstream output; 327 // params->setParameter( 328 // Psi3Parser_Parameters::theoryParam, 329 // params->getTheoryName(Psi3Parser_Parameters::CLKS) 330 // ); 331 // stringstream input(waterPsi3_CLKS); 332 // for (; std::getline(input, first) && std::getline(output, second); ) { 333 // //std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl; 334 // CPPUNIT_ASSERT(first == second); 335 // } 336 // } 337 // { 338 // // compare both configs for MBPT2 339 // stringstream output; 340 // params->setParameter( 341 // Psi3Parser_Parameters::theoryParam, 342 // params->getTheoryName(Psi3Parser_Parameters::MBPT2) 343 // ); 344 // stringstream input(waterPsi3_MBPT2); 345 // for (; std::getline(input, first) && std::getline(output, second); ) { 346 // //std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl; 347 // CPPUNIT_ASSERT(first == second); 348 // } 349 // } 350 // { 351 // // compare both configs for MBPT2_R12 352 // stringstream output; 353 // params->setParameter( 354 // Psi3Parser_Parameters::theoryParam, 355 // params->getTheoryName(Psi3Parser_Parameters::MBPT2_R12) 356 // ); 357 // stringstream input(waterPsi3_MBPT2_R12); 358 // for (; std::getline(input, first) && std::getline(output, second); ) { 359 // //std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl; 360 // CPPUNIT_ASSERT(first == second); 361 // } 362 // } 363 } 294 // build up hydrogen molecule 295 string first; 296 string second; 297 atom *Walker = NULL; 298 Walker = World::getInstance().createAtom(); 299 Walker->setType(1); 300 Walker->setPosition(Vector(0.,0.,0.)); 301 Walker = World::getInstance().createAtom(); 302 Walker->setType(1); 303 Walker->setPosition(Vector(0.,0,0.74)); 304 CPPUNIT_ASSERT_EQUAL(2, World::getInstance().numAtoms()); 305 306 // set general parameters: label and freeze_core 307 params->setParameter( 308 Psi3Parser_Parameters::labelParam, 309 "cc-pVTZ SCF H2" 310 ); 311 params->setParameter( 312 Psi3Parser_Parameters::freeze_coreParam, 313 params->ValidFreezeCore[Psi3Parser_Parameters::NO] 314 ); 315 params->setParameter( 316 Psi3Parser_Parameters::unitsParam, 317 params->ValidUnits[Psi3Parser_Parameters::angstrom] 318 ); 319 320 // create two stringstreams, one stored, one created 321 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 322 { 323 // compare both configs for RHF 324 stringstream output; 325 params->setParameter( 326 Psi3Parser_Parameters::referenceParam, 327 params->ValidReference[Psi3Parser_Parameters::RHF] 328 ); 329 parser->save(&output, atoms); 330 stringstream input(hydrogenPsi3_RHF); 331 // check for non-empty streams 332 input.peek(); 333 output.peek(); 334 CPPUNIT_ASSERT(input.good() && output.good()); 335 // check equality of streams per line (for debugging) 336 for (; std::getline(input, first) && std::getline(output, second); ) { 337 //std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl; 338 CPPUNIT_ASSERT(first == second); 339 } 340 } 341 { 342 // compare both configs for ROHF 343 stringstream output; 344 params->setParameter( 345 Psi3Parser_Parameters::referenceParam, 346 params->ValidReference[Psi3Parser_Parameters::ROHF] 347 ); 348 parser->save(&output, atoms); 349 stringstream input(hydrogenPsi3_ROHF); 350 // check for non-empty streams 351 input.peek(); 352 output.peek(); 353 CPPUNIT_ASSERT(input.good() && output.good()); 354 // check equality of streams per line (for debugging) 355 for (; std::getline(input, first) && std::getline(output, second); ) { 356 //std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl; 357 CPPUNIT_ASSERT(first == second); 358 } 359 } 360 { 361 params->setParameter(Psi3Parser_Parameters::multiplicityParam, "2"); 362 params->setParameter(Psi3Parser_Parameters::chargeParam, "2"); 363 // compare both configs for UHF 364 stringstream output; 365 params->setParameter( 366 Psi3Parser_Parameters::referenceParam, 367 params->ValidReference[Psi3Parser_Parameters::UHF] 368 ); 369 parser->save(&output, atoms); 370 params->setParameter(Psi3Parser_Parameters::chargeParam, "0"); 371 params->setParameter(Psi3Parser_Parameters::multiplicityParam, "1"); 372 stringstream input(hydrogenPsi3_UHF); 373 // check for non-empty streams 374 input.peek(); 375 output.peek(); 376 CPPUNIT_ASSERT(input.good() && output.good()); 377 // check equality of streams per line (for debugging) 378 for (; std::getline(input, first) && std::getline(output, second); ) { 379 //std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl; 380 CPPUNIT_ASSERT(first == second); 381 } 382 } 383 { 384 params->setParameter(Psi3Parser_Parameters::multiplicityParam, "1"); 385 params->setParameter(Psi3Parser_Parameters::chargeParam, "2"); 386 params->setParameter(Psi3Parser_Parameters::soccParam, "( 1 1 0 0 0 0 0 0 )"); 387 params->setParameter(Psi3Parser_Parameters::doccParam, "( 0 0 0 0 0 0 0 0 )"); 388 params->setParameter(Psi3Parser_Parameters::subgroupParam, "c2v"); 389 params->setParameter(Psi3Parser_Parameters::unique_axisParam, "x"); 390 // compare both configs for TWOCON 391 stringstream output; 392 params->setParameter( 393 Psi3Parser_Parameters::referenceParam, 394 params->ValidReference[Psi3Parser_Parameters::TWOCON] 395 ); 396 parser->save(&output, atoms); 397 params->setParameter(Psi3Parser_Parameters::multiplicityParam, "1"); 398 params->setParameter(Psi3Parser_Parameters::chargeParam, "0"); 399 stringstream input(hydrogenPsi3_TWOCON); 400 // check for non-empty streams 401 input.peek(); 402 output.peek(); 403 CPPUNIT_ASSERT(input.good() && output.good()); 404 // check equality of streams per line (for debugging) 405 for (; std::getline(input, first) && std::getline(output, second); ) { 406 //std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl; 407 CPPUNIT_ASSERT(first == second); 408 } 409 } 410 }
Note:
See TracChangeset
for help on using the changeset viewer.