From e86fe9afdfb56d1e6f9627d9854cb93e1fee820c Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Thu, 26 Sep 2013 10:58:49 +0200
Subject: [PATCH] Fixed acceptand for HREX and NPT

The contribution from gromacs (DeltaP*DeltaV) should not
be counted with hrex. Indeed, this term is already included
in the foreign energy calculation.
---
 patches/gromacs-4.6.3.diff/src/kernel/repl_ex.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/patches/gromacs-4.6.3.diff/src/kernel/repl_ex.c b/patches/gromacs-4.6.3.diff/src/kernel/repl_ex.c
index e3a1078b6..5f9590f15 100644
--- a/patches/gromacs-4.6.3.diff/src/kernel/repl_ex.c
+++ b/patches/gromacs-4.6.3.diff/src/kernel/repl_ex.c
@@ -890,12 +890,6 @@ static real calc_delta(FILE *fplog, gmx_bool bPrint, struct gmx_repl_ex *re, int
         fprintf(fplog, "Repl %d <-> %d  dE_term = %10.3e (kT)\n", a, b, delta);
     }
 
-/* PLUMED */
-/* this is necessary because with plumed HREX the energy contribution is
-   already taken into account */
-    if(plumed_hrex) delta=0.0;
-/* END PLUMED */
-
     if (re->bNPT)
     {
         /* revist the calculation for 5.0.  Might be some improvements. */
@@ -1112,6 +1106,10 @@ test_for_replica_exchange(FILE                 *fplog,
             if (i % 2 == m)
             {
                 delta = calc_delta(fplog, bPrint, re, a, b, a, b);
+/* this is necessary because with plumed HREX the energy contribution is
+   already taken into account */
+                if(plumed_hrex) delta=0.0;
+
                 /* PLUMED */
                 if(plumedswitch){
                   real adb,bdb,dplumed;
-- 
GitLab