# MSD curve has a large non-linear part

**URL:** <https://gromacs.bioexcel.eu/t/msd-curve-has-a-large-non-linear-part/11781>\
**Category:** User discussions\
**Tags:** analysis-tools\
**Created:** [March 21, 2025, 6:30am UTC](https://gromacs.bioexcel.eu/t/msd-curve-has-a-large-non-linear-part/11781 "2025-03-21T06:30:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![minqi](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@minqi](https://gromacs.bioexcel.eu/u/minqi)\
**Post date:** [March 21, 2025, 6:30am UTC](https://gromacs.bioexcel.eu/t/msd-curve-has-a-large-non-linear-part/11781/1 "2025-03-21T06:30:39Z")

</div>

GROMACS version: 2022.4  
GROMACS modification: No

Dear gromacs users,

In a micelle-water system, I hope to calculate the MSD and diffusion coefficient of surfactants. The overall surfactant number is ~120 and I simulated for 50ns,  
I used command `gmx msd -f md.xtc -s md.tpr -sel 'resname AE3 SDS BTN' -o surf.xvg -trestart 2` to calulate the msd curve and D, but the end of curve shows an abnormal drop, which makes the curve have a bad linear correlation.

 ![1](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/b/bb4c02c8de480c2be6edca21575d4d24864076cd.png)

I am awared that the fit for D only use the 10~90% of time range data for fit by defalut, but the the non-linear part seems to exceed 10% of simulation duration.

I have also referred previous posts like [https://gromacs.bioexcel.eu/t/curve-in-water-msd/10999/9](https://gromacs.bioexcel.eu/t/curve-in-water-msd/10999/9) and I thought things are a bit different here as I run the simulation for a longer time for better statistic average.

So here should I just use the linear part for fit, or is there any approaches to get a linear line for that? Any suggestions on this issue will be welcomed. Thank you.

---

<div class="post-metadata">

**Author:** ![hess](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/hess/32/416_2.png) [@hess](https://gromacs.bioexcel.eu/u/hess)\
**Post date:** [March 21, 2025, 8:04am UTC](https://gromacs.bioexcel.eu/t/msd-curve-has-a-large-non-linear-part/11781/2 "2025-03-21T08:04:35Z")

</div>

You should use far less than 90%. I would never use more that up to 50%. In this case 5-25 ns seems reasonable.

---

<div class="post-metadata">

**Author:** ![minqi](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@minqi](https://gromacs.bioexcel.eu/u/minqi)\
**Post date:** [March 21, 2025, 9:19am UTC](https://gromacs.bioexcel.eu/t/msd-curve-has-a-large-non-linear-part/11781/3 "2025-03-21T09:19:40Z")

</div>

Oh I see, thanks for your point Hess!

---

<div class="post-metadata">

**Author:** ![minqi](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@minqi](https://gromacs.bioexcel.eu/u/minqi)\
**Post date:** [March 24, 2025, 2:57am UTC](https://gromacs.bioexcel.eu/t/msd-curve-has-a-large-non-linear-part/11781/4 "2025-03-24T02:57:11Z")

</div>

Hi Hess, I have another question about MSD and could you please offer me some suggestions?

In another simulation, an inflection point was observed in the MSD curve (see fig below) as the micelle initially placed at box center moved across the box boundary. The slope is not identical at different sides. In this case, which part should I choose for D calculation and is there any command that could eliminate this effect? Thank you.

 ![Picture1](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/a/a46cc2e7beeb2da6cbf388b2af314ee39b709242.jpeg)

---

<div class="post-metadata">

**Author:** ![hess](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/hess/32/416_2.png) [@hess](https://gromacs.bioexcel.eu/u/hess)\
**Post date:** [March 26, 2025, 1:38pm UTC](https://gromacs.bioexcel.eu/t/msd-curve-has-a-large-non-linear-part/11781/5 "2025-03-26T13:38:04Z")

</div>

If you use the standard per atom MSD, which is the case in your command line in your first post, then PBC is correctly handled. I don’t know what can cause the inflection point. Statistics is extremely low, as are atoms move in a correlated fashion, so it could just be “noise”.

---

<div class="post-metadata">

**Author:** ![minqi](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@minqi](https://gromacs.bioexcel.eu/u/minqi)\
**Post date:** [March 26, 2025, 1:41pm UTC](https://gromacs.bioexcel.eu/t/msd-curve-has-a-large-non-linear-part/11781/6 "2025-03-26T13:41:15Z")

</div>

I got it, much appreciate for your help, thanks hess!
