msd#
- msd(univ, atom_type, dt=100.0, nblocks=None, corrlength=None, gaplength=None)[source]#
Calculate the diffusion coefficient in a bulk solution from the mean squared displacement (MSD).
Uses Einstein’s equation: .. math:: D = frac{1}{6} frac{langle [mathbf{r}(t_0 + tau) - mathbf{r}(t_0)]^2 rangle}{tau}
- Parameters:
- univMDAnalysis.Universe
The input MDAnalysis Universe to analyze.
- atom_typestr
The atom type to compute the diffusion coefficient.
- dtfloat
Time between two saved frames, in femtoseconds – the MD timestep multiplied by the dump interval, not the MD timestep itself.
Warning
Do not take this from
universe.trajectory.dt. A DCD written by LAMMPS stores a time field that MDAnalysis reinterprets, and the result need not be the real interval: on the reference trajectory it reads 4.888821 ps where the frames are 100 fs apart, a factor of 49. The mean-squared displacement stays perfectly linear either way, so the diffusion coefficient comes out wrong by that factor with nothing to suggest anything is amiss. Take the value from the input deck that produced the trajectory.- nblocksint, optional
Number of blocks.
- corrlengthint, optional
Number of frames in a block.
- gaplengthint, optional
Number of frames between blocks.
- Returns:
- pd.DataFrame
DataFrame containing MSD values over time.