From 6e9bb1b54089bda7609940b66b9e3f5e872d3fcd Mon Sep 17 00:00:00 2001 From: Alon Grinberg Dana Date: Sun, 11 Aug 2024 08:38:31 +0300 Subject: [PATCH] Tests: Parsing a Mockter output file Testing freqs, xyz, sp, and ess identification --- arc/parser_test.py | 16 ++++++++++++++++ arc/testing/freq/mockter.yml | 10 ++++++++++ 2 files changed, 26 insertions(+) create mode 100644 arc/testing/freq/mockter.yml diff --git a/arc/parser_test.py b/arc/parser_test.py index 7f774d0232..fcc67cee96 100644 --- a/arc/parser_test.py +++ b/arc/parser_test.py @@ -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') @@ -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)) @@ -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') @@ -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') @@ -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""" diff --git a/arc/testing/freq/mockter.yml b/arc/testing/freq/mockter.yml new file mode 100644 index 0000000000..5a3f2579d6 --- /dev/null +++ b/arc/testing/freq/mockter.yml @@ -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