# Distance between ion and coordinating residue

**URL:** <https://gromacs.bioexcel.eu/t/distance-between-ion-and-coordinating-residue/6739>\
**Category:** User discussions\
**Tags:** analysis-tools, gmx-distance\
**Created:** [July 3, 2023, 1:09pm UTC](https://gromacs.bioexcel.eu/t/distance-between-ion-and-coordinating-residue/6739 "2023-07-03T13:09:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielhall](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@danielhall](https://gromacs.bioexcel.eu/u/danielhall)\
**Post date:** [July 3, 2023, 1:09pm UTC](https://gromacs.bioexcel.eu/t/distance-between-ion-and-coordinating-residue/6739/1 "2023-07-03T13:09:27Z")

</div>

GROMACS version: 2021.3  
GROMACS modification: No

Hi all users!,

I am trying to use the distance function within Gromacs to measure the average distance between a Zinc ion and a coordinating residue e.g, Histidine (NE2) or cysteine (SG). I have created index file with specific groups for the coordinating residues and the zinc ion but the error message I get is that the selection does not equal into an even number of positions.

How do i solve/overcome this issue?  
Can I use the -select option if so how does the syntax for this work?

Any help would be greatly appreciated! :)

With regards,  
Dan.

---

<div class="post-metadata">

**Author:** ![danielhall](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@danielhall](https://gromacs.bioexcel.eu/u/danielhall)\
**Post date:** [July 3, 2023, 2:04pm UTC](https://gromacs.bioexcel.eu/t/distance-between-ion-and-coordinating-residue/6739/2 "2023-07-03T14:04:23Z")

</div>

For those who may have a similar problem, my steps to solve this problem was:

1. Create an index file with the atoms you want to calculate the distance between e.g.  
r “X” & a “atom selection” where X = residue number and atom selection is the atom you which to select e.g., SG, NE2, OD1 etc.

2. Then merge the two groups together, so if your selection was 1 and 2 then type 1 | 2 to merge the groups.

Hope this helps!

Dan.

---

<div class="post-metadata">

**Author:** ![jalemkul](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/jalemkul/32/18_2.png) [@jalemkul](https://gromacs.bioexcel.eu/u/jalemkul)\
**Post date:** [July 3, 2023, 2:09pm UTC](https://gromacs.bioexcel.eu/t/distance-between-ion-and-coordinating-residue/6739/3 "2023-07-03T14:09:39Z")

</div>

You can also see examples and lots of helpful documentation with `gmx help selections` (subtopics `cmdline` and `examples` are particularly useful).
