From 7ec6eb4cb443e031f1a65d900be8c1f4bccd536f Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Wed, 15 Jun 2016 14:34:41 +0200
Subject: [PATCH] Fix on -hrex with NPT

With -hrex, there was a term missing in the acceptance. This
is fixed now.
---
 patches/gromacs-5.1.2.diff/src/programs/mdrun/repl_ex.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/patches/gromacs-5.1.2.diff/src/programs/mdrun/repl_ex.cpp b/patches/gromacs-5.1.2.diff/src/programs/mdrun/repl_ex.cpp
index 63eac8236..e799bc669 100644
--- a/patches/gromacs-5.1.2.diff/src/programs/mdrun/repl_ex.cpp
+++ b/patches/gromacs-5.1.2.diff/src/programs/mdrun/repl_ex.cpp
@@ -895,6 +895,11 @@ 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);
     }
+
+/* this is necessary because with plumed HREX the energy contribution is
+   already taken into account */
+    if(plumed_hrex) delta=0.0;
+
     if (re->bNPT)
     {
         /* revist the calculation for 5.0.  Might be some improvements. */
@@ -1117,9 +1122,6 @@ 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){
-- 
GitLab