# Calculating diffusion coefficient with MSD (gmx msd)

**URL:** <https://gromacs.bioexcel.eu/t/calculating-diffusion-coefficient-with-msd-gmx-msd/3749>\
**Category:** User discussions\
**Tags:** analysis-tools\
**Created:** [February 28, 2022, 2:24pm UTC](https://gromacs.bioexcel.eu/t/calculating-diffusion-coefficient-with-msd-gmx-msd/3749 "2022-02-28T14:24:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lois](https://avatars.discourse-cdn.com/v4/letter/l/5f8ce5/32.png) [@Lois](https://gromacs.bioexcel.eu/u/Lois)\
**Post date:** [February 28, 2022, 2:24pm UTC](https://gromacs.bioexcel.eu/t/calculating-diffusion-coefficient-with-msd-gmx-msd/3749/1 "2022-02-28T14:24:58Z")

</div>

GROMACS version: 2016

Hi all,

I’m trying to calculate the diffusion coefficient of some water molecules in the x direction of my system. I used gmx msd and did the following:

gmx\_mpi msd -f nvt.trr -s nvt.tpr -n index.ndx -mol -b 1000 -e 1900 -beginfit 100 -endfit 300 -type x

which GROMACS automatically calculates the diffusion coefficient, D[Water] 1.6535 (+/- 0.1480) 1e-5 cm^2/s. However, when I manually calculate the diffusion coefficient (over the linear region between 100 and 300 ps which I told GROMACS to use as well) by calculating the slope of my msd plot, I get 0.0031806 nm^2/ps (3.1806e-5 cm^2/s). Does anyone know what might be happening? It looks like I’m around a factor of 1/2 out from what GROMACS gives but I don’t know why.

Thanks
