diff --git a/patches/gromacs-2018.4.config b/patches/gromacs-2018.5.config
similarity index 100%
rename from patches/gromacs-2018.4.config
rename to patches/gromacs-2018.5.config
diff --git a/patches/gromacs-2018.4.diff/src/gromacs/CMakeLists.txt b/patches/gromacs-2018.5.diff/src/gromacs/CMakeLists.txt
similarity index 100%
rename from patches/gromacs-2018.4.diff/src/gromacs/CMakeLists.txt
rename to patches/gromacs-2018.5.diff/src/gromacs/CMakeLists.txt
diff --git a/patches/gromacs-2018.4.diff/src/gromacs/CMakeLists.txt.preplumed b/patches/gromacs-2018.5.diff/src/gromacs/CMakeLists.txt.preplumed
similarity index 100%
rename from patches/gromacs-2018.4.diff/src/gromacs/CMakeLists.txt.preplumed
rename to patches/gromacs-2018.5.diff/src/gromacs/CMakeLists.txt.preplumed
diff --git a/patches/gromacs-2018.4.diff/src/gromacs/mdlib/force.cpp b/patches/gromacs-2018.5.diff/src/gromacs/mdlib/force.cpp
similarity index 100%
rename from patches/gromacs-2018.4.diff/src/gromacs/mdlib/force.cpp
rename to patches/gromacs-2018.5.diff/src/gromacs/mdlib/force.cpp
diff --git a/patches/gromacs-2018.4.diff/src/gromacs/mdlib/force.cpp.preplumed b/patches/gromacs-2018.5.diff/src/gromacs/mdlib/force.cpp.preplumed
similarity index 100%
rename from patches/gromacs-2018.4.diff/src/gromacs/mdlib/force.cpp.preplumed
rename to patches/gromacs-2018.5.diff/src/gromacs/mdlib/force.cpp.preplumed
diff --git a/patches/gromacs-2018.4.diff/src/gromacs/mdlib/minimize.cpp b/patches/gromacs-2018.5.diff/src/gromacs/mdlib/minimize.cpp
similarity index 100%
rename from patches/gromacs-2018.4.diff/src/gromacs/mdlib/minimize.cpp
rename to patches/gromacs-2018.5.diff/src/gromacs/mdlib/minimize.cpp
diff --git a/patches/gromacs-2018.4.diff/src/gromacs/mdlib/minimize.cpp.preplumed b/patches/gromacs-2018.5.diff/src/gromacs/mdlib/minimize.cpp.preplumed
similarity index 100%
rename from patches/gromacs-2018.4.diff/src/gromacs/mdlib/minimize.cpp.preplumed
rename to patches/gromacs-2018.5.diff/src/gromacs/mdlib/minimize.cpp.preplumed
diff --git a/patches/gromacs-2018.4.diff/src/programs/mdrun/md.cpp b/patches/gromacs-2018.5.diff/src/programs/mdrun/md.cpp
similarity index 99%
rename from patches/gromacs-2018.4.diff/src/programs/mdrun/md.cpp
rename to patches/gromacs-2018.5.diff/src/programs/mdrun/md.cpp
index 31f271a63de7822c7e4931635ef4361c8bbef70c..3415849286aeffa54cf9f19ae9062302ce1c1692 100644
--- a/patches/gromacs-2018.4.diff/src/programs/mdrun/md.cpp
+++ b/patches/gromacs-2018.5.diff/src/programs/mdrun/md.cpp
@@ -620,9 +620,15 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog,
             /* Update mdebin with energy history if appending to output files */
             if (continuationOptions.appendFiles)
             {
-                restore_energyhistory_from_state(mdebin, observablesHistory->energyHistory.get());
+                /* If no history is available (because a checkpoint is from before
+                 * it was written) make a new one later, otherwise restore it.
+                 */
+                if (observablesHistory->energyHistory)
+                {
+                    restore_energyhistory_from_state(mdebin, observablesHistory->energyHistory.get());
+                }
             }
-            else if (observablesHistory->energyHistory.get() != nullptr)
+            else if (observablesHistory->energyHistory)
             {
                 /* We might have read an energy history from checkpoint.
                  * As we are not appending, we want to restart the statistics.
@@ -631,7 +637,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog,
                 observablesHistory->energyHistory = {};
             }
         }
-        if (observablesHistory->energyHistory.get() == nullptr)
+        if (!observablesHistory->energyHistory)
         {
             observablesHistory->energyHistory = std::unique_ptr<energyhistory_t>(new energyhistory_t {});
         }
diff --git a/patches/gromacs-2018.4.diff/src/programs/mdrun/md.cpp.preplumed b/patches/gromacs-2018.5.diff/src/programs/mdrun/md.cpp.preplumed
similarity index 99%
rename from patches/gromacs-2018.4.diff/src/programs/mdrun/md.cpp.preplumed
rename to patches/gromacs-2018.5.diff/src/programs/mdrun/md.cpp.preplumed
index de5a7031ff1093334ca547c574fdf64d5596c6ac..e77170a9c870af3a909d6cd3ce3a986d6b683226 100644
--- a/patches/gromacs-2018.4.diff/src/programs/mdrun/md.cpp.preplumed
+++ b/patches/gromacs-2018.5.diff/src/programs/mdrun/md.cpp.preplumed
@@ -603,9 +603,15 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog,
             /* Update mdebin with energy history if appending to output files */
             if (continuationOptions.appendFiles)
             {
-                restore_energyhistory_from_state(mdebin, observablesHistory->energyHistory.get());
+                /* If no history is available (because a checkpoint is from before
+                 * it was written) make a new one later, otherwise restore it.
+                 */
+                if (observablesHistory->energyHistory)
+                {
+                    restore_energyhistory_from_state(mdebin, observablesHistory->energyHistory.get());
+                }
             }
-            else if (observablesHistory->energyHistory.get() != nullptr)
+            else if (observablesHistory->energyHistory)
             {
                 /* We might have read an energy history from checkpoint.
                  * As we are not appending, we want to restart the statistics.
@@ -614,7 +620,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog,
                 observablesHistory->energyHistory = {};
             }
         }
-        if (observablesHistory->energyHistory.get() == nullptr)
+        if (!observablesHistory->energyHistory)
         {
             observablesHistory->energyHistory = std::unique_ptr<energyhistory_t>(new energyhistory_t {});
         }
diff --git a/patches/gromacs-2018.4.diff/src/programs/mdrun/mdrun.cpp b/patches/gromacs-2018.5.diff/src/programs/mdrun/mdrun.cpp
similarity index 100%
rename from patches/gromacs-2018.4.diff/src/programs/mdrun/mdrun.cpp
rename to patches/gromacs-2018.5.diff/src/programs/mdrun/mdrun.cpp
diff --git a/patches/gromacs-2018.4.diff/src/programs/mdrun/mdrun.cpp.preplumed b/patches/gromacs-2018.5.diff/src/programs/mdrun/mdrun.cpp.preplumed
similarity index 100%
rename from patches/gromacs-2018.4.diff/src/programs/mdrun/mdrun.cpp.preplumed
rename to patches/gromacs-2018.5.diff/src/programs/mdrun/mdrun.cpp.preplumed
diff --git a/patches/gromacs-2018.4.diff/src/programs/mdrun/repl_ex.cpp b/patches/gromacs-2018.5.diff/src/programs/mdrun/repl_ex.cpp
similarity index 100%
rename from patches/gromacs-2018.4.diff/src/programs/mdrun/repl_ex.cpp
rename to patches/gromacs-2018.5.diff/src/programs/mdrun/repl_ex.cpp
diff --git a/patches/gromacs-2018.4.diff/src/programs/mdrun/repl_ex.cpp.preplumed b/patches/gromacs-2018.5.diff/src/programs/mdrun/repl_ex.cpp.preplumed
similarity index 100%
rename from patches/gromacs-2018.4.diff/src/programs/mdrun/repl_ex.cpp.preplumed
rename to patches/gromacs-2018.5.diff/src/programs/mdrun/repl_ex.cpp.preplumed
diff --git a/patches/gromacs-2018.4.diff/src/programs/mdrun/repl_ex.h b/patches/gromacs-2018.5.diff/src/programs/mdrun/repl_ex.h
similarity index 100%
rename from patches/gromacs-2018.4.diff/src/programs/mdrun/repl_ex.h
rename to patches/gromacs-2018.5.diff/src/programs/mdrun/repl_ex.h
diff --git a/patches/gromacs-2018.4.diff/src/programs/mdrun/repl_ex.h.preplumed b/patches/gromacs-2018.5.diff/src/programs/mdrun/repl_ex.h.preplumed
similarity index 100%
rename from patches/gromacs-2018.4.diff/src/programs/mdrun/repl_ex.h.preplumed
rename to patches/gromacs-2018.5.diff/src/programs/mdrun/repl_ex.h.preplumed
diff --git a/patches/gromacs-2018.4.diff/src/programs/mdrun/runner.cpp b/patches/gromacs-2018.5.diff/src/programs/mdrun/runner.cpp
similarity index 100%
rename from patches/gromacs-2018.4.diff/src/programs/mdrun/runner.cpp
rename to patches/gromacs-2018.5.diff/src/programs/mdrun/runner.cpp
diff --git a/patches/gromacs-2018.4.diff/src/programs/mdrun/runner.cpp.preplumed b/patches/gromacs-2018.5.diff/src/programs/mdrun/runner.cpp.preplumed
similarity index 100%
rename from patches/gromacs-2018.4.diff/src/programs/mdrun/runner.cpp.preplumed
rename to patches/gromacs-2018.5.diff/src/programs/mdrun/runner.cpp.preplumed
diff --git a/patches/gromacs-2018.4.diff/src/programs/mdrun/runner.h b/patches/gromacs-2018.5.diff/src/programs/mdrun/runner.h
similarity index 100%
rename from patches/gromacs-2018.4.diff/src/programs/mdrun/runner.h
rename to patches/gromacs-2018.5.diff/src/programs/mdrun/runner.h
diff --git a/patches/gromacs-2018.4.diff/src/programs/mdrun/runner.h.preplumed b/patches/gromacs-2018.5.diff/src/programs/mdrun/runner.h.preplumed
similarity index 100%
rename from patches/gromacs-2018.4.diff/src/programs/mdrun/runner.h.preplumed
rename to patches/gromacs-2018.5.diff/src/programs/mdrun/runner.h.preplumed