Atom to atom distance measured by gmx distance command is larger than measured in VMD

GROMACS version: 2021.4
GROMACS modification: No
Here post your question :

Hi, I used gmx distance to measure the distance between two atoms using this command: gmx distance -s md_0_10.tpr -f md_0_10_center.xtc -n index.ndx -select ‘cog of group “xxx” plus cog of group “yyy”’ -oall distance.xvg. Before that, I edited index.ndx to define these two atoms as two separate groups using their index number. The distance I got is around 0.6 ±0.04nm. However, if I measured the distance between the same two atom in VMD, either mannually or using tkconsole command, I got a distance of about 4 (angostrom I suppose, I was not able to find the unit in the mannul) throughout the course of simulation. These two atoms are supposed to form hydrophobic interactions, so the results from VMD are more reasonable.

Any suggestions?

You may need to add -pbc no to your gmx distance command. I’ve found that even after accounting for periodic boundary conditions with trjconv, gmx distance will still return distances that haven’t accounted for pbc unless you explicitly include -pbc no