Gromacs
2020.1
|
#include <gromacs/modularsimulator/statepropagatordata.h>
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< RVec > | positionsView () |
Get write access to position vector. | |
ArrayRefWithPadding< const RVec > | constPositionsView () const |
Get read access to position vector. | |
ArrayRefWithPadding< RVec > | previousPositionsView () |
Get write access to previous position vector. | |
ArrayRefWithPadding< const RVec > | constPreviousPositionsView () const |
Get read access to previous position vector. | |
ArrayRefWithPadding< RVec > | velocitiesView () |
Get write access to velocity vector. | |
ArrayRefWithPadding< const RVec > | constVelocitiesView () const |
Get read access to velocity vector. | |
ArrayRefWithPadding< RVec > | forcesView () |
Get write access to force vector. | |
ArrayRefWithPadding< const RVec > | constForcesView () 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 ®isterRunFunction) override |
Register run function for step / time. More... | |
void | elementSetup () override |
Backup starting velocities. More... | |
void | elementTeardown () override |
No element teardown needed. | |
|
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.
|
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.
step | The step number |
time | The time |
registerRunFunction | Function allowing to register a run function |
Implements gmx::ISimulatorElement.