1 | /*
|
---|
2 | * Project: MoleCuilder
|
---|
3 | * Description: creates and alters molecular systems
|
---|
4 | * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
|
---|
5 | *
|
---|
6 | *
|
---|
7 | * This file is part of MoleCuilder.
|
---|
8 | *
|
---|
9 | * MoleCuilder is free software: you can redistribute it and/or modify
|
---|
10 | * it under the terms of the GNU General Public License as published by
|
---|
11 | * the Free Software Foundation, either version 2 of the License, or
|
---|
12 | * (at your option) any later version.
|
---|
13 | *
|
---|
14 | * MoleCuilder is distributed in the hope that it will be useful,
|
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
17 | * GNU General Public License for more details.
|
---|
18 | *
|
---|
19 | * You should have received a copy of the GNU General Public License
|
---|
20 | * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
|
---|
21 | */
|
---|
22 |
|
---|
23 | /*
|
---|
24 | * ParserPsi3UnitTest.cpp
|
---|
25 | *
|
---|
26 | * Created on: Mar 3, 2010
|
---|
27 | * Author: metzler
|
---|
28 | */
|
---|
29 |
|
---|
30 | // include config.h
|
---|
31 | #ifdef HAVE_CONFIG_H
|
---|
32 | #include <config.h>
|
---|
33 | #endif
|
---|
34 |
|
---|
35 | #include "ParserPsi3UnitTest.hpp"
|
---|
36 |
|
---|
37 | #include <cppunit/CompilerOutputter.h>
|
---|
38 | #include <cppunit/extensions/TestFactoryRegistry.h>
|
---|
39 | #include <cppunit/ui/text/TestRunner.h>
|
---|
40 |
|
---|
41 | #include <boost/any.hpp>
|
---|
42 |
|
---|
43 | #include "CodePatterns/Log.hpp"
|
---|
44 |
|
---|
45 | #include "Atom/atom.hpp"
|
---|
46 | #include "Atom/AtomObserver.hpp"
|
---|
47 | #include "Element/element.hpp"
|
---|
48 | #include "Element/periodentafel.hpp"
|
---|
49 | #include "CodePatterns/Assert.hpp"
|
---|
50 | #include "Descriptors/AtomTypeDescriptor.hpp"
|
---|
51 | #include "Parser/ChangeTracker.hpp"
|
---|
52 | #include "Parser/Psi3Parser.hpp"
|
---|
53 | #include "World.hpp"
|
---|
54 |
|
---|
55 | #ifdef HAVE_TESTRUNNER
|
---|
56 | #include "UnitTestMain.hpp"
|
---|
57 | #endif /*HAVE_TESTRUNNER*/
|
---|
58 |
|
---|
59 | using namespace std;
|
---|
60 |
|
---|
61 | // Registers the fixture into the 'registry'
|
---|
62 | CPPUNIT_TEST_SUITE_REGISTRATION( ParserPsi3UnitTest );
|
---|
63 |
|
---|
64 | static string hydrogenPsi3_RHF ="% Created by MoleCuilder\n\
|
---|
65 | psi: (\n\
|
---|
66 | \tlabel = \"cc-pVTZ SCF H2\"\n\
|
---|
67 | \tjobtype = sp\n\
|
---|
68 | \twfn = scf\n\
|
---|
69 | \tmaxiter = 80\n\
|
---|
70 | \treference = rhf\n\
|
---|
71 | \tbasis = \"cc-pVTZ\"\n\
|
---|
72 | \tfreeze_core = no\n\
|
---|
73 | \tunits = angstrom\n\
|
---|
74 | \tgeometry = (\n\
|
---|
75 | \t( H\t0\t0\t-0.37 )\n\
|
---|
76 | \t( H\t0\t0\t0.37 )\n\
|
---|
77 | \t)\n\
|
---|
78 | \torigin = (0.0\t0.0\t0.0)\n\
|
---|
79 | )\n"; // tested with ???
|
---|
80 |
|
---|
81 | static string hydrogenPsi3_ROHF ="% Created by MoleCuilder\n\
|
---|
82 | psi: (\n\
|
---|
83 | \tlabel = \"cc-pVTZ SCF H2\"\n\
|
---|
84 | \tjobtype = sp\n\
|
---|
85 | \twfn = scf\n\
|
---|
86 | \tmaxiter = 80\n\
|
---|
87 | \treference = rohf\n\
|
---|
88 | \tbasis = \"cc-pVTZ\"\n\
|
---|
89 | \tfreeze_core = no\n\
|
---|
90 | \tunits = angstrom\n\
|
---|
91 | \tgeometry = (\n\
|
---|
92 | \t( H\t0\t0\t-0.37 )\n\
|
---|
93 | \t( H\t0\t0\t0.37 )\n\
|
---|
94 | \t)\n\
|
---|
95 | \torigin = (0.0\t0.0\t0.0)\n\
|
---|
96 | )\n"; // tested with ???
|
---|
97 |
|
---|
98 | static string hydrogenPsi3_UHF ="% Created by MoleCuilder\n\
|
---|
99 | psi: (\n\
|
---|
100 | \tlabel = \"cc-pVTZ SCF H2\"\n\
|
---|
101 | \tjobtype = sp\n\
|
---|
102 | \twfn = scf\n\
|
---|
103 | \tmaxiter = 80\n\
|
---|
104 | \treference = uhf\n\
|
---|
105 | \tbasis = \"cc-pVTZ\"\n\
|
---|
106 | \tmultp = 3\n\
|
---|
107 | \tcharge = 2\n\
|
---|
108 | \tfreeze_core = no\n\
|
---|
109 | \tunits = angstrom\n\
|
---|
110 | \tgeometry = (\n\
|
---|
111 | \t( H\t0\t0\t-0.37 )\n\
|
---|
112 | \t( H\t0\t0\t0.37 )\n\
|
---|
113 | \t)\n\
|
---|
114 | \torigin = (0.0\t0.0\t0.0)\n\
|
---|
115 | )\n"; // tested with ???
|
---|
116 |
|
---|
117 | static string hydrogenPsi3_TWOCON ="% Created by MoleCuilder\n\
|
---|
118 | psi: (\n\
|
---|
119 | \tlabel = \"cc-pVTZ SCF H2\"\n\
|
---|
120 | \tjobtype = sp\n\
|
---|
121 | \twfn = scf\n\
|
---|
122 | \tmaxiter = 80\n\
|
---|
123 | \treference = twocon\n\
|
---|
124 | \tbasis = \"cc-pVTZ\"\n\
|
---|
125 | \tmultp = 3\n\
|
---|
126 | \tcharge = 2\n\
|
---|
127 | \tsocc = ( 1 1 0 0 0 0 0 0 )\n\
|
---|
128 | \tdocc = ( 0 0 0 0 0 0 0 0 )\n\
|
---|
129 | \tsubgroup = c2v\n\
|
---|
130 | \tunique_axis = x\n\
|
---|
131 | \tfreeze_core = no\n\
|
---|
132 | \tunits = angstrom\n\
|
---|
133 | \tgeometry = (\n\
|
---|
134 | \t( H\t0\t0\t-0.37 )\n\
|
---|
135 | \t( H\t0\t0\t0.37 )\n\
|
---|
136 | \t)\n\
|
---|
137 | \torigin = (0.0\t0.0\t0.0)\n\
|
---|
138 | )\n"; // tested with ???
|
---|
139 |
|
---|
140 | void ParserPsi3UnitTest::setUp()
|
---|
141 | {
|
---|
142 | // failing asserts should be thrown
|
---|
143 | ASSERT_DO(Assert::Throw);
|
---|
144 |
|
---|
145 | parser = new FormatParser<psi3>();
|
---|
146 |
|
---|
147 | params = &parser->getParams();
|
---|
148 |
|
---|
149 | World::getInstance();
|
---|
150 |
|
---|
151 | setVerbosity(2);
|
---|
152 |
|
---|
153 | // we need hydrogens and oxygens in the following tests
|
---|
154 | CPPUNIT_ASSERT(World::getInstance().getPeriode()->FindElement(1) != NULL);
|
---|
155 | }
|
---|
156 |
|
---|
157 | void ParserPsi3UnitTest::tearDown()
|
---|
158 | {
|
---|
159 | params = NULL;
|
---|
160 | delete parser;
|
---|
161 | ChangeTracker::purgeInstance();
|
---|
162 | World::purgeInstance();
|
---|
163 | AtomObserver::purgeInstance();
|
---|
164 | }
|
---|
165 |
|
---|
166 | /************************************ tests ***********************************/
|
---|
167 |
|
---|
168 | void ParserPsi3UnitTest::ParameterDefaultTest() {
|
---|
169 | // check default values
|
---|
170 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::labelParam) == std::string("unknown job"));
|
---|
171 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::jobtypeParam) == params->ValidJobtypes[Psi3Parser_Parameters::SP]);
|
---|
172 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::wavefunctionParam) == params->ValidWavefunction[Psi3Parser_Parameters::SCF]);
|
---|
173 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::maxiterParam) == std::string("80"));
|
---|
174 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::referenceParam) == params->ValidReference[Psi3Parser_Parameters::RHF]);
|
---|
175 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::basisParam) == std::string("cc-pVTZ"));
|
---|
176 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::freeze_coreParam) == params->ValidFreezeCore[Psi3Parser_Parameters::YES]);
|
---|
177 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::unitsParam) == params->ValidUnits[Psi3Parser_Parameters::angstrom]);
|
---|
178 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::dertypeParam) == params->ValidDerivativeType[Psi3Parser_Parameters::NONE]);
|
---|
179 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::originParam) == std::string("(0.0\t0.0\t0.0)"));
|
---|
180 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::multiplicityParam) == std::string("1"));
|
---|
181 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::chargeParam) == std::string("0"));
|
---|
182 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::soccParam) == std::string("()"));
|
---|
183 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::doccParam) == std::string("()"));
|
---|
184 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::subgroupParam) == std::string(""));
|
---|
185 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::unique_axisParam) == params->ValidUniqueAxis[Psi3Parser_Parameters::X]);
|
---|
186 | }
|
---|
187 |
|
---|
188 | void ParserPsi3UnitTest::ParameterCloneTest() {
|
---|
189 | FormatParser_Parameters *clone = params->clone();
|
---|
190 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::jobtypeParam) == params->ValidJobtypes[Psi3Parser_Parameters::SP]);
|
---|
191 | std::stringstream setvalue(params->ParamNames[Psi3Parser_Parameters::jobtypeParam]+"="+params->ValidJobtypes[Psi3Parser_Parameters::OPT]);
|
---|
192 | setvalue >> *params;
|
---|
193 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::jobtypeParam) == params->ValidJobtypes[Psi3Parser_Parameters::OPT]);
|
---|
194 | params->makeClone(*clone);
|
---|
195 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::jobtypeParam) == params->ValidJobtypes[Psi3Parser_Parameters::SP]);
|
---|
196 | }
|
---|
197 |
|
---|
198 | void ParserPsi3UnitTest::ParameterSetterTest() {
|
---|
199 | // test a jobtype
|
---|
200 | {
|
---|
201 | std::stringstream setvalue(
|
---|
202 | params->ParamNames[Psi3Parser_Parameters::jobtypeParam]
|
---|
203 | +" = "+params->ValidJobtypes[Psi3Parser_Parameters::OPT]
|
---|
204 | );
|
---|
205 | setvalue >> *params;
|
---|
206 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::jobtypeParam) == params->ValidJobtypes[Psi3Parser_Parameters::OPT]);
|
---|
207 | }
|
---|
208 | // test a wavefunction
|
---|
209 | {
|
---|
210 | std::stringstream setvalue(
|
---|
211 | params->ParamNames[Psi3Parser_Parameters::wavefunctionParam]
|
---|
212 | +" = "+params->ValidWavefunction[Psi3Parser_Parameters::MP2]
|
---|
213 | );
|
---|
214 | setvalue >> *params;
|
---|
215 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::wavefunctionParam) == params->ValidWavefunction[Psi3Parser_Parameters::MP2]);
|
---|
216 | }
|
---|
217 | // test a reference
|
---|
218 | {
|
---|
219 | std::stringstream setvalue(
|
---|
220 | params->ParamNames[Psi3Parser_Parameters::referenceParam]
|
---|
221 | +" = "+params->ValidReference[Psi3Parser_Parameters::ROHF]
|
---|
222 | );
|
---|
223 | setvalue >> *params;
|
---|
224 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::referenceParam) == params->ValidReference[Psi3Parser_Parameters::ROHF]);
|
---|
225 | }
|
---|
226 | // test a unique_axis
|
---|
227 | {
|
---|
228 | std::stringstream setvalue(
|
---|
229 | params->ParamNames[Psi3Parser_Parameters::unique_axisParam]
|
---|
230 | +" = "+params->ValidUniqueAxis[Psi3Parser_Parameters::Y]
|
---|
231 | );
|
---|
232 | setvalue >> *params;
|
---|
233 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::unique_axisParam) == params->ValidUniqueAxis[Psi3Parser_Parameters::Y]);
|
---|
234 | }
|
---|
235 | // test a units
|
---|
236 | {
|
---|
237 | std::stringstream setvalue(
|
---|
238 | params->ParamNames[Psi3Parser_Parameters::unitsParam]
|
---|
239 | +" = "+params->ValidUnits[Psi3Parser_Parameters::bohr]
|
---|
240 | );
|
---|
241 | setvalue >> *params;
|
---|
242 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::unitsParam) == params->ValidUnits[Psi3Parser_Parameters::bohr]);
|
---|
243 | }
|
---|
244 | // test a dertype
|
---|
245 | {
|
---|
246 | std::stringstream setvalue(
|
---|
247 | params->ParamNames[Psi3Parser_Parameters::dertypeParam]
|
---|
248 | +" = "+params->ValidDerivativeType[Psi3Parser_Parameters::NONE]
|
---|
249 | );
|
---|
250 | setvalue >> *params;
|
---|
251 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::dertypeParam) == params->ValidDerivativeType[Psi3Parser_Parameters::NONE]);
|
---|
252 | }
|
---|
253 | // test a freeze_core
|
---|
254 | {
|
---|
255 | std::stringstream setvalue(
|
---|
256 | params->ParamNames[Psi3Parser_Parameters::freeze_coreParam]
|
---|
257 | +" = "+params->ValidFreezeCore[Psi3Parser_Parameters::LARGE]
|
---|
258 | );
|
---|
259 | setvalue >> *params;
|
---|
260 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::freeze_coreParam) == params->ValidFreezeCore[Psi3Parser_Parameters::LARGE]);
|
---|
261 | }
|
---|
262 | // test int
|
---|
263 | {
|
---|
264 | std::stringstream setvalue(
|
---|
265 | params->ParamNames[Psi3Parser_Parameters::maxiterParam]
|
---|
266 | +" = 500"
|
---|
267 | );
|
---|
268 | setvalue >> *params;
|
---|
269 | // std::cout << "maxiter is "
|
---|
270 | // << params->getString(Psi3Parser_Parameters::maxiterParam) << std::endl;
|
---|
271 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::maxiterParam) == std::string("500"));
|
---|
272 | }
|
---|
273 | // test whether unknown key fails
|
---|
274 | std::cout << "The following Assertion warning is desired and does not indicate a failure of the test." << std::endl;
|
---|
275 | {
|
---|
276 | std::stringstream setvalue("sd = no");
|
---|
277 | #ifndef NDEBUG
|
---|
278 | ASSERT_DO(Assert::Throw);
|
---|
279 | CPPUNIT_ASSERT_THROW(setvalue >> *params, Assert::AssertionFailure);
|
---|
280 | #else
|
---|
281 | setvalue >> *params;
|
---|
282 | #endif
|
---|
283 | // std::cout << "Hessian is still "
|
---|
284 | // << params->getString(Psi3Parser_Parameters::hessianParam) << std::endl;
|
---|
285 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::jobtypeParam) == params->ValidJobtypes[Psi3Parser_Parameters::OPT]);
|
---|
286 | }
|
---|
287 | }
|
---|
288 |
|
---|
289 | void ParserPsi3UnitTest::readPsi3Test() {
|
---|
290 | stringstream input(hydrogenPsi3_RHF);
|
---|
291 | // set some other parameter for jobtype
|
---|
292 | params->setParameter(
|
---|
293 | Psi3Parser_Parameters::jobtypeParam,
|
---|
294 | params->ValidJobtypes[Psi3Parser_Parameters::OPT]
|
---|
295 | );
|
---|
296 | parser->load(&input);
|
---|
297 |
|
---|
298 | // check for jobtype from file
|
---|
299 | CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::jobtypeParam) == params->ValidJobtypes[Psi3Parser_Parameters::SP]);
|
---|
300 | // check for 2 hydrogens
|
---|
301 | CPPUNIT_ASSERT_EQUAL(2, World::getInstance().numAtoms());
|
---|
302 | // check that positions are right
|
---|
303 | Vector PositionSum;
|
---|
304 | std::vector<atom *> atoms = World::getInstance().getAllAtoms();
|
---|
305 | for (std::vector<atom *>::const_iterator iter = atoms.begin();
|
---|
306 | iter != atoms.end();
|
---|
307 | ++iter)
|
---|
308 | PositionSum += (*iter)->getPosition();
|
---|
309 | CPPUNIT_ASSERT_EQUAL( PositionSum, Vector(0.,0.,0.) );
|
---|
310 | }
|
---|
311 |
|
---|
312 | void ParserPsi3UnitTest::writePsi3Test() {
|
---|
313 | // build up hydrogen molecule
|
---|
314 | string first;
|
---|
315 | string second;
|
---|
316 | atom *Walker = NULL;
|
---|
317 | Walker = World::getInstance().createAtom();
|
---|
318 | Walker->setType(1);
|
---|
319 | Walker->setPosition(Vector(0.,0.,0.));
|
---|
320 | Walker = World::getInstance().createAtom();
|
---|
321 | Walker->setType(1);
|
---|
322 | Walker->setPosition(Vector(0.,0,0.74));
|
---|
323 | CPPUNIT_ASSERT_EQUAL(2, World::getInstance().numAtoms());
|
---|
324 |
|
---|
325 | // set general parameters: label and freeze_core
|
---|
326 | params->setParameter(
|
---|
327 | Psi3Parser_Parameters::labelParam,
|
---|
328 | "cc-pVTZ SCF H2"
|
---|
329 | );
|
---|
330 | params->setParameter(
|
---|
331 | Psi3Parser_Parameters::freeze_coreParam,
|
---|
332 | params->ValidFreezeCore[Psi3Parser_Parameters::NO]
|
---|
333 | );
|
---|
334 | params->setParameter(
|
---|
335 | Psi3Parser_Parameters::unitsParam,
|
---|
336 | params->ValidUnits[Psi3Parser_Parameters::angstrom]
|
---|
337 | );
|
---|
338 |
|
---|
339 | // create two stringstreams, one stored, one created
|
---|
340 | std::vector<atom *> atoms = World::getInstance().getAllAtoms();
|
---|
341 | {
|
---|
342 | // compare both configs for RHF
|
---|
343 | stringstream output;
|
---|
344 | params->setParameter(
|
---|
345 | Psi3Parser_Parameters::referenceParam,
|
---|
346 | params->ValidReference[Psi3Parser_Parameters::RHF]
|
---|
347 | );
|
---|
348 | parser->save(&output, atoms);
|
---|
349 | stringstream input(hydrogenPsi3_RHF);
|
---|
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 | // compare both configs for ROHF
|
---|
362 | stringstream output;
|
---|
363 | params->setParameter(
|
---|
364 | Psi3Parser_Parameters::referenceParam,
|
---|
365 | params->ValidReference[Psi3Parser_Parameters::ROHF]
|
---|
366 | );
|
---|
367 | parser->save(&output, atoms);
|
---|
368 | stringstream input(hydrogenPsi3_ROHF);
|
---|
369 | // check for non-empty streams
|
---|
370 | input.peek();
|
---|
371 | output.peek();
|
---|
372 | CPPUNIT_ASSERT(input.good() && output.good());
|
---|
373 | // check equality of streams per line (for debugging)
|
---|
374 | for (; std::getline(input, first) && std::getline(output, second); ) {
|
---|
375 | //std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl;
|
---|
376 | CPPUNIT_ASSERT(first == second);
|
---|
377 | }
|
---|
378 | }
|
---|
379 | {
|
---|
380 | params->setParameter(Psi3Parser_Parameters::multiplicityParam, "2");
|
---|
381 | params->setParameter(Psi3Parser_Parameters::chargeParam, "2");
|
---|
382 | // compare both configs for UHF
|
---|
383 | stringstream output;
|
---|
384 | params->setParameter(
|
---|
385 | Psi3Parser_Parameters::referenceParam,
|
---|
386 | params->ValidReference[Psi3Parser_Parameters::UHF]
|
---|
387 | );
|
---|
388 | parser->save(&output, atoms);
|
---|
389 | params->setParameter(Psi3Parser_Parameters::chargeParam, "0");
|
---|
390 | params->setParameter(Psi3Parser_Parameters::multiplicityParam, "1");
|
---|
391 | stringstream input(hydrogenPsi3_UHF);
|
---|
392 | // check for non-empty streams
|
---|
393 | input.peek();
|
---|
394 | output.peek();
|
---|
395 | CPPUNIT_ASSERT(input.good() && output.good());
|
---|
396 | // check equality of streams per line (for debugging)
|
---|
397 | for (; std::getline(input, first) && std::getline(output, second); ) {
|
---|
398 | //std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl;
|
---|
399 | CPPUNIT_ASSERT(first == second);
|
---|
400 | }
|
---|
401 | }
|
---|
402 | {
|
---|
403 | params->setParameter(Psi3Parser_Parameters::multiplicityParam, "1");
|
---|
404 | params->setParameter(Psi3Parser_Parameters::chargeParam, "2");
|
---|
405 | params->setParameter(Psi3Parser_Parameters::soccParam, "( 1 1 0 0 0 0 0 0 )");
|
---|
406 | params->setParameter(Psi3Parser_Parameters::doccParam, "( 0 0 0 0 0 0 0 0 )");
|
---|
407 | params->setParameter(Psi3Parser_Parameters::subgroupParam, "c2v");
|
---|
408 | params->setParameter(Psi3Parser_Parameters::unique_axisParam, "x");
|
---|
409 | // compare both configs for TWOCON
|
---|
410 | stringstream output;
|
---|
411 | params->setParameter(
|
---|
412 | Psi3Parser_Parameters::referenceParam,
|
---|
413 | params->ValidReference[Psi3Parser_Parameters::TWOCON]
|
---|
414 | );
|
---|
415 | parser->save(&output, atoms);
|
---|
416 | params->setParameter(Psi3Parser_Parameters::multiplicityParam, "1");
|
---|
417 | params->setParameter(Psi3Parser_Parameters::chargeParam, "0");
|
---|
418 | stringstream input(hydrogenPsi3_TWOCON);
|
---|
419 | // check for non-empty streams
|
---|
420 | input.peek();
|
---|
421 | output.peek();
|
---|
422 | CPPUNIT_ASSERT(input.good() && output.good());
|
---|
423 | // check equality of streams per line (for debugging)
|
---|
424 | for (; std::getline(input, first) && std::getline(output, second); ) {
|
---|
425 | //std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl;
|
---|
426 | CPPUNIT_ASSERT(first == second);
|
---|
427 | }
|
---|
428 | }
|
---|
429 | }
|
---|