Gromacs  2024.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions

#include <gromacs/mdrun/mdmodules.h>

Description

Manages the collection of all modules used for mdrun.

This class acts as a central place for constructing modules for mdrun and wiring up dependencies between them. This class should be the only place that contains the full list of modules, although in the future, some code (e.g., in tools) may benefit from the ability to only create one or a few modules and use them.

The general idea is that each module takes care of its own data rather than mdrun having to know about all the details of each type of force calculation. Initially this is applied for simple things like electric field calculations but later more complex forces will be supported too.

Currently, where the set of modules needs to be accessed, either a pointer to MDModules is passed around, or an instance of IMDOutputProvider or ForceProviders returned from MDModules. These objects returned from MDModules call the corresponding methods in the relevant modules. In the future, some additional logic may need to be introduced at the call sites that can also influence the signature of the methods, similar to what ForceProviders already does for force computation.

The assignOptionsToModules() and adjustInputrecBasedOnModules() methods of this class also take responsibility for wiring up the options (and their defaults) for each module.

Public Member Functions

void initMdpTransform (IKeyValueTreeTransformRules *rules)
 Initializes a transform from mdp values to sectioned options. More...
 
void buildMdpOutput (KeyValueTreeObjectBuilder *builder)
 Initializes a builder of flat mdp-style key-value pairs suitable for output. More...
 
void assignOptionsToModules (const KeyValueTreeObject &params, IKeyValueTreeErrorHandler *errorHandler)
 Sets input parameters from params for each module. More...
 
void adjustInputrecBasedOnModules (t_inputrec *ir)
 Normalizes inputrec parameters to match current code version. More...
 
IMDOutputProvideroutputProvider ()
 Returns an interface for initializing and finalizing output for modules.
 
ForceProvidersinitForceProviders ()
 Returns an object for computing forces from the modules.
 
void subscribeToSimulationSetupNotifications ()
 Subscribe MDModules to simulation setup notifications. More...
 
void subscribeToPreProcessingNotifications ()
 Subscribe MDModules to notifications during pre-processing. More...
 
void add (std::shared_ptr< IMDModule > module)
 Add a module to the container. More...
 
const MDModulesNotifiersnotifiers ()
 Return a handle to the notifiers used for callbacks between modules.
 

Member Function Documentation

void gmx::MDModules::add ( std::shared_ptr< IMDModule module)

Add a module to the container.

An object may be added by a client to the bound MD Modules at run time. Both the client and the MDModules object may need to extend the life of the provided object. However, the MDModules container guarantees to extend the life of a provided object for as long as its consumers may attempt to use its the interfaces accessible through IMDModule methods.

Parameters
moduleimplements some sort of modular functionality for MD.
Note
: There is not yet a way to add a IMDModule object between creation of the MDModules container and the execution of the various initialization protocols it supports.
void gmx::MDModules::adjustInputrecBasedOnModules ( t_inputrec *  ir)

Normalizes inputrec parameters to match current code version.

This orders the parameters in ir->param to match the current code and adds any missing defaults. It also throws an error if the inputrec contains parameters that are not recognized by any module.

void gmx::MDModules::assignOptionsToModules ( const KeyValueTreeObject &  params,
IKeyValueTreeErrorHandler *  errorHandler 
)

Sets input parameters from params for each module.

Parameters
[in]paramsContains keys and values from user input (and defaults) to configure modules that have registered options with those keys.
[out]errorHandlerCalled to report errors.
void gmx::MDModules::buildMdpOutput ( KeyValueTreeObjectBuilder builder)

Initializes a builder of flat mdp-style key-value pairs suitable for output.

If used as input to initMdpTransform(), the key-value pairs resulting from this function would leave the module settings unchanged.

Once the transition from mdp to key-value input is complete, this method will probably not exist.

void gmx::MDModules::initMdpTransform ( IKeyValueTreeTransformRules rules)

Initializes a transform from mdp values to sectioned options.

See Also
IMdpOptionProvider::initMdpTransform()

Initializes the combined transform from all modules.

void gmx::MDModules::subscribeToPreProcessingNotifications ( )

Subscribe MDModules to notifications during pre-processing.

Allows MDModules to subscribe to notifications that are called back during pre processing an MD simulation, after the options were assigned to the modules.

void gmx::MDModules::subscribeToSimulationSetupNotifications ( )

Subscribe MDModules to simulation setup notifications.

Allows MDModules to subscribe to notifications that are called back during the set up of an MD simulation, after the options were assigned to the modules.


The documentation for this class was generated from the following files: