/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020,2021, 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.
#include "gromacs/mdlib/stat.h"
#include "gromacs/mdlib/stophandler.h"
+#include "gromacs/mdrunutility/handlerestart.h"
#include "modularsimulatorinterfaces.h"
LoggingSignaller::LoggingSignaller(std::vector<SignallerCallback> callbacks,
Step nstlog,
Step initStep,
- Time initTime) :
+ StartingBehavior startingBehavior) :
callbacks_(std::move(callbacks)),
nstlog_(nstlog),
initStep_(initStep),
- initTime_(initTime),
+ startingBehavior_(startingBehavior),
lastStep_(-1),
lastStepRegistrationDone_(false)
{
void LoggingSignaller::signal(Step step, Time time)
{
- if (do_per_step(step, nstlog_) || step == lastStep_)
+ if (do_per_step(step, nstlog_) || step == lastStep_
+ || (step == initStep_ && startingBehavior_ == StartingBehavior::NewSimulation))
{
runAllCallbacks(callbacks_, step, time);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020,2021, 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.
{
class StopHandler;
class TrajectoryElement;
+enum class StartingBehavior;
/*! \internal
* \ingroup module_modularsimulator
private:
/*! \brief Constructor
*
- * \param callbacks A vector of pointers to callbacks
- * \param nstlog The logging frequency
- * \param initStep The first step of the simulation
- * \param initTime The start time of the simulation
+ * \param callbacks A vector of pointers to callbacks
+ * \param nstlog The logging frequency
+ * \param initStep The first step of the simulation
+ * \param startingBehavior Whether this is a new simulation or restarting from checkpoint
*/
- LoggingSignaller(std::vector<SignallerCallback> callbacks, Step nstlog, Step initStep, Time initTime);
+ LoggingSignaller(std::vector<SignallerCallback> callbacks,
+ Step nstlog,
+ Step initStep,
+ StartingBehavior startingBehavior);
//! Client callbacks
std::vector<SignallerCallback> callbacks_;
const Step nstlog_;
//! The initial step of the simulation
const Step initStep_;
- //! The initial time of the simulation
- const Time initTime_;
+ //! How we are starting the simulation
+ const StartingBehavior startingBehavior_;
//! ILastStepSignallerClient implementation
std::optional<SignallerCallback> registerLastStepCallback() override;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2020, by the GROMACS development team, led by
+ * Copyright (c) 2020,2021, 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.
inputrec->nstxout_compressed, trajectoryElement->tngBoxOut(),
trajectoryElement->tngLambdaOut(), trajectoryElement->tngBoxOutCompressed(),
trajectoryElement->tngLambdaOutCompressed(), inputrec->nstenergy));
- addSignaller(loggingSignallerBuilder_.build(inputrec->nstlog, inputrec->init_step, inputrec->init_t));
+ addSignaller(loggingSignallerBuilder_.build(inputrec->nstlog, inputrec->init_step,
+ legacySimulatorData_->startingBehavior));
addSignaller(lastStepSignallerBuilder_.build(inputrec->nsteps, inputrec->init_step,
algorithm.stopHandler_.get()));
addSignaller(neighborSearchSignallerBuilder_.build(inputrec->nstlist, inputrec->init_step,