// to eventual notifications during pre-processing their data
mdModules.subscribeToPreProcessingNotifications();
+ // And notify MdModules of existing logger
+ mdModules.notifiers().preProcessingNotifier_.notify(logger);
if (bVerbose)
{
}
do_index(mdparin, ftp2fn_null(efNDX, NFILE, fnm), &sys, bVerbose, mdModules.notifiers(), ir, wi);
+ // Notify topology to MdModules for pre-processing after all indexes were built
+ mdModules.notifiers().preProcessingNotifier_.notify(&sys);
+
if (ir->cutoff_scheme == CutoffScheme::Verlet && ir->verletbuf_tol > 0)
{
if (EI_DYNAMICS(ir->eI) && inputrec2nboundeddim(ir) == 3)
}
}
+ // Hand over box and coordiantes to MdModules before they evaluate their final parameters
+ {
+ gmx::CoordinatesAndBoxPreprocessed coordinatesAndBoxPreprocessed;
+ coordinatesAndBoxPreprocessed.coordinates_ = state.x.arrayRefWithPadding();
+ copy_mat(state.box, coordinatesAndBoxPreprocessed.box_);
+ coordinatesAndBoxPreprocessed.pbc_ = ir->pbcType;
+ mdModules.notifiers().preProcessingNotifier_.notify(coordinatesAndBoxPreprocessed);
+ }
+
// Add the md modules internal parameters that are not mdp options
// e.g., atom indices
mdModules_->subscribeToSimulationSetupNotifications();
const auto& setupNotifier = mdModules_->notifiers().simulationSetupNotifier_;
+ // Notify MdModules of existing logger
+ setupNotifier.notify(mdlog);
+
+ // Notify MdModules of internal parameters, saved into KVT
if (inputrec->internalParameters != nullptr)
{
setupNotifier.notify(*inputrec->internalParameters);
}
+ // Let MdModules know the .tpr filename
+ {
+ gmx::MdRunInputFilename mdRunInputFilename = { ftp2fn(efTPR, filenames.size(), filenames.data()) };
+ setupNotifier.notify(mdRunInputFilename);
+ }
+
if (fplog != nullptr)
{
pr_inputrec(fplog, 0, "Input Parameters", inputrec.get(), FALSE);
#include <string>
#include <vector>
+#include "gromacs/math/arrayrefwithpadding.h"
+#include "gromacs/math/vectypes.h"
#include "gromacs/utility/mdmodulesnotifier.h"
struct t_commrec;
class KeyValueTreeObject;
class KeyValueTreeObjectBuilder;
class LocalAtomSetManager;
+class MDLogger;
class IndexGroupsAndNames;
class SeparatePmeRanksPermitted;
struct MDModulesCheckpointReadingDataOnMaster;
const double delta_t;
};
+/*! \libinternal \brief Provides coordinates and simulation box.
+ */
+struct CoordinatesAndBoxPreprocessed
+{
+ ArrayRefWithPadding<RVec> coordinates_;
+ matrix box_;
+ PbcType pbc_;
+};
+
+/*! \libinternal \brief Mdrun input filename.
+ */
+struct MdRunInputFilename
+{
+ //! The name of the run input file (.tpr) as output by grompp
+ std::string mdRunFilename_;
+};
+
/*! \libinternal
* \brief Group of notifers to organize that MDModules
* can receive callbacks they subscribe to.
*/
struct MDModulesNotifiers
{
- /*! \brief Handles subscribing and calling pre-processing callback functions.
- *
+ /*! \brief Pre-processing callback functions.
+ * const CoordinatesAndBoxPreprocessed Allows modules to access coordinates,
+ * box and pbc during grompp
+ * const MDLogger& Allows MdModule to use standard logging class for messages output
* EnergyCalculationFrequencyErrors* allows modules to check if they match
* their required calculation frequency
* and add their error message if needed
* to the collected error messages
+ * gmx_mtop_t * Allows modules to modify the topology during pre-processing
* IndexGroupsAndNames provides modules with atom indices and their names
* KeyValueTreeObjectBuilder enables writing of module internal data to
* .tpr files.
*/
- BuildMDModulesNotifier<EnergyCalculationFrequencyErrors*, const IndexGroupsAndNames&, KeyValueTreeObjectBuilder>::type preProcessingNotifier_;
+ BuildMDModulesNotifier<const CoordinatesAndBoxPreprocessed,
+ const MDLogger&,
+ EnergyCalculationFrequencyErrors*,
+ gmx_mtop_t*,
+ const IndexGroupsAndNames&,
+ KeyValueTreeObjectBuilder>::type preProcessingNotifier_;
/*! \brief Handles subscribing and calling checkpointing callback functions.
*
* wrote to .tpr files
* LocalAtomSetManager* enables modules to add atom indices to local atom sets
* to be managed
+ * const MDLogger& Allows MdModule to use standard logging class for messages output
* const gmx_mtop_t& provides the topology of the system to the modules
* MDModulesEnergyOutputToDensityFittingRequestChecker* enables modules to
* report if they want to write their energy output
* time information
* const t_commrec& provides a communicator to the modules during simulation
* setup
+ * MdRunInputFilename Allows modules to know .tpr filename during mdrun
*/
BuildMDModulesNotifier<const KeyValueTreeObject&,
LocalAtomSetManager*,
+ const MDLogger&,
const gmx_mtop_t&,
MDModulesEnergyOutputToDensityFittingRequestChecker*,
SeparatePmeRanksPermitted*,
const PbcType&,
const SimulationTimeStep&,
- const t_commrec&>::type simulationSetupNotifier_;
+ const t_commrec&,
+ MdRunInputFilename>::type simulationSetupNotifier_;
};
} // namespace gmx