# Difference in diffusion coefficients using msd and velacc functions

**URL:** <https://gromacs.bioexcel.eu/t/difference-in-diffusion-coefficients-using-msd-and-velacc-functions/9410>\
**Category:** User discussions\
**Created:** [June 17, 2024, 11:19am UTC](https://gromacs.bioexcel.eu/t/difference-in-diffusion-coefficients-using-msd-and-velacc-functions/9410 "2024-06-17T11:19:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlyjlysjd](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@jlyjlysjd](https://gromacs.bioexcel.eu/u/jlyjlysjd)\
**Post date:** [June 17, 2024, 11:19am UTC](https://gromacs.bioexcel.eu/t/difference-in-diffusion-coefficients-using-msd-and-velacc-functions/9410/1 "2024-06-17T11:19:46Z")

</div>

GROMACS version:2024.1  
GROMACS modification: No  
For the same generated phase, the diffusion coefficients produced using gmx msd and velocity autocorrelation are significantly different, how should one determine which is accurate?  
For a 1M MgCl2 solution, the system uses 500 water molecules, 9 Mg and 18Cl.  
Calculate the diffusion coefficient for the Mg ion:  
Using gmx msd to select Mg, the diffusion coefficient calculated directly is: @ s0 legend “D[Mg] = 0.2957 (+/- 0.2086) (1e-5 cm^2/s)”  
And using gmx velacc and gmx analyze -integrate using the velocity autocorrelation function integrated and divided by 3 comes out to 0.008231067 cm^2/s

Analysed quantitatively they are both very different, what is the reason for this and which one is correct?

---

<div class="post-metadata">

**Author:** ![scinikhil](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/scinikhil/32/3483_2.png) [@scinikhil](https://gromacs.bioexcel.eu/u/scinikhil)\
**Post date:** [June 20, 2024, 3:44pm UTC](https://gromacs.bioexcel.eu/t/difference-in-diffusion-coefficients-using-msd-and-velacc-functions/9410/2 "2024-06-20T15:44:09Z")

</div>

What kind of simulation system are you addressing? time length of the simulation? pbc is fixed? both method uses different approaches and it varies on several factors.

---

<div class="post-metadata">

**Author:** ![jlyjlysjd](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@jlyjlysjd](https://gromacs.bioexcel.eu/u/jlyjlysjd)\
**Post date:** [June 21, 2024, 8:44am UTC](https://gromacs.bioexcel.eu/t/difference-in-diffusion-coefficients-using-msd-and-velacc-functions/9410/3 "2024-06-21T08:44:19Z")

</div>

thank you for answer my question, and in my case, I use tcoupl = V-rescale, pcoupl = C-rescale , the nsteps is 10000000, dt =0.02 , use Annealing Simulation start 500K to 298.15K and pbc =xyz in eql.mdp. and i have one more question is what is units of gmx current outputs value, sigma? is S/m?
