When loading AWH user data do not convolve the bias along FEP dims.
authorMagnus Lundborg <lundborg.magnus@gmail.com>
Thu, 15 Oct 2020 10:17:03 +0000 (12:17 +0200)
committerPaul Bauer <paul.bauer.q@gmail.com>
Fri, 16 Oct 2020 11:58:18 +0000 (11:58 +0000)
Fixes: #3736.

src/gromacs/applied_forces/awh/biasstate.cpp

index a64e8e6038d9cfc1dd383c41634c8a42c1aa9491..c248699916bce5910114656c06fad4e8407cdb31 100644 (file)
@@ -314,15 +314,19 @@ void BiasState::calcConvolvedPmf(const std::vector<DimParams>& dimParams,
         const GridPoint& point             = grid.point(m);
         for (auto& neighbor : point.neighbor)
         {
-            /* The negative PMF is a positive bias. */
-            double biasNeighbor = -pmf[neighbor];
-
-            /* Add the convolved PMF weights for the neighbors of this point.
-               Note that this function only adds point within the target > 0 region.
-               Sum weights, take the logarithm last to get the free energy. */
-            double logWeight = biasedLogWeightFromPoint(dimParams, points_, grid, neighbor,
-                                                        biasNeighbor, point.coordValue, {}, m);
-            freeEnergyWeights += std::exp(logWeight);
+            /* Do not convolve the bias along a lambda axis - only use the pmf from the current point */
+            if (!pointsHaveDifferentLambda(grid, m, neighbor))
+            {
+                /* The negative PMF is a positive bias. */
+                double biasNeighbor = -pmf[neighbor];
+
+                /* Add the convolved PMF weights for the neighbors of this point.
+                Note that this function only adds point within the target > 0 region.
+                Sum weights, take the logarithm last to get the free energy. */
+                double logWeight = biasedLogWeightFromPoint(dimParams, points_, grid, neighbor,
+                                                            biasNeighbor, point.coordValue, {}, m);
+                freeEnergyWeights += std::exp(logWeight);
+            }
         }
 
         GMX_RELEASE_ASSERT(freeEnergyWeights > 0,