Conversion

Conversion to the Atomic Simulation Environment

crystals.ase_atoms(crystal: Crystal, **kwargs)

Convert a crystals.Crystal object into an ase.Atoms object. Keyword arguments are passed to ase.Atoms constructor.

Parameters

crystal (Crystal) – Crystal to be converted.

Returns

atoms (ase.Atoms) – Group of atoms ready for ASE’s routines.

:raises ImportError : If ASE is not installed:

Writing to disk

crystals.writers.write_xyz(crystal: Iterable[Atom], fname: PathLike, comment: Optional[str] = None)

Generate an atomic coordinates .xyz file from a crystal structure.

Parameters
  • crystal (crystals.Crystal) – Crystal to be converted.

  • fname (path-like) – The XYZ file will be written to this file. If the file already exists, it will be overwritten.

  • comment (str or None, optional) – Comment to include at the second line of fname.

crystals.writers.write_cif(crystal: Crystal, fname: PathLike)

Generate an atomic coordinates .cif file from a crystal structure.

New in version 1.2.0.

Parameters
  • crystal (crystals.Crystal) – Crystal to be converted.

  • fname (path-like) – The CIF file will be written to this file. If the file already exists, it will be overwritten.

  • comment (str or None, optional) – Comment to include at the second line of fname.