[gmx-developers] Bug in g_hbond

Anton Feenstra feenstra at few.vu.nl
Thu Mar 3 15:47:05 CET 2005


Michael Patra wrote:
[...]
> The solution to the problem is obvious:
> 
>         grididx[m]=x[ad[i]][m]/box[m][m]*ngrid[m];

But, it may be faster to actually do the math with 'invdelta' in double 
precision, by defining it as 'double' and add a bit of type-casting.
On most hardware I assume a 'double' multiplication will still be faster 
than a 'single' division.

> In addition, I wonder why x[] can be outside the box by at most a single
> box size - especially if trjconv -pbc nojump is used. Perhaps there is some
> pre-processing of the input data done somewhere in one of the library functions
> (I didn't check it). If not, perhaps one should replace the if-statements
> by while-statements.
> 
>       while( x[ad[i]][m] < 0 ) 
>         rvec_inc(x[ad[i]],box[m]);
>       while( x[ad[i]][m] >= box[m][m] ) 
>         rvec_dec(x[ad[i]],box[m]);

That was assuming you'd only read trajectories in g_hbond that were 
written by mdrun - then the atoms are at most one box off. In any other 
case, you're right and it had better be while statements (IIRC, there 
used to be while's, maybe they got optimized away, it would be slightly 
faster to check only once with an 'if').

Be aware that optimization in g_hbond may be very important if you, for 
example, want to look at water insertion in a peptide, you'd basically 
be calculating three-body interactions througout the trajectory.
A factor of 2 in speed can be the difference between one or two *days* 
of analysis in a case like that!

-- 
Groetjes,

Anton

* NOTE: New Phone & Fax numbers (below) *

  _____________ _______________________________________________________
|             |                                                       |
|  _   _  ___,| K. Anton Feenstra                                     |
| / \ / \'| | | Dept. of Pharmacochem. - Vrije Universiteit Amsterdam |
|(   |   )| | | De Boelelaan 1083 - 1081 HV Amsterdam - Netherlands   |
| \_/ \_/ | | | Tel: +31 20 59 87608 - Fax: +31 20 59 87610           |
|             | Feenstra at few.vu.nl - www.few.vu.nl/~feenstra/         |
|             | "If You See Me Getting High, Knock Me Down" (RHCP)    |
|_____________|_______________________________________________________|




More information about the gromacs.org_gmx-developers mailing list