Does gmx use the center of mass(COM) to calculate the MSD?

GROMACS version:2020.2
GROMACS modification: NO
Dear all,
I want to know if the Gromacs use the COM in the gmx msd? Because I get some different results. My procedure is as follows:

  1. make an index file for an ion(PF6) useing gmx make_ndx

  2. using the command:
    gmx msd -f xxx.trr -s xxx.tpr -n index.ndx -b 0 -e 1 (just the 0-1ps for the selected one PF6 )
    And I get the MSD at t=1.0ps of the one selected PF6.

  3. I get the COM of the selected the PF6 using gmx traj at t=0, t=1.0ps, and I get the MSD via these COM. But the MSD produced by 2 step is different from the step 3 .

    I want to know the reasons, Thank you so much!


perhaps the -mol flag is what you want? If your group is a single molecule it will calculate the MSD of its center-of-mass.

Edit: However, if you want the center-of-mass MSD of a group which is several molecules, I don’t think that is possible out of the box.


Dear Petter,
Thank you so much. maybe I don’t express my question clearly.
I computed the MSD for an ion, not a group. I get the COM of a PF6 by gmx traj, and then I get the (R(t=1ps)-R(t=0ps) )^2 for this ion (merely for this PF6 ion, not all PF6s in the box) by hand, which is different from the one produced by gmx. So I just wonder if gmx use COM or other algorithm?
I just want to know the reason.

Ah. gmx msd calculates the average (individual) MSD of all atoms in the group, not of the COM.

That’s correct - if you want a mol COM diffusion coefficient, you need to use the -mol option, but IIRC that doesn’t give you per-mol MSD plots, just the overall diffusion coefficient.

That said, I’d expect the diffusion of PF6 would be reasonably well modeled by just the central P, particularly at longer taus. So if you want a 1:1 comparison, I’d suggest comparing gmx traj on the individual atom to gmx msd on the individual atom.

Oh, I see, Thank you so much! Best wishes with you! (^_^)

Many thanks! Best wishes!(^_^)