Understanding the mean square displacement in molecular dynamics In a Molecular Dynamics (MD) simulation, the mean square displacement $\text{MSD}$ is given by
$$\text{MSD}(\delta t) = \left\langle\left|\vec{r}(\delta t)-\vec{r}(0)\right|^2\right\rangle,$$
where $\vec{r}$ is the position vector of an atom and $\delta t$ is some time step. Often the time step dependence of the $\text{MSD}$ is left out, which seems to relate to my question, but no problems so far.
However, the practical calculation of the ensemble average $\langle\ldots\rangle$ is usually somewhat vaguely explained and seems to depend on where you look. This source states that we must average over all atoms and many time steps (I would assume all time steps in a given simulation). This and this source on the other hand mention only the average over all atoms (though the latter does indicate a time (step) dependence). This last source seems to support the first one. Note that both the first and last source give the $\text{MSD}$ a dependence upon the time step.
My interpretation is as follows. I would expect the $\text{MSD}$ to have a time step dependence, so I'm inclined to follow the first and last source I've quoted. So in the case of an MD simulation of $N$ atoms spanning a total time $N_{k\tau}k\tau$ one would calculate the $k\tau$ mean square displacement as
$$\text{MSD}(k\tau) = \frac{1}{N}\frac{1}{N_{k\tau}}\sum_{n=1}^{N}{\sum_{i=1}^{N_{k\tau}}{\Big|\vec{r}_n\big(ik\tau\big)-\vec{r}_n\big((i-1)k\tau\big)\Big|^2}}.\qquad(*)$$
My question is really just: is this correct? And if so, what's the difference with the other two sources I've mentioned? Why do they not mention averaging over the time steps? Do they simply discuss the formula for a single time step? (i.e. $N_{k\tau} = 1$)
 A: Actually, all of your references are correct. In a MD simulation, for homogeneous systems, you can calculate the ensemble average of a thermodynamic property in several different ways.


*

*You can simply average over all the particles in your system during one time step.

*You can average over a single particle over many time steps.

*You can average over all particles and over all time steps.

*You can average over a random number of particles over randomly selected time steps.
There are many other options also. If your sample space (number of particles and time steps) is large enough the all methods should produce the same answer. This is called the Ergodic Principle. Many Statistical Mechanics references will not mention averaging over time because they are assuming the system is Ergodic. But in MD simulations, your system is in general not Ergodic due to the limited size of your system. That's why MD reference discuss time averages.
The trick in MD or MC simulations is knowing whether or not your sample space is large enough, but that is a different topic. You also have to be careful with non-homogeneous systems.
