Read essential dynamics data from checkpoint at correct place, fixes #1392
authorCarsten Kutzner <ckutzne@gwdg.de>
Fri, 6 Dec 2013 10:45:48 +0000 (11:45 +0100)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Fri, 10 Jan 2014 23:18:31 +0000 (00:18 +0100)
In read_checkpoint(), the order in which the data blocks are read from .cpt
differs from the order in write_checkpoint(), read_checkpoint_data() and
list_checkpoint().
This change puts the do_cpt_EDstate() routine after the do_cpt_enerhist()
routine, as is already the case for the other checkpoint-reading functions.

Change-Id: Ib017dfbd05918b4ee8e27f1ec93523497c559936

src/gromacs/gmxlib/checkpoint.c

index 5a3fb148b0ab5a77f4811b08a8d6589c31d523e1..65984af7025b2eed4b009f3893e9353631a01b62 100644 (file)
@@ -1981,12 +1981,6 @@ static void read_checkpoint(const char *fn, FILE **pfplog,
         cp_error();
     }
 
-    ret = do_cpt_EDstate(gmx_fio_getxdr(fp), TRUE, &state->edsamstate, NULL);
-    if (ret)
-    {
-        cp_error();
-    }
-
     if (file_version < 6)
     {
         const char *warn = "Reading checkpoint file in old format, assuming that the run that generated this file started at step 0, if this is not the case the averages stored in the energy file will be incorrect.";
@@ -2006,6 +2000,12 @@ static void read_checkpoint(const char *fn, FILE **pfplog,
         cp_error();
     }
 
+    ret = do_cpt_EDstate(gmx_fio_getxdr(fp), TRUE, &state->edsamstate, NULL);
+    if (ret)
+    {
+        cp_error();
+    }
+
     ret = do_cpt_files(gmx_fio_getxdr(fp), TRUE, &outputfiles, &nfiles, NULL, file_version);
     if (ret)
     {