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

#include <gromacs/energyanalysis/energyterm.h>

Description

Class describing the whole time series of an energy term.

Public Member Functions

 EnergyTerm (unsigned int indexWithinEnergyFile, bool bStoreData, const std::string &energyTerm, const std::string &energyUnit)
 Constructor. More...
 
unsigned int fileIndex () const
 Return the index in the file to the function type stored here.
 
std::string name () const
 Return the name corresponding to the energy term.
 
std::string unit () const
 Return the name corresponding to the energy unit.
 
void setStoreData (bool bStoreData)
 Tell the class to store or not to store data. More...
 
bool storeData () const
 Returns whether any data has been stored from the analyzed frame.
 
bool termIsEnergy () const
 Is this a true energy or e.g. Temperature.
 
EnergyAnalysisFrameIterator begin () const
 Return iterator to begin looping over energy frames.
 
EnergyAnalysisFrameIterator end () const
 Return iterator to end looping over energy frames.
 
EnergyAnalysisFrameIterator findFrame (int64_t frameIndex) const
 Return the stored energy frame corresponding to a certain input frame. More...
 
void addFrame (double time, int64_t step, int numIntermediateStepsSum, double energySumOverNumSteps, double energyVarianceOverNumSteps, double energyAtTime)
 Add a data frame to this EnergyTerm. More...
 
double average () const
 Return the average energy.
 
double standardDeviation () const
 Return the standard deviation.
 
std::optional< realerrorEstimate (unsigned int numBlocks) const
 Compute an error estimate based on block averaging. Requires that the energies have been stored. More...
 
std::optional< realslopeOfLinearFit () const
 Calculate the slope of linear fit of energy. More...
 
int64_t numFrames () const
 Return the number of points stored.
 
double timeSpan () const
 Return the length of the data set in time.
 
double timeBegin () const
 Return the begin time of the data set.
 
double timeEnd () const
 Return the end time of the data set.
 
int64_t numSteps () const
 Return the length of the data set in steps.
 
int64_t stepBegin () const
 Return the begin step of the data set.
 
int64_t stepEnd () const
 Return the end step of the data set.
 

Constructor & Destructor Documentation

gmx::EnergyTerm::EnergyTerm ( unsigned int  indexWithinEnergyFile,
bool  bStoreData,
const std::string &  energyTerm,
const std::string &  energyUnit 
)

Constructor.

Parameters
[in]indexWithinEnergyFileFile index (in the energies stored)
[in]bStoreDataboolean indicating whether to store the data
[in]energyTermString describing the energy
[in]energyUnitString describing the energy unit

Member Function Documentation

void gmx::EnergyTerm::addFrame ( double  time,
int64_t  step,
int  numIntermediateStepsSum,
double  energySumOverNumSteps,
double  energyVarianceOverNumSteps,
double  energyAtTime 
)

Add a data frame to this EnergyTerm.

Parameters
[in]timeThe time in the simulation
[in]stepThe simulation step
[in]numIntermediateStepsSumThe number of intermediate steps for the sums
[in]energySumOverNumStepsThe sum of energies over the last nsum steps
[in]energyVarianceOverNumStepsThe variance of the energies over the last nsum steps
[in]energyAtTimeThe energy at this point in time (trajectory)
std::optional< real > gmx::EnergyTerm::errorEstimate ( unsigned int  numBlocks) const

Compute an error estimate based on block averaging. Requires that the energies have been stored.

Parameters
[in]numBlocksNumber of blocks
Returns
Optional error estimate
EnergyAnalysisFrameIterator gmx::EnergyTerm::findFrame ( int64_t  frameIndex) const

Return the stored energy frame corresponding to a certain input frame.

Parameters
[in]frameIndexThe frame number to search the storage for.
Returns
the actual EnergyFrameIterator, or end() if not found
void gmx::EnergyTerm::setStoreData ( bool  bStoreData)
inline

Tell the class to store or not to store data.

Parameters
[in]bStoreDataBoolean
std::optional< real > gmx::EnergyTerm::slopeOfLinearFit ( ) const

Calculate the slope of linear fit of energy.

This energy drift calculation can only be done when the data is stored. This is done by fitting the data to a line y = ax + b.

Returns
Optional slope of the line when calculated

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