Hello everyone,

I am calculating MSD to study the defect diffusion in the material, I feel some problems to discuss the physics, and I want to be sure about the exact formula LAMMPS is employing to calculate MSD, for example as discussed in the paper “Statistical variances of diffusional properties from ab initio molecular dynamics simulations”, it can be TMSD or MSD. Unfortunately I couldn’t find the refrence to calculate MSD from documentation.

please accept my best regards

What LAMMPS implements is based on the so-called Einstein relation and this is described in any MD text book worth its money (e.g. Allen & Tildesley or Frenkel & Smit). The original publication describing the method predates MD simulations by more than 60 years and was written by Albert Einstein (according to Diffusion page on SklogWiki - a wiki for statistical mechanics and thermodynamics).

1 Like

But also, the source code seems fairly clear to me. At the start of each evaluation `msd`

is set to all zeroes. Then each particle’s displacements are squared and accumulated in the relevant components:

```
dx = xtmp - xoriginal[i][0];
dy = ytmp - xoriginal[i][1];
dz = ztmp - xoriginal[i][2];
msd[0] += dx * dx;
msd[1] += dy * dy;
msd[2] += dz * dz;
msd[3] += dx * dx + dy * dy + dz * dz;
```

The rest is just there to adjust for the user’s requests of centre of mass usage, different normalisations, running averages and so on.

1 Like