Gromacs
5.1.5
|
#include "gmxpre.h"
#include "handlerestart.h"
#include <string.h>
#include "gromacs/fileio/filenm.h"
#include "gromacs/fileio/gmxfio.h"
#include "gromacs/legacyheaders/checkpoint.h"
#include "gromacs/legacyheaders/main.h"
#include "gromacs/legacyheaders/types/commrec.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/smalloc.h"
This file declares functions for mdrun to call to manage the details of doing a restart (ie. reading checkpoints, appending output files).
Functions | |
static gmx_bool | exist_output_file (const char *fnm_cp, int nfile, const t_filenm fnm[]) |
Search for fnm_cp in fnm and return true iff found. More... | |
static void | read_checkpoint_data (const char *filename, int *simulation_part, t_commrec *cr, gmx_bool bTryToAppendFiles, int nfile, const t_filenm fnm[], const char *part_suffix, gmx_bool *bAddPart, gmx_bool *bDoAppendFiles) |
Support handling restarts. More... | |
void | handleRestart (t_commrec *cr, gmx_bool bTryToAppendFiles, const int NFILE, t_filenm fnm[], gmx_bool *bDoAppendFiles, gmx_bool *bStartFromCpt) |
Handle startup of mdrun, particularly regarding -cpi and -append. More... | |
|
static |
Search for fnm_cp
in fnm and return true iff found.
void handleRestart | ( | t_commrec * | cr, |
gmx_bool | bTryToAppendFiles, | ||
const int | NFILE, | ||
t_filenm | fnm[], | ||
gmx_bool * | bDoAppendFiles, | ||
gmx_bool * | bStartFromCpt | ||
) |
Handle startup of mdrun, particularly regarding -cpi and -append.
If there is a checkpoint file, then prepare to start from that state. If there is also appending, then organize the file naming accordingly, if possible. Issues various fatal errors if the input conditions are inconsistent or broken. fnm
is updated with suffix strings for part numbers if we are doing a restart from checkpoint and are not appending.
Does communication to coordinate behaviour between all ranks of a simulation, and/or simulations.
[in] | cr | Communication structure |
[in] | bTryToAppendFiles | Whether mdrun -append was used |
[in] | NFILE | Size of fnm struct |
[in,out] | fnm | Filename parameters to mdrun |
[out] | bDoAppendFiles | Whether mdrun will append to files |
[out] | bStartFromCpt | Whether mdrun will start from the -cpi file |
|
static |
Support handling restarts.
Read just the simulation 'generation' and with bTryToAppendFiles check files. This is is needed at the beginning of mdrun, to be able to rename the logfile correctly. When file appending is requested, checks which output files are present, and returns TRUE/FALSE in bDoAppendFiles if all or none are present. If only some output files are present, give a fatal error. When bDoAppendFiles is TRUE upon return, bAddPart will tell whether the simulation part needs to be added to the output file name.
This routine cannot print tons of data, since it is called before the log file is opened.