How to track the atoms index change after convert-tpr

GROMACS version: 2024.2
GROMACS modification: No

I have my wet trajectory (md.xtc) and the corresponding md.tpr and index.ndx. The molecular composition is like:
D 1
A 1
E 1
B 1
F 1
C 1
SOL 1000
I have also made two groups: A+C and B for the subsequent binding energy analyzation. Now I want to contract my system to remove water (and maybe other unimportant atoms), so I used gmx trjconv and gmx convert-tpr to dry-up my xtc and tpr files and got drymd.xtc and drymd.tpr. However, the self-defined groups A+C and B were not reserved in the new ndx file (got from gmx make_ndx -f drymd.tpr). Is there any elegant way to track the self-defined groups atoms index by gromacs command? If not, I could only handly change the atoms indexes by scripts. Thank you!

Dear @Supernova

The index file is just a list of numbers and nothing more, it has no memory of the system from which it was derived.

As such, you may try to use your old index file with the new dry .tpr and .xtc files. If the molecular composition you report (which I suppose is in your old index file) is consistent with the topology, so to be clearer if you open the (not dry) .gro file and you see that the first molecule is D, the second is A etc., then in your dry files the first N atoms containing molecules D-A-E-B-F-C will correspond to the first N atoms of the dry runs. You can check by dumping a .gro frame from the dry .xtc.

Clearly, if you use the dry files with the old index and point to the SOL group, then GROMACS will throw and error saying that it doesn’t see those molecules (as you removed them). But if the rest of the molecules are in the same order, then the numbering should still be correct.

At the same time, however, if it is a matter of just re-define a couple of groups that are simple unions, you can easily re-do a new index with gmx make_ndx.

Thank you for your kindly reply. I have known that it may be more convinent to just generate a new ndx file based on drymd.tpr. If there is any self-defined groups, maybe I need to define the corresponding groups again, or process the index file by scripts for automatic processing. Thanks again for the answer.