structuretoolkit.analyse.strain.Strain#
- class structuretoolkit.analyse.strain.Strain(structure: Atoms, ref_structure: Atoms, num_neighbors: int | None = None, only_bulk_type: bool = False)[source]#
Bases:
objectCalculate local strain of each atom following the Lagrangian strain tensor:
>>> strain = (F.T*F - 1)/2
where F is the atomic deformation gradient.
Example:
>>> from ase.build import bulk >>> import structuretoolkit as st >>> bulk = bulk('Fe', cubic=True) >>> structure = st.get_strain(bulk, np.random.random((3,3))*0.1, return_box=True) >>> Strain(structure, bulk).strain
- __init__(structure: Atoms, ref_structure: Atoms, num_neighbors: int | None = None, only_bulk_type: bool = False)[source]#
- Parameters:
structure (ase.atoms.Atoms) – Structure to calculate the strain values.
ref_structure (ase.atoms.Atoms) – Reference bulk structure (against which the strain is calculated)
num_neighbors (int) – Number of neighbors to take into account to calculate the local frame. If not specified, it is estimated based on cna analysis (only available if the bulk structure is bcc, fcc or hcp).
only_bulk_type (bool) – Whether to calculate the strain of all atoms or only for those which cna considers has the same crystal structure as the bulk. Those which have a different crystal structure will get 0 strain.
Methods
__init__(structure, ref_structure[, ...])- param structure:
Structure to calculate the
Attributes
Local coordinates of each atom.
Majority crystal phase calculated via common neighbor analysis.
Number of neighbors to consider the local frame.
Reference local coordinates.
Rotation for each atom to find the correct pairs of coordinates.
Calculate the strain value of each atom.
- property coords: ndarray#
Local coordinates of each atom.
- Returns:
The local coordinates of each atom.
- Return type:
np.ndarray
- property crystal_phase: str#
Majority crystal phase calculated via common neighbor analysis.
- property num_neighbors: int#
Number of neighbors to consider the local frame. Should be the coordination number.
- property ref_coord: ndarray#
Reference local coordinates.
- Returns:
The reference local coordinates.
- Return type:
np.ndarray
- property rotations: ndarray#
Rotation for each atom to find the correct pairs of coordinates.
- Returns:
The rotation matrix for each atom.
- Return type:
np.ndarray
- property strain: ndarray#
Calculate the strain value of each atom.
- Returns:
The strain value of each atom.
- Return type:
np.ndarray