QMCPACK
LocalEnergyOnlyEstimator Struct Reference

Estimator for local energy only. More...

+ Inheritance diagram for LocalEnergyOnlyEstimator:
+ Collaboration diagram for LocalEnergyOnlyEstimator:

Public Types

using WP = WalkerProperties::Indexes
 
- Public Types inherited from ScalarEstimatorBase
using RealType = QMCTraits::FullPrecRealType
 
using accumulator_type = accumulator_set< RealType >
 
using Walker_t = MCWalkerConfiguration::Walker_t
 
using MCPWalker = Walker< QMCTraits, PtclOnLatticeTraits >
 
using WalkerIterator = MCWalkerConfiguration::const_iterator
 
using RecordListType = RecordNamedProperty< RealType >
 

Public Member Functions

 LocalEnergyOnlyEstimator ()
 
std::string getName () const override
 
void accumulate (const MCWalkerConfiguration &W, WalkerIterator first, WalkerIterator last, RealType wgt) override
 a virtual function to accumulate observables or collectables More...
 
void accumulate (const RefVector< MCPWalker > &walkers) override
 a virtual function to accumulate observables or collectables More...
 
void registerObservables (std::vector< ObservableHelper > &h5dec, hdf_archive &file) override
 add descriptors of observables to utilize hdf5 More...
 
void add2Record (RecordListType &record) override
 add the local energy, variance and all the Hamiltonian components to the scalar record container More...
 
LocalEnergyOnlyEstimatorclone () override
 clone the object More...
 
const std::string & getSubTypeStr () const override
 String representation of the derived type of the ScalarEstimator. More...
 
- Public Member Functions inherited from ScalarEstimatorBase
 ScalarEstimatorBase ()
 
virtual ~ScalarEstimatorBase ()
 
virtual bool isMainEstimator () const
 Is this estimator a main estimator i.e. the estimator required for a particular driver. More...
 
RealType average (int i=0) const
 return average of the More...
 
RealType variance (int i=0) const
 return a variance More...
 
std::pair< RealType, RealTypeoperator[] (int i) const
 retrun mean and variance More...
 
virtual int size () const
 return the size of scalars it manages More...
 
void clear ()
 clear the scalars to collect More...
 
template<typename IT >
void takeBlockAverage (IT first)
 take block average and write to a common container More...
 
template<typename IT >
void takeBlockAverage (IT first, IT first_sq)
 take block average and write to common containers for values and squared values More...
 
template<typename IT >
void addAccumulated (IT first)
 add the block accumulated scalars More...
 
virtual void add2Record (RecordNamedProperty< RealType > &record)=0
 add the content of the scalar estimator to the record More...
 

Public Attributes

const std::string type_str = "LocalEnergyOnlyEstimatorNotSupportedInBatchedVersion"
 
- Public Attributes inherited from ScalarEstimatorBase
int FirstIndex
 first index within an record of the first element handled by an object More...
 
int LastIndex
 last index within an record of the first element handled by an object More...
 
std::vector< accumulator_typescalars
 scalars to be measured More...
 
std::vector< accumulator_typescalars_saved
 scalars saved More...
 

Detailed Description

Estimator for local energy only.

Definition at line 22 of file LocalEnergyOnlyEstimator.h.

Member Typedef Documentation

◆ WP

Definition at line 24 of file LocalEnergyOnlyEstimator.h.

Constructor & Destructor Documentation

◆ LocalEnergyOnlyEstimator()

Definition at line 26 of file LocalEnergyOnlyEstimator.h.

References ScalarEstimatorBase::scalars, and ScalarEstimatorBase::scalars_saved.

Referenced by LocalEnergyOnlyEstimator::clone().

27  {
28  scalars.resize(2);
29  scalars_saved.resize(2);
30  }
std::vector< accumulator_type > scalars
scalars to be measured
std::vector< accumulator_type > scalars_saved
scalars saved

Member Function Documentation

◆ accumulate() [1/2]

void accumulate ( const MCWalkerConfiguration W,
WalkerIterator  first,
WalkerIterator  last,
RealType  wgt 
)
inlineoverridevirtual

a virtual function to accumulate observables or collectables

Parameters
Wconst MCWalkerConfiguration
firstconst_iterator for the first walker
lastconst_iterator for the last walker
wgtweight

Pass W along with the iterators so that the properties of W can be utilized.

Implements ScalarEstimatorBase.

Definition at line 34 of file LocalEnergyOnlyEstimator.h.

References ScalarEstimatorBase::scalars.

Referenced by qmcplusplus::TEST_CASE().

38  {
39  for (; first != last; ++first)
40  {
41  scalars[0]((*first)->Properties(WP::LOCALENERGY), wgt);
42  scalars[1]((*first)->Properties(WP::LOCALPOTENTIAL), wgt);
43  }
44  }
std::vector< accumulator_type > scalars
scalars to be measured

◆ accumulate() [2/2]

void accumulate ( const RefVector< MCPWalker > &  )
inlineoverridevirtual

a virtual function to accumulate observables or collectables

Parameters
global_walkers_walkers per ranks or walkers total?
RefVectorof MCPWalkers
wgtweight or maybe norm

Implements ScalarEstimatorBase.

Definition at line 46 of file LocalEnergyOnlyEstimator.h.

References ScalarEstimatorBase::scalars, qmcplusplus::walker, and qmcplusplus::hdf::walkers.

47  {
48  for (MCPWalker& walker : walkers)
49  {
50  scalars[0](walker.Properties(WP::LOCALENERGY), 1.0);
51  scalars[1](walker.Properties(WP::LOCALPOTENTIAL), 1.0);
52  }
53  }
const char walkers[]
Definition: HDFVersion.h:36
std::vector< accumulator_type > scalars
scalars to be measured
Walker< QMCTraits, PtclOnLatticeTraits > MCPWalker

◆ add2Record()

void add2Record ( RecordListType record)
inlineoverride

add the local energy, variance and all the Hamiltonian components to the scalar record container

Parameters
recordstorage of scalar records (name,value)

Definition at line 60 of file LocalEnergyOnlyEstimator.h.

References RecordNamedProperty< T >::add(), ScalarEstimatorBase::clear(), ScalarEstimatorBase::FirstIndex, and ScalarEstimatorBase::LastIndex.

61  {
62  FirstIndex = record.add("LocalEnergy");
63  int s1 = record.add("LocalPotential");
64  LastIndex = FirstIndex + 2;
65  // int s2=record.add("KineticEnergy");
66  //LastIndex = FirstIndex+3;
67  clear();
68  }
int FirstIndex
first index within an record of the first element handled by an object
void clear()
clear the scalars to collect
int LastIndex
last index within an record of the first element handled by an object

◆ clone()

LocalEnergyOnlyEstimator* clone ( )
inlineoverridevirtual

◆ getName()

std::string getName ( ) const
inlineoverridevirtual

Implements ScalarEstimatorBase.

Definition at line 32 of file LocalEnergyOnlyEstimator.h.

Referenced by qmcplusplus::TEST_CASE().

32 { return "LocalEnergyOnlyEstimator"; }

◆ getSubTypeStr()

const std::string& getSubTypeStr ( ) const
inlineoverridevirtual

String representation of the derived type of the ScalarEstimator.

Implements ScalarEstimatorBase.

Definition at line 73 of file LocalEnergyOnlyEstimator.h.

References LocalEnergyOnlyEstimator::type_str.

73 { return type_str; }

◆ registerObservables()

void registerObservables ( std::vector< ObservableHelper > &  h5dec,
hdf_archive file 
)
inlineoverridevirtual

add descriptors of observables to utilize hdf5

Parameters
h5descdescriptor of a data stored in a h5 group
filefile to which each statistical data will be stored

Implements ScalarEstimatorBase.

Definition at line 55 of file LocalEnergyOnlyEstimator.h.

55 {}

Member Data Documentation

◆ type_str

const std::string type_str = "LocalEnergyOnlyEstimatorNotSupportedInBatchedVersion"

Definition at line 72 of file LocalEnergyOnlyEstimator.h.

Referenced by LocalEnergyOnlyEstimator::getSubTypeStr().


The documentation for this struct was generated from the following file: