Why make_ndx gives duplicates groups? ionic distance analysis

GROMACS version: 2021.1
GROMACS modification: Yes/No

Dear users,
I have a solvent + ionic system.
The solvent has one group (TFS), so do the ions (TMP and LI).
My goal is to analyse some quantities after the MD run, eg the average distance between ions. When trying to create the index list, I get the following:

$ gmx make_ndx -f md.gro
    0 System              :  1304 atoms
    1 Other               :  1303 atoms
    2 TFS                 :    15 atoms
    3 TMP                 :  1288 atoms
    4 LI                  :     1 atoms
    5 Ion                 :     1 atoms
    6 TFS                 :    15 atoms
    7 TMP                 :  1288 atoms
    8 LI                  :     1 atoms

First question: why do I have twice TFS, TMP and LI? Why do I have “Ion”?
To get to this point I have basically followed jalemkul’s tutorial on Lysozyme in Water but with different molecules. Therefore: editconf, solvate, grompp, genion.

Is there a problem? Shall I combine them?
If I accept the default and close make_ndx, the index.ndx file has duplicates, eg.

[ TFS ]
   1    2    3    4    5    6    7    8    9   10   11   12   13   14   15
[ LI ]

Moving on to the distance analysis, I would like to calculate the average distance between the ions:

gmx distance -f md.gro -n index.ndx
Available static index groups:
 Group  0 "System" (1304 atoms)
 Group  1 "Other" (1303 atoms)
 Group  2 "TFS" (15 atoms)
 Group  3 "TMP" (1288 atoms)
 Group  4 "LI" (1 atoms)
 Group  5 "Ion" (1 atoms)
 Group  6 "TFS" (15 atoms)
 Group  7 "TMP" (1288 atoms)
 Group  8 "LI" (1 atoms)

I type 2 and 4, getting the following Inconsistency:

Currently provided selections:
  1. 2
  2. 4
> Reading frames from gro file 'TFS in solvent in water', 1304 atoms.
Inconsistency in user input:
Selection 'TFS' does not evaluate into an even number of positions (there are 15 positions)

Could anyone give me some advice? I tried to couple the two ions at the make_ndx step, but make_ndx is quite cryptic to understand, and there is very little example apart from jalemkul’s tutorial.

> 2 & 4

Copied index group 2 'TFS'
Copied index group 4 'LI'
Merged two groups with AND: 15 1 -> 0
Group is empty

Thank you



  1. gmx distance calculates distances between (fix) pairs of positions as a function of time. For example to calculate the distance between atom 1 and atom 2 , you should provide an index file with the following groups
    [ distance ]
    1 2

It does not calculate the distance between two group.

There are several posts on the topic in the forum that may help you see for example What is the difference between gmx distance, gmx mindist and gmx pairdist?

an option is to calculate the rdf between the two ions with the tools gmx rdf

On the prompt of gmx make_ndx you can type h


This will provide some help and examples
An example is

2 | 4 & r 3-5
selects all atoms from group 2 and 4 that have residue numbers 3, 4 or 5

if you want to merge group 2 and 4 the command is : 2 | 4
the command 2 & 4 will provide the atoms that are in common in both group (and correctly in your case is 0)

Best regards

Dear @alevilla thank you for your answer,

I still do not understand why in all utilities such as make_ndx and distance I get 8 groups.
It looks to me that System, Other+Ion and twice TFS+TMP+Li represent the same thing. Does this matter? is there some default value which I am messing up?

My topology file looks like this:

#include "path2/oplsaa.ff/forcefield.itp"
#include "path2/oplsaa.ff/ions.itp"
#include "path2/TFSI+.itp"
#include "path2/diglyme.itp"
[ system ]
TFS in solvent in water
[ molecules ]
;molecule name nr. 
TFS              1
DIG         43
LI               1

Thank you

When you run gmx make_ndx, some default groups are automatically generated on pre-defined criteria. It can occur that some of those groups are identical. If those group do not fullfill your need, you can ignore them or delete them and create the one you need.
Best regards