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

#include <gromacs/modularsimulator/energydata.h>

Description

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...
 
rvecforceVirial (Step step)
 Get pointer to force virial tensor. More...
 
rvecconstraintVirial (Step step)
 Get pointer to constraint virial tensor. More...
 
rvectotalVirial (Step step)
 Get pointer to total virial tensor. More...
 
rvecpressure (Step step)
 Get pointer to pressure tensor. More...
 
realmuTot ()
 Get pointer to mu_tot. More...
 
gmx_enerdata_tenerdata ()
 Get pointer to energy structure. More...
 
const gmx_enerdata_tenerdata () 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.
 
Elementelement ()
 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...
 

Member Function Documentation

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.

rvec * gmx::EnergyData::constraintVirial ( Step  step)

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.

rvec * gmx::EnergyData::forceVirial ( Step  step)

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)

void gmx::EnergyData::initializeEnergyHistory ( StartingBehavior  startingBehavior,
ObservablesHistory observablesHistory,
EnergyOutput *  energyOutput 
)
static

Initialize energy history.

Kept as a static function to allow usage from legacy code

Todo:
Make member function once legacy use is not needed anymore
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.

rvec * gmx::EnergyData::pressure ( Step  step)

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.

See Also
ModularSimulatorAlgorithm::teardown
rvec * gmx::EnergyData::totalVirial ( Step  step)

Get pointer to total virial tensor.

Allows access to the raw pointer to the tensor.


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