How does gmx hbond work?

What is the mechanism behind gmx hbond?

I am reading the documentation, and I don’t quite understand it.
From here, I see that it is a geometric criterion. I have a polymer with an N-H bond embedded in it. My question is, my understand of an H-bond was that if I had an N-H bond which was smaller than 0.35 nm, and the angle N-H-H, where the last H atom is bonded to an O or an N, we have a hydrogen bond. I don’t understand the reason for the ghost H atom that seems to be added in Fig 58 in the man pages.

According the man pages,
"The program gmx hbond analyzes all hydrogen bonds existing between two groups of atoms or in specified donor-hydrogen-acceptor triplets […]. "

If I want to calculate the h-bonds between the N-H group in my polymer and water, can I simply do -num hbnum and select the N, H atoms in the NH group of my polymer and H atoms in water?

There is no “ghost” atom. In your case, NH is the donor group (D-H in Fig. 58), and the acceptor atom, A, is some suitable acceptor within the second selection you make (either within the polymer or water).

No, this does not make chemical sense. NH groups (when acting as donors) form a hydrogen bond with oxygen atoms, which are the acceptors. For the purposes of gmx hbond the donor group must always include (donor,hydrogen) pairs and the second (acceptor) group must include all acceptor atoms.

Got it, thank you for your response Justin.

When providing my donor group index, should I be providing simply the hydrogens attached to the nitrogen, or is it both, the nitrogen and hydrogen?

Both. The angle calculation requires three atoms: donor, hydrogen, and acceptor.

Thank you for your response, Justin. I am writing to you because I am seeing some pretty strange behavior with gmx hbond.
First, I run gmx hbond to find all the hydrogen bonds between all NH moieties in my polymer with all the oxygen in my solvent (water).

  gmx hbond -f md_pbc.xtc -s md.tpr -n index_hbond.ndx -num

Reading file md.tpr, VERSION 2020.5 (single precision)
Specify 2 groups to analyze:
Group     0 (         System) has 50804 elements
Group     1 (          Other) has   572 elements
Group     2 (            UNL) has   572 elements
Group     3 (          Water) has 50232 elements
Group     4 (            SOL) has 50232 elements
Group     5 (      non-Water) has   572 elements
Group     6 (             OW) has 16744 elements
Group     7 (N09_N08_H09_H10) has    60 elements
Select a group: 7
Selected 7: 'N09_N08_H09_H10'
Select a group: 6
Selected 6: 'OW'
Checking for overlap in atoms between N09_N08_H09_H10 and OW
Calculating hydrogen bonds between N09_N08_H09_H10 (60 atoms) and OW (16744 atoms)
Found 30 donors and 16774 acceptors
Reading frame       0 time    0.000   
Will do grid-search on 18x18x18 grid, rcut=0.34999999
Frame loop parallelized with OpenMP using 28 threads.
Last frame      12000 time 60000.000   

Back Off! I just backed up hbnum.xvg to ./#hbnum.xvg.1#
Average number of hbonds per timeframe 20.045 out of 251610 possible

This worked out fine, I believe. But now, I decided to find all hbonds between OH water and the N present in my polymer.

  gmx hbond -f md_pbc.xtc -s md.tpr -n index_hbond.ndx -num -nitacc

Reading file md.tpr, VERSION 2020.5 (single precision)
Specify 2 groups to analyze:
Group     0 (         System) has 50804 elements
Group     1 (          Other) has   572 elements
Group     2 (            UNL) has   572 elements
Group     3 (          Water) has 50232 elements
Group     4 (            SOL) has 50232 elements
Group     5 (      non-Water) has   572 elements
Group     6 (             OW) has 16744 elements
Group     7 (N09_N08_H09_H10) has    60 elements
Group     8 (        N09_N08) has    30 elements
Group     9 (     HW1_HW2_OW) has 50232 elements
Select a group: 9
Selected 9: 'HW1_HW2_OW'
Select a group: 8
Selected 8: 'N09_N08'
Checking for overlap in atoms between HW1_HW2_OW and N09_N08
Calculating hydrogen bonds between HW1_HW2_OW (50232 atoms) and N09_N08 (30 atoms)
Found 16744 donors and 16774 acceptors
Reading frame       0 time    0.000   
Will do grid-search on 18x18x18 grid, rcut=0.34999999
Frame loop parallelized with OpenMP using 28 threads.
Last frame      12000 time 60000.000   

Back Off! I just backed up hbnum.xvg to ./#hbnum.xvg.3#
Average number of hbonds per timeframe 0.141 out of 1.40432e+08 possible

Thanx for Using GROMACS - Have a Nice Day

It says there are 0.141 hbonds per timeframe, out of a possible 1.4e+8. Clearly, gmx is also trying to count all OH-OH hbonds, and not just OH-N hbonds. However, even in that event, 0.141 seems very low, considering there are nearly 17000 water molecules in my simulation box.

What could be the cause of me going wrong in my gmx hbond calculation? I have tried including -nitacc to ensure N is the acceptor atom, but that doesn’t seem to work…

No, it’s considering the possibility of two H-bond donors for each water with each N acceptor, and also may be adding in the possibility of N as donors to O receptors (but will find none because there are no H atoms in the nitrogen group).

The result suggests simply that there are few H-bonds directly to the polymer backbone. If this is inconsistent with other observations, you would have to diagnose further by analyzing a single frame in which you can visually confirm a given number of H-bonds with gmx hbond giving a different number. Sometimes the outcome is simply surprising, but I’ve never seen this program be flatly wrong.

Deal Megamence,
How to obtain index_hbond.ndx file?

Best wishes,
Alisher