Skip to content

Commit

Permalink
Tests: Parsing a Mockter output file
Browse files Browse the repository at this point in the history
Testing freqs, xyz, sp, and ess identification
  • Loading branch information
alongd committed Aug 11, 2024
1 parent fe74a87 commit 6e9bb1b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
16 changes: 16 additions & 0 deletions arc/parser_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def test_parse_frequencies(self):
ts_xtb_freqs_path = os.path.join(ARC_PATH, 'arc', 'testing', 'freq', 'TS_NH2+N2H3_xtb.out')
yml_freqs_path = os.path.join(ARC_PATH, 'arc', 'testing', 'freq', 'output.yml')
vibspectrum_path = os.path.join(ARC_PATH, 'arc', 'testing', 'freq', 'vibspectrum')
mock_path = os.path.join(ARC_PATH, 'arc', 'testing', 'freq', 'mockter.yml')

no3_freqs = parser.parse_frequencies(path=no3_path, software='QChem')
c2h6_freqs = parser.parse_frequencies(path=c2h6_path, software='QChem')
Expand All @@ -58,6 +59,7 @@ def test_parse_frequencies(self):
ts_xtb_freqs = parser.parse_frequencies(path=ts_xtb_freqs_path)
yml_freqs = parser.parse_frequencies(path=yml_freqs_path)
vibspectrum_freqs = parser.parse_frequencies(path=vibspectrum_path, software='xTB')
mock_freqs = parser.parse_frequencies(path=mock_path, software='Mockter')

np.testing.assert_almost_equal(no3_freqs,
np.array([-390.08, -389.96, 822.75, 1113.23, 1115.24, 1195.35], np.float64))
Expand Down Expand Up @@ -111,6 +113,8 @@ def test_parse_frequencies(self):
np.float64))
np.testing.assert_almost_equal(vibspectrum_freqs, np.array([4225.72], np.float64))

np.testing.assert_almost_equal(mock_freqs, np.array([-500., 520., 540.], np.float64))

def test_parse_normal_mode_displacement(self):
"""Test parsing frequencies and normal mode displacements"""
freq_path = os.path.join(ARC_PATH, 'arc', 'testing', 'freq', 'Gaussian_neg_freq.out')
Expand Down Expand Up @@ -373,6 +377,12 @@ def test_parse_geometry(self):
(1.1691669229762556, -2.0726946137332924, -0.4703870247902347))}
self.assertTrue(almost_equal_coords(xyz_3, expected_xyz_3))

path_4 = os.path.join(ARC_PATH, 'arc', 'testing', 'freq', 'mockter.yml')
xyz_4 = parser.parse_geometry(path=path_4)
expected_xyz_4 = {'symbols': ('O', 'H', 'H'), 'isotopes': (16, 1, 1),
'coords': ((0.0, 0.0, 1.0), (0.0, 0.0, 0.0), (1.0, 0.0, 0.0))}
self.assertTrue(almost_equal_coords(xyz_4, expected_xyz_4))

def test_parse_trajectory(self):
"""Test parsing trajectories"""
path = os.path.join(ARC_PATH, 'arc', 'testing', 'xyz', 'scan_optim.xyz')
Expand Down Expand Up @@ -464,10 +474,16 @@ def test_parse_e_elect(self):
e_elect = parser.parse_e_elect(path)
self.assertAlmostEqual(e_elect, -40692.56663699465)

path = os.path.join(ARC_PATH, 'arc', 'testing', 'freq', 'mockter.yml')
e_elect = parser.parse_e_elect(path)
self.assertAlmostEqual(e_elect, 50)

def test_identify_ess(self):
"""Test the identify_ess() function."""
ess = parser.identify_ess(os.path.join(ARC_PATH, 'arc', 'testing', 'sp', 'NCC_xTB.out'))
self.assertEqual(ess, 'xtb')
ess = parser.identify_ess(os.path.join(ARC_PATH, 'arc', 'testing', 'freq', 'mockter.yml'))
self.assertEqual(ess, 'mockter')

def test_parse_zpe(self):
"""Test the parse_zpe() function for parsing zero point energies"""
Expand Down
10 changes: 10 additions & 0 deletions arc/testing/freq/mockter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
adapter: mockter
sp: 50
freqs:
- -500
- 520
- 540
xyz: |-
O 0.00000000 0.00000000 1.00000000
H 0.00000000 0.00000000 0.00000000
H 1.00000000 0.00000000 0.00000000

0 comments on commit 6e9bb1b

Please sign in to comment.