Issues in PPPM: ifact, unit conversion for accuracy measurement

Dear all:

Rolf, one of the graduate students in my group, has come across some potential issues in the PPPM routine.

(1) We were doing some calculations and noticed that there were some discrepancies in the energies as a function of the order. Orders 1-6 gave consistent results, but order 7 was off by a few percent.

After some hunting, he isolated the problem in the declaration of the variable ifact in pppm.cpp:

int ifact = 1;
for (k = 1; k < 2*order; k++) ifact *= k;

The problem with this declaration is that on a system where int is 32 bits, MAX_INT = 2,147,483,647, while ifact for order 7 should be set to 6,227,020,800. Clearly an unsigned int isn’t enough, so either making ifact a 64-bit integer or writing a special case to do order = 7 is required.

(2) There also appears to be an issue in the calculation of the error measure. There appears to be a conversion factor missing to change the units from (e^2/A^2) to (kcal/mol/A). This leads to an insufficient number of grid points being used relative to the actual accuracy desired. (The missing factor appears to be about 330.)

Thanks,

–AEI

Dear all:

Rolf, one of the graduate students in my group, has come across some potential issues in the PPPM routine.

(1) We were doing some calculations and noticed that there were some discrepancies in the energies as a function of the order. Orders 1-6 gave consistent results, but order 7 was off by a few percent.

After some hunting, he isolated the problem in the declaration of the variable ifact in pppm.cpp:

int ifact = 1;
for (k = 1; k < 2*order; k++) ifact *= k;

The problem with this declaration is that on a system where int is 32 bits, MAX_INT = 2,147,483,647, while ifact for order 7 should be set to 6,227,020,800. Clearly an unsigned int isn’t enough, so either making ifact a 64-bit integer or writing a special case to do order = 7 is required.

Or just not allow an order of 7 or more. I remember doing benchmarks and never finding a case where an order of more than 5 was beneficial.

(2) There also appears to be an issue in the calculation of the error measure. There appears to be a conversion factor missing to change the units from (e^2/A^2) to (kcal/mol/A). This leads to an insufficient number of grid points being used relative to the actual accuracy desired. (The missing factor appears to be about 330.)

Interesting. I remember having trouble with getting bad grid estimates for systems with a low percentage of charged coarse grain particles. We thus switched to setting grids explicitly. Perhaps this finding explains that.

Thanks,
Axel

(2) There also appears to be an issue in the calculation of the error measure. There appears to be a conversion

factor missing to change the units from (e^2/A^2) to (kcal/mol/A). This leads to an insufficient number of grid

points being used relative to the actual accuracy desired. (The missing factor appears to be about 330.)

Interesting. I remember having trouble with getting bad grid estimates for systems with a low percentage of
charged coarse grain particles. We thus switched to setting grids explicitly. Perhaps this finding explains
that.

Yes, I’ve run into this as well. I think I know where the problem lies and will look into a fix.

Paul