strain
Cell deformation, and which deformations a structure's symmetry allows.
A cell degree of freedom is an amplitude along a symmetry-adapted strain direction, not a lattice parameter and not a raw Voigt component. That choice is what keeps a cell optimisation inside the structure's space group.
The strains a crystal may undergo without losing its space group are those
invariant under every rotation R in its point group, eps = R eps R^T. Those
form a linear subspace of the symmetric 3x3 tensors, and this module builds an
orthonormal basis for it by projection:
P = (1 / |G|) sum_R T(R), T(R): eps -> R eps R^T
P is the projector onto the invariant subspace, and its eigenvectors of
eigenvalue 1 are the basis. Nothing here consults a lattice type or assumes the
cell is in a standard setting: a rhombohedral cell with its three-fold along
a + b + c and one in the hexagonal setting both come out right, because both
are described by their own rotation matrices.
Mapping one degree of freedom to one Voigt component -- the obvious scheme --
cannot express these subspaces at all. Tetragonal requires eps_xx = eps_yy,
cubic requires all three equal, and rhombohedral requires an isotropic part
plus a uniaxial one along an axis that need not be a Cartesian direction. Left
uncoupled, a cell optimisation walks the metric out of its lattice type within
a few steps.
Strain is the symmetric tensor eps in r -> (I + eps) r, and because every
inner product here is the Frobenius one, no engineering factor of two on the
shear components ever appears.
cartesian_rotations(crystal)
The Cartesian point operations of a crystal's space group.
A symmetry operation acts on fractional column coordinates as R x + t.
With the lattice vectors stored as the rows of A, a Cartesian column
vector is r = A^T x, so the same operation in Cartesian space is
A^T R A^-T.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
crystal
|
a |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
(M, 3, 3) Cartesian rotation matrices, duplicates removed |
Source code in chmpy/opt/strain.py
deformation(amplitudes, basis)
The deformation matrix I + eps for amplitudes along a strain basis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
amplitudes
|
(k,) amplitudes |
required | |
basis
|
(k, 3, 3) strain basis |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
(3, 3) deformation to apply as |
Source code in chmpy/opt/strain.py
elastic_from_voigt(voigt)
elastic_to_voigt(tensor)
An orthonormal-basis elastic matrix as an engineering Voigt 6x6.
from_vector(vector)
The symmetric (3, 3) tensor with these coordinates in SYMMETRIC_BASIS.
invariant_elastic_basis(rotations, tolerance=1e-08)
An orthonormal basis for the elastic tensors a point group allows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rotations
|
(M, 3, 3) Cartesian point operations. An empty list gives the full 21-dimensional triclinic space. |
required | |
tolerance
|
float
|
how far an eigenvalue of the projector may sit from 1 |
1e-08
|
Returns:
| Type | Description |
|---|---|
ndarray
|
(k, 6, 6) orthonormal symmetric matrices, in this module's basis, where |
ndarray
|
|
Source code in chmpy/opt/strain.py
invariant_strain_basis(rotations, tolerance=1e-08)
An orthonormal basis for the strains a set of rotations leaves invariant.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rotations
|
(M, 3, 3) Cartesian point operations of the structure. Pass an empty list for no symmetry, which gives all six directions. |
required | |
tolerance
|
float
|
how far an eigenvalue of the projector may sit from 1 |
1e-08
|
Returns:
| Type | Description |
|---|---|
ndarray
|
(k, 3, 3) orthonormal symmetric tensors spanning the allowed strains, |
ndarray
|
with |
Source code in chmpy/opt/strain.py
project_elastic(tensor, basis)
The part of an elastic tensor its symmetry allows.
Finite differences and a finite atomic relaxation leave a little of the tensor outside the invariant subspace. Projecting it back is not cosmetic: the components that symmetry forbids are pure noise, and leaving them in puts a spurious anisotropy into every modulus derived from the tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tensor
|
(6, 6) in this module's orthonormal basis |
required | |
basis
|
(k, 6, 6) from |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
(6, 6) projected tensor |
Source code in chmpy/opt/strain.py
rotation_action(rotation)
The (6, 6) matrix of eps -> R eps R^T in SYMMETRIC_BASIS.
Source code in chmpy/opt/strain.py
step_fraction(amplitudes, step, basis)
The largest t in [0, 1] keeping eps(q + t * dq) inside the bounds.
The whole step is scaled by one factor rather than each component being clamped separately. Clamping per component breaks a trust region twice over: the geometry evaluated is not the step the predicted reduction was computed for, and the unclamped step is still handed to the curvature update as the secant. It would also push the strain straight out of the symmetry subspace the basis exists to define.
Source code in chmpy/opt/strain.py
strain_of(amplitudes, basis)
symmetric_basis()
An orthonormal basis of the symmetric 3x3 tensors, under Frobenius.
Returns:
| Type | Description |
|---|---|
ndarray
|
(6, 3, 3) with the three normal directions first, then the shears |
Source code in chmpy/opt/strain.py
to_vector(tensor)
A symmetric (3, 3) tensor as its (6,) coordinates in SYMMETRIC_BASIS.
Unlike engineering Voigt notation this is an isometry: lengths and inner products are the same in both representations.