Structure#

class libcasm.xtal.Structure(
self: Structure,
lattice: Lattice,
atom_coordinate_frac: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, n]'] = array([], shape=(0, 0), dtype=float64),
atom_type: collections.abc.Sequence[str] = [],
atom_properties: collections.abc.Mapping[str, Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, n]']] = {},
mol_coordinate_frac: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, n]'] = array([], shape=(0, 0), dtype=float64),
mol_type: collections.abc.Sequence[str] = [],
mol_properties: collections.abc.Mapping[str, Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, n]']] = {},
global_properties: collections.abc.Mapping[str, Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, n]']] = {},
)#

Bases: pybind11_object

A crystal structure

Structure may specify atom and / or molecule coordinates and properties:

  • lattice vectors

  • atom coordinates

  • atom type names

  • continuous atom properties

  • molecule coordinates

  • molecule type names

  • continuous molecule properties

  • continuous global properties

Atom representation is most widely supported in CASM methods. In some limited cases the molecule representation is used.

Notes

The positions of atoms or molecules in the crystal structure is defined by the lattice and atom coordinates or molecule coordinates. If included, strain and displacement properties, which are defined in reference to an ideal state, should be interpreted as the strain and displacement that takes the crystal from the ideal state to the state specified by the structure lattice and atom or molecule coordinates. The convention used by CASM is that displacements are applied first, and then the displaced coordinates and lattice vectors are strained.

See the CASM Degrees of Freedom (DoF) and Properties documentation for the full list of supported properties and their definitions.

Special Methods

  • Structure may be copied with Structure.copy, copy.copy, or copy.deepcopy.

Constructor

Parameters:
  • lattice (Lattice) – The Lattice. Note: The lattice tolerance is not saved in Structure.

  • atom_coordinate_frac (array_like, shape (3, n)) – Atom positions, as columns of a matrix, in fractional coordinates with respect to the lattice vectors.

  • atom_type (list[str], size=n) – Atom type names.

  • atom_properties (dict[str, numpy.ndarray[numpy.float64[m, n]]], default={}) – Continuous properties associated with individual atoms, if present. Keys must be the name of a CASM-supported property type. Values are arrays with dimensions matching the standard dimension of the property type.

  • mol_coordinate_frac (array_like, shape (3, n)) – Molecule positions, as columns of a matrix, in fractional coordinates with respect to the lattice vectors.

  • mol_type (list[str], size=n) – Molecule type names.

  • mol_properties (dict[str, numpy.ndarray[numpy.float64[m, n]]], default={}) – Continuous properties associated with individual molecules, if present. Keys must be the name of a CASM-supported property type. Values are arrays with dimensions matching the standard dimension of the property type.

  • global_properties (dict[str, numpy.ndarray[numpy.float64[m, n]]], default={}) – Continuous properties associated with entire crystal, if present. Keys must be the name of a CASM-supported property type. Values are (m, 1) arrays with dimensions matching the standard dimension of the property type.

Methods

atom_coordinate_cart(…)

Returns the atom positions, as columns of a 2d array, in Cartesian coordinates.

atom_coordinate_frac(…)

Returns the atom positions, as columns of a 2d array, in fractional coordinates with respect to the lattice vectors.

atom_properties(…)

Returns continuous properties associated with individual atoms, if present.

atom_type(…)

Returns a list with atom type names.

copy(…)

Returns a copy of the Structure.

from_dict(…)

Construct a Structure from a Python dict.

from_json(…)

Construct a Structure from a JSON-formatted string.

from_poscar(…)

Construct a Structure from a VASP POSCAR file

from_poscar_str(…)

Construct a Structure from a VASP POSCAR string

global_properties(…)

Returns continuous properties associated with the entire crystal, if present.

is_equivalent_to(…)

Check if self is equivalent to structure2

lattice(…)

Returns the lattice, as a copy

mol_coordinate_cart(…)

Returns the molecule positions, as columns of a 2d array, in Cartesian coordinates.

mol_coordinate_frac(…)

Returns the molecule positions, as columns of a 2d array, in fractional coordinates with respect to the lattice vectors.

mol_properties(…)

Returns continuous properties associated with individual molecules, if present.

mol_type(…)

Returns a list with molecule type names.

to_dict(…)

Represent the Structure as a Python dict.

to_json(…)

Represent the Structure as a JSON-formatted string.

to_poscar_str(…)

Convert a Structure to a VASP POSCAR string