Bug #502

g_hbond with -ins option - 4.5-beta3

Added by servaas empty almost 10 years ago. Updated almost 10 years ago.

analysis tools
Target version:
Affected version - extra info:
Affected version:


Using the -ins option of g_hbond is not working. I tried searching the list and the bugzilla for this but it did not give me any results. Below is what I think is going wrong here, I hope it is useful for you and the community:

Line 3336 of gmx_hbond.c set bSelected to TRUE if option -sel is used, which is not possible anymore. But on line 3851 is stated that bSelected and bInserted must be TRUE before solvent insertions are checked. So actually this option will not do anything anymore but one could still expect it to function since this option could in theory also be combined with the normal selection procedure (without -sel).

I also noticed some other problems with the code to compute the insertions itself. From the manual I understand that the purpose is here to find the hydrogen bond between to groups taking into account that there is a group of molecules that can form a bridge between the 2 groups.

This is what I found:

1. I noticed that when the grid is build the insertion group (I guess this is grI) is added to all other groups which should not be the case I guess. If I understood correctly all donors and acceptors are added to every groups at this point. For the grid structure we have: grid[zi][yi][xi].d[gr].atoms[i] but before the atoms are added to the grids it is not checked if they belong to the group gr (line 1319 for ac 1321 for don). An if statement like: if((bAcc&&hb->a.grp[i]==gr)||(!bAcc&&hb->d.grp[i]==gr)){
might help here.

2. Also the check for insertion is only done if there is allready a hbond, which might be the case, but is not necessarily so...
if(ihb) on line 3825

3. Finally the way that insertion is computed in the end is not very clear to me. A simpler way might be: check all donors in the insertion group having a hydrogen bond with j (acceptor) and all acceptors in the insertion group having a hbond with i. Then check to overlap, if there is no overlap it is not a bridging water molecule if there is we have a insertion....


#1 Updated by Rossen Apostolov almost 10 years ago

CC: Erik Marklund

#2 Updated by Erik Marklund almost 10 years ago

This functionality has always been mysterious to me and I have tried to keep away from any code related to it. I can have a crack at it, but I can't promise to have it done over the next couple of weeks. In fact, it'll probably take until mid-september until I even look at it.

#3 Updated by Erik Lindahl almost 10 years ago

g_hbond already suffers seriously from feature bloat and huge codebase that has lead to several bugs. If even the people working most with g_hbond aren't sure what it does or how to support it we should remove it, which I've dictatorially done in git commit a7a491d86a812ece7d5551e08cad85b7ce621075.

When/if we have a cleaner gmx_hbond() code base we can revive it, but that will have to be post-4.5 :-/

Also available in: Atom PDF