From 8d19511de045f631713fe5b4a3c77e9d3738260b Mon Sep 17 00:00:00 2001 From: Erik Lindahl Date: Thu, 22 Nov 2012 18:28:45 +0100 Subject: [PATCH] Fixed LJ-14 error in free energy This bug was introduced when I implemented the new separate 1,4-evaluation of free energies, and failed to take the now-included 6.0 & 12.0 prefactors in c6 & c12 into account. The net effect is merely that it altered the softcore power slightly, which caused it to deviate somewhat from the reference value in the regression testing. Change-Id: I70fb7e6da7186b0f10b654d060e1e1275f3676e9 --- src/gmxlib/nonbonded/nb_free_energy.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gmxlib/nonbonded/nb_free_energy.c b/src/gmxlib/nonbonded/nb_free_energy.c index 9400c8a899..a4bbe5b512 100644 --- a/src/gmxlib/nonbonded/nb_free_energy.c +++ b/src/gmxlib/nonbonded/nb_free_energy.c @@ -638,8 +638,11 @@ nb_free_energy_evaluate_single(real r2,real sc_r_power,real alpha_coul,real alph { if((c6[i] > 0) && (c12[i] > 0)) { - sigma6[i] = c12[i]/c6[i]; - sigma2[i] = pow(c12[i]/c6[i],1.0/3.0); + /* The c6 & c12 coefficients now contain the constants 6.0 and 12.0, respectively. + * Correct for this by multiplying with (1/12.0)/(1/6.0)=6.0/12.0=0.5. + */ + sigma6[i] = 0.5*c12[i]/c6[i]; + sigma2[i] = pow(0.5*c12[i]/c6[i],1.0/3.0); /* should be able to get rid of this ^^^ internal pow call eventually. Will require agreement on what data to store externally. Can't be fixed without larger scale changes, so not 4.6 */ if (sigma6[i] < sigma6_min) { /* for disappearing coul and vdw with soft core at the same time */ -- 2.11.4.GIT