Skip to content

Commit 2d2d43d

Browse files
committed
add test for write gjf files
1 parent 4668f49 commit 2d2d43d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/test_gaussian_gjf.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,27 @@ def setUp(self):
1010

1111
def test_dump_to_gjf(self):
1212
self.system.to_gaussian_gjf("gaussian/tmp.gjf")
13+
with open("gaussian/tmp.gjf") as f:
14+
header = f.readline().strip()
15+
f.readline()
16+
title = f.readline().strip()
17+
f.readline()
18+
charge, mult = (int(x) for x in f.readline().strip().split())
19+
atoms = []
20+
coords = []
21+
for ii in range(5):
22+
line = f.readline().strip().split()
23+
atoms.append(line[0])
24+
coords.append([float(x) for x in line[1:]])
25+
26+
self.assertEqual(header, "#force B3LYP/6-31G(d)")
27+
self.assertEqual(title, self.system.formula)
28+
self.assertEqual(charge, 0)
29+
self.assertEqual(mult, 1)
30+
self.assertEqual(atoms, ['C', 'H', 'H', 'H', 'H'])
31+
for i in range(self.system['coords'].shape[1]):
32+
for j in range(3):
33+
self.assertAlmostEqual(coords[i][j], self.system['coords'][0][i][j])
1334

1435
def tearDown(self):
1536
if os.path.exists('gaussian/tmp.gjf'):

0 commit comments

Comments
 (0)