| [9e4fd1] | 1 | /*
 | 
|---|
 | 2 |  * Project: MoleCuilder
 | 
|---|
 | 3 |  * Description: creates and alters molecular systems
 | 
|---|
| [0aa122] | 4 |  * Copyright (C)  2010-2012 University of Bonn. All rights reserved.
 | 
|---|
| [5aaa43] | 5 |  * Copyright (C)  2013 Frederik Heber. All rights reserved.
 | 
|---|
| [94d5ac6] | 6 |  * 
 | 
|---|
 | 7 |  *
 | 
|---|
 | 8 |  *   This file is part of MoleCuilder.
 | 
|---|
 | 9 |  *
 | 
|---|
 | 10 |  *    MoleCuilder is free software: you can redistribute it and/or modify
 | 
|---|
 | 11 |  *    it under the terms of the GNU General Public License as published by
 | 
|---|
 | 12 |  *    the Free Software Foundation, either version 2 of the License, or
 | 
|---|
 | 13 |  *    (at your option) any later version.
 | 
|---|
 | 14 |  *
 | 
|---|
 | 15 |  *    MoleCuilder is distributed in the hope that it will be useful,
 | 
|---|
 | 16 |  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
 | 17 |  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
 | 18 |  *    GNU General Public License for more details.
 | 
|---|
 | 19 |  *
 | 
|---|
 | 20 |  *    You should have received a copy of the GNU General Public License
 | 
|---|
 | 21 |  *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
 | 
|---|
| [9e4fd1] | 22 |  */
 | 
|---|
 | 23 | 
 | 
|---|
 | 24 | /*
 | 
|---|
 | 25 |  * ParserMpqcUnitTest.cpp
 | 
|---|
 | 26 |  *
 | 
|---|
 | 27 |  *  Created on: Mar 3, 2010
 | 
|---|
 | 28 |  *      Author: metzler
 | 
|---|
 | 29 |  */
 | 
|---|
 | 30 | 
 | 
|---|
 | 31 | // include config.h
 | 
|---|
 | 32 | #ifdef HAVE_CONFIG_H
 | 
|---|
 | 33 | #include <config.h>
 | 
|---|
 | 34 | #endif
 | 
|---|
 | 35 | 
 | 
|---|
 | 36 | #include "ParserMpqcUnitTest.hpp"
 | 
|---|
 | 37 | 
 | 
|---|
 | 38 | #include <cppunit/CompilerOutputter.h>
 | 
|---|
 | 39 | #include <cppunit/extensions/TestFactoryRegistry.h>
 | 
|---|
 | 40 | #include <cppunit/ui/text/TestRunner.h>
 | 
|---|
 | 41 | 
 | 
|---|
| [61d69a4] | 42 | #include <boost/any.hpp>
 | 
|---|
 | 43 | 
 | 
|---|
| [6f0841] | 44 | #include "Atom/atom.hpp"
 | 
|---|
| [006e1e] | 45 | #include "Atom/AtomObserver.hpp"
 | 
|---|
 | 46 | #include "CodePatterns/Assert.hpp"
 | 
|---|
 | 47 | #include "Descriptors/AtomTypeDescriptor.hpp"
 | 
|---|
| [3bdb6d] | 48 | #include "Element/element.hpp"
 | 
|---|
 | 49 | #include "Element/periodentafel.hpp"
 | 
|---|
| [765f16] | 50 | #include "Parser/ChangeTracker.hpp"
 | 
|---|
 | 51 | #include "Parser/MpqcParser.hpp"
 | 
|---|
| [006e1e] | 52 | #include "World.hpp"
 | 
|---|
| [9e4fd1] | 53 | 
 | 
|---|
 | 54 | #ifdef HAVE_TESTRUNNER
 | 
|---|
 | 55 | #include "UnitTestMain.hpp"
 | 
|---|
 | 56 | #endif /*HAVE_TESTRUNNER*/
 | 
|---|
 | 57 | 
 | 
|---|
 | 58 | using namespace std;
 | 
|---|
 | 59 | 
 | 
|---|
 | 60 | // Registers the fixture into the 'registry'
 | 
|---|
 | 61 | CPPUNIT_TEST_SUITE_REGISTRATION( ParserMpqcUnitTest );
 | 
|---|
 | 62 | 
 | 
|---|
| [f31edc] | 63 | static string waterMpqc_CLHF ="% Created by MoleCuilder\n\
 | 
|---|
 | 64 | mpqc: (\n\
 | 
|---|
| [e3c4c5] | 65 | \tcheckpoint = no\n\
 | 
|---|
| [f31edc] | 66 | \tsavestate = no\n\
 | 
|---|
 | 67 | \tdo_gradient = yes\n\
 | 
|---|
 | 68 | \tmole<CLHF>: (\n\
 | 
|---|
 | 69 | \t\tmolecule = $:molecule\n\
 | 
|---|
 | 70 | \t\tbasis = $:basis\n\
 | 
|---|
| [61d69a4] | 71 | \t\tmaxiter = 1000\n\
 | 
|---|
| [f31edc] | 72 | \t\tmemory = 16000000\n\
 | 
|---|
 | 73 | \t)\n\
 | 
|---|
 | 74 | )\n\
 | 
|---|
 | 75 | molecule<Molecule>: (\n\
 | 
|---|
 | 76 | \tunit = angstrom\n\
 | 
|---|
 | 77 | \t{ atoms geometry } = {\n\
 | 
|---|
| [e9dc19] | 78 | \t\tO [ 0\t0\t0 ]\n\
 | 
|---|
 | 79 | \t\tH [ 0.758602\t0\t0.504284 ]\n\
 | 
|---|
 | 80 | \t\tH [ 0.758602\t0\t-0.504284 ]\n\
 | 
|---|
| [f31edc] | 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_CLKS ="% Created by MoleCuilder\n\
 | 
|---|
 | 88 | mpqc: (\n\
 | 
|---|
| [e3c4c5] | 89 | \tcheckpoint = no\n\
 | 
|---|
| [f31edc] | 90 | \tsavestate = no\n\
 | 
|---|
 | 91 | \tdo_gradient = yes\n\
 | 
|---|
 | 92 | \tmole<CLKS>: (\n\
 | 
|---|
 | 93 | \t\tfunctional<StdDenFunctional>:(name=B3LYP)\n\
 | 
|---|
 | 94 | \t\tmolecule = $:molecule\n\
 | 
|---|
 | 95 | \t\tbasis = $:basis\n\
 | 
|---|
| [61d69a4] | 96 | \t\tmaxiter = 1000\n\
 | 
|---|
| [f31edc] | 97 | \t\tmemory = 16000000\n\
 | 
|---|
 | 98 | \t)\n\
 | 
|---|
 | 99 | )\n\
 | 
|---|
 | 100 | molecule<Molecule>: (\n\
 | 
|---|
 | 101 | \tunit = angstrom\n\
 | 
|---|
 | 102 | \t{ atoms geometry } = {\n\
 | 
|---|
| [e9dc19] | 103 | \t\tO [ 0\t0\t0 ]\n\
 | 
|---|
 | 104 | \t\tH [ 0.758602\t0\t0.504284 ]\n\
 | 
|---|
 | 105 | \t\tH [ 0.758602\t0\t-0.504284 ]\n\
 | 
|---|
| [f31edc] | 106 | \t}\n\
 | 
|---|
 | 107 | )\n\
 | 
|---|
 | 108 | basis<GaussianBasisSet>: (\n\
 | 
|---|
 | 109 | \tname = \"3-21G\"\n\
 | 
|---|
 | 110 | \tmolecule = $:molecule\n\
 | 
|---|
 | 111 | )\n"; // tested with mpqc 3.0.0-alpha
 | 
|---|
 | 112 | static string waterMpqc_MBPT2 ="% Created by MoleCuilder\n\
 | 
|---|
| [9e4fd1] | 113 | mpqc: (\n\
 | 
|---|
| [e3c4c5] | 114 | \tcheckpoint = no\n\
 | 
|---|
| [9e4fd1] | 115 | \tsavestate = no\n\
 | 
|---|
 | 116 | \tdo_gradient = yes\n\
 | 
|---|
 | 117 | \tmole<MBPT2>: (\n\
 | 
|---|
 | 118 | \t\tbasis = $:basis\n\
 | 
|---|
 | 119 | \t\tmolecule = $:molecule\n\
 | 
|---|
| [61d69a4] | 120 | \t\tmemory = 16000000\n\
 | 
|---|
| [9e4fd1] | 121 | \t\treference<CLHF>: (\n\
 | 
|---|
| [bb74ba] | 122 | \t\t\tmaxiter = 1000\n\
 | 
|---|
| [9e4fd1] | 123 | \t\t\tbasis = $:basis\n\
 | 
|---|
 | 124 | \t\t\tmolecule = $:molecule\n\
 | 
|---|
| [61d69a4] | 125 | \t\t\tmemory = 16000000\n\
 | 
|---|
| [9e4fd1] | 126 | \t\t)\n\
 | 
|---|
 | 127 | \t)\n\
 | 
|---|
 | 128 | )\n\
 | 
|---|
 | 129 | molecule<Molecule>: (\n\
 | 
|---|
 | 130 | \tunit = angstrom\n\
 | 
|---|
 | 131 | \t{ atoms geometry } = {\n\
 | 
|---|
| [e9dc19] | 132 | \t\tO [ 0\t0\t0 ]\n\
 | 
|---|
 | 133 | \t\tH [ 0.758602\t0\t0.504284 ]\n\
 | 
|---|
 | 134 | \t\tH [ 0.758602\t0\t-0.504284 ]\n\
 | 
|---|
| [9e4fd1] | 135 | \t}\n\
 | 
|---|
 | 136 | )\n\
 | 
|---|
 | 137 | basis<GaussianBasisSet>: (\n\
 | 
|---|
 | 138 | \tname = \"3-21G\"\n\
 | 
|---|
 | 139 | \tmolecule = $:molecule\n\
 | 
|---|
| [f31edc] | 140 | )\n"; // tested with mpqc 3.0.0-alpha
 | 
|---|
 | 141 | static string waterMpqc_MBPT2_R12 ="% Created by MoleCuilder\n\
 | 
|---|
 | 142 | mpqc: (\n\
 | 
|---|
| [e3c4c5] | 143 | \tcheckpoint = no\n\
 | 
|---|
| [f31edc] | 144 | \tsavestate = no\n\
 | 
|---|
 | 145 | \tdo_gradient = yes\n\
 | 
|---|
 | 146 | \tmole<MBPT2_R12>: (\n\
 | 
|---|
 | 147 | \t\tmolecule = $:molecule\n\
 | 
|---|
 | 148 | \t\tbasis = $:basis\n\
 | 
|---|
 | 149 | \t\taux_basis = $:abasis\n\
 | 
|---|
 | 150 | \t\tstdapprox = \"A'\"\n\
 | 
|---|
 | 151 | \t\tnfzc = 1\n\
 | 
|---|
 | 152 | \t\tmemory = 16000000\n\
 | 
|---|
 | 153 | \t\tintegrals<IntegralCints>:()\n\
 | 
|---|
 | 154 | \t\treference<CLHF>: (\n\
 | 
|---|
 | 155 | \t\t\tmolecule = $:molecule\n\
 | 
|---|
 | 156 | \t\t\tbasis = $:basis\n\
 | 
|---|
 | 157 | \t\t\tmaxiter = 1000\n\
 | 
|---|
 | 158 | \t\t\tmemory = 16000000\n\
 | 
|---|
 | 159 | \t\t\tintegrals<IntegralCints>:()\n\
 | 
|---|
 | 160 | \t\t)\n\
 | 
|---|
 | 161 | \t)\n\
 | 
|---|
 | 162 | )\n\
 | 
|---|
 | 163 | molecule<Molecule>: (\n\
 | 
|---|
 | 164 | \tunit = angstrom\n\
 | 
|---|
 | 165 | \t{ atoms geometry } = {\n\
 | 
|---|
| [e9dc19] | 166 | \t\tO [ 0\t0\t0 ]\n\
 | 
|---|
 | 167 | \t\tH [ 0.758602\t0\t0.504284 ]\n\
 | 
|---|
 | 168 | \t\tH [ 0.758602\t0\t-0.504284 ]\n\
 | 
|---|
| [f31edc] | 169 | \t}\n\
 | 
|---|
 | 170 | )\n\
 | 
|---|
 | 171 | basis<GaussianBasisSet>: (\n\
 | 
|---|
 | 172 | \tname = \"3-21G\"\n\
 | 
|---|
 | 173 | \tmolecule = $:molecule\n\
 | 
|---|
 | 174 | )\n\
 | 
|---|
 | 175 | % auxiliary basis set specification\n\
 | 
|---|
 | 176 | \tabasis<GaussianBasisSet>: (\n\
 | 
|---|
 | 177 | \tname = \"aug-cc-pVDZ\"\n\
 | 
|---|
 | 178 | \tmolecule = $:molecule\n\
 | 
|---|
 | 179 | )\n"; // basically tested with mpqc 3.0.0-alpha (no parse errors but did not calculate due to missing code)
 | 
|---|
| [9e4fd1] | 180 | 
 | 
|---|
| [3308b6] | 181 | void ParserMpqcUnitTest::setUp() 
 | 
|---|
 | 182 | {
 | 
|---|
 | 183 |   // failing asserts should be thrown
 | 
|---|
 | 184 |   ASSERT_DO(Assert::Throw);
 | 
|---|
 | 185 | 
 | 
|---|
| [765f16] | 186 |   parser = new FormatParser<mpqc>();
 | 
|---|
| [61d69a4] | 187 | 
 | 
|---|
| [9e4fd1] | 188 |   World::getInstance();
 | 
|---|
 | 189 | 
 | 
|---|
 | 190 |   setVerbosity(2);
 | 
|---|
 | 191 | 
 | 
|---|
 | 192 |   // we need hydrogens and oxygens in the following tests
 | 
|---|
 | 193 |   CPPUNIT_ASSERT(World::getInstance().getPeriode()->FindElement(1) != NULL);
 | 
|---|
 | 194 |   CPPUNIT_ASSERT(World::getInstance().getPeriode()->FindElement(8) != NULL);
 | 
|---|
 | 195 | }
 | 
|---|
 | 196 | 
 | 
|---|
| [3308b6] | 197 | void ParserMpqcUnitTest::tearDown() 
 | 
|---|
 | 198 | {
 | 
|---|
| [765f16] | 199 |   delete parser;
 | 
|---|
| [9e4fd1] | 200 |   ChangeTracker::purgeInstance();
 | 
|---|
 | 201 |   World::purgeInstance();
 | 
|---|
| [708277] | 202 |   AtomObserver::purgeInstance();
 | 
|---|
| [9e4fd1] | 203 | }
 | 
|---|
 | 204 | 
 | 
|---|
 | 205 | /************************************ tests ***********************************/
 | 
|---|
 | 206 | 
 | 
|---|
| [61d69a4] | 207 | void ParserMpqcUnitTest::ParameterDefaultTest() {
 | 
|---|
 | 208 |   // check default values
 | 
|---|
| [ee50c1] | 209 |   CPPUNIT_ASSERT(parser->getParams().getParameter(MpqcParser_Parameters::hessianParam) == std::string("no"));
 | 
|---|
 | 210 |   CPPUNIT_ASSERT(parser->getParams().getParameter(MpqcParser_Parameters::savestateParam) == std::string("no"));
 | 
|---|
 | 211 |   CPPUNIT_ASSERT(parser->getParams().getParameter(MpqcParser_Parameters::do_gradientParam) == std::string("yes"));
 | 
|---|
 | 212 |   CPPUNIT_ASSERT(parser->getParams().getParameter(MpqcParser_Parameters::maxiterParam) == std::string("1000"));
 | 
|---|
 | 213 |   CPPUNIT_ASSERT(parser->getParams().getParameter(MpqcParser_Parameters::memoryParam) == std::string("16000000"));
 | 
|---|
 | 214 |   CPPUNIT_ASSERT(parser->getParams().getParameter(MpqcParser_Parameters::stdapproxParam) == std::string("A'"));
 | 
|---|
 | 215 |   CPPUNIT_ASSERT(parser->getParams().getParameter(MpqcParser_Parameters::nfzcParam) == std::string("1"));
 | 
|---|
 | 216 |   CPPUNIT_ASSERT(parser->getParams().getParameter(MpqcParser_Parameters::basisParam) == std::string("3-21G"));
 | 
|---|
 | 217 |   CPPUNIT_ASSERT(parser->getParams().getParameter(MpqcParser_Parameters::aux_basisParam) == std::string("aug-cc-pVDZ"));
 | 
|---|
 | 218 |   CPPUNIT_ASSERT(parser->getParams().getParameter(MpqcParser_Parameters::integrationParam) == std::string("IntegralCints"));
 | 
|---|
 | 219 |   CPPUNIT_ASSERT(parser->getParams().getParameter(MpqcParser_Parameters::theoryParam) == std::string("MBPT2"));
 | 
|---|
| [61d69a4] | 220 | }
 | 
|---|
 | 221 | 
 | 
|---|
| [c1db05] | 222 | void ParserMpqcUnitTest::ParameterCloneTest() {
 | 
|---|
| [765f16] | 223 |   FormatParser_Parameters *clone = parser->getParams().clone();
 | 
|---|
| [ee50c1] | 224 |   CPPUNIT_ASSERT(parser->getParams().getParameter(MpqcParser_Parameters::theoryParam) == std::string("MBPT2"));
 | 
|---|
| [c1db05] | 225 |   std::stringstream setvalue("theory = CLHF");
 | 
|---|
| [765f16] | 226 |   setvalue >> parser->getParams();
 | 
|---|
| [ee50c1] | 227 |   CPPUNIT_ASSERT(parser->getParams().getParameter(MpqcParser_Parameters::theoryParam) == std::string("CLHF"));
 | 
|---|
| [765f16] | 228 |   parser->getParams().makeClone(*clone);
 | 
|---|
| [ee50c1] | 229 |   CPPUNIT_ASSERT(parser->getParams().getParameter(MpqcParser_Parameters::theoryParam) == std::string("MBPT2"));
 | 
|---|
| [c1db05] | 230 | }
 | 
|---|
 | 231 | 
 | 
|---|
| [44fce5] | 232 | void ParserMpqcUnitTest::ParameterSetterTest() {
 | 
|---|
 | 233 |   // test a string
 | 
|---|
 | 234 |   {
 | 
|---|
 | 235 |     std::stringstream setvalue("theory = CLHF");
 | 
|---|
| [765f16] | 236 |     setvalue >> parser->getParams();
 | 
|---|
| [44fce5] | 237 | //    std::cout << "integration method is "
 | 
|---|
| [765f16] | 238 | //        << parser->getParams().getString(MpqcParser_Parameters::theoryParam) << std::endl;
 | 
|---|
| [ee50c1] | 239 |     CPPUNIT_ASSERT(parser->getParams().getParameter(MpqcParser_Parameters::theoryParam) == std::string("CLHF"));
 | 
|---|
| [44fce5] | 240 |   }
 | 
|---|
 | 241 |   // test a bool
 | 
|---|
 | 242 |   {
 | 
|---|
 | 243 |     std::stringstream setvalue("Hessian = yes");
 | 
|---|
| [765f16] | 244 |     setvalue >> parser->getParams();
 | 
|---|
| [44fce5] | 245 | //    std::cout << "Hessian is "
 | 
|---|
| [765f16] | 246 | //        << parser->getParams().getString(MpqcParser_Parameters::hessianParam) << std::endl;
 | 
|---|
| [ee50c1] | 247 |     CPPUNIT_ASSERT(parser->getParams().getParameter(MpqcParser_Parameters::hessianParam) == std::string("yes"));
 | 
|---|
| [44fce5] | 248 |   }
 | 
|---|
 | 249 |   // test int
 | 
|---|
 | 250 |   {
 | 
|---|
 | 251 |     std::stringstream setvalue("maxiter = 500");
 | 
|---|
| [765f16] | 252 |     setvalue >> parser->getParams();
 | 
|---|
| [44fce5] | 253 | //    std::cout << "maxiter is "
 | 
|---|
| [765f16] | 254 | //        << parser->getParams().getString(MpqcParser_Parameters::maxiterParam) << std::endl;
 | 
|---|
| [ee50c1] | 255 |     CPPUNIT_ASSERT(parser->getParams().getParameter(MpqcParser_Parameters::maxiterParam) == std::string("500"));
 | 
|---|
| [44fce5] | 256 |   }
 | 
|---|
 | 257 |   // test whether unknown key fails
 | 
|---|
| [311da7b] | 258 |   std::cout << "The following Assertion warning is desired and does not indicate a failure of the test." << std::endl;
 | 
|---|
| [44fce5] | 259 |   {
 | 
|---|
 | 260 |     std::stringstream setvalue("hessian = no");
 | 
|---|
| [311da7b] | 261 | #ifndef NDEBUG
 | 
|---|
 | 262 |     ASSERT_DO(Assert::Throw);
 | 
|---|
| [765f16] | 263 |     CPPUNIT_ASSERT_THROW(setvalue >> parser->getParams(), Assert::AssertionFailure);
 | 
|---|
| [311da7b] | 264 | #else
 | 
|---|
| [765f16] | 265 |     setvalue >> parser->getParams();
 | 
|---|
| [311da7b] | 266 | #endif
 | 
|---|
| [44fce5] | 267 | //    std::cout << "Hessian is still "
 | 
|---|
| [765f16] | 268 | //        << parser->getParams().getString(MpqcParser_Parameters::hessianParam) << std::endl;
 | 
|---|
| [ee50c1] | 269 |     CPPUNIT_ASSERT(parser->getParams().getParameter(MpqcParser_Parameters::hessianParam) == std::string("yes"));
 | 
|---|
| [44fce5] | 270 |   }
 | 
|---|
 | 271 | }
 | 
|---|
 | 272 | 
 | 
|---|
| [aa8ef2] | 273 | void ParserMpqcUnitTest::readMpqcTest() {
 | 
|---|
 | 274 |   stringstream input(waterMpqc_CLHF);
 | 
|---|
| [ee50c1] | 275 |   parser->getParams().setParameter(
 | 
|---|
 | 276 |       MpqcParser_Parameters::theoryParam,
 | 
|---|
 | 277 |       parser->getParams().getTheoryName(MpqcParser_Parameters::CLHF)
 | 
|---|
 | 278 |           );
 | 
|---|
| [765f16] | 279 |   parser->load(&input);
 | 
|---|
| [aa8ef2] | 280 | 
 | 
|---|
 | 281 |   CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());
 | 
|---|
 | 282 | }
 | 
|---|
 | 283 | 
 | 
|---|
| [9e4fd1] | 284 | void ParserMpqcUnitTest::writeMpqcTest() {
 | 
|---|
 | 285 |   // build up water molecule
 | 
|---|
| [f31edc] | 286 |   string first;
 | 
|---|
 | 287 |   string second;
 | 
|---|
| [9e4fd1] | 288 |   atom *Walker = NULL;
 | 
|---|
 | 289 |   Walker = World::getInstance().createAtom();
 | 
|---|
 | 290 |   Walker->setType(8);
 | 
|---|
 | 291 |   Walker->setPosition(Vector(0,0,0));
 | 
|---|
 | 292 |   Walker = World::getInstance().createAtom();
 | 
|---|
 | 293 |   Walker->setType(1);
 | 
|---|
 | 294 |   Walker->setPosition(Vector(0.758602,0,0.504284));
 | 
|---|
 | 295 |   Walker = World::getInstance().createAtom();
 | 
|---|
 | 296 |   Walker->setType(1);
 | 
|---|
 | 297 |   Walker->setPosition(Vector(0.758602,0,-0.504284));
 | 
|---|
 | 298 |   CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());
 | 
|---|
 | 299 | 
 | 
|---|
 | 300 |   // create two stringstreams, one stored, one created
 | 
|---|
| [f31edc] | 301 | 
 | 
|---|
| [fac58f] | 302 |   std::vector<const atom *> atoms = const_cast<const World &>(World::getInstance()).
 | 
|---|
 | 303 |       getAllAtoms();
 | 
|---|
| [f31edc] | 304 |   {
 | 
|---|
 | 305 |     // compare both configs for CLHF
 | 
|---|
 | 306 |     stringstream output;
 | 
|---|
| [ee50c1] | 307 |     parser->getParams().setParameter(
 | 
|---|
 | 308 |         MpqcParser_Parameters::theoryParam,
 | 
|---|
 | 309 |         parser->getParams().getTheoryName(MpqcParser_Parameters::CLHF)
 | 
|---|
 | 310 |             );
 | 
|---|
| [765f16] | 311 |     parser->save(&output, atoms);
 | 
|---|
| [f31edc] | 312 |     stringstream input(waterMpqc_CLHF);
 | 
|---|
| [120a86] | 313 |     // check for non-empty streams
 | 
|---|
 | 314 |     input.peek();
 | 
|---|
 | 315 |     output.peek();
 | 
|---|
 | 316 |     CPPUNIT_ASSERT(input.good() && output.good());
 | 
|---|
 | 317 |     // check equality of streams per line (for debugging)
 | 
|---|
| [f31edc] | 318 |     for (; std::getline(input, first) && std::getline(output, second); ) {
 | 
|---|
 | 319 |       //std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl;
 | 
|---|
 | 320 |       CPPUNIT_ASSERT(first == second);
 | 
|---|
 | 321 |     }
 | 
|---|
 | 322 |   }
 | 
|---|
 | 323 |   {
 | 
|---|
 | 324 |     // compare both configs for CLKS
 | 
|---|
 | 325 |     stringstream output;
 | 
|---|
| [ee50c1] | 326 |     parser->getParams().setParameter(
 | 
|---|
 | 327 |         MpqcParser_Parameters::theoryParam,
 | 
|---|
 | 328 |         parser->getParams().getTheoryName(MpqcParser_Parameters::CLKS)
 | 
|---|
 | 329 |             );
 | 
|---|
| [120a86] | 330 |     parser->save(&output, atoms);
 | 
|---|
| [f31edc] | 331 |     stringstream input(waterMpqc_CLKS);
 | 
|---|
| [120a86] | 332 |     // check for non-empty streams
 | 
|---|
 | 333 |     input.peek();
 | 
|---|
 | 334 |     output.peek();
 | 
|---|
 | 335 |     CPPUNIT_ASSERT(input.good() && output.good());
 | 
|---|
 | 336 |     // check equality of streams per line (for debugging)
 | 
|---|
| [f31edc] | 337 |     for (; std::getline(input, first) && std::getline(output, second); ) {
 | 
|---|
 | 338 |       //std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl;
 | 
|---|
 | 339 |       CPPUNIT_ASSERT(first == second);
 | 
|---|
 | 340 |     }
 | 
|---|
 | 341 |   }
 | 
|---|
 | 342 |   {
 | 
|---|
 | 343 |     // compare both configs for MBPT2
 | 
|---|
 | 344 |     stringstream output;
 | 
|---|
| [ee50c1] | 345 |     parser->getParams().setParameter(
 | 
|---|
 | 346 |         MpqcParser_Parameters::theoryParam,
 | 
|---|
 | 347 |         parser->getParams().getTheoryName(MpqcParser_Parameters::MBPT2)
 | 
|---|
 | 348 |             );
 | 
|---|
| [120a86] | 349 |     parser->save(&output, atoms);
 | 
|---|
| [f31edc] | 350 |     stringstream input(waterMpqc_MBPT2);
 | 
|---|
| [120a86] | 351 |     // check for non-empty streams
 | 
|---|
 | 352 |     input.peek();
 | 
|---|
 | 353 |     output.peek();
 | 
|---|
 | 354 |     CPPUNIT_ASSERT(input.good() && output.good());
 | 
|---|
 | 355 |     // check equality of streams per line (for debugging)
 | 
|---|
| [f31edc] | 356 |     for (; std::getline(input, first) && std::getline(output, second); ) {
 | 
|---|
 | 357 |       //std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl;
 | 
|---|
 | 358 |       CPPUNIT_ASSERT(first == second);
 | 
|---|
 | 359 |     }
 | 
|---|
 | 360 |   }
 | 
|---|
 | 361 |   {
 | 
|---|
 | 362 |     // compare both configs for MBPT2_R12
 | 
|---|
 | 363 |     stringstream output;
 | 
|---|
| [ee50c1] | 364 |     parser->getParams().setParameter(
 | 
|---|
 | 365 |         MpqcParser_Parameters::theoryParam,
 | 
|---|
 | 366 |         parser->getParams().getTheoryName(MpqcParser_Parameters::MBPT2_R12)
 | 
|---|
 | 367 |             );
 | 
|---|
| [120a86] | 368 |     parser->save(&output, atoms);
 | 
|---|
| [f31edc] | 369 |     stringstream input(waterMpqc_MBPT2_R12);
 | 
|---|
| [120a86] | 370 |     // check for non-empty streams
 | 
|---|
 | 371 |     input.peek();
 | 
|---|
 | 372 |     output.peek();
 | 
|---|
 | 373 |     CPPUNIT_ASSERT(input.good() && output.good());
 | 
|---|
 | 374 |     // check equality of streams per line (for debugging)
 | 
|---|
| [f31edc] | 375 |     for (; std::getline(input, first) && std::getline(output, second); ) {
 | 
|---|
 | 376 |       //std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl;
 | 
|---|
 | 377 |       CPPUNIT_ASSERT(first == second);
 | 
|---|
 | 378 |     }
 | 
|---|
 | 379 |   }
 | 
|---|
| [9e4fd1] | 380 | }
 | 
|---|