XYZ Writer

class XyzWriter[source]

Bases: object

A writer class for .xyz files.

Examples

Writing to a File

import stk

bb1 = stk.BuildingBlock('BrCCBr', [stk.BromoFactory()])

writer = stk.XyzWriter()
writer.write(molecule=bb1, path='bb1.xyz')

Methods

to_string(molecule[, atom_ids])

Get the .xyz string of molecule.

write(molecule, path[, atom_ids])

Write molecule to .xyz file format.

to_string(molecule, atom_ids=None)[source]

Get the .xyz string of molecule.

Parameters
  • molecule (Molecule) – Molecule to write to .xyz format.

  • atom_ids (iterable of int) – The atom ids of atoms to write. Can be a single int, if a single atom is to be used, or None, if all atoms are to be used.

Returns

String in .xyz file format.

Return type

str

write(molecule, path, atom_ids=None)[source]

Write molecule to .xyz file format.

Parameters
  • molecule (Molecule) – Molecule to write to .xyz format.

  • path (str) – The full path to the file being written.

  • atom_ids (iterable of int) – The atom ids of atoms to write. Can be a single int, if a single atom is to be used, or None, if all atoms are to be used.

Returns

None – A file is written.

Return type

NoneType