msd

mdtools.dynamics.msd(t, D, d=3)[source]

Mean square displacement (MSD) as fuction of time according to the Einstein relation:

\[\langle \Delta\mathbf{r}^2(\tau) \rangle = 2d \cdot D \cdot \tau\]

with \(\Delta\mathbf{r}(\tau) = |\mathbf{r}(t_0+\tau) - \mathbf{r}(t_0)|\) being the displacement vector after a diffusion time \(\tau\), \(D\) being the diffusion coefficient and \(d\) being the number of spatial dimensions of the diffusion process. The brackets \(\langle ... \rangle\) denote averaging over all particles of the same species and over all possible starting times \(t_0\).

Parameters:
  • t (scalar or numpy.ndarray) – Array of diffusion times \(\tau\) for which to calculate the MSD.

  • D (scalar or numpy.ndarray) – Diffustion coefficient.

  • d (scalar or numpy.ndarray, optional) – Number of spatial dimensions of the diffusion process.

Returns:

msd (scalar or numpy.ndarray) – Mean square displacement MSD(t) = 2d*D*t.

See also

mdtools.dynamics.msd_non_diffusive()

Calculate a non-diffusive MSD as function of time.

Notes

If more than one input argument is a numpy.ndarray, the arrays must be broadcastable to a common shape.

Examples

>>> mdt.dyn.msd(t=np.arange(4), D=2, d=3)
array([ 0, 12, 24, 36])