Fix LJcorrection behavior in alchemical simulations 08/4808/2
authorradakb <brian.radak@gmail.com>
Tue, 13 Nov 2018 15:08:59 +0000 (10:08 -0500)
committerradakb <brian.radak@gmail.com>
Tue, 13 Nov 2018 15:18:17 +0000 (10:18 -0500)
The alchemical tail correction previously used the fixed value of
alchLambda2 rather than the IDWS-enabled getter function
SimParameters->getCurrentLambda2(). This produces incorrect comparison
energies when performing FEP w/IDWS.

A separate error also could have occured if combining nonbondedScaling
with TI (probably never been done before). The TI derivatives now use
the correct Molecule->getEnergyTailCorr() getter function which includes
the scale factor.

Change-Id: Ibed7793c4f6625f0fc8118d4271f413ca2755b1c

src/Controller.C

index 8ef5c41..af0a937 100644 (file)
@@ -3055,13 +3055,12 @@ void Controller::printEnergies(int step, int minimize)
       ljEnergy += molecule->getEnergyTailCorr(alchLambda) / volume;
 
       if (simParameters->alchOn) {
-        BigReal alchLambda2 = simParameters->alchLambda2;
         if (simParameters->alchFepOn) {
+          BigReal alchLambda2 = simParameters->getCurrentLambda2(step);
           ljEnergy_f += molecule->getEnergyTailCorr(alchLambda2) / volume;
-        } else if (simParameters->alchThermIntOn && 
-                   simParameters->alchVdwLambdaEnd) {
-          ljEnergy_ti_1 += molecule->tail_corr_dUdl_1 / volume;
-          ljEnergy_ti_2 += molecule->tail_corr_dUdl_2 / volume;
+        } else if (simParameters->alchThermIntOn) {
+          ljEnergy_ti_1 += molecule->getEnergyTailCorr(1.0) / volume;
+          ljEnergy_ti_2 += molecule->getEnergyTailCorr(0.0) / volume;
         }
       }
 #endif