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

#include <gromacs/awh/pointstate.h>

Description

The state of a coordinate point.

This class contains all the state variables of a coordinate point (on the bias grid) and methods to update the state of a point.

Public Member Functions

 PointState ()
 Constructs a point state with default values.
 
void setFromHistory (const AwhPointStateHistory &psh)
 Set all values in the state to those from a history. More...
 
void storeState (AwhPointStateHistory *psh) const
 Store the state of a point in a history struct. More...
 
bool inTargetRegion () const
 Query if the point is in the target region. More...
 
double bias () const
 Return the bias function estimate.
 
void setTargetToZero ()
 Set the target to zero and the bias to minus infinity.
 
double freeEnergy () const
 Return the free energy.
 
void setFreeEnergy (double freeEnergy)
 Set the free energy, only to be used at initialization. More...
 
double target () const
 Return the target distribution value.
 
double weightSumIteration () const
 Return the weight accumulated since the last update.
 
void increaseWeightSumIteration (double weight)
 Increases the weight accumulated since the last update. More...
 
double weightSumTot () const
 Returns the accumulated weight.
 
double weightSumRef () const
 Return the reference weight histogram.
 
double logPmfSum () const
 Return log(PmfSum).
 
void setLogPmfSum (double logPmfSum)
 Set log(PmfSum). More...
 
double numVisitsIteration () const
 Return the number of visits since the last update.
 
double numVisitsTot () const
 Return the total number of visits.
 
void setTargetConstantWeight (double targetConstantWeight)
 Set the constant target weight factor. More...
 
void updateBias ()
 Updates the bias of a point.
 
void setInitialReferenceWeightHistogram (double histogramSize)
 Set the initial reference weighthistogram. More...
 
void normalizeFreeEnergyAndPmfSum (double minimumFreeEnergy)
 Correct free energy and PMF sum for the change in minimum. More...
 
bool performPreviouslySkippedUpdates (const BiasParams &params, int64_t numUpdates, double weighthistScaling, double logPmfSumScaling)
 Apply previous updates that were skipped. More...
 
void updateWithNewSampling (const BiasParams &params, int64_t numUpdates, double weighthistScaling, double logPmfSumScaling)
 Apply a point update with new sampling. More...
 
void samplePmf (double convolvedBias)
 Update the PMF histogram with the current coordinate value. More...
 
double updateTargetWeight (const BiasParams &params, double freeEnergyCutoff)
 Update the target weight of a point. More...
 
void setPartialWeightAndCount (double weightSum, double numVisits)
 Set the weight and count accumulated since the last update. More...
 
void addPartialWeightAndCount ()
 Add the weights and counts accumulated between updates.
 
void scaleTarget (double scaleFactor)
 Scale the target weight of the point. More...
 

Member Function Documentation

void gmx::PointState::increaseWeightSumIteration ( double  weight)
inline

Increases the weight accumulated since the last update.

Parameters
[in]weightThe amount to add to the weight
bool gmx::PointState::inTargetRegion ( ) const
inline

Query if the point is in the target region.

Returns
true if the point is in the target region.
void gmx::PointState::normalizeFreeEnergyAndPmfSum ( double  minimumFreeEnergy)
inline

Correct free energy and PMF sum for the change in minimum.

Parameters
[in]minimumFreeEnergyThe free energy at the minimum;
bool gmx::PointState::performPreviouslySkippedUpdates ( const BiasParams params,
int64_t  numUpdates,
double  weighthistScaling,
double  logPmfSumScaling 
)
inline

Apply previous updates that were skipped.

An update can only be skipped if the parameters needed for the update are constant or deterministic so that the same update can be performed at a later time. Here, the necessary parameters are the sampled weight and scaling factors for the histograms. The scaling factors are provided as arguments only to avoid recalculating them for each point

The last update index is also updated here.

Parameters
[in]paramsThe AWH bias parameters.
[in]numUpdatesThe global number of updates.
[in]weighthistScalingScale factor for the reference weight histogram.
[in]logPmfSumScalingScale factor for the reference PMF histogram.
Returns
true if at least one update was applied.
void gmx::PointState::samplePmf ( double  convolvedBias)

Update the PMF histogram with the current coordinate value.

Parameters
[in]convolvedBiasThe convolved bias.
void gmx::PointState::scaleTarget ( double  scaleFactor)
inline

Scale the target weight of the point.

Parameters
[in]scaleFactorFactor to scale with.
void gmx::PointState::setFreeEnergy ( double  freeEnergy)
inline

Set the free energy, only to be used at initialization.

Parameters
[in]freeEnergyThe free energy.
void gmx::PointState::setFromHistory ( const AwhPointStateHistory &  psh)
inline

Set all values in the state to those from a history.

Parameters
[in]pshCoordinate point history to copy from.
void gmx::PointState::setInitialReferenceWeightHistogram ( double  histogramSize)
inline

Set the initial reference weighthistogram.

Parameters
[in]histogramSizeThe weight histogram size.
void gmx::PointState::setLogPmfSum ( double  logPmfSum)
inline

Set log(PmfSum).

TODO: Replace this setter function with a more elegant solution.

Parameters
[in]logPmfSumThe log(PmfSum).
void gmx::PointState::setPartialWeightAndCount ( double  weightSum,
double  numVisits 
)
inline

Set the weight and count accumulated since the last update.

Parameters
[in]weightSumThe weight-sum value
[in]numVisitsThe number of visits
void gmx::PointState::setTargetConstantWeight ( double  targetConstantWeight)
inline

Set the constant target weight factor.

Parameters
[in]targetConstantWeightThe target weight factor.
void gmx::PointState::storeState ( AwhPointStateHistory *  psh) const
inline

Store the state of a point in a history struct.

Parameters
[in,out]pshCoordinate point history to copy to.
double gmx::PointState::updateTargetWeight ( const BiasParams params,
double  freeEnergyCutoff 
)
inline

Update the target weight of a point.

Note that renormalization over all points is needed after the update.

Parameters
[in]paramsThe AWH bias parameters.
[in]freeEnergyCutoffThe cut-off for the free energy for target type "cutoff".
Returns
the updated value of the target.
void gmx::PointState::updateWithNewSampling ( const BiasParams params,
int64_t  numUpdates,
double  weighthistScaling,
double  logPmfSumScaling 
)
inline

Apply a point update with new sampling.

Note
The last update index is also updated here.
The new sampling containers are cleared here.
Parameters
[in]paramsThe AWH bias parameters.
[in]numUpdatesThe global number of updates.
[in]weighthistScalingScaling factor for the reference weight histogram.
[in]logPmfSumScalingLog of the scaling factor for the PMF histogram.

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