Calculating diffusion coefficient from Mean Squared Displacement

I am performing a molecular dynamics simulation and I have calculated the velocity autocorrelation function (VACF), $$\psi (t)$$ and mean square displacement, $$\langle (\Delta r)^2 \rangle$$. In my simulation, I have $$N$$ particles interacting with the Lennard-Jones potential function, and I am stepping forward in time from $$0$$ to $$T$$, in steps of $$\Delta t$$.

From here, I see that $$D = v_0^2 \int_0^{\infty} \psi(t) \mathrm{d}t$$

where $$v_0$$ is the thermal velocity.

My question is, how do I calculate $$D$$ if I only know values of $$v_0$$ and $$\psi(t)$$ for $$t$$ in $$[0,T]$$ (rather than up to $$t=\infty$$)? Is there a better way to do this?

• +1. Thanks for asking your question here, and welcome to the site !!! We hope to see much more of you !!! So the problem is that you don't know the thermal velocity $v_0$, so you don't know how to calculate $D$ using only $\psi$? As for only knowing $\psi(t)$ from $t\in[0,T]$ and needing to integrate up to $t=\infty$, what does $\psi(t)$ look like? Is there a point where it's decayed enough that $\int_0^\infty \approx \int_0^T$ ? – Nike Dattani Jul 18 '20 at 19:44
• @NikeDattani, I know thermal velocity, I am wondering if I can do that approximation you mentioned by the end of your statement – user207526 Jul 18 '20 at 19:46
• Can you plot $\psi(t)$ and show it to us? Is it oscillating or decaying after some time $t_0$ ? – Nike Dattani Jul 18 '20 at 19:48
• Nice. So it's a straight line that reaches 0. What happens after it reaches 0? Does it go back up or does it stay at 0? If it stays at 0, then just integrate up to t=0.05 and it will be the same as integrating up to t=$\infty$. – Nike Dattani Jul 18 '20 at 20:12
• Your plot for ACF is a bit suspicious cause usually ACF should decay exponentially not linearly specifically when you use LJ as force field. See here: aip.scitation.org/doi/abs/10.1063/1.460171?journalCode=jcp – Alone Programmer Jul 18 '20 at 23:49

As with all MD simulations, you have to assume (often wrongly) convergence with finite time. This is fairly easy to do with autocorrelation functions though, because you know that once they become negative, you are already in the random fluctuation (i.e. uncorrelated noise) zone and this is the point where you can stop. This is slightly trickier in some cases still, especially for unthermostatted systems, where you can have deterministic correlated oscillatory behaviour around zero, so this metric is not very good and I am not sure there is a better alternative than just visually inspecting the plot to pick a suitable cutoff. This won't be a problem, since you will typically sample for a longer time than your decorrelation time, mostly because you need multiple datapoints for autocorrelation function convergence. Finally, in some really pathological cases (e.g. in 1D systems), you can get decay to a constant value which is substantially larger than 0. Thankfully, this behaviour isn't very common at all but it is still worth knowing that it is possible (and in these cases I don't even know how one calculates a diffusion coefficient or whether doing so makes any sense in the first place).

The problem with autocorrelation functions is that this oscillation (even the random one) can still impact your results depending on where you decide to stop and that's why I would say that calculating diffusion coefficients with mean-square displacement is much more robust, because you usually get an almost perfect straight line, whose slope you can accurately obtain from linear regression and this is pretty robust to noise, number of datapoints or cutoff choice (!), certainly more so than integrating the autocorrelation function. In cases where you don't get a straight line (e.g. superdiffusion or subdiffusion), this actually tells you that there is something else going on and calculating diffusion coefficients might need additional assumptions for this system. In any case, you get more information using the RMSD method.

So the bottom line is: if you have a choice between integrating and not integrating, (almost) always choose a method that doesn't rely on integration and if this is for coursework, don't be too worried if the VACF method gives you noisier results (although it's always a good idea to be completely sure you aren't doing anything wrong).

Translation diffusion coefficient $$D_{t}$$ may be calculated by linear fitting of the MSD of center of mass of a molecule:

$$MSD(\tau)=<(\textbf{r}(t+\tau)-\textbf{r}(t))^{2}>$$

$$D_{t}=\frac{MSD(\tau)}{6\tau}$$

where $$\tau$$ is the lag time between the two positions. One should also be aware of the artifacts from the periodic boundary conditions (is they are imposed).

Rotational diffusion coefficient $$D_{r}$$ may be estimated through fitting of the correlation functions and estimation of the rotational correlation time $$\tau$$:

$$\tau=S_{R}^{2}\tau_{R_{s}}+(1-S_{R}^{2})\tau_{R_{f}}$$

with $$\tau_{R_{s}}$$ and $$\tau_{R_{f}}$$ being the slow and fast correlation times respectively; $$S_{R}^{2}$$ is a parameter in fitting of the correlation function. The $$D_{r}$$ acquires following form:

$$D_{r}=\frac{1}{6\tau}$$

Examples of these calculations can be found here:

Slow-Down in Diffusion in Crowded Protein Solutions Correlates with Transient Cluster Formation

Evaluating Rotational Diffusion from Protein MD Simulations