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

#include <gromacs/modularsimulator/energyelement.h>

+ Inheritance diagram for gmx::EnergyElement:
+ Collaboration diagram for gmx::EnergyElement:

Description

Element managing energies.

The EnergyElement owns the EnergyObject, and is hence responsible for saving energy data and writing it to trajectory. It also owns the tensors for the different virials and the pressure as well as the total dipole vector.

It subscribes to the trajectory signaller, the energy signaller, and the logging signaller to know when an energy calculation is needed and when a non-recording step is enough. The simulator builder is responsible to place the element in a location at which a valid energy state is available. The EnergyElement is also a subscriber to the trajectory writer element, as it is responsible to write energy data to trajectory.

The EnergyElement 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.

Public Member Functions

 EnergyElement (StatePropagatorData *statePropagatorData, FreeEnergyPerturbationElement *freeEnergyPerturbationElement, 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 MdModulesNotifier &mdModulesNotifier, bool isMasterRank, ObservablesHistory *observablesHistory, StartingBehavior startingBehavior)
 Constructor.
 
void scheduleTask (Step step, Time time, const RegisterRunFunctionPtr &registerRunFunction) override
 Register run function for step / time. More...
 
void elementSetup () override
 No element setup needed.
 
void elementTeardown () override
 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...
 
realmuTot ()
 Get pointer to mu_tot. More...
 
gmx_enerdata_t * enerdata ()
 Get pointer to energy structure. More...
 
gmx_ekindata_t * ekindata ()
 Get pointer to kinetic energy structure. More...
 
bool * needToSumEkinhOld ()
 Get pointer to needToSumEkinhOld. More...
 
void setVRescaleThermostat (const VRescaleThermostat *vRescaleThermostat)
 set vrescale thermostat More...
 
void setParrinelloRahamnBarostat (const ParrinelloRahmanBarostat *parrinelloRahmanBarostat)
 set Parrinello-Rahman barostat More...
 
- Public Member Functions inherited from gmx::ISimulatorElement
virtual ~ISimulatorElement ()=default
 Standard virtual destructor.
 
- Public Member Functions inherited from gmx::ITrajectoryWriterClient
virtual ~ITrajectoryWriterClient ()=default
 Standard virtual destructor.
 
- Public Member Functions inherited from gmx::ITrajectorySignallerClient
virtual ~ITrajectorySignallerClient ()=default
 Standard virtual destructor.
 
- Public Member Functions inherited from gmx::IEnergySignallerClient
virtual ~IEnergySignallerClient ()=default
 Standard virtual destructor.
 
- Public Member Functions inherited from gmx::ICheckpointHelperClient
virtual ~ICheckpointHelperClient ()=default
 Standard virtual destructor.
 

Static Public Member Functions

static void initializeEnergyHistory (StartingBehavior startingBehavior, ObservablesHistory *observablesHistory, EnergyOutput *energyOutput)
 Initialize energy history. More...
 

Additional Inherited Members

Member Function Documentation

void gmx::EnergyElement::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::EnergyElement::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::EnergyElement::constraintVirial ( Step  step)

Get pointer to constraint virial tensor.

Allows access to the raw pointer to the tensor.

gmx_ekindata_t * gmx::EnergyElement::ekindata ( )

Get pointer to kinetic energy structure.

void gmx::EnergyElement::elementTeardown ( )
overridevirtual

Final output.

Prints the averages to log.

Implements gmx::ISimulatorElement.

gmx_enerdata_t * gmx::EnergyElement::enerdata ( )

Get pointer to energy structure.

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

Get pointer to force virial tensor.

Allows access to the raw pointer to the tensor.

void gmx::EnergyElement::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::EnergyElement::muTot ( )

Get pointer to mu_tot.

Allows access to the raw pointer to the dipole vector.

bool * gmx::EnergyElement::needToSumEkinhOld ( )

Get pointer to needToSumEkinhOld.

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

Get pointer to pressure tensor.

Allows access to the raw pointer to the tensor.

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

Register run function for step / time.

This needs to be called when the energies are at a full time step. Positioning this element is the responsibility of the programmer.

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.

void gmx::EnergyElement::setParrinelloRahamnBarostat ( const ParrinelloRahmanBarostat parrinelloRahmanBarostat)

set Parrinello-Rahman barostat

This allows to set a pointer to the Parrinello-Rahman barostat used to print the box velocities. TODO: This should be made obsolete my a more modular energy element

void gmx::EnergyElement::setVRescaleThermostat ( const VRescaleThermostat vRescaleThermostat)

set vrescale thermostat

This allows to set a pointer to the vrescale thermostat used to print the thermostat integral. TODO: This should be made obsolete my a more modular energy element

rvec * gmx::EnergyElement::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: