How to make an index file that contains waters within 2<Z<5?

GROMACS version: 2019.3
GROMACS modification: Yes/No
Here post your question
I want to make an index file in gromacs more specifically a dynamic index file where the water molecules are within 0.25<Z<0.75 of the box for the last 1ns. Partially, I solved it by executing the command:
gmx select -f md_50_100_noPBC.xtc -s md_0_100.tpr -on output.ndx -select ‘resname SOL and z>=0.25 and z<=0.75’ -b 99000 -e 100000. But this gives me a list of atoms only that satisfies the criteria but I want the whole water molecules if any of the atom of a particular water molecule satisfies the criteria. How do I do that? Please help me.

Hi,
Did you try to use the position c.o.m in place of the atom position?
Maybe here you can find something useful Selection syntax and usage — GROMACS 2021.2 documentation
Best regards
Alessandra

Hi,

I am tackling a similar issue; parsing an auxillary variable:

> rdist = res_com distance from ...

seems to help; if you want to select an interval of coordinates instead of a distance:

> rx = res_com x               
> rz = res_com z
> resname RES and rx > ... and rx < ... and rz < ...