# Hbond calculation between two index groups

**URL:** <https://gromacs.bioexcel.eu/t/hbond-calculation-between-two-index-groups/1135>\
**Category:** User discussions\
**Created:** [November 21, 2020, 5:33pm UTC](https://gromacs.bioexcel.eu/t/hbond-calculation-between-two-index-groups/1135 "2020-11-21T17:33:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter.mawanga](https://avatars.discourse-cdn.com/v4/letter/p/ccd318/32.png) [@peter.mawanga](https://gromacs.bioexcel.eu/u/peter.mawanga)\
**Post date:** [November 21, 2020, 5:33pm UTC](https://gromacs.bioexcel.eu/t/hbond-calculation-between-two-index-groups/1135/1 "2020-11-21T17:33:49Z")

</div>

GROMACS version: 2019.5  
GROMACS modification: No

How do I calculate the number of hydrogen bonds between any two index groups? Such as something possible with “distance” command. I could only find an option to supply an index file to the “hbond” command.

Any insights will be highly appreciated. Thanks a lot for reading!

---

<div class="post-metadata">

**Author:** ![Teslim](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@Teslim](https://gromacs.bioexcel.eu/u/Teslim)\
**Post date:** [November 22, 2020, 2:22am UTC](https://gromacs.bioexcel.eu/t/hbond-calculation-between-two-index-groups/1135/2 "2020-11-22T02:22:32Z")

</div>

Use

echo x y | gmx hbond -f traj.xtc -s em.tpr -n index.ndx -num Hbond.xvg -g

where x & y are the groups, traj.xtc is your trajectory file, em.tpr is input run file, index.ndx contains the groups, Hbond.xvg is the output file containing the number of hydrogen bonds as a function of time.

more info [here](http://manual.gromacs.org/archive/5.0.2/programs/gmx-hbond.html)

---

<div class="post-metadata">

**Author:** ![peter.mawanga](https://avatars.discourse-cdn.com/v4/letter/p/ccd318/32.png) [@peter.mawanga](https://gromacs.bioexcel.eu/u/peter.mawanga)\
**Post date:** [December 8, 2020, 10:20am UTC](https://gromacs.bioexcel.eu/t/hbond-calculation-between-two-index-groups/1135/3 "2020-12-08T10:20:03Z")

</div>

This indeed worked, thanks a lot for your assistance.
