Gromacs
2025-dev-20241003-bd59e46
|
#include <gromacs/applied_forces/awh/pointstate.h>
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. | |
double | localWeightSum () const |
Return the local contribution to the accumulated weight. | |
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 ¶ms, int64_t numUpdates, double weighthistScaling, double logPmfSumScaling) |
Apply previous updates that were skipped. More... | |
void | updateWithNewSampling (const BiasParams ¶ms, 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... | |
void | updatePmfUnvisited (double bias) |
Update the PMF histogram of unvisited coordinate values (along a lambda axis) More... | |
double | updateTargetWeight (const BiasParams ¶ms, 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 | addLocalWeightSum () |
Add the local weight contribution accumulated between updates. | |
void | scaleTarget (double scaleFactor) |
Scale the target weight of the point. More... | |
|
inline |
Increases the weight accumulated since the last update.
[in] | weight | The amount to add to the weight |
|
inline |
Query if the point is in the target region.
|
inline |
Correct free energy and PMF sum for the change in minimum.
[in] | minimumFreeEnergy | The free energy at the minimum; |
|
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.
[in] | params | The AWH bias parameters. |
[in] | numUpdates | The global number of updates. |
[in] | weighthistScaling | Scale factor for the reference weight histogram. |
[in] | logPmfSumScaling | Scale factor for the reference PMF histogram. |
void gmx::PointState::samplePmf | ( | double | convolvedBias | ) |
Update the PMF histogram with the current coordinate value.
[in] | convolvedBias | The convolved bias. |
|
inline |
Scale the target weight of the point.
[in] | scaleFactor | Factor to scale with. |
|
inline |
Set the free energy, only to be used at initialization.
[in] | freeEnergy | The free energy. |
|
inline |
Set all values in the state to those from a history.
[in] | psh | Coordinate point history to copy from. |
|
inline |
Set the initial reference weighthistogram.
[in] | histogramSize | The weight histogram size. |
|
inline |
Set log(PmfSum).
TODO: Replace this setter function with a more elegant solution.
[in] | logPmfSum | The log(PmfSum). |
|
inline |
Set the weight and count accumulated since the last update.
[in] | weightSum | The weight-sum value |
[in] | numVisits | The number of visits |
|
inline |
Set the constant target weight factor.
[in] | targetConstantWeight | The target weight factor. |
|
inline |
Store the state of a point in a history struct.
[in,out] | psh | Coordinate point history to copy to. |
void gmx::PointState::updatePmfUnvisited | ( | double | bias | ) |
Update the PMF histogram of unvisited coordinate values (along a lambda axis)
[in] | bias | The bias to update with. |
|
inline |
Update the target weight of a point.
Note that renormalization over all points is needed after the update.
[in] | params | The AWH bias parameters. |
[in] | freeEnergyCutoff | The cut-off for the free energy for target type "cutoff". |
|
inline |
Apply a point update with new sampling.
[in] | params | The AWH bias parameters. |
[in] | numUpdates | The global number of updates. |
[in] | weighthistScaling | Scaling factor for the reference weight histogram. |
[in] | logPmfSumScaling | Log of the scaling factor for the PMF histogram. |