I/O Write: XYZ

I/O Write: XYZ#

Writer for standard XYZ files. See https://en.wikipedia.org/wiki/XYZ_file_format.

tad_mctc.io.write.xyz.write_xyz(fileobj, numbers, positions, **kwargs)#

Write atomic coordinates in XYZ format to a file object. The input positions are expected to be in atomic units (bohrs).

Parameters:
  • fileobj (IO[Any]) – The file-like object to which the XYZ data will be written.

  • numbers (Tensor) – A 1D tensor containing atomic numbers or symbols.

  • positions (Tensor) – A 2D tensor of shape (nat, 3) containing atomic positions in atomic units (bohrs).

  • fmt (str, optional) – Format string for the position coordinates.

  • comment (str, optional) – A comment string for the XYZ file header.

Raises:

ValueError – If the comment contains line breaks.