# I want to calculate distance between the atom om of DNA and atom of ligand

**URL:** <https://gromacs.bioexcel.eu/t/i-want-to-calculate-distance-between-the-atom-om-of-dna-and-atom-of-ligand/4794>\
**Category:** User discussions\
**Tags:** gmx-distance\
**Created:** [September 15, 2022, 1:18pm UTC](https://gromacs.bioexcel.eu/t/i-want-to-calculate-distance-between-the-atom-om-of-dna-and-atom-of-ligand/4794 "2022-09-15T13:18:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pallavi](https://avatars.discourse-cdn.com/v4/letter/p/3be4f8/32.png) [@Pallavi](https://gromacs.bioexcel.eu/u/Pallavi)\
**Post date:** [September 15, 2022, 1:18pm UTC](https://gromacs.bioexcel.eu/t/i-want-to-calculate-distance-between-the-atom-om-of-dna-and-atom-of-ligand/4794/1 "2022-09-15T13:18:50Z")

</div>

GROMACS version:  
GROMACS modification: Yes/No  
Here post your question For this i use the command  
gmx make\_ndx -f md\_0\_150.gro -o dist.ndx  
and make a index file for the atoms of my choice  
Available static index groups:  
Group 0 “r\_6\_&_O1P" (1 atoms)  
Group 1 "r\_14_&_O4’" (1 atoms)  
Group 2 “r\_13” (32 atoms)  
Group 3 "r\_13_&_H3" (1 atoms)  
Group 4 "r\_12_&_H42" (1 atoms)  
Group 5 "r\_5_&_O1P" (1 atoms)  
Group 6 “r\_17” (59 atoms)  
Group 7 "r\_17_&_H" (1 atoms)  
Group 8 "r\_17_&_H" (1 atoms)  
Group 9 "r\_17_&_H5" (1 atoms)  
Group 10 "r\_17_&_O1" (1 atoms)  
Group 11 "r\_17_&\_C18” (1 atoms)  
Specify any number of selections for option ‘select’  
(Position pairs to calculate distances for):  
(one per line, for status/groups, ‘help’ for help, Ctrl-D to end)

> 0  
> Selection ‘0’ parsed  
> 7  
> Selection ‘7’ parsed  
> Inconsistency in user input:  
> Selection ‘r\_6\_&\_O1P’ does not evaluate into an even number of positions  
> (there are 1 positions)

and trying to calculate the distance between two atoms with command  
gmx distance -f md\_0\_150.xtc -s md\_0\_150.tpr -n dist.ndx -oav dis.xvg -dt 100  
but either it gives error when i use 2 atoms or it gives the distance of only one atom when i use single atom.  
please tell me the correct method.

---

<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:** [September 16, 2022, 11:44am UTC](https://gromacs.bioexcel.eu/t/i-want-to-calculate-distance-between-the-atom-om-of-dna-and-atom-of-ligand/4794/2 "2022-09-16T11:44:51Z")

</div>

Hi,  
you can use gmx mindist if you want to calculate the distance between 2 atoms belonging to two groups (each group = one atom), like group 0 and 7 in the index group above.  
To use gmx distance you need to provide a group containing pairs of atoms  
I hope it helps  
Alessandra
