[gmx-developers] table allocations

Erik Lindahl lindahl at stanford.edu
Fri Jun 14 23:59:40 CEST 2002

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 (fr->ntab+1)*sizeof(real) needs only to be (fr->ntab+1)+1, 
> as is is when fr->coulvdwtab is allocated in tables.c 
>   snew(fr->coulvdwtab,12*(nx+1)+1);
> I presume the tables.c code is never called to tabulate a buckingham 
> potential, only for user-defined potentials, so there is no
> danger you'd ever need 16 not 12? 

Not sure about this; in theory it might be tabulated when if you
do free energy runs, but I don't think anyone would use bham when we
have softcore. In any case I'll change it - it won't hurt :-)



More information about the gromacs.org_gmx-developers mailing list