This modifier calculates the atomic-level deformation gradient and the strain tensor at each particle from the relative motion of its neighbors. The two per-particle tensors represent versions of the corresponding continuum kinematic quantities obtained from averaging the discrete particle displacements over finite volumes around each particle.

The deformation calculation is based on two input particle configurations: a *reference* (or initial) configuration
and a *current* (or deformed) configuration. In other words, the local deformation is calculated with
respect to some explicitly specified initial arrangement of the input particles.
The modifier always considers the currently loaded particle positions as the current configuration.
The reference particle positions are by default taken from frame 0 of the same animation sequence.
Alternatively, the modifier supports loading the reference particle positions from a separate data file.

Conceptually, the calculation of various micromechanical quantities happens in several steps:

- First, the particle displacement vectors {u
_{i}} are calculated from the particle positions in the initial and the final configuration. - Based on this information, the atomic deformation gradient tensor F is calculated for each particle.
- Based on F, the atomic Green-Lagrangian strain tensor E is derived for each particle (E=1/2(F
^{T}F-I)). - Based on E, the
*von Mises*local shear invariant and the hydrostatic strain measure are calculated. - Additionally, a polar decomposition of the atomic deformation gradient F yields a local rotation tensor R and a stretch tensor U.
- Furthermore, a quantity knows as D
^{2}_{min}may be calculated from the particle displacements and the deformation gradient F, which is a measure for the non-affine part of the local deformation.

The modifier outputs these micromechanical quantities as new particle properties. You can use the Color coding modifier, for example, to visualize the values of these properties in OVITO or look at specific particles using the Data Inspector. Note that the displacements are only intermediate calculation results which are not output by the modifier. If you need them, please use the Displacement vectors modifier.

The *cutoff radius* is a parameter controlling the range of neighbors taken
into account when computing the atomic deformation gradient tensor of one particle. In other words in determines
the size of the spherical volume around the particle over which the relative motion of neighboring particles is averaged to obtain
the continuum deformation measure. As a rule of thumb: Use a small cutoff radius parameter to resolve all local details of the deformation field.
On the other hand, a large cutoff radius will yield slowly varying (smooth) deformation values at the atomic sites.

Since the deformation gradient at each site is calculated from the relative motion of neighboring particles, it is important to ensure that sufficient neighbors are within the given cutoff range (in the undeformed configuration). This puts a lower limit on the cutoff radius that you can safely use. For three-dimensional systems, OVITO requires at a minimum three neighbor particles within the cutoff range of the central particle in order to calculate a deformation gradient tensor. Furthermore, these three neighbors must not be co-planar. If the cutoff radius has been chosen too small and there are only less than three neighbors within range of the central particle, the deformation gradient calculation and all subsequent calculations will fail for this particle. The modifier will notify you about this situation in the status field and will, for diagnostic purposes, select all "undercoordinated" particles for which the calculation failed. Depending on the situation, you may react to this kind of condition by bumping up the cutoff radius parameter such that more neighbors become within range and the calculation succeeds.

The atomic strain calculation uses finite-strain theory. Accordingly, strain is measured using the
Green-Lagrangian strain tensor
E=1/2(F^{T}F-I).
On the basis of this symmetric strain tensor, the modifier also calculates the *von Mises* local shear invariant and the
volumetric (hydrostatic) part of the strain tensor and outputs these scalar quantities as particle properties named
`Shear Strain`

and `Volumetric Strain`

, respectively. The former is a good measure for shear deformations
in arbitrary directions.

The deformation gradient and the strain tensor both can only describe material deformations that are locally affine.
In fact, the atomic deformation gradient tensor is computed such that it best describes only the affine component of the
true deformation, which may actually be non-affine within the spherical sampling volumes. Falk & Langer (see reference below) have proposed a measure to
quantify the deviation of the true deformation of the particle system from the affine approximation that the local deformation
gradient represents. This measure, the *non-affine squared displacement* (D^{2}_{min}),
is basically the residual of the least-squares fit through which the deformation gradient is calculated.
It may be used as a diagnostic for identifying local irreversible shear transformations in amorphous solids, for example.

The atomic deformation gradient F can be decomposed into the product
F=RU
with R being the rigid-body rotation tensor and U the right stretch tensor.
U is symmetric positive definite. The local rotation R is encoded
as a quaternion R=(X, Y, Z, W) and is output by the modifier
as a particle property named `Rotation`

. From this, the angle of rotation (in radians) for each particle can subsequently be
obtained as theta=2*acos(Rotation.W),
e.g., using the Compute Property modifier.

By default, the modifier obtains the reference particle positions from the currently loaded
simulation sequence by evaluating the data pipeline at animation time 0. This default mode
is denoted as *"Constant reference configuration"* in the user interface.
If desired, OVITO allows you to pick an animation frame other than 0 as reference.

Alternatively, you can let OVITO calculate incremental deformation quantities using
the *"Relative to current frame"* option. In this mode, a sliding reference
configuration is used, based on a relative time offset with respect to the current configuration.
Negative offsets correspond to a reference configuration preceding the current configuration
in time. An offset of -1, for example, lets OVITO use the animation frame immediately preceding
the current frame as reference. Note that, in this case, deformation quantities cannot be calculated at
frame 0, because there is no preceding frame.

If you want to load the reference particle positions from a separate file instead of taking them from the currently loaded dataset, you can select the "External file" data source option. Activating this option will show an additional panel "Reference: External file" allowing you to pick the file containing the undeformed particle positions.

In order to calculate the displacement vectors that enter in the deformation gradient calculation, OVITO needs to build a one-to-one mapping between the particles in the undeformed
and the deformed configuration. If the particles possess a property named `Particle Identifier`

,
then OVITO will use this identity information to generate the mapping. In such a case, it is okay if the storage order of particles
in the input file(s) changes with time. However, if particles do not possess unique identifiers, then the modifier requires that
the reference configuration contains exactly the same number of particles as the current configuration
and it assumes that they are stored in the same order. This assumption is not always true as some simulation
codes reorder particles during a simulation run for performance reasons. If you forget to dump the particle IDs or atom IDs
in addition to the positions during a simulation, you should be aware that OVITO may compute wrong displacement vectors because of
an invalid default particle mapping. You can use the Data Inspector
to check for the presence of the `Particle Identifier`

property after file import.

Note: This option applies to systems with periodic boundary conditions. For non-periodic systems (and typically also for systems with mixed boundary conditions) it should remain turned off.

The *affine mapping* setting controls how OVITO treats situations in which the shape or volume of the periodic simulation cell
changes from the initial to the deformed configuration. Such a cell change typically occurs in simulations due to straining or
pressure/stress relaxation. Because the calculation of displacement vectors is ambiguous in such situations,
the *affine mapping* option lets you control the precise calculation method.

If affine mapping is turned off (the default), atomic displacements are calculated simply by subtracting the initial particle position from the current position. Any change of the simulation cell geometry is ignored.

The *"To reference"* setting performs a remapping of the current particle positions into the reference simulation cell
before calculating the displacement vectors. For that, OVITO first computes an affine transformation from the current and the reference
simulation cell geometry and applies it to the particle coordinates. This mode may be used to effectively filter out contributions
to the atomic strain that stem from the uniform deformation of the simulation cell, retaining only the internal, non-uniform
deformation of the particles.

The *"To current"* setting performs the opposite type of preprocessing: It transforms the particles of the undeformed configuration to the deformed
cell before calculating the displacements. It does that by applying the same affine transformation that the
simulation cell undergoes.

This option tells OVITO whether or not to use the minimum image convention
when calculating the displacement vectors for systems with periodic boundary conditions.
You should deactivate this option if you work with *unwrapped* particle coordinates. In this case
OVITO assumes that particle trajectories are all continuous. On the other hand, if you work with
*wrapped* particle coordinates, this option should be turned on. The minimum image convention
ensures that displacements are calculated correctly even when particles cross a periodic boundary of the cell
and were mapped back into the cell by the simulation code. On the other hand, if you intend to analyze system where particles have moved by
more than half of the simulation box size, then the minimum imagine convention cannot be used. You *must*
use unwrapped coordinates in this case, because large displacements would otherwise be folded back into the periodic cell thanks to
the minimum image convention.

The following figure shows the effect of the option on the calculated displacement vectors (which in turn affect the other kinematic deformation measures):

More detailed information on the strain calculation method can be found in the following sources:

Note that OVITO uses a convention where particle positions are column vectors.
Some other programs such as *AtomEye* use a row-vector convention instead.
As a result, the computed deformation gradient tensors are transposed.