Changeset f31edc for src/Parser/unittests/ParserMpqcUnitTest.cpp
- Timestamp:
- Feb 7, 2011, 10:27:23 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:
- aa8ef2
- Parents:
- bb74ba
- git-author:
- Frederik Heber <heber@…> (02/01/11 16:39:55)
- git-committer:
- Frederik Heber <heber@…> (02/07/11 10:27:23)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/unittests/ParserMpqcUnitTest.cpp
rbb74ba rf31edc 40 40 CPPUNIT_TEST_SUITE_REGISTRATION( ParserMpqcUnitTest ); 41 41 42 static string waterMpqc ="% Created by MoleCuilder\n\ 42 static string waterMpqc_CLHF ="% Created by MoleCuilder\n\ 43 mpqc: (\n\ 44 \tsavestate = no\n\ 45 \tdo_gradient = yes\n\ 46 \tmole<CLHF>: (\n\ 47 \t\tmolecule = $:molecule\n\ 48 \t\tbasis = $:basis\n\ 49 \t\tmemory = 16000000\n\ 50 \t)\n\ 51 )\n\ 52 molecule<Molecule>: (\n\ 53 \tunit = angstrom\n\ 54 \t{ atoms geometry } = {\n\ 55 \t\tO [ -0.505735\t0\t0 ]\n\ 56 \t\tH [ 0.252867\t0\t0.504284 ]\n\ 57 \t\tH [ 0.252867\t0\t-0.504284 ]\n\ 58 \t}\n\ 59 )\n\ 60 basis<GaussianBasisSet>: (\n\ 61 \tname = \"3-21G\"\n\ 62 \tmolecule = $:molecule\n\ 63 )\n"; // tested with mpqc 3.0.0-alpha 64 static string waterMpqc_CLKS ="% Created by MoleCuilder\n\ 65 mpqc: (\n\ 66 \tsavestate = no\n\ 67 \tdo_gradient = yes\n\ 68 \tmole<CLKS>: (\n\ 69 \t\tfunctional<StdDenFunctional>:(name=B3LYP)\n\ 70 \t\tmolecule = $:molecule\n\ 71 \t\tbasis = $:basis\n\ 72 \t\tmemory = 16000000\n\ 73 \t)\n\ 74 )\n\ 75 molecule<Molecule>: (\n\ 76 \tunit = angstrom\n\ 77 \t{ atoms geometry } = {\n\ 78 \t\tO [ -0.505735\t0\t0 ]\n\ 79 \t\tH [ 0.252867\t0\t0.504284 ]\n\ 80 \t\tH [ 0.252867\t0\t-0.504284 ]\n\ 81 \t}\n\ 82 )\n\ 83 basis<GaussianBasisSet>: (\n\ 84 \tname = \"3-21G\"\n\ 85 \tmolecule = $:molecule\n\ 86 )\n"; // tested with mpqc 3.0.0-alpha 87 static string waterMpqc_MBPT2 ="% Created by MoleCuilder\n\ 43 88 mpqc: (\n\ 44 89 \tsavestate = no\n\ … … 65 110 \tname = \"3-21G\"\n\ 66 111 \tmolecule = $:molecule\n\ 67 )\n"; 112 )\n"; // tested with mpqc 3.0.0-alpha 113 static string waterMpqc_MBPT2_R12 ="% Created by MoleCuilder\n\ 114 mpqc: (\n\ 115 \tsavestate = no\n\ 116 \tdo_gradient = yes\n\ 117 \tmole<MBPT2_R12>: (\n\ 118 \t\tmolecule = $:molecule\n\ 119 \t\tbasis = $:basis\n\ 120 \t\taux_basis = $:abasis\n\ 121 \t\tstdapprox = \"A'\"\n\ 122 \t\tnfzc = 1\n\ 123 \t\tmemory = 16000000\n\ 124 \t\tintegrals<IntegralCints>:()\n\ 125 \t\treference<CLHF>: (\n\ 126 \t\t\tmolecule = $:molecule\n\ 127 \t\t\tbasis = $:basis\n\ 128 \t\t\tmaxiter = 1000\n\ 129 \t\t\tmemory = 16000000\n\ 130 \t\t\tintegrals<IntegralCints>:()\n\ 131 \t\t)\n\ 132 \t)\n\ 133 )\n\ 134 molecule<Molecule>: (\n\ 135 \tunit = angstrom\n\ 136 \t{ atoms geometry } = {\n\ 137 \t\tO [ -0.505735\t0\t0 ]\n\ 138 \t\tH [ 0.252867\t0\t0.504284 ]\n\ 139 \t\tH [ 0.252867\t0\t-0.504284 ]\n\ 140 \t}\n\ 141 )\n\ 142 basis<GaussianBasisSet>: (\n\ 143 \tname = \"3-21G\"\n\ 144 \tmolecule = $:molecule\n\ 145 )\n\ 146 % auxiliary basis set specification\n\ 147 \tabasis<GaussianBasisSet>: (\n\ 148 \tname = \"aug-cc-pVDZ\"\n\ 149 \tmolecule = $:molecule\n\ 150 )\n"; // basically tested with mpqc 3.0.0-alpha (no parse errors but did not calculate due to missing code) 68 151 69 152 void ParserMpqcUnitTest::setUp() { … … 86 169 void ParserMpqcUnitTest::writeMpqcTest() { 87 170 // build up water molecule 171 string first; 172 string second; 88 173 atom *Walker = NULL; 89 174 Walker = World::getInstance().createAtom(); … … 99 184 100 185 // create two stringstreams, one stored, one created 101 stringstream input(waterMpqc); 186 102 187 MpqcParser* testParser = new MpqcParser(); 103 stringstream output;104 188 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 105 testParser->save(&output, atoms); 106 107 // compare both configs 108 string first = input.str(); 109 string second = output.str(); 110 CPPUNIT_ASSERT(first == second); 189 { 190 // compare both configs for CLHF 191 stringstream output; 192 testParser->setTheory(MpqcParser::CLHF); 193 testParser->save(&output, atoms); 194 stringstream input(waterMpqc_CLHF); 195 for (; std::getline(input, first) && std::getline(output, second); ) { 196 //std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl; 197 CPPUNIT_ASSERT(first == second); 198 } 199 } 200 { 201 // compare both configs for CLKS 202 stringstream output; 203 testParser->setTheory(MpqcParser::CLKS); 204 testParser->save(&output, atoms); 205 stringstream input(waterMpqc_CLKS); 206 for (; std::getline(input, first) && std::getline(output, second); ) { 207 //std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl; 208 CPPUNIT_ASSERT(first == second); 209 } 210 } 211 { 212 // compare both configs for MBPT2 213 stringstream output; 214 testParser->setTheory(MpqcParser::MBPT2); 215 testParser->save(&output, atoms); 216 stringstream input(waterMpqc_MBPT2); 217 for (; std::getline(input, first) && std::getline(output, second); ) { 218 //std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl; 219 CPPUNIT_ASSERT(first == second); 220 } 221 } 222 { 223 // compare both configs for MBPT2_R12 224 stringstream output; 225 testParser->setTheory(MpqcParser::MBPT2_R12); 226 testParser->save(&output, atoms); 227 stringstream input(waterMpqc_MBPT2_R12); 228 for (; std::getline(input, first) && std::getline(output, second); ) { 229 //std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl; 230 CPPUNIT_ASSERT(first == second); 231 } 232 } 111 233 }
Note:
See TracChangeset
for help on using the changeset viewer.