Removed rounding issue in nbnxn Ewald table
authorBerk Hess <hess@kth.se>
Mon, 9 Jun 2014 13:12:12 +0000 (15:12 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Tue, 17 Jun 2014 13:42:57 +0000 (15:42 +0200)
The nbnxn Ewald table could got the spacing dx passed as a real.
Changing this to double improves the accuracy of the single precision
table by two orders of magnitude, because rounding errors are avoided.

Change-Id: I11b6c27bd3f4e306c412da8f01761b03dc337ce7

include/tables.h
src/mdlib/tables.c

index defdd3f4a559c19278fb96d6513811e01b4fbb92..5658125dbb78398f13d6d1c671a209b1903778b8 100644 (file)
@@ -48,12 +48,12 @@ extern "C" {
 #endif
 
 GMX_LIBMD_EXPORT
-void table_spline3_fill_ewald_lr(real *table_F,
-                                 real *table_V,
-                                 real *table_FDV0,
-                                 int   ntab,
-                                 real  dx,
-                                 real  beta);
+void table_spline3_fill_ewald_lr(real  *table_F,
+                                 real  *table_V,
+                                 real  *table_FDV0,
+                                 int    ntab,
+                                 double dx,
+                                 real   beta);
 /* Fill tables of ntab points with spacing dr with the ewald long-range
  * (mesh) force.
  * There are three separate tables with format FDV0, F, and V.
index fc6df57e8d32de4d8582d954c99cb92f6f596d42..a994d227310aab18e1b4cbc9432fb875d0950d87 100644 (file)
@@ -143,12 +143,12 @@ static double v_ewald_lr(double beta, double r)
     }
 }
 
-void table_spline3_fill_ewald_lr(real *table_f,
-                                 real *table_v,
-                                 real *table_fdv0,
-                                 int   ntab,
-                                 real  dx,
-                                 real  beta)
+void table_spline3_fill_ewald_lr(real  *table_f,
+                                 real  *table_v,
+                                 real  *table_fdv0,
+                                 int    ntab,
+                                 double dx,
+                                 real   beta)
 {
     real     tab_max;
     int      i, i_inrange;