Invalid index group references encountered

GROMACS version: gromacs/2023.2 and 5.0.7
GROMACS modification: Yes/No

I don’t know if this issue should be reported here, but maybe I can get some hints about what I could do.

Using gmx select I created an index and PDB file from my system:

gmx select -s topol.tpr -f conf.gro -select ‘group “Protein” and resid 2438 to 2521 4959 to 5042 7480 to 7563 2198 to 2208 4719 to 4729 7240 to 7250 2310 to 2318 4831 to 4839 7352 to 7360’ -on cavity.ndx
echo “0” | gmx trjconv -s topol.tpr -f conf.gro -n cavity.ndx -o cavity.pdb

Now I have an index and pdb files with 5175 atoms ready to using in an external tool, but compatible with gromacs called trj_cavity. I also created a new trajectory containing only my 5175 atoms in pdb format (traj.pdb) using the cavity.ndx and gmx trjconv. This tool, trjcavity 2.0.0 is compatible with GROMACS 5.1.4. When I type the command:

trj_cavity -s cavity.pdb -f traj.pdb -dim 4 -n cavity.ndx -o cavity2.pdb -ov volume.xvg -ot -ostat

I got the error:

“Inconsistency in user input:
Invalid index group references encountered
Group
‘group_“Protein”_and_resid_2438_to_2521_4959_to_5042_7480_to_7563_2198_to_2208_4719_to_4729_7240_to_7250_2310_to_2318_4831_to_4839_7352_to_7360’
cannot be used in selections, because it contains negative atom indices
and/or references atoms not present (largest allowed atom index is 5175).”

I don’t see a reason to have some incompatibilities between files, since they are only text files (ndx, pdb) and could be read for any GROMACS versions.
Could someone help me with this?

This tool is not an official GROMACS tool, so I can not comment on that. But you have selected residues with numbers that are higher than the atom count in the pdb file. I could imagine that this causes issues.

Thank you , Hess!
Now I understand the problem. When I look the end of my pdb file, I realized that I need to renumber the residues in my structure file.

ATOM 5175 OT2 GLU C7563 324.080 305.170 53.960 1.00 0.00 O
TER
ENDMDL

Thank you again.