dynsight.lens.compute_lens

dynsight.lens.compute_lens(universe, r_cut, delay=1, centers='all', selection='all', trajslice=None, respect_pbc=True, n_jobs=1)[source]

Compute the LENS descriptor for all frames along a trajectory.

LENS was developed by Martina Crippa, see https://doi.org/10.1073/pnas.2300565120. The current implementation is mainly due to @SimoneMartino98.

Warning

The LENS functions only work with orthogonal simulation boxes. We are working to make them compatible with non-orthogonal ones.

The LENS value of a particle between two frames is deined as:

\[LENS(t, t + \delta t) = \frac{|C(t)\cup C(t+\delta t)| - |C(t)\cap C(t+\delta t)|} {|C(t)| + |C(t+\delta t)|}\]

where \(C(t)\) and \(C(t+\delta t)\) are the neighbors’ list of the particle at frames \(t\) and \(t+\delta t\) respectively.

Parameters:
  • universe (Universe) – MDAnalysis Universe containing the trajectory.

  • r_cut (float) – r_cut distance (Å) for defining neighbors.

  • delay (int) – Number of frames separating the pairs for comparison.

  • centers (str) – Atom selection string for the centers where LENS is computed.

  • selection (str) – Atom selection string defining the environment.

  • trajslice (slice | None) – Frame slicing parameters for trajectory iteration.

  • respect_pbc (bool) – Whether to apply periodic boundary conditions.

  • n_jobs (int) – The number of jobs for parallelization with numba.

Returns:

LENS values for each center and each pair of frames. Has shape

(n_centers, n_pairs)

Return type:

NDArray[np.float64]