Gromacs
2024.3
|
#include <gromacs/modularsimulator/energydata.h>
Data class managing energies.
The EnergyData owns the EnergyObject, the tensors for the different virials and the pressure as well as the total dipole vector. It has a member class which is part of the simulator loop and and is responsible for saving energy data and writing it to trajectory.
The EnergyData offers an interface to add virial contributions, but also allows access to the raw pointers to tensor data, the dipole vector, and the legacy energy data structures.
The EnergyData owns an object of type EnergyData::Element, which takes part in the simulation loop, allowing to record and output energies during the simulation.
Classes | |
class | Element |
Element for EnergyData. More... | |
Public Member Functions | |
EnergyData (StatePropagatorData *statePropagatorData, FreeEnergyPerturbationData *freeEnergyPerturbationData, const gmx_mtop_t &globalTopology, const t_inputrec *inputrec, const MDAtoms *mdAtoms, gmx_enerdata_t *enerd, gmx_ekindata_t *ekind, const Constraints *constr, FILE *fplog, t_fcdata *fcd, const MDModulesNotifiers &mdModulesNotifiers, bool isMainRank, ObservablesHistory *observablesHistory, StartingBehavior startingBehavior, bool simulationsShareHamiltonian, pull_t *pullWork) | |
Constructor. | |
void | teardown () |
Final output. More... | |
void | addToForceVirial (const tensor virial, Step step) |
Add contribution to force virial. More... | |
void | addToConstraintVirial (const tensor virial, Step step) |
Add contribution to constraint virial. More... | |
rvec * | forceVirial (Step step) |
Get pointer to force virial tensor. More... | |
rvec * | constraintVirial (Step step) |
Get pointer to constraint virial tensor. More... | |
rvec * | totalVirial (Step step) |
Get pointer to total virial tensor. More... | |
rvec * | pressure (Step step) |
Get pointer to pressure tensor. More... | |
real * | muTot () |
Get pointer to mu_tot. More... | |
gmx_enerdata_t * | enerdata () |
Get pointer to energy structure. More... | |
const gmx_enerdata_t * | enerdata () const |
Get const pointer to energy structure. More... | |
gmx_ekindata_t * | ekindata () |
Get pointer to kinetic energy structure. More... | |
bool * | needToSumEkinhOld () |
Get pointer to needToSumEkinhOld. More... | |
bool | hasReadEkinFromCheckpoint () const |
Whether kinetic energy was read from checkpoint. More... | |
void | addConservedEnergyContribution (EnergyContribution &&energyContribution) |
Add conserved energy contribution. More... | |
void | setParrinelloRahmanBoxVelocities (std::function< const rvec *()> &&parrinelloRahmanBoxVelocities) |
set Parrinello-Rahman barostat More... | |
void | updateKineticEnergy () |
Request (local) kinetic energy update. | |
Element * | element () |
Get pointer to element (whose lifetime is managed by this) | |
Static Public Member Functions | |
static void | initializeEnergyHistory (StartingBehavior startingBehavior, ObservablesHistory *observablesHistory, EnergyOutput *energyOutput) |
Initialize energy history. More... | |
void gmx::EnergyData::addConservedEnergyContribution | ( | EnergyContribution && | energyContribution | ) |
Add conserved energy contribution.
This allows other elements to register callbacks for contributions to the conserved energy term.
void gmx::EnergyData::addToConstraintVirial | ( | const tensor | virial, |
Step | step | ||
) |
Add contribution to constraint virial.
This automatically resets the tensor if the step is higher than the current step, starting the tensor calculation for a new step at zero. Otherwise, it adds the new contribution to the existing virial.
void gmx::EnergyData::addToForceVirial | ( | const tensor | virial, |
Step | step | ||
) |
Add contribution to force virial.
This automatically resets the tensor if the step is higher than the current step, starting the tensor calculation for a new step at zero. Otherwise, it adds the new contribution to the existing virial.
Get pointer to constraint virial tensor.
Allows access to the raw pointer to the tensor.
gmx_ekindata_t * gmx::EnergyData::ekindata | ( | ) |
Get pointer to kinetic energy structure.
gmx_enerdata_t * gmx::EnergyData::enerdata | ( | ) |
Get pointer to energy structure.
const gmx_enerdata_t * gmx::EnergyData::enerdata | ( | ) | const |
Get const pointer to energy structure.
Get pointer to force virial tensor.
Allows access to the raw pointer to the tensor.
bool gmx::EnergyData::hasReadEkinFromCheckpoint | ( | ) | const |
Whether kinetic energy was read from checkpoint.
This is needed by the compute globals element TODO: Remove this when moving global reduction to client system (#3421)
|
static |
Initialize energy history.
Kept as a static function to allow usage from legacy code
real * gmx::EnergyData::muTot | ( | ) |
Get pointer to mu_tot.
Allows access to the raw pointer to the dipole vector.
bool * gmx::EnergyData::needToSumEkinhOld | ( | ) |
Get pointer to needToSumEkinhOld.
Get pointer to pressure tensor.
Allows access to the raw pointer to the tensor.
void gmx::EnergyData::setParrinelloRahmanBoxVelocities | ( | std::function< const rvec *()> && | parrinelloRahmanBoxVelocities | ) |
set Parrinello-Rahman barostat
This allows to set a pointer to the Parrinello-Rahman barostat used to print the box velocities.
void gmx::EnergyData::teardown | ( | ) |
Final output.
Prints the averages to log. This is called from ModularSimulatorAlgorithm.
Get pointer to total virial tensor.
Allows access to the raw pointer to the tensor.