[gmx-users] memory problem of g_hbond?

Erik Marklund erikm at xray.bmc.uu.se
Mon May 23 11:05:01 CEST 2011


Baofu Qiao skrev 2011-05-23 10.47:
> Hi all,
>
> Very recently, I meet a problem when using g_hbond (gromacs 4.5.3 with 
> the bugfixed)
> *********************************
> Select a group: Selected 1: 'SOL'
> Select a group: Selected 1: 'SOL'
> Calculating hydrogen bonds in SOL (98280 atoms)
> Found 32760 donors and 32760 acceptors
> *Segmentation fault*
> *********************************
> I check the code of gmx_hbond.c. The problem comes from the function 
> of "mk_hbmap". However, g_hbond doesn't complain  
> "gmx_fatal(FARGS,"Could not allocate enough memory for hbmap")' while 
> giving the "Segmentation fault". My first guess is 1) the function 
> doesn't work correctly; 2) there is no enough memory for 32760 donors 
> and 32760 acceptors.
>
> What I really want to calculate is the HB correlation function is some 
> slab structure of thickness of about 3ns, where there is only ~3000 
> waters. Can someone give me some suggestions? Thanks a lot!
>
> best regards,
> Baofu Qiao
>
That sounds like a memory problem indeed, and it could be outside the 
control of g_hbond. From the manpages of malloc:

"By default, Linux follows an  optimistic  memory  allocation  strategy. 
This  means  that  when malloc() returns non-NULL there is no guarantee 
that the memory really is available. This is a really bad bug."

g_hbond checks for NULL pointers to decide whether snew() was successful 
or not. Hence the menetioned bug could be the culprit. That said, the 
hbmap of your system requires 32760^2 pointers (> 8 Gb on 64 bit 
systems) that in turn points to existence arrays with size that scales 
with trajectory length. Hence you will easily run out of memory. I 
suggest that you build the acf for a subset of your system, e.g. 1000 
waters. The acf will converge slower, but have the same features. You 
can do this many times and take an average for better statistics.

Cheers,

-- 
-----------------------------------------------
Erik Marklund, PhD student
Dept. of Cell and Molecular Biology, Uppsala University.
Husargatan 3, Box 596,    75124 Uppsala, Sweden
phone:    +46 18 471 4537        fax: +46 18 511 755
erikm at xray.bmc.uu.se    http://folding.bmc.uu.se/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-users/attachments/20110523/97f0840f/attachment.html>


More information about the gromacs.org_gmx-users mailing list