Skip to content

Commit 42eeeac

Browse files
jwallenrwest
authored andcommitted
GaussianLog can actually read G3 energies.
There was an indexing error caused by the lack of space between "G3" and "(0 K)". I've also added a unit test like I should have the first time, so this actually works now.
1 parent 2fdcc63 commit 42eeeac

3 files changed

Lines changed: 2940 additions & 2 deletions

File tree

rmgpy/cantherm/gaussian.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,10 @@ def loadEnergy(self):
267267

268268
if 'SCF Done:' in line:
269269
E0 = float(line.split()[4]) * constants.E_h * constants.Na
270-
elif 'CBS-QB3 (0 K)' in line or 'G3(0 K)' in line:
270+
elif 'CBS-QB3 (0 K)' in line:
271271
E0_cbs = float(line.split()[3]) * constants.E_h * constants.Na
272+
elif 'G3(0 K)' in line:
273+
E0_cbs = float(line.split()[2]) * constants.E_h * constants.Na
272274
# Do NOT read the ZPE from the "E(ZPE)=" line, as this is the scaled version!
273275
elif 'Zero-point correction=' in line:
274276
ZPE = float(line.split()[2]) * constants.E_h * constants.Na

rmgpy/cantherm/gaussianTest.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class GaussianTest(unittest.TestCase):
1717
and writing Gaussian files.
1818
"""
1919

20-
def testLoadEthyleneFromGaussianLog(self):
20+
def testLoadEthyleneFromGaussianLog_CBSQB3(self):
2121
"""
2222
Uses a Gaussian03 log file for ethylene (C2H4) to test that its
2323
molecular degrees of freedom can be properly read.
@@ -71,5 +71,33 @@ def testLoadOxygenFromGaussianLog(self):
7171
self.assertEqual(conformer.spinMultiplicity, 3)
7272
self.assertEqual(conformer.opticalIsomers, 1)
7373

74+
def testLoadEthyleneFromGaussianLog_G3(self):
75+
"""
76+
Uses a Gaussian03 log file for ethylene (C2H4) to test that its
77+
molecular degrees of freedom can be properly read.
78+
"""
79+
80+
log = GaussianLog(os.path.join(os.path.dirname(__file__),'test','ethylene_G3.log'))
81+
conformer = log.loadConformer()
82+
E0 = log.loadEnergy()
83+
84+
self.assertTrue(len([mode for mode in conformer.modes if isinstance(mode,IdealGasTranslation)]) == 1)
85+
self.assertTrue(len([mode for mode in conformer.modes if isinstance(mode,NonlinearRotor)]) == 1)
86+
self.assertTrue(len([mode for mode in conformer.modes if isinstance(mode,HarmonicOscillator)]) == 1)
87+
self.assertTrue(len([mode for mode in conformer.modes if isinstance(mode,HinderedRotor)]) == 0)
88+
89+
trans = [mode for mode in conformer.modes if isinstance(mode,IdealGasTranslation)][0]
90+
rot = [mode for mode in conformer.modes if isinstance(mode,NonlinearRotor)][0]
91+
vib = [mode for mode in conformer.modes if isinstance(mode,HarmonicOscillator)][0]
92+
Tlist = numpy.array([298.15], numpy.float64)
93+
94+
self.assertAlmostEqual(trans.getPartitionFunction(Tlist), 5.83338e6, delta=1e1)
95+
self.assertAlmostEqual(rot.getPartitionFunction(Tlist), 2.53410e3, delta=1e-2)
96+
self.assertAlmostEqual(vib.getPartitionFunction(Tlist), 1.0304e0, delta=1e-4)
97+
98+
self.assertAlmostEqual(E0 / constants.Na / constants.E_h, -78.562189, 4)
99+
self.assertEqual(conformer.spinMultiplicity, 1)
100+
self.assertEqual(conformer.opticalIsomers, 1)
101+
74102
if __name__ == '__main__':
75103
unittest.main( testRunner = unittest.TextTestRunner(verbosity=2) )

0 commit comments

Comments
 (0)