Gromacs  2020.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::StatePropagatorData Class Referencefinal

#include <gromacs/modularsimulator/statepropagatordata.h>

+ Inheritance diagram for gmx::StatePropagatorData:
+ Collaboration diagram for gmx::StatePropagatorData:

Description

StatePropagatorData and associated data.

The StatePropagatorData contains a little more than the pure statistical-physical micro state, namely the positions, velocities, forces, and box matrix, as well as a backup of the positions and box of the last time step. While it takes part in the simulator loop to be able to backup positions / boxes and save the current state if needed, it's main purpose is to offer access to its data via getter methods. All elements reading or writing to this data need a pointer to the StatePropagatorData and need to request their data explicitly. This will later simplify the understanding of data dependencies between elements.

The StatePropagatorData takes part in the simulator run, as it might have to save a valid state at the right moment during the integration. Placing the StatePropagatorData correctly is for now the duty of the simulator builder - this might be automatized later if we have enough meta-data of the variables (i.e., if StatePropagatorData knows at which time the variables currently are, and can decide when a valid state (full-time step of all variables) is reached. The StatePropagatorData is also a client of both the trajectory signaller and writer - it will save a state for later writeout during the simulator step if it knows that trajectory writing will occur later in the step, and it knows how to write to file given a file pointer by the TrajectoryElement.

Note that the StatePropagatorData can be converted to and from the legacy t_state object. This is useful when dealing with functionality which has not yet been adapted to use the new data approach - of the elements currently implemented, only domain decomposition, PME load balancing, and the initial constraining are using this.

Public Member Functions

 StatePropagatorData (int numAtoms, FILE *fplog, const t_commrec *cr, t_state *globalState, int nstxout, int nstvout, int nstfout, int nstxout_compressed, bool useGPU, FreeEnergyPerturbationElement *freeEnergyPerturbationElement, const TopologyHolder *topologyHolder, bool canMoleculesBeDistributedOverPBC, bool writeFinalConfiguration, std::string finalConfigurationFilename, const t_inputrec *inputrec, const t_mdatoms *mdatoms)
 Constructor.
 
ArrayRefWithPadding< RVecpositionsView ()
 Get write access to position vector.
 
ArrayRefWithPadding< const RVecconstPositionsView () const
 Get read access to position vector.
 
ArrayRefWithPadding< RVecpreviousPositionsView ()
 Get write access to previous position vector.
 
ArrayRefWithPadding< const RVecconstPreviousPositionsView () const
 Get read access to previous position vector.
 
ArrayRefWithPadding< RVecvelocitiesView ()
 Get write access to velocity vector.
 
ArrayRefWithPadding< const RVecconstVelocitiesView () const
 Get read access to velocity vector.
 
ArrayRefWithPadding< RVecforcesView ()
 Get write access to force vector.
 
ArrayRefWithPadding< const RVecconstForcesView () const
 Get read access to force vector.
 
rvec * box ()
 Get pointer to box.
 
const rvec * constBox ()
 Get const pointer to box.
 
rvec * previousBox ()
 Get pointer to previous box.
 
const rvec * constPreviousBox ()
 Get const pointer to previous box.
 
int localNumAtoms ()
 Get the local number of atoms.
 
void scheduleTask (Step step, Time time, const RegisterRunFunctionPtr &registerRunFunction) override
 Register run function for step / time. More...
 
void elementSetup () override
 Backup starting velocities. More...
 
void elementTeardown () override
 No element teardown needed.
 

Member Function Documentation

void gmx::StatePropagatorData::elementSetup ( )
overridevirtual

Backup starting velocities.

This is only needed for vv, where the first (velocity) half step is only used to compute the constraint virial, but the velocities need to be reset after. TODO: There must be a more elegant solution to this!

Implements gmx::ISimulatorElement.

void gmx::StatePropagatorData::scheduleTask ( Step  step,
Time  time,
const RegisterRunFunctionPtr registerRunFunction 
)
overridevirtual

Register run function for step / time.

This needs to be called during the integration part of the simulator, at the moment at which the state is at a full time step. Positioning this element is the responsibility of the programmer writing the integration algorithm! If the current step is a trajectory writing step, StatePropagatorData will save a backup for later writeout.

This is also the place at which the current state becomes the previous state.

Parameters
stepThe step number
timeThe time
registerRunFunctionFunction allowing to register a run function

Implements gmx::ISimulatorElement.


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