Plotting a distance vs time graph

GROMACS version: 2020.1
GROMACS modification: Yes/No


I am a beginner in Gromacs. I have performed the protein-ligand simulation given in the official GROMACS Tutorials website. I want to calculate the distance between binding site residues of the protein and the ligand during the MD simulation. I have used the command “gmx distance -s md_0_10.tpr -f md_0_10_center.xtc -select ‘resname “JZ4” and name OAB plus resid 102 and name OE1’ -oall” and I have got the average distance value. However, I have seen many published papers where researchers plot the distance vs time graph. Hence, I would also like to know the specific script for obtaining such a graph.

Thanks in advance

gmx distance calculates distances between pairs of positions as a function of time.

-oall [<.xvg>] (dist.xvg) (Optional
All distances as function of time

You’ve already calculated it. Simply plot the values within the output file.

Thank you very much for the reply. Since I am very new to GROMACS I am still learning the scripts and commands. It would be of great help to me if you could elaborate your answer or just mention the exact command that I need to give as an input.
Thanks and regards

You don’t have to run any script again, you already have the results in the output file that you generated when you ran gmx distance.

Since you didn’t specify any file name when you ran the command with the -oall switch, suspect the distance versus time data will be contained within the dist.xvg file.

Thank you for the reply. Yes, there is a file named “dist.xvg” in my working directory. I used the command xmgrace dist.xvg and got the graph. Thanks for the timely help.