Gmx_trajectory and dynamic index

GROMACS version: 2018- 2020
GROMACS modification: NO


I am using gmx select to select the water molecules within a given distance from a protein at different time of my simulation and output the corresponding index files. And from this index I would like to output the X,Y and Z coordinates . However I have seen that this not yet possible since the gmx trajectory plot the

" gmx trajectory plots coordinates, velocities, and/or forces for provided selections. By default, the X, Y, and Z … For dynamic selections, currently the values are written out for all positions that the selection could select."

Is there a workaround ?

Thank you


I never used ‘gmx select’ , but VMD has dynamics selection for visualization purpose.

Yeah my objective is to obtain the X, Y and Z components for only the selected atoms. I see that it is only It is only possible if you provide a index file already generated with gmx select


Hi StephaneA,
Did you find a way to do it?

Thank you,

Unfortunately not dynamically. I had to use two steps and two gmx tools in a bash script to use

  1. gmx select to obtain a ndx file with the selected water for each frame
  2. the gmx trajectory with the ndx file for each frame to obtained the x; y, z coordinates

It was long

Yeah in two steps

  1. Using gmx select to obtain a

Hello @StephaneA ,
I want to do a similar analysis for my polymer-solvent system. If you can help me with the use of “gmx select”. My target is to select solvents near polymer walls. I wonder how to give the criteria like <0.4 nm while extracting solvents.
Thank you.

Hi Tijanar,

gmx select is a powerful tool. You could build an index file where you select for instance only the heavy atoms of your polymer “HEAVY_POLYMER_ATOM” this index file with gmx select with the following syntax

gmx select -f myxtc.xtc -s mytpr.tpr -select “resname SOL and name OW within 0.4 of group” “HEAVY_POLYMER_ATOM” -on mynew.ndx

see also Selection syntax and usage — GROMACS 5.1 documentation for syntax