2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2004, The GROMACS development team,
6 * check out http://www.gromacs.org for more information.
7 * Copyright (c) 2012,2013, by the GROMACS development team, led by
8 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9 * others, as listed in the AUTHORS file in the top-level source
10 * directory and at http://www.gromacs.org.
12 * GROMACS is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 2.1
15 * of the License, or (at your option) any later version.
17 * GROMACS is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with GROMACS; if not, see
24 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * If you want to redistribute modifications to GROMACS, please
28 * consider that scientific software is very special. Version
29 * control is crucial - bugs must be traceable. We will be happy to
30 * consider code for inclusion in the official distribution, but
31 * derived work must not be called official GROMACS. Details are found
32 * in the README & COPYING files - if they are missing, get the
33 * official version at http://www.gromacs.org.
35 * To help us fund GROMACS development, we humbly ask that you cite
36 * the research papers on the package. Check out http://www.gromacs.org.
42 #include "visibility.h"
50 /* the name of the environment variable to disable fsync failure checks with */
51 #define GMX_IGNORE_FSYNC_FAILURE_ENV "GMX_IGNORE_FSYNC_FAILURE"
53 /* Write a checkpoint to <fn>.cpt
54 * Appends the _step<step>.cpt with bNumberAndKeep,
55 * otherwise moves the previous <fn>.cpt to <fn>_prev.cpt
58 void write_checkpoint(const char *fn
, gmx_bool bNumberAndKeep
,
59 FILE *fplog
, t_commrec
*cr
,
60 int eIntegrator
, int simulation_part
,
61 gmx_bool bExpanded
, int elamstats
,
62 gmx_large_int_t step
, double t
,
65 /* Loads a checkpoint from fn for run continuation.
66 * Generates a fatal error on system size mismatch.
67 * The master node reads the file
68 * and communicates all the modified number of steps and the parallel setup,
69 * but not the state itself.
70 * When bAppend is set, lock the log file and truncate the existing output
71 * files so they can be appended.
72 * With bAppend and bForceAppend: truncate anyhow if the system does not
73 * support file locking.
76 void load_checkpoint(const char *fn
, FILE **fplog
,
77 t_commrec
*cr
, gmx_bool bPartDecomp
, ivec dd_nc
,
78 t_inputrec
*ir
, t_state
*state
, gmx_bool
*bReadRNG
,
79 gmx_bool
*bReadEkin
, gmx_bool bAppend
, gmx_bool bForceAppend
);
81 /* Read the state from checkpoint file.
82 * Arrays in state that are NULL are allocated.
83 * If bReadRNG=TRUE a RNG state compatible with the current
84 * number of nodes was read.
87 void read_checkpoint_state(const char *fn
, int *simulation_part
,
88 gmx_large_int_t
*step
, double *t
, t_state
*state
);
90 /* Read everything that can be stored in t_trxframe from a checkpoint file */
91 void read_checkpoint_trxframe(t_fileio
*fp
, t_trxframe
*fr
);
93 /* Print the complete contents of checkpoint file fn to out */
95 void list_checkpoint(const char *fn
, FILE *out
);
97 /* Read just the simulation 'generation' and with bAppendReq check files.
98 * This is necessary already at the beginning of mdrun,
99 * to be able to rename the logfile correctly.
100 * When file appending is requested, checks which output files are present:
101 * all present: return TRUE,
102 * none present: return FALSE,
103 * part present: fatal error.
104 * When TRUE is returned, bAddPart will tell whether the simulation part
105 * needs to be added to the output file name.
108 gmx_bool
read_checkpoint_simulation_part(const char *filename
, int *simulation_part
,
109 gmx_large_int_t
*step
, t_commrec
*cr
,
111 int nfile
, const t_filenm fnm
[],
112 const char *part_suffix
, gmx_bool
*bAddPart
);