Colvars: get topol chain names to match make_ndx

GROMACS version: 2025.3
GROMACS modification: Yes/No: No
Here post your question

I’m trying to select groups in a colvars input file.

I have a topol.top file that looks like

;	File 'topol.top' was generated
;	By user: dcondon (12056)
;	On host: blip-a.hpc.uidaho.edu
;	At date: Tue Oct  7 08:26:06 2025
;
;	This is a standalone topology file
;
;	Created by:
;	                    :-) GROMACS - gmx pdb2gmx, 2025.3 (-:
;	
;	Executable:   /opt/modules/physics/gromacs/2025.3/bin/gmx
;	Data prefix:  /opt/modules/physics/gromacs/2025.3
;	Working dir:  /mnt/ceph/dcondon/ui/gromacs/tut/small.2puy
;	Command line:
;	  gmx pdb2gmx -f 2puy.noH2O.nochainA.pdbfixer.pdb -ignh -o 2puy.noH2O.nochainA.pdbfixer.gro -water tip3p -ff amber99sb-ildn
;	Force field was read from the standard GROMACS share directory.
;

; Include forcefield parameters
#include "amber99sb-ildn.ff/forcefield.itp"

; Include chain topologies
#include "topol_Protein_chain_B.itp"
#include "topol_Protein_chain_E.itp"
#include "topol_Ion_chain_B2.itp"

; Include water topology
#include "amber99sb-ildn.ff/tip3p.itp"

#ifdef POSRES_WATER
; Position restraint for each water oxygen
[ position_restraints ]
;  i funct       fcx        fcy        fcz
   1    1       1000       1000       1000
#endif

; Include topology for ions
#include "amber99sb-ildn.ff/ions.itp"

[ system ]
; Name
Protein in water

[ molecules ]
; Compound        #mols
Protein_chain_B     1
Protein_chain_E     1
Ion_chain_B2        1
SOL         7527
NA               22
CL               30

but surprisingly, the names change when I used make_ndx after energy minimization and equilibration:

Nr. Group #Entries First Last
0 System 23771 1 23771
1 Protein 1136 1 1136
2 Protein-H 561 1 1136
3 C-alpha 70 5 1127
4 Backbone 210 1 1134
5 MainChain 282 1 1136
6 MainChain+Cb 350 1 1136
7 MainChain+H 352 1 1136
8 SideChain 784 6 1133
9 SideChain-H 279 7 1132
10 Prot-Masses 1136 1 1136
11 non-Protein 22635 1137 23771
12 Ion 54 1137 23771
13 Water 22581 1139 23719
14 SOL 22581 1139 23719
15 non-Water 1190 1 23771
16 Water_and_ions 22635 1139 23771
17 Protein_chain1 965 1 965
18 Protein_chain2 171 966 1136

Why did Protein_chain_B and Protein_chain_E change names?

How can I prevent this name change?

There is no name change. As far as I know, the topology names are unrelated from those reported in the index. For example, you have a Protein group but no protein in the topology names, or you have NA and CL but those are reported generically as Ion. The index groups that are automatically generated by GROMACS are eyeballed on the type of atoms that you have in the box, not the names in the topology. Also notice that Protein_chain1 and Protein_chain2 are not common names usually present, but they were generated most likely by a splitch 1 command during the making of the index.

On top of generating groups, with the make_ndx command you can also rename them as you want. Take a look at the manual. if you want to conserve the group names for the sake of COLVAR readability (which is a very good idea), I suggest you to rename the groups 17 and 18 in your index file with what fits you the best, so Protein_chain_B and Protein_chain_E in your case. :)