# Why make\_ndx gives duplicates groups? ionic distance analysis

**URL:** <https://gromacs.bioexcel.eu/t/why-make-ndx-gives-duplicates-groups-ionic-distance-analysis/2152>\
**Category:** User discussions\
**Created:** [May 12, 2021, 8:36am UTC](https://gromacs.bioexcel.eu/t/why-make-ndx-gives-duplicates-groups-ionic-distance-analysis/2152 "2021-05-12T08:36:30Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![alevilla](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/alevilla/32/439_2.png) [@alevilla](https://gromacs.bioexcel.eu/u/alevilla)\
**Post date:** [May 12, 2021, 12:50pm UTC](https://gromacs.bioexcel.eu/t/why-make-ndx-gives-duplicates-groups-ionic-distance-analysis/2152/2 "2021-05-12T12:50:23Z")

</div>

Hi

1. [gmx distance](http://manual.gromacs.org/documentation/current/onlinehelp/gmx-distance.html) 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?](https://gromacs.bioexcel.eu/t/what-is-the-difference-between-gmx-distance-gmx-mindist-and-gmx-pairdist/649)

1. 

> [@mdigennaro](#):
>
> I would like to calculate the average distance between the ions:

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

1. 

> [@mdigennaro](#):
>
> make\_ndx is quite cryptic to understand

On the prompt of gmx make\_ndx you can type h

> 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  
Alessandra

---

_[View the full topic](https://gromacs.bioexcel.eu/t/why-make-ndx-gives-duplicates-groups-ionic-distance-analysis/2152)._
