def atomic_strain(atoms_now, atoms_old, cutoff=None, i_now=None, j_now=None):
if i_now is None or j_now is None:<EOL><INDENT>if cutoff is None:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>p = native.from_atoms(a_now)<EOL>nl = native.Neighbors(avgn)<EOL>nl.request_interaction_range(cutoff)<EOL>i_now, j_now, abs_dr_now = nl.get_neighbors(p)<EOL><DEDENT>elif cutoff is not None:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>delta_plus_epsilon, d_sq = get_D_square_min(atoms_now, atoms_old, i_now,<EOL>j_now)<EOL>return delta_plus_epsilon, d_sq<EOL>
Calculate deformation gradient tensor and D^2_min measure for non-affine
displacements.
See: Falk, Langer, Phys. Rev. B 57, 7192 (1998)

Parameters:
-----------
atoms_now      Current atomic configuration
atoms_old      Reference atomic configuration
cutoff         Neighbor list cutoff.
i_now, j_now   Neighbor list. Automatically computed if not provided.

Returns:
--------
delta_plus_epsilon  Strain gradient tensor
d_sq                D^2_min norm