cctk.XYZFile

class cctk.XYZFile(molecule, title=None)[source]

Bases: cctk.file.File

Class representing plain .xyz files.

title

the title from the file

Type

str

molecule

Molecule instance

Type

Molecule

__init__(molecule, title=None)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(molecule[, title])

Initialize self.

append_to_file(filename, text)

Appends output text to a file.

file_from_lines(lines)

read_ensemble(filename[, conformational])

Alias for read_trajectory.

read_file(filename[, charge, multiplicity])

Factory method to create new XYZFile instances.

read_trajectory(filename)

Read an .xyz trajectory file, which is just a bunch of concatenated .xyz files.

write_ensemble_to_file(filename, ensemble[, …])

Write a cctk.Ensemble to a single .xyz file.

write_file(filename)

Write an .xyz file, using object attributes.

write_molecule_to_file(filename, molecule[, …])

Write an .xyz file, using object attributes.

static append_to_file(filename, text)

Appends output text to a file.

Parameters
  • filename (str) – path to file, including name (e.g. path/to/input.gjf)

  • text (str) – desired contents of file

Returns

True if write succeeded, False otherwise

classmethod file_from_lines(lines)[source]
classmethod read_ensemble(filename, conformational=False)[source]

Alias for read_trajectory.

classmethod read_file(filename, charge=0, multiplicity=1)[source]

Factory method to create new XYZFile instances.

Parameters
  • filename (str) – path to .xyz file

  • charge (int) – charge of resultant molecule

  • multiplicity (int) – multiplicity of resultant molecule

classmethod read_trajectory(filename)[source]

Read an .xyz trajectory file, which is just a bunch of concatenated .xyz files. Currently the files must be separated by nothing (no blank line, just one after the other) although this may be changed in future.

Parameters

filename (str) – path to file

Returns

list of cctk.XYZFile objects in the order they appear in the file

classmethod write_ensemble_to_file(filename, ensemble, title=None)[source]

Write a cctk.Ensemble to a single .xyz file. Can be viewed in MOLDEN.

write_file(filename)[source]

Write an .xyz file, using object attributes.

classmethod write_molecule_to_file(filename, molecule, title='title', append=False)[source]

Write an .xyz file, using object attributes.

Parameters
  • filename (str) – path to the new file

  • molecule (Molecule) – molecule to write

  • title (str) – title of file

  • append (Bool) – whether or not to append to file