From d97acae5a2d1f709186ddfd48e03f04c31c428ef Mon Sep 17 00:00:00 2001 From: Alon Grinberg Dana Date: Sun, 7 Sep 2025 10:24:45 +0300 Subject: [PATCH 1/3] BugFix: NUMBER_BY_SYMBOL is a dict use `dict[key]`, not `dict(key)` in plotter --- arc/plotter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arc/plotter.py b/arc/plotter.py index 5621025420..526688be52 100644 --- a/arc/plotter.py +++ b/arc/plotter.py @@ -751,7 +751,7 @@ def save_irc_traj_animation(irc_f_path, irc_r_path, out_path): f.write(' Number Number Type X Y Z\n') f.write(' ---------------------------------------------------------------------\n') for i, symbol in enumerate(xyz['symbols']): - el_num, x, y, z = NUMBER_BY_SYMBOL(symbol), xs[i], ys[i], zs[i] + el_num, x, y, z = NUMBER_BY_SYMBOL[symbol], xs[i], ys[i], zs[i] f.write(f' {i + 1:>5} {el_num} 0 {x} {y} {z}\n') f.write(' ---------------------------------------------------------------------\n') f.write(' GradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGrad\n') From af602359a3e642ecbc35d285a8316afc87a04bc4 Mon Sep 17 00:00:00 2001 From: Alon Grinberg Dana Date: Mon, 29 Dec 2025 09:58:55 +0200 Subject: [PATCH 2/3] Tests: plotter save_irc_traj_animation() --- arc/plotter_test.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/arc/plotter_test.py b/arc/plotter_test.py index e347c8a4bb..8a8a1e6a14 100644 --- a/arc/plotter_test.py +++ b/arc/plotter_test.py @@ -209,6 +209,16 @@ def test_delete_multi_species_output_file(self): self.assertFalse(os.path.isfile(os.path.join(ARC_PATH, 'arc', 'testing', 'acetylene.log'))) self.assertFalse(os.path.isfile(os.path.join(ARC_PATH, 'arc', 'testing', 'N-Valeric_Acid.log'))) + def test_save_irc_traj_animation(self): + """Test the save_irc_traj_animation function""" + irc_f_path = os.path.join(ARC_PATH, 'arc', 'testing', 'irc', 'rxn_1_irc_1.out') + irc_r_path = os.path.join(ARC_PATH, 'arc', 'testing', 'irc', 'rxn_1_irc_2.out') + out_path = os.path.join(ARC_PATH, 'arc', 'testing', 'irc', 'rxn_1_irc_animation.out') + self.assertFalse(os.path.isfile(out_path)) + plotter.save_irc_traj_animation(irc_f_path, irc_r_path, out_path) + self.assertTrue(os.path.isfile(out_path)) + + @classmethod def tearDownClass(cls): """A function that is run ONCE after all unit tests in this class.""" @@ -218,7 +228,9 @@ def tearDownClass(cls): files_to_remove = [os.path.join(ARC_PATH, 'arc', 'testing', 'bde_report_test.txt'), os.path.join(ARC_PATH, 'arc', 'testing', 'water.log'), os.path.join(ARC_PATH, 'arc', 'testing', 'acetylene.log'), - os.path.join(ARC_PATH, 'arc', 'testing', 'N-Valeric_Acid.log'),] + os.path.join(ARC_PATH, 'arc', 'testing', 'N-Valeric_Acid.log'), + os.path.join(ARC_PATH, 'arc', 'testing', 'irc', 'rxn_1_irc_animation.out'), + ] for file_path in files_to_remove: if os.path.isfile(file_path): os.remove(file_path) From ecca8c522a4cb6e502658400611ae71f52b80cb7 Mon Sep 17 00:00:00 2001 From: Alon Grinberg Dana Date: Wed, 31 Dec 2025 17:18:51 +0200 Subject: [PATCH 3/3] Tests: Lower the accuracy of get_zmat_param_value almost equal checks To avoid errors like: AssertionError: 160.00001525878906 != 160 within 5 places (1.52587890625e-05 difference) --- arc/species/converter_test.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arc/species/converter_test.py b/arc/species/converter_test.py index 086b46c2ea..940313dc8d 100644 --- a/arc/species/converter_test.py +++ b/arc/species/converter_test.py @@ -4003,7 +4003,7 @@ def test_modify_coords(self): new_xyz = converter.modify_coords(coords=xyz1, indices=indices, new_value=new_val, modification_type=modification_type, mol=mol1) self.assertTrue(almost_equal_coords_lists(new_xyz, expected_xyz)) - self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 5) + self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 3) indices, new_val = [1, 0], -1.5 expected_xyz = {'symbols': ('O', 'C', 'C', 'O', 'H', 'H', 'H', 'H'), 'isotopes': (16, 12, 12, 16, 1, 1, 1, 1), @@ -4034,7 +4034,7 @@ def test_modify_coords(self): new_xyz = converter.modify_coords(coords=xyz1, indices=indices, new_value=new_val, modification_type=modification_type, mol=mol1) self.assertTrue(almost_equal_coords_lists(new_xyz, expected_xyz)) - self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 5) + self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 3) # test changing an angle to 180 degrees indices, new_val = [0, 1, 2], 180 @@ -4080,7 +4080,7 @@ def test_modify_coords(self): new_xyz = converter.modify_coords(coords=xyz1, indices=indices, new_value=new_val, modification_type=modification_type, mol=mol1) self.assertTrue(almost_equal_coords_lists(new_xyz, expected_xyz)) - self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 5) + self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 3) indices, new_val = [3, 2, 1, 0], -30 expected_xyz = {'symbols': ('O', 'C', 'C', 'O', 'H', 'H', 'H', 'H'), 'isotopes': (16, 12, 12, 16, 1, 1, 1, 1), @@ -4131,7 +4131,7 @@ def test_modify_coords(self): new_xyz = converter.modify_coords(coords=xyz1, indices=indices, new_value=new_val, modification_type=modification_type, mol=mol1) self.assertTrue(almost_equal_coords_lists(new_xyz, expected_xyz)) - self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 5) + self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 3) # test A_group modification indices, new_val = [0, 1, 2], 160 @@ -4147,7 +4147,7 @@ def test_modify_coords(self): new_xyz = converter.modify_coords(coords=xyz1, indices=indices, new_value=new_val, modification_type=modification_type, mol=mol1) self.assertTrue(almost_equal_coords_lists(new_xyz, expected_xyz)) - self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 5) + self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 3) indices, new_val = [1, 2, 5], 160 expected_xyz = {'symbols': ('O', 'C', 'C', 'S', 'O', 'C', 'C', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H'), @@ -4211,7 +4211,7 @@ def test_modify_coords(self): new_xyz = converter.modify_coords(coords=xyz1, indices=indices, new_value=new_val, modification_type=modification_type, mol=mol1) self.assertTrue(almost_equal_coords_lists(new_xyz, expected_xyz)) - self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 5) + self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 3) indices, new_val = [5, 2, 1, 0], 180 expected_xyz = {'symbols': ('O', 'C', 'C', 'S', 'O', 'C', 'C', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H'), @@ -4278,7 +4278,7 @@ def test_modify_coords(self): new_xyz = converter.modify_coords(coords=xyz1, indices=indices, new_value=new_val, modification_type=modification_type, mol=mol1) self.assertTrue(almost_equal_coords_lists(new_xyz, expected_xyz)) - self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 4) + self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 3) self.assertAlmostEqual(converter.get_zmat_param_value(coords=xyz1, indices=[4, 1, 2, 3], mol=mol1), 176.7937925, 4) self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=[4, 1, 2, 3], mol=mol1),