From a6ba354a3905bac7cdb543f8643bdc4b3d14c6e6 Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Tue, 3 Oct 2017 21:27:02 +0200
Subject: [PATCH] Updated gromacs to 2016.4

---
 ...cs-2016.3.config => gromacs-2016.4.config} |  0
 .../src/gromacs/CMakeLists.txt                |  0
 .../src/gromacs/CMakeLists.txt.preplumed      |  0
 .../src/gromacs/mdlib/force.cpp               |  0
 .../src/gromacs/mdlib/force.cpp.preplumed     |  0
 .../src/gromacs/mdlib/minimize.cpp            |  0
 .../src/gromacs/mdlib/minimize.cpp.preplumed  |  0
 .../src/programs/mdrun/md.cpp                 | 41 +++++++++++--------
 .../src/programs/mdrun/md.cpp.preplumed       | 41 +++++++++++--------
 .../src/programs/mdrun/mdrun.cpp              |  4 +-
 .../src/programs/mdrun/mdrun.cpp.preplumed    |  4 +-
 .../src/programs/mdrun/repl_ex.cpp            |  0
 .../src/programs/mdrun/repl_ex.cpp.preplumed  |  0
 .../src/programs/mdrun/runner.cpp             |  0
 .../src/programs/mdrun/runner.cpp.preplumed   |  0
 15 files changed, 52 insertions(+), 38 deletions(-)
 rename patches/{gromacs-2016.3.config => gromacs-2016.4.config} (100%)
 rename patches/{gromacs-2016.3.diff => gromacs-2016.4.diff}/src/gromacs/CMakeLists.txt (100%)
 rename patches/{gromacs-2016.3.diff => gromacs-2016.4.diff}/src/gromacs/CMakeLists.txt.preplumed (100%)
 rename patches/{gromacs-2016.3.diff => gromacs-2016.4.diff}/src/gromacs/mdlib/force.cpp (100%)
 rename patches/{gromacs-2016.3.diff => gromacs-2016.4.diff}/src/gromacs/mdlib/force.cpp.preplumed (100%)
 rename patches/{gromacs-2016.3.diff => gromacs-2016.4.diff}/src/gromacs/mdlib/minimize.cpp (100%)
 rename patches/{gromacs-2016.3.diff => gromacs-2016.4.diff}/src/gromacs/mdlib/minimize.cpp.preplumed (100%)
 rename patches/{gromacs-2016.3.diff => gromacs-2016.4.diff}/src/programs/mdrun/md.cpp (98%)
 rename patches/{gromacs-2016.3.diff => gromacs-2016.4.diff}/src/programs/mdrun/md.cpp.preplumed (98%)
 rename patches/{gromacs-2016.3.diff => gromacs-2016.4.diff}/src/programs/mdrun/mdrun.cpp (99%)
 rename patches/{gromacs-2016.3.diff => gromacs-2016.4.diff}/src/programs/mdrun/mdrun.cpp.preplumed (99%)
 rename patches/{gromacs-2016.3.diff => gromacs-2016.4.diff}/src/programs/mdrun/repl_ex.cpp (100%)
 rename patches/{gromacs-2016.3.diff => gromacs-2016.4.diff}/src/programs/mdrun/repl_ex.cpp.preplumed (100%)
 rename patches/{gromacs-2016.3.diff => gromacs-2016.4.diff}/src/programs/mdrun/runner.cpp (100%)
 rename patches/{gromacs-2016.3.diff => gromacs-2016.4.diff}/src/programs/mdrun/runner.cpp.preplumed (100%)

diff --git a/patches/gromacs-2016.3.config b/patches/gromacs-2016.4.config
similarity index 100%
rename from patches/gromacs-2016.3.config
rename to patches/gromacs-2016.4.config
diff --git a/patches/gromacs-2016.3.diff/src/gromacs/CMakeLists.txt b/patches/gromacs-2016.4.diff/src/gromacs/CMakeLists.txt
similarity index 100%
rename from patches/gromacs-2016.3.diff/src/gromacs/CMakeLists.txt
rename to patches/gromacs-2016.4.diff/src/gromacs/CMakeLists.txt
diff --git a/patches/gromacs-2016.3.diff/src/gromacs/CMakeLists.txt.preplumed b/patches/gromacs-2016.4.diff/src/gromacs/CMakeLists.txt.preplumed
similarity index 100%
rename from patches/gromacs-2016.3.diff/src/gromacs/CMakeLists.txt.preplumed
rename to patches/gromacs-2016.4.diff/src/gromacs/CMakeLists.txt.preplumed
diff --git a/patches/gromacs-2016.3.diff/src/gromacs/mdlib/force.cpp b/patches/gromacs-2016.4.diff/src/gromacs/mdlib/force.cpp
similarity index 100%
rename from patches/gromacs-2016.3.diff/src/gromacs/mdlib/force.cpp
rename to patches/gromacs-2016.4.diff/src/gromacs/mdlib/force.cpp
diff --git a/patches/gromacs-2016.3.diff/src/gromacs/mdlib/force.cpp.preplumed b/patches/gromacs-2016.4.diff/src/gromacs/mdlib/force.cpp.preplumed
similarity index 100%
rename from patches/gromacs-2016.3.diff/src/gromacs/mdlib/force.cpp.preplumed
rename to patches/gromacs-2016.4.diff/src/gromacs/mdlib/force.cpp.preplumed
diff --git a/patches/gromacs-2016.3.diff/src/gromacs/mdlib/minimize.cpp b/patches/gromacs-2016.4.diff/src/gromacs/mdlib/minimize.cpp
similarity index 100%
rename from patches/gromacs-2016.3.diff/src/gromacs/mdlib/minimize.cpp
rename to patches/gromacs-2016.4.diff/src/gromacs/mdlib/minimize.cpp
diff --git a/patches/gromacs-2016.3.diff/src/gromacs/mdlib/minimize.cpp.preplumed b/patches/gromacs-2016.4.diff/src/gromacs/mdlib/minimize.cpp.preplumed
similarity index 100%
rename from patches/gromacs-2016.3.diff/src/gromacs/mdlib/minimize.cpp.preplumed
rename to patches/gromacs-2016.4.diff/src/gromacs/mdlib/minimize.cpp.preplumed
diff --git a/patches/gromacs-2016.3.diff/src/programs/mdrun/md.cpp b/patches/gromacs-2016.4.diff/src/programs/mdrun/md.cpp
similarity index 98%
rename from patches/gromacs-2016.3.diff/src/programs/mdrun/md.cpp
rename to patches/gromacs-2016.4.diff/src/programs/mdrun/md.cpp
index 548037ceb..f3b524385 100644
--- a/patches/gromacs-2016.3.diff/src/programs/mdrun/md.cpp
+++ b/patches/gromacs-2016.4.diff/src/programs/mdrun/md.cpp
@@ -517,11 +517,11 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
                                         repl_ex_nst, repl_ex_nex, repl_ex_seed);
     }
 
-    /* PME tuning is only supported with PME for Coulomb. Is is not supported
-     * with only LJ PME, or for reruns.
-     */
+    /* PME tuning is only supported in the Verlet scheme, with PME for
+     * Coulomb. It is not supported with only LJ PME, or for
+     * reruns. */
     bPMETune = ((Flags & MD_TUNEPME) && EEL_PME(fr->eeltype) && !bRerunMD &&
-                !(Flags & MD_REPRODUCIBLE));
+                !(Flags & MD_REPRODUCIBLE) && ir->cutoff_scheme != ecutsGROUP);
     if (bPMETune)
     {
         pme_loadbal_init(&pme_loadbal, cr, fplog, ir, state->box,
@@ -625,11 +625,6 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
             copy_mat(ekind->tcstat[i].ekinh, ekind->tcstat[i].ekinh_old);
         }
     }
-    if (ir->eI != eiVV)
-    {
-        enerd->term[F_TEMP] *= 2; /* result of averages being done over previous and current step,
-                                     and there is no previous step */
-    }
 
     /* need to make an initiation call to get the Trotter variables set, as well as other constants for non-trotter
        temperature control */
@@ -637,16 +632,28 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
 
     if (MASTER(cr))
     {
-        if (constr && !ir->bContinuation && ir->eConstrAlg == econtLINCS)
+        if (!ir->bContinuation)
         {
-            fprintf(fplog,
-                    "RMS relative constraint deviation after constraining: %.2e\n",
-                    constr_rmsd(constr));
-        }
-        if (EI_STATE_VELOCITY(ir->eI))
-        {
-            fprintf(fplog, "Initial temperature: %g K\n", enerd->term[F_TEMP]);
+            if (constr && ir->eConstrAlg == econtLINCS)
+            {
+                fprintf(fplog,
+                        "RMS relative constraint deviation after constraining: %.2e\n",
+                        constr_rmsd(constr));
+            }
+            if (EI_STATE_VELOCITY(ir->eI))
+            {
+                real temp = enerd->term[F_TEMP];
+                if (ir->eI != eiVV)
+                {
+                    /* Result of Ekin averaged over velocities of -half
+                     * and +half step, while we only have -half step here.
+                     */
+                    temp *= 2;
+                }
+                fprintf(fplog, "Initial temperature: %g K\n", temp);
+            }
         }
+
         if (bRerunMD)
         {
             fprintf(stderr, "starting md rerun '%s', reading coordinates from"
diff --git a/patches/gromacs-2016.3.diff/src/programs/mdrun/md.cpp.preplumed b/patches/gromacs-2016.4.diff/src/programs/mdrun/md.cpp.preplumed
similarity index 98%
rename from patches/gromacs-2016.3.diff/src/programs/mdrun/md.cpp.preplumed
rename to patches/gromacs-2016.4.diff/src/programs/mdrun/md.cpp.preplumed
index 8cf138636..bbb8e5975 100644
--- a/patches/gromacs-2016.3.diff/src/programs/mdrun/md.cpp.preplumed
+++ b/patches/gromacs-2016.4.diff/src/programs/mdrun/md.cpp.preplumed
@@ -504,11 +504,11 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
                                         repl_ex_nst, repl_ex_nex, repl_ex_seed);
     }
 
-    /* PME tuning is only supported with PME for Coulomb. Is is not supported
-     * with only LJ PME, or for reruns.
-     */
+    /* PME tuning is only supported in the Verlet scheme, with PME for
+     * Coulomb. It is not supported with only LJ PME, or for
+     * reruns. */
     bPMETune = ((Flags & MD_TUNEPME) && EEL_PME(fr->eeltype) && !bRerunMD &&
-                !(Flags & MD_REPRODUCIBLE));
+                !(Flags & MD_REPRODUCIBLE) && ir->cutoff_scheme != ecutsGROUP);
     if (bPMETune)
     {
         pme_loadbal_init(&pme_loadbal, cr, fplog, ir, state->box,
@@ -612,11 +612,6 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
             copy_mat(ekind->tcstat[i].ekinh, ekind->tcstat[i].ekinh_old);
         }
     }
-    if (ir->eI != eiVV)
-    {
-        enerd->term[F_TEMP] *= 2; /* result of averages being done over previous and current step,
-                                     and there is no previous step */
-    }
 
     /* need to make an initiation call to get the Trotter variables set, as well as other constants for non-trotter
        temperature control */
@@ -624,16 +619,28 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
 
     if (MASTER(cr))
     {
-        if (constr && !ir->bContinuation && ir->eConstrAlg == econtLINCS)
+        if (!ir->bContinuation)
         {
-            fprintf(fplog,
-                    "RMS relative constraint deviation after constraining: %.2e\n",
-                    constr_rmsd(constr));
-        }
-        if (EI_STATE_VELOCITY(ir->eI))
-        {
-            fprintf(fplog, "Initial temperature: %g K\n", enerd->term[F_TEMP]);
+            if (constr && ir->eConstrAlg == econtLINCS)
+            {
+                fprintf(fplog,
+                        "RMS relative constraint deviation after constraining: %.2e\n",
+                        constr_rmsd(constr));
+            }
+            if (EI_STATE_VELOCITY(ir->eI))
+            {
+                real temp = enerd->term[F_TEMP];
+                if (ir->eI != eiVV)
+                {
+                    /* Result of Ekin averaged over velocities of -half
+                     * and +half step, while we only have -half step here.
+                     */
+                    temp *= 2;
+                }
+                fprintf(fplog, "Initial temperature: %g K\n", temp);
+            }
         }
+
         if (bRerunMD)
         {
             fprintf(stderr, "starting md rerun '%s', reading coordinates from"
diff --git a/patches/gromacs-2016.3.diff/src/programs/mdrun/mdrun.cpp b/patches/gromacs-2016.4.diff/src/programs/mdrun/mdrun.cpp
similarity index 99%
rename from patches/gromacs-2016.3.diff/src/programs/mdrun/mdrun.cpp
rename to patches/gromacs-2016.4.diff/src/programs/mdrun/mdrun.cpp
index 2c3906175..cf0f72cf8 100644
--- a/patches/gromacs-2016.3.diff/src/programs/mdrun/mdrun.cpp
+++ b/patches/gromacs-2016.4.diff/src/programs/mdrun/mdrun.cpp
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -378,7 +378,7 @@ int gmx_mdrun(int argc, char *argv[])
         { "-nstlist", FALSE, etINT, {&nstlist},
           "Set nstlist when using a Verlet buffer tolerance (0 is guess)" },
         { "-tunepme", FALSE, etBOOL, {&bTunePME},
-          "Optimize PME load between PP/PME ranks or GPU/CPU" },
+          "Optimize PME load between PP/PME ranks or GPU/CPU (only with the Verlet cut-off scheme)" },
         { "-v",       FALSE, etBOOL, {&bVerbose},
           "Be loud and noisy" },
         { "-pforce",  FALSE, etREAL, {&pforce},
diff --git a/patches/gromacs-2016.3.diff/src/programs/mdrun/mdrun.cpp.preplumed b/patches/gromacs-2016.4.diff/src/programs/mdrun/mdrun.cpp.preplumed
similarity index 99%
rename from patches/gromacs-2016.3.diff/src/programs/mdrun/mdrun.cpp.preplumed
rename to patches/gromacs-2016.4.diff/src/programs/mdrun/mdrun.cpp.preplumed
index 7829a823a..798f76827 100644
--- a/patches/gromacs-2016.3.diff/src/programs/mdrun/mdrun.cpp.preplumed
+++ b/patches/gromacs-2016.4.diff/src/programs/mdrun/mdrun.cpp.preplumed
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -370,7 +370,7 @@ int gmx_mdrun(int argc, char *argv[])
         { "-nstlist", FALSE, etINT, {&nstlist},
           "Set nstlist when using a Verlet buffer tolerance (0 is guess)" },
         { "-tunepme", FALSE, etBOOL, {&bTunePME},
-          "Optimize PME load between PP/PME ranks or GPU/CPU" },
+          "Optimize PME load between PP/PME ranks or GPU/CPU (only with the Verlet cut-off scheme)" },
         { "-v",       FALSE, etBOOL, {&bVerbose},
           "Be loud and noisy" },
         { "-pforce",  FALSE, etREAL, {&pforce},
diff --git a/patches/gromacs-2016.3.diff/src/programs/mdrun/repl_ex.cpp b/patches/gromacs-2016.4.diff/src/programs/mdrun/repl_ex.cpp
similarity index 100%
rename from patches/gromacs-2016.3.diff/src/programs/mdrun/repl_ex.cpp
rename to patches/gromacs-2016.4.diff/src/programs/mdrun/repl_ex.cpp
diff --git a/patches/gromacs-2016.3.diff/src/programs/mdrun/repl_ex.cpp.preplumed b/patches/gromacs-2016.4.diff/src/programs/mdrun/repl_ex.cpp.preplumed
similarity index 100%
rename from patches/gromacs-2016.3.diff/src/programs/mdrun/repl_ex.cpp.preplumed
rename to patches/gromacs-2016.4.diff/src/programs/mdrun/repl_ex.cpp.preplumed
diff --git a/patches/gromacs-2016.3.diff/src/programs/mdrun/runner.cpp b/patches/gromacs-2016.4.diff/src/programs/mdrun/runner.cpp
similarity index 100%
rename from patches/gromacs-2016.3.diff/src/programs/mdrun/runner.cpp
rename to patches/gromacs-2016.4.diff/src/programs/mdrun/runner.cpp
diff --git a/patches/gromacs-2016.3.diff/src/programs/mdrun/runner.cpp.preplumed b/patches/gromacs-2016.4.diff/src/programs/mdrun/runner.cpp.preplumed
similarity index 100%
rename from patches/gromacs-2016.3.diff/src/programs/mdrun/runner.cpp.preplumed
rename to patches/gromacs-2016.4.diff/src/programs/mdrun/runner.cpp.preplumed
-- 
GitLab