atomistics.workflows.evcurve.helper.apply_strain#
- atomistics.workflows.evcurve.helper.apply_strain(structure: Atoms, epsilon: float | list[float] | ndarray, return_box: bool = False, mode: str = 'linear') Atoms[source]#
Apply a given strain on the structure. It applies the matrix F in the manner:
- Parameters:
structure (Atoms) – The input structure.
epsilon (float/list/ndarray) – The epsilon matrix. If a single number is set, the same strain is applied in each direction. If a 3-dim vector is set, it will be multiplied by a unit matrix.
return_box (bool, optional) – Whether to return a box. If set to True, only the returned box will have the desired strain and the original box will stay unchanged. Defaults to False.
mode (str, optional) – The mode of strain application. Can be ‘linear’ or ‘lagrangian’. If ‘linear’, F is equal to the epsilon - 1. If ‘lagrangian’, epsilon is given by (F^T * F - 1) / 2. It raises an error if the strain is not symmetric (if the shear components are given). Defaults to ‘linear’.
- Returns:
The structure with the applied strain.
- Return type:
Atoms
- Raises:
ValueError – If the strain value is too negative or if the strain is not symmetric in ‘lagrangian’ mode.