[gmx-developers] table allocations

David spoel at xray.bmc.uu.se
Sat Jun 15 20:02:14 CEST 2002


On Fri, 2002-06-14 at 23:59, Erik Lindahl wrote:
> Graham Smith wrote:
> > 
> > Isn't quite a lot of space currently wasted when fr->coultab and
> > fr->vdwtab are snew'ed in mdlib/force.c? 
> >   snew(fr->coultab,4*(fr->ntab+1)*sizeof(real));
> >   snew(fr->vdwtab,(tabelemsize-4)*(fr->ntab+1)*sizeof(real));  
> > 
> 
> The 4 isn't the size of 'float', but the number of entries; for each
> table point we need four values to do spline interpolations.
    I think Graham refers to the sizeof(real) which is indeed
    unnecessary. Thus we save a factor of four (eight for double) in the
    table size. It could even give a small performance increment for
    table lookups (caching). I removed the sizeof and the code works
    fine, is in CVS now. I didn't check the 12/16 argment.

 
-- 
Groeten, David.
________________________________________________________________________
Dr. David van der Spoel, 	Biomedical center, Dept. of Biochemistry
Husargatan 3, Box 576,  	75123 Uppsala, Sweden
phone:	46 18 471 4205		fax: 46 18 511 755
spoel at xray.bmc.uu.se	spoel at gromacs.org   http://zorn.bmc.uu.se/~spoel
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



More information about the gromacs.org_gmx-developers mailing list