Fix LJPME Lorentz-Berthelot combination rules
authorErik Lindahl <erik@kth.se>
Wed, 25 Jun 2014 17:41:12 +0000 (19:41 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Fri, 27 Jun 2014 18:01:07 +0000 (20:01 +0200)
Christian found a bug in the way we evaluate
arithmetic combination rules for LJ-PME reciprocal
space. With this change, both group and verlet kernels
produce virtually identical total energies for both
types of reciprocal-space combination rules. It does
not affect the (default) geometric LJPME case.

Change-Id: I4bb0de1df9588dce3ca94e39a370a0b994b25b53

src/gromacs/mdlib/forcerec.c

index 3b2d69ca048b06ff393bba9d74c54d8412632532..2ea1e549c84130320b034463525f6ceeb419c4be 100644 (file)
@@ -218,8 +218,8 @@ static real *mk_nbfp_combination_rule(const gmx_ffparams_t *idef, int comb_rule)
                 sigmaj = pow(c12j / c6j, 1.0/6.0);
                 epsi   = c6i * c6i / c12i;
                 epsj   = c6j * c6j / c12j;
-                c6     = epsi * epsj * pow(0.5*(sigmai+sigmaj), 6);
-                c12    = epsi * epsj * pow(0.5*(sigmai+sigmaj), 12);
+                c6     = sqrt(epsi * epsj) * pow(0.5*(sigmai+sigmaj), 6);
+                c12    = sqrt(epsi * epsj) * pow(0.5*(sigmai+sigmaj), 12);
             }
             C6(nbfp, atnr, i, j)   = c6*6.0;
             C12(nbfp, atnr, i, j)  = c12*12.0;