[gmx-developers] Cubic spline accuracy
hessb at mpip-mainz.mpg.de
Tue Sep 5 15:52:35 CEST 2006
> If we prescribe V and V' at table points the relative error in the second
> derivative at a table point is:
> V'''' h^2/(3 V'')
> where h is the table spacing (if I did not make a mistake in my math).
> The jump in the second derivative is double this.
> Even for the r^-12 LJ repulsion this error is very small with h=1/500 nm.
I did make a mistake in my math.
With V+V' matching splines
The maximum error in V is halfway between two table points: V'''' h^4 /384
The maximum error in V' is at a quarter between points: V'''' h^3 /128
The maximum error in V'' is at table points: V'''' h^2 /12 (the jump is
With the current V+V'' matching splines:
The maximum error in V is halfway between two table points: V'''' h^4 5/384
The maximum error in V' is at table points: V'''' h^3 /24 (the jump is
The maximum error in V'' is halfway points: V'''' h^2 /8
The potential with the largest 4th derivative is the LJ potential.
At short distances V'''' goes as r^-16.
In single precision we use a table spacing of h=1/500 nm.
For oxygen in SPC water at 0.25 nm (the distance of closest approach)
the jump in the force is: 0.02 kJ/mol nm,
at 0.28 nm (the rdf peak) the jump is: 0.004 kJ/mol nm
compared to an average force of 1000 kJ/mol nm.
The errors in V are beyond the single precision.
When we switch to V' matching we get rid of the jump in V'
and the errors in V and V' are 5 times smaller.
We can then change the spacing to 1/200 nm and have an error
for V' for the SPC oxygen of 0.03 kJ/mol nm at 0.25 nm and 0.005 at 0.28 nm.
But the advantage of continuous V' is that the integration is more accurate
and therefore one can increase the table spacing more, say to 1/100 nm
if one does not mind that V and V' are not up to the last digit the LJ
between table points.
So I would suggest a default of 1/200 nm for single precision
and 1/1000 nm for double precision.
In single precision I did not notice a performance difference
on an AMD64 when going from 1/500 to 1/200.
In double precision I get a 5% speed-up when going from 1/2000 to 1/1000.
More information about the gromacs.org_gmx-developers