Пример #1
0
    def save_to(self, filename, mode="w"):
        """Save current coordinates of molecule into a .xzy file.

        Parameters
        ----------
        filename : str
            File name of the saved file
        mode : str, optional
            I/O mode of file
        """
        Utils.save_file(filename, self, mode=mode)
Пример #2
0
    def ts_to_file(self, filename=""):
        """Save the ts structure to xyz file.

        Parameters
        ----------
        filename : str, optional
            filename of stored file

        Raises
        ------
        InvalidArgumentError
            the input filename is not valid.
        """
        if filename:
            Utils.save_file(filename, self.ts)
        else:
            raise InvalidArgumentError("Invalid empty filename")
Пример #3
0
 def test_save_xyz(self):
     with path("saddle.test.data", "water.xyz") as file_path:
         water_mol = Utils.load_file(file_path)
     with path("saddle.test.data", "") as file_path:
         new_file_name = file_path / "test_base_mole_test_file"
     Utils.save_file(new_file_name, water_mol)
     new_add_file = new_file_name.parent / (new_file_name.name + ".xyz")
     TestUtils.file_list.append(new_add_file)
     with path("saddle.test.data",
               "test_base_mole_test_file.xyz") as file_path:
         mol = Utils.load_file(file_path)
     ref_coor = np.array([
         [1.481237149, -0.93019116, 0.0],
         [0.0, 0.11720080, 0],
         [-1.481237149, -0.93019116, 0.0],
     ])
     assert np.allclose(mol.coordinates, ref_coor)
     assert np.allclose(mol.numbers, [1, 8, 1])