QMCPACK
DMCRefEnergy Class Reference

Handle updating Eref used for calculating the trial energy. More...

+ Collaboration diagram for DMCRefEnergy:

Public Types

enum  DataLayout { ENERGY = 0, VARIANCE, DATA_SIZE }
 
using FullPrecReal = QMCTraits::FullPrecRealType
 

Public Member Functions

 DMCRefEnergy (DMCRefEnergyScheme scheme, size_t history_limit)
 
std::tuple< FullPrecReal, FullPrecRealgetEnergyVariance () const
 return energy and variance More...
 
void pushWeightEnergyVariance (FullPrecReal weight, FullPrecReal ene, FullPrecReal var)
 record weight, energy and variance. More...
 
size_t count () const
 return record count. More...
 

Private Attributes

DMCRefEnergyScheme scheme_
 scheme More...
 
accumulator_set< FullPrecRealenergy_hist_
 a simple accumulator for energy More...
 
accumulator_set< FullPrecRealvariance_hist_
 a simple accumulator for variance More...
 
SizeLimitedDataQueue< FullPrecReal, DataLayout::DATA_SIZE > energy_and_variance_
 

Detailed Description

Handle updating Eref used for calculating the trial energy.

Definition at line 25 of file DMCRefEnergy.h.

Member Typedef Documentation

◆ FullPrecReal

Definition at line 28 of file DMCRefEnergy.h.

Member Enumeration Documentation

◆ DataLayout

enum DataLayout
Enumerator
ENERGY 
VARIANCE 
DATA_SIZE 

Definition at line 30 of file DMCRefEnergy.h.

Constructor & Destructor Documentation

◆ DMCRefEnergy()

DMCRefEnergy ( DMCRefEnergyScheme  scheme,
size_t  history_limit 
)

Definition at line 20 of file DMCRefEnergy.cpp.

21  : scheme_(scheme), energy_and_variance_(history_limit)
22 {}
SizeLimitedDataQueue< FullPrecReal, DataLayout::DATA_SIZE > energy_and_variance_
Definition: DMCRefEnergy.h:48
DMCRefEnergyScheme scheme_
scheme
Definition: DMCRefEnergy.h:39

Member Function Documentation

◆ count()

size_t count ( ) const

return record count.

Definition at line 46 of file DMCRefEnergy.cpp.

References accumulator_set< T, typename >::count(), DMCRefEnergy::energy_and_variance_, DMCRefEnergy::energy_hist_, qmcplusplus::LIMITED_HISTORY, DMCRefEnergy::scheme_, SizeLimitedDataQueue< T, NUM_FIELDS >::size(), and DMCRefEnergy::variance_hist_.

Referenced by SFNBranch::updateParamAfterPopControl().

47 {
49  return energy_and_variance_.size();
50  else
51  {
52  assert(energy_hist_.count() == variance_hist_.count());
53  return energy_hist_.count();
54  }
55 }
SizeLimitedDataQueue< FullPrecReal, DataLayout::DATA_SIZE > energy_and_variance_
Definition: DMCRefEnergy.h:48
accumulator_set< FullPrecReal > variance_hist_
a simple accumulator for variance
Definition: DMCRefEnergy.h:45
DMCRefEnergyScheme scheme_
scheme
Definition: DMCRefEnergy.h:39
accumulator_set< FullPrecReal > energy_hist_
a simple accumulator for energy
Definition: DMCRefEnergy.h:43
return_type count() const
return the count
Definition: accumulators.h:116
auto size() const
return the number of records

◆ getEnergyVariance()

std::tuple< FullPrecReal, FullPrecReal > getEnergyVariance ( ) const

return energy and variance

Definition at line 24 of file DMCRefEnergy.cpp.

References DMCRefEnergy::ENERGY, DMCRefEnergy::energy_and_variance_, DMCRefEnergy::energy_hist_, qmcplusplus::LIMITED_HISTORY, accumulator_set< T, typename >::mean(), DMCRefEnergy::scheme_, DMCRefEnergy::VARIANCE, DMCRefEnergy::variance_hist_, and SizeLimitedDataQueue< T, NUM_FIELDS >::weighted_avg().

Referenced by SFNBranch::updateParamAfterPopControl().

25 {
27  {
29  return {avg[ENERGY], avg[VARIANCE]};
30  }
31  else
32  return {energy_hist_.mean(), variance_hist_.mean()};
33 }
SizeLimitedDataQueue< FullPrecReal, DataLayout::DATA_SIZE > energy_and_variance_
Definition: DMCRefEnergy.h:48
accumulator_set< FullPrecReal > variance_hist_
a simple accumulator for variance
Definition: DMCRefEnergy.h:45
DMCRefEnergyScheme scheme_
scheme
Definition: DMCRefEnergy.h:39
return_type mean() const
return the mean
Definition: accumulators.h:126
accumulator_set< FullPrecReal > energy_hist_
a simple accumulator for energy
Definition: DMCRefEnergy.h:43
auto weighted_avg() const
return weighted average

◆ pushWeightEnergyVariance()

void pushWeightEnergyVariance ( FullPrecReal  weight,
FullPrecReal  ene,
FullPrecReal  var 
)

record weight, energy and variance.

Definition at line 35 of file DMCRefEnergy.cpp.

References DMCRefEnergy::energy_and_variance_, DMCRefEnergy::energy_hist_, qmcplusplus::LIMITED_HISTORY, SizeLimitedDataQueue< T, NUM_FIELDS >::push(), DMCRefEnergy::scheme_, and DMCRefEnergy::variance_hist_.

Referenced by SFNBranch::updateParamAfterPopControl().

36 {
38  energy_and_variance_.push({weight, {ene, var}});
39  else
40  {
41  energy_hist_(ene);
42  variance_hist_(var);
43  }
44 }
SizeLimitedDataQueue< FullPrecReal, DataLayout::DATA_SIZE > energy_and_variance_
Definition: DMCRefEnergy.h:48
accumulator_set< FullPrecReal > variance_hist_
a simple accumulator for variance
Definition: DMCRefEnergy.h:45
DMCRefEnergyScheme scheme_
scheme
Definition: DMCRefEnergy.h:39
accumulator_set< FullPrecReal > energy_hist_
a simple accumulator for energy
Definition: DMCRefEnergy.h:43
void push(const value_type &val)
add a new record

Member Data Documentation

◆ energy_and_variance_

SizeLimitedDataQueue<FullPrecReal, DataLayout::DATA_SIZE> energy_and_variance_
private

◆ energy_hist_

accumulator_set<FullPrecReal> energy_hist_
private

a simple accumulator for energy

Definition at line 43 of file DMCRefEnergy.h.

Referenced by DMCRefEnergy::count(), DMCRefEnergy::getEnergyVariance(), and DMCRefEnergy::pushWeightEnergyVariance().

◆ scheme_

◆ variance_hist_

accumulator_set<FullPrecReal> variance_hist_
private

a simple accumulator for variance

Definition at line 45 of file DMCRefEnergy.h.

Referenced by DMCRefEnergy::count(), DMCRefEnergy::getEnergyVariance(), and DMCRefEnergy::pushWeightEnergyVariance().


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