6
$\begingroup$

In GROMACS I have used the command below to calculate mean square displacement (MSD) over time,

gmx msd -f ../run01/run01.trr -s ../run01/run01.tpr -s ../setup/index.ndx -o msd01.xvg -tu ns -type z

From the equation,

$$D = \frac{1}{6t} \langle(r(t) - r(0))^{2}\rangle$$

I suppose that in GROMACS the default resetting time for $r(0)$ is $\pu{10 ps}$ thus $t=\pu{10 ps}$. However my most confusing part is selecting the correct linear region. Is there proper mathematical method to find correct linear region?

In GROMACS, the args -beginfit -endfit defaulted to fitting the curve between 10% and 90%. That means I should select linear region as between 10% to 90% along the x axis?

An example graph,

Example MSD plot

$\endgroup$

2 Answers 2

4
$\begingroup$

MSD accuracy decreases as a function of the lag-time $t$, because for large $t$ there are fewer pairs of time slices of interval $t$ to average over. Think of the limit in calculating MSD for the largest possible lag-time interval of a simulation. In that case you can only use the initial and final frame to calculate the MSD at that $t$. Whereas for small $t$, you can average this over many sets of nearby time frames.

The above is why, beyond $\ce{15 ns}$, your MSD curve becomes highly non-linear. You simply don't have good statistics here. Very short times are also not ideal to use for $D$, as displacements are ballistic prior to a particle's first collision and the MSD slope is usually very steep at short $t$. Hence, choose the large smooth region in the middle of your MSD plot to calculate the slope. As long as your simulation is not changing it's diffusion properties over time, and you have sufficient data to average over, this region of the MSD should have a constant slope.

In your case, it looks like you either don't quite have enough data to generate a perfectly smooth MSD beyond $\ce{6 ns}$, or your simulation may be changing in some way over time. However, the medium-time MSD is smooth enough to calculate a diffusion constant. Just use the region from about $\ce{1 ns}$ to $\ce{5 ns}$.

By the way, you can improve MSD statistics by using a shorter reset time (this also increases computational cost).

$\endgroup$
8
  • $\begingroup$ So the answer obtained from GROMACS is incorrect? $\endgroup$ Jun 6, 2022 at 17:33
  • $\begingroup$ It's not that there's anything incorrect about the GROMACS MSD code per se, but you can improve upon the default parameters by optimizing them to your specific situation. $\endgroup$
    – Hayden S
    Jun 7, 2022 at 0:46
  • 1
    $\begingroup$ Remember that the factor of 6 in your equation above is really $2n$ where $n$ is the dimension of particle motion. When you specify -type z you set $n =1$ as you're calculating diffusion in the $z$-direction only. $\endgroup$
    – Hayden S
    Jun 7, 2022 at 7:47
  • 1
    $\begingroup$ Also I should note that there's no single $t$ (lag time) in your equation when calculating $D$. You should be fitting a line to MSD$(t)$ vs $t$, then the slope is just $2nD$. The reset time does not come into this equation, it only trades additional accuracy for computational cost. $\endgroup$
    – Hayden S
    Jun 7, 2022 at 7:54
  • 1
    $\begingroup$ Good to see that got clarified :) $\endgroup$ Jun 7, 2022 at 12:50
4
$\begingroup$

If you can obtain the raw data used in that plot, as a purely statistical and numerical exercise you can determine the interval which will give you minimum uncertainty in the estimate of the gradient.

A short line segment will inherently have higher uncertainty in estimated gradient simply because you are using fewer sample points. But, for your data, a too-long line segment will also begin to have higher uncertainty in estimated gradient because the segment will start including clearly non-linear, noisy data. This implies that there will be some optimum segment of the line to use. Find that optimum and use it, and as a byproduct you also get an estimate of the uncertainty for free.

However, this is only correct as a matter of abstract statistics. The uncertainty will be drastically underestimated (relative to the ground truth of "if I ran a completely independent simulation would I get a similar gradient"), because molecular dynamics snapshots are correlated instead of being statistically independent. If you need to be very accurate in stating the uncertainty (and you may not need to) then you should be referring to this recent paper and choosing a good methodology from it: Optimal estimates of self-diffusion coefficients from molecular dynamics simulations. Note that the paper authors have made available a python script which implements their recommendation, the generalised least-squares approach.

$\endgroup$
1
  • $\begingroup$ This is a very advanced answer Thank you. $\endgroup$ Jun 7, 2022 at 13:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .