I calculated the MSD using the gmx msd -f run05.part0005.xtc -s run05.tpr -o msd_200-250ns.xvg. As a result, I got a graph with 2 slopes as attached.

In the MD simulation, I followed a simulated annealing schedule for every 25 ns. Since I get the kink at 25 ns, I believe this behavior (two slopes with a kink) is due to the annealing schedule. I want to calculate the diffusion coefficient of water in the system. With this behavior of my MSD graph, I am now confused about how I get the diffusion coefficient of water. I appreciate your help.

Thank you.

enter image description here

  • 1
    $\begingroup$ +1 Welcome to our forum. $\endgroup$
    – Camps
    Dec 18, 2023 at 13:16

1 Answer 1


In order to calculate the diffusion coefficient from the MSD plot, you can use this equation:

  MSD(t) = 6Dt

where MSD(t) is the mean square displacement at time t, D is the diffusion coefficient,and t is time.

In the case where you have a simple system with constant diffusion, the MSD should be a straight line, and the slope of the line can be used to determine the diffusion coefficient. In your case, seems that you have a system with changes in dynamics, such as the simulated annealing schedule you mentioned, and the MSD plot is showing multiple slopes. In this case, you can calculate the diffusion coefficient for different time intervals separately, where the dynamics appear to be relatively constant. You can do that by fitting a straight line to each segment and determine the slope for that interval ( you can use linear regression to fit straight lines to these stable segments. Tools such as GROMACS or Python with libraries such as NumPy and Matplotlib can be used for this purpose). Then diffusion coefficient can be calculated for each segment. Afterwards, as you have multiple segments, you may want to average the diffusion coefficients obtained from different segments to get an overall estimate.

  • 1
    $\begingroup$ Thank you very much for this clear answer. $\endgroup$
    – Ema
    Dec 20, 2023 at 8:43
  • 1
    $\begingroup$ Welcome to the forum! $\endgroup$ Dec 20, 2023 at 9:05

You must log in to answer this question.

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