from_structure#
- static ConfigurationWithProperties.from_structure(
- prim: Prim,
- structure: Structure,
- converter: str = 'isotropic_atomic',
- supercells: SupercellSet | None = None,
- magspin_tol: float = 1.0,
Construct a ConfigurationWithProperties from a Structure
This method is designed to be used with a mapped structure generated from
map_structures()
andmake_mapped_structure()
or the equivalent, meaning that atoms and atom properties are in the same order as the supercell sites they are mapped to and all properties (including the coordinates, displacements, and lattice vectors) are rotated so that they can be directly copied to configuration DoF or properties.If structure has a global strain property (i.e. “Ustrain”, “Hstrain”, “GLstrain”, etc.) it must be of a type recognized by CASM and it is interpreted as the strain applied to the ideal lattice vectors to result in the structure’s lattice vectors. The strain property is read and converted to \(U\), the right stretch tensor (see
StrainConverter
).Then, the ideal supercell lattice vectors, as column vector matrix \(S\), are solved for from the lattice vectors of structure, column vector matrix \(L^{mapped}\), using \(L^{mapped} = U S\). For this method, it is required that S = P T, where \(P\) is the prim lattice vectors as a column vector matrix and \(T\) is an integer transformation matrix. If \(T\) is not found to be integer, an exception will be thrown.
When interpreting strain and displacement properties of structure, the convention in CASM is that displacements are applied to ideal coordinates before strain deformation is applied to the displaced coordinates. See the CASM Degrees of Freedom (DoF) and Properties documentation for the full list of supported properties and their definitions.
If the input structure has “selectivedynamics” in its atom properties, then occupants must have an approximately matching “selectivedynamics” AtomComponent property. The default value for occupants without an explicitly specified “selectivedynamics” AtomComponent property is [0.0, 0.0, 0.0].
- Parameters:
prim (
Prim
) – Thelibcasm.configuration.Prim
.structure (
Structure
) – AStructure
which has been mapped to a supercell of prim.converter (str = "isotropic_atomic") –
The converter to use for generating the configuration. Options are currently limited to one of:
”isotropic_atomic”: Conversion is performed using a method which is limited to prim with isotropic atomic occupants
”discrete_magnetic_atomic”: Conversion is performed using a method which is limited to prim with atomic occupants, allowing discrete magnetic states.
Requires the following, else raises:
Prim is atomic, with discrete occupants with magspin properties
The structure has magspin atom properties, with the same key as in the prim
Occupants in the resulting configuration are determined by:
First, the structure atom_type must match the AtomComponent name of one or more occupant on the corresponding site, otherwise raises
Second, the magspin value must be within magspin_tol of one of the occupants with matching name, otherwise raises
Third, the occupant with the closest discrete magspin value is chosen, according to norm(calculated_magspin - ideal_magspin).
The calculated magspin values are passed through and included as local properties.
supercells (Optional[
SupercellSet
] = None) – An optionalSupercellSet
, in which to hold the shared supercell of the generated configuration in order to avoid duplicates.magspin_tol (float = 1.0) – When determining site occupants, magspin_tol is the maximum allowed norm of the difference between the calculated and ideal magspin values, calculated equivalently to
np.linalg.norm(calculated_magspin - ideal_magspin)
. Used withconverter=="discrete_magnetic_atomic"
.
- Returns:
configuration_with_properties – The
ConfigurationWithProperties
constructed from the structure.- Return type: