Path Integral Quantum Monte Carlo
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
EstimatorBase Class Reference

The base class that all estimator classes will be derived from. More...

#include <estimator.h>

+ Inheritance diagram for EstimatorBase:

Public Member Functions

 EstimatorBase (const Path &_path, ActionBase *_actionPtr, const MTRand &_random, double _maxR, int _frequency=1, string _label="")
 Constructor. More...
 
virtual ~EstimatorBase ()
 Destructor.
 
virtual void sample ()
 Sample the estimator. More...
 
void reset ()
 Reset numAccumulated and the estimator to 0.
 
void restart (const uint32, const uint32)
 Restart the measurment process from a previous state.
 
virtual void output ()
 Output the estimator value to disk. More...
 
virtual void outputFooter ()
 Ouptut the fooder to disk.
 
bool baseSample ()
 Determine the basic sampling condition. More...
 
uint32 getTotNumAccumulated ()
 Get the total number of accumulated measurments.
 
uint32 getNumAccumulated ()
 Get the number of accumulated measurements since the last reset.
 
uint32 getNumSampled ()
 Get the number of samples since the last reset.
 
virtual string getName ()
 Get the name of the estimator.
 
void prepare ()
 Prepare estimator for i/o. More...
 
void appendLabel (string append)
 AppendLabel.
 

Protected Member Functions

virtual void accumulate ()
 Accumulate the estimator.
 
void initialize (int)
 Initialize estimator. More...
 

Protected Attributes

const Pathpath
 A constant reference to the paths.
 
ActionBaseactionPtr
 A pointer to the action.
 
MTRand random
 
double maxR
 
fstream * outFilePtr
 The output fie.
 
Array< double, 1 > estimator
 The estimator array.
 
Array< double, 1 > norm
 The normalization factor for each estimator.
 
int numEst
 The number of individual quantities measured.
 
int frequency
 The frequency at which we accumulate.
 
string label
 The label used for the output file.
 
uint32 numSampled
 The number of times we have sampled.
 
uint32 numAccumulated
 The number of accumulated values.
 
uint32 totNumAccumulated
 The total number of accumulated values.
 
int numBeads0
 The target number of beads for the canonical ensemble.
 
bool diagonal
 Is this a diagonal estimator?
 
bool endLine
 Should we output a carriage return?
 
bool canonical
 Are we in the canonical ensemble?
 
string header
 The data file header.
 

Detailed Description

The base class that all estimator classes will be derived from.

Contains the common elements of all estimators, including the ability to initialize, accumulate, output and reset. We assume a default measurment frequency of every time.

Definition at line 28 of file estimator.h.

Constructor & Destructor Documentation

◆ EstimatorBase()

EstimatorBase::EstimatorBase ( const Path _path,
ActionBase _actionPtr,
const MTRand &  _random,
double  _maxR,
int  _frequency = 1,
string  _label = "" 
)

Constructor.

Initialize and specify the output file.

We take in some options that might only be needed by derived classes (_actionPtr, _random, _maxR) in order to facilitate instantiation via a factory.

Definition at line 109 of file estimator.cpp.

Member Function Documentation

◆ baseSample()

bool EstimatorBase::baseSample ( )

Determine the basic sampling condition.

We only sample when: 1) frequency > 0 2) numSampled is a even factor of frequency 3) The configuration (diagonal/off diagonal) matches the estimator type. 4) If we are canonical, then only when we match the desired number of particles

Definition at line 146 of file estimator.cpp.

◆ initialize()

void EstimatorBase::initialize ( int  _numEst)
protected

Initialize estimator.

Initilize the estimator and normalization arrays.

Definition at line 186 of file estimator.cpp.

◆ output()

void EstimatorBase::output ( )
virtual

Output the estimator value to disk.

We only attempt an output if we have accumulated at least numBins measurements. This works because the final 'scalar' estimator is the diagonal estimator which gets measured for both diaagonal and off diagonal configurations.

Reimplemented in LocalPermutationEstimator, LocalSuperfluidDensityEstimator, ParticlePositionEstimator, TimeEstimator, and NullEstimator.

Definition at line 243 of file estimator.cpp.

◆ prepare()

void EstimatorBase::prepare ( )

Prepare estimator for i/o.

Assign the output file and write a header depending on whether or not we are restarting the simulation.

Definition at line 201 of file estimator.cpp.

◆ sample()

void EstimatorBase::sample ( )
virtual

Sample the estimator.

Here we simply call accumulate every frequency times sample is called, depending on whether we are measuring a diagonal or off-diagonal estimator. If frequency == 0, we don't bother to measure it.

Reimplemented in PIGSOneBodyDensityMatrixEstimator, CylinderPairCorrelationEstimator, CylinderOneBodyDensityMatrixEstimator, OneBodyDensityMatrixEstimator, DiagonalFractionEstimator, and TimeEstimator.

Definition at line 172 of file estimator.cpp.


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