msd_layer
- msd_layer_serial.msd_layer(pos, boxes, bins, direction='z', restart=1, verbose=True)[source]
Calculate the mean displacement (MD) and the mean squared displacement (MSD) as function of the particle’s initial position.
Calculate the mean displacement (MD)
\[\langle \Delta r_i(\Delta t, z) \rangle = \langle [r_i(t_0 + \Delta t) - r_i(t_0)] \cdot \delta[z0 - z_i(t_0)] \rangle\]and the mean squared displacement (MSD)
\[\langle \Delta r_i^2(\Delta t, z) \rangle = \langle |r_i(t_0 + \Delta t) - r_i(t_0)|^2 \cdot \delta[z0 - z_i(t_0)] \rangle\]as function of the initial particle position \(z_0\).
The brackets \(\langle ... \rangle\) denote averaging over all particles \(i\) and over all given restarting times \(t_0\).
- Parameters:
pos (
array_like
) – Array of unwrapped(!) particle positions of shape(m, n, 3)
, wherem
is the number of frames andn
is the number of particles.boxes (
array_like
) – Array of simulation boxes of shape(m, 6)
, one for each frame. The simulation boxes can be orthogonal or triclinic and must be provided in the same format as returned byMDAnalysis.coordinates.base.Timestep.dimensions
:[lx, ly, lz, alpha, beta, gamma]
.bins (
array_like
) – 1-dimensional array containing the bin edges to use for binning the initial particle position. For binning the particle positions, the positions are wrapped back into the primary unit cell.direction (
{'x', 'y', 'z'}
) – The spatial direction in which to bin the initial particle position.restart (
int
, optional) – Number of frames between restarting points \(t_0\).verbose (
bool
, optional) – IfTrue
, print progress information to standard output.
- Returns:
md (
numpy.ndarray
) – Array of shape(m, len(bins)-1, 3)
containing the three spatial components of the mean displacement \(\langle \Delta r_i(\Delta t, z_0) \rangle\) for each bin for all possible lag times \(\Delta t\).msd (
numpy.ndarray
) – Array of shape(m, len(bins)-1, 3)
containing the three spatial components of the mean squared displacement \(\langle \Delta r_i^2(\Delta t, z_0) \rangle\) for each bin for all possible lag times \(\Delta t\).