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') 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) 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),