Debian Codegraph @

test/data/testBOMD.py

raw
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright (c) 2018, the cclib development team
4 #
5 # This file is part of cclib (http://cclib.github.io) and is distributed under
6 # the terms of the BSD 3-Clause License.
7
8 """Test Born-Oppenheimer molecular dynamics (BOMD) logfiles in cclib."""
9
10 import os
11 import unittest
12
13
14 __filedir__ = os.path.realpath(os.path.dirname(__file__))
15
16
17 class GenericBOMDTest(unittest.TestCase):
18 """Generic Born-Oppenheimer molecular dynamics unittest"""
19
20 # To calculate the initial set of forces/velocities, programs
21 # first converge the energy at the input geometry, so there is
22 # always one more geometry/energy than MD step.
23 nsteps = 35
24 nenergies = 36
25
26 def testdimscfenergies(self):
27 """Are the number of parsed energies consistent with the number of MD
28 steps?
29 """
30 self.assertEqual(self.data.scfenergies.shape, (self.nenergies, ))
31
32 def testdimatomcoords(self):
33 """Are the number of parsed geometries consistent with the number of
34 MD steps?
35 """
36 self.assertEqual(self.data.atomcoords.shape, (self.nenergies, 20, 3))
37
38 def testdimtime(self):
39 """Are the number of time points consistent with the number of MD
40 steps?
41 """
42 self.assertEqual(self.data.time.shape, (self.nsteps, ))
43
44
45 class GaussianBOMDTest(GenericBOMDTest):
46 """Customized Born-Oppenheimer molecular dynamics unittest"""
47
48 # This may have something to do with our corrections for
49 # extrapolation step rejection.
50 nenergies = 35
51
52
53 if __name__=="__main__":
54
55 import sys
56 sys.path.append(os.path.join(__filedir__, ".."))
57
58 from test_data import DataSuite
59 suite = DataSuite(['BOMD'])
60 suite.testall()