Gromacs
2024.3
|
#include <gromacs/mdrun/runner.h>
Runner object for supporting setup and execution of mdrun.
This class has responsibility for the lifetime of data structures that exist for the life of the simulation, e.g. for logging and communication.
It is also responsible for initializing data members that e.g. correspond to values potentially set by commmand-line options. Later these will be obtained directly from modules, and the results of command-line option handling returned directly to the modules, rather than propagated to them by data members of this class.
Public Member Functions | |
int | mdrunner () |
Driver routine, that calls the different simulation methods. More... | |
void | addPotential (std::shared_ptr< IRestraintPotential > restraint, const std::string &name) |
Add a potential to be evaluated during MD integration. More... | |
void | spawnThreads (int numThreadsToLaunch) |
Prepare the thread-MPI communicator to have numThreadsToLaunch ranks, by spawning new thread-MPI threads. More... | |
Mdrunner | cloneOnSpawnedThread () const |
Initializes a new Mdrunner from the main. More... | |
Mdrunner (const Mdrunner &)=delete | |
Copy not allowed. More... | |
Mdrunner & | operator= (const Mdrunner &)=delete |
Mdrunner (Mdrunner &&handle) noexcept | |
Mdrunner objects can be passed by value via move semantics. More... | |
Mdrunner & | operator= (Mdrunner &&handle) noexcept |
|
delete |
Copy not allowed.
An Mdrunner has unique resources and it is not clear whether any of one of those resources should be duplicated or shared unless the specific use case is known. Either build a fresh runner or use a helper function for clearly indicated behavior. API clarification may allow unambiguous initialization by copy in future versions.
|
defaultnoexcept |
Mdrunner objects can be passed by value via move semantics.
handle | runner instance to be moved from. |
void gmx::Mdrunner::addPotential | ( | std::shared_ptr< IRestraintPotential > | restraint, |
const std::string & | name | ||
) |
Add a potential to be evaluated during MD integration.
restraint | MD restraint potential to apply |
name | User-friendly plain-text name to uniquely identify the puller |
This implementation attaches an object providing the gmx::IRestraintPotential interface.
Mdrunner gmx::Mdrunner::cloneOnSpawnedThread | ( | ) | const |
Initializes a new Mdrunner from the main.
Run this method in a new thread from a main runner to get additional workers on spawned threads.
int gmx::Mdrunner::mdrunner | ( | ) |
Driver routine, that calls the different simulation methods.
Currently, thread-MPI does not spawn threads until during mdrunner() and parallelism is not initialized until some time during this call...
void gmx::Mdrunner::spawnThreads | ( | int | numThreadsToLaunch | ) |
Prepare the thread-MPI communicator to have numThreadsToLaunch
ranks, by spawning new thread-MPI threads.
Called by mdrunner() to start a specific number of threads (including the main thread) for thread-parallel runs. This in turn calls mdrunner() for each thread.