Fix a table generation bug for pme-shift
authorErik Lindahl <erik@kth.se>
Wed, 8 Jul 2015 20:43:17 +0000 (22:43 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Wed, 29 Jul 2015 18:30:59 +0000 (20:30 +0200)
The shift correction was not applied correctly to PME and PME-user
tables, but a value of 0 was used instead. This will not have
influenced any normal runs since the shift correction is applied
directly (analytically) in the current kernels. In theory it
might have resulted in 10^-5 relative errors at the cutoff that
are only likely to be visible in double precision if you were
(1) using PME-user electrostatics with custom tables, and
(2) applying shift modifiers (switch is fine). This is not a
setup we are testing anyway, and the PME-user options are likely
to go soon.

Change-Id: Ibd4d2388713879a6613938929edc2cba142b7c9b

src/gromacs/mdlib/tables.c

index a6f3b202258c34933727e335b9a0528af29a2e12..c883d4afabfceb5154892a069d2254b6d584d640 100644 (file)
@@ -944,11 +944,11 @@ static void fill_table(t_tabledata *td, int tp, const t_forcerec *fr,
                 break;
             case etabEwald:
             case etabEwaldSwitch:
-                Vtab  = gmx_erfc(ewc*rc)/rc;
+                Vcut  = gmx_erfc(ewc*rc)/rc;
                 break;
             case etabEwaldUser:
                 /* Only calculate minus the reciprocal space contribution */
-                Vtab  = -gmx_erf(ewc*rc)/rc;
+                Vcut  = -gmx_erf(ewc*rc)/rc;
                 break;
             case etabRF:
             case etabRF_ZERO: