Path Integral Quantum Monte Carlo
Public Member Functions | Static Public Attributes
ParticlePositionEstimator Class Reference

Create histogram of particle positions. More...

#include <estimator.h>

+ Inheritance diagram for ParticlePositionEstimator:
+ Collaboration diagram for ParticlePositionEstimator:

Public Member Functions

 ParticlePositionEstimator (const Path &, ActionBase *, const MTRand &, double, int _frequency=1, string _label="position")
 Constructor. More...
 
 ~ParticlePositionEstimator ()
 Destructor.
 
string getName () const
 Get the name of the estimator.
 
void output ()
 Output the estimator value to disk. More...
 
- Public Member Functions inherited from EstimatorBase
 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 outputFlat ()
 Output a flat estimator value to disk. More...
 
virtual void outputFooter ()
 Ouptut the fooder to disk.
 
bool baseSample ()
 Determine the basic sampling condition. More...
 
uint32 getTotNumAccumulated () const
 Get the total number of accumulated measurments.
 
uint32 getNumAccumulated () const
 Get the number of accumulated measurements since the last reset.
 
uint32 getNumSampled () const
 Get the number of samples since the last reset.
 
void prepare ()
 Prepare the estimator for i/o. More...
 
void addEndLine ()
 Add a carriage return to estimator files.
 
void appendLabel (string append)
 Append to default label. More...
 
string getLabel () const
 Get the estimator label.
 

Static Public Attributes

static const string name
 

Additional Inherited Members

- Protected Member Functions inherited from EstimatorBase
void initialize (int)
 Initialize estimator. More...
 
void initialize (vector< string >)
 Initialize estimator. More...
 
- Protected Attributes inherited from EstimatorBase
const Pathpath
 A constant reference to the paths.
 
ActionBaseactionPtr
 A pointer to the action.
 
MTRand random
 
double maxR
 
fstream * outFilePtr
 The output fie.
 
map< string, int > estIndex
 Map estimator labels to indices.
 
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.
 
int startSlice
 Where imaginary time averages begin.
 
int endSlice
 Where imaginary time averages end.
 
int endDiagSlice
 Where imaginary time averages end for diagonal estimiators.
 
vector< double > sliceFactor
 Used to properly incorporate end affects.
 
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

Create histogram of particle positions.

Definition at line 241 of file estimator.h.

Constructor & Destructor Documentation

◆ ParticlePositionEstimator()

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

Constructor.

A full NDIM-dimensional particle density histogram.

Note
Only tested for cubic boxes

Definition at line 816 of file estimator.cpp.

818  :
819  EstimatorBase(_path,_actionPtr,_random,_maxR,_frequency,_label) {
820 
822 
823  /* Setup estimator name and header. We include the PIMCID as we
824  * replace the file on every output.*/
825  diffLabels = {"dx","dy","dz"};
826 
827  header = str(format("# PIMCID: %s\n") % constants()->id());
828  header += "# ESTINF:" ;
829  for (int i = 0; i < NDIM; i++)
830  header += str(format(" %s = %12.6E") % diffLabels[i] % path.boxPtr->gridSize[i]);
831  header += str(format(" NGRIDSEP = %d\n") % NGRIDSEP);
832  header += str(format("#%15s") % "density");
833 
834  /* The normalization: 1/(dV*M) */
835  for (int n = 0; n < numEst; n++)
836  norm(n) = 1.0/(1.0*(endSlice-startSlice)*(1.0/actionPtr->period) *
838 }
dVec gridSize
The grid size in each dimension.
Definition: container.h:44
int numGrid
The number of grid boxes for the position grid.
Definition: container.h:41
virtual double gridBoxVolume(const int) const =0
The physical size of a NDIM-dimensional grid box.
int endSlice
Where imaginary time averages end.
Definition: estimator.h:96
ActionBase * actionPtr
A pointer to the action.
Definition: estimator.h:82
Array< double, 1 > norm
The normalization factor for each estimator.
Definition: estimator.h:91
string header
The data file header.
Definition: estimator.h:110
int numEst
The number of individual quantities measured.
Definition: estimator.h:93
int startSlice
Where imaginary time averages begin.
Definition: estimator.h:95
EstimatorBase(const Path &_path, ActionBase *_actionPtr, const MTRand &_random, double _maxR, int _frequency=1, string _label="")
Constructor.
Definition: estimator.cpp:103
const Path & path
A constant reference to the paths.
Definition: estimator.h:78
void initialize(int)
Initialize estimator.
Definition: estimator.cpp:201
const Container * boxPtr
A constant reference to the container class.
Definition: path.h:43
#define NDIM
Number of spatial dimnsions.
Definition: common.h:71
#define NGRIDSEP
Spatial separations to be used in each dimension of the particle position grid.
Definition: common.h:93
ConstantParameters * constants()
Global public access to the constants.
Definition: constants.h:201
+ Here is the call graph for this function:

Member Function Documentation

◆ output()

void ParticlePositionEstimator::output ( )
inlinevirtual

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 from EstimatorBase.

Definition at line 251 of file estimator.h.

251 {outputFlat();} // overload the output
virtual void outputFlat()
Output a flat estimator value to disk.
Definition: estimator.cpp:305
+ Here is the call graph for this function:

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