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

Compute the two-body pair-correlation function, g(r) ~ <rho(r)rho(0)>. More...

#include <estimator.h>

+ Inheritance diagram for PairCorrelationEstimator:
+ Collaboration diagram for PairCorrelationEstimator:

Public Member Functions

 PairCorrelationEstimator (const Path &, ActionBase *, const MTRand &, double, int _frequency=1, string _label="pair")
 Constructor. More...
 
 ~PairCorrelationEstimator ()
 Destructor.
 
string getName () const
 Get the name of the estimator.
 
- 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 output ()
 Output the estimator value to disk. More...
 
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

Compute the two-body pair-correlation function, g(r) ~ <rho(r)rho(0)>.

Definition at line 690 of file estimator.h.

Constructor & Destructor Documentation

◆ PairCorrelationEstimator()

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

Constructor.

For the pair correlation function, we measure NPCFSEP positions to get high enough data density to observe possible osscilations. The normalization depends on dimension.

Definition at line 2497 of file estimator.cpp.

2499  :
2500  EstimatorBase(_path,_actionPtr,_random,_maxR,_frequency,_label)
2501 {
2502  /* The spatial discretization */
2503  dR = 0.5*sqrt(sum(path.boxPtr->periodic))*path.boxPtr->side[NDIM-1] / (1.0*NPCFSEP);
2504 
2505  /* This is a diagonal estimator that gets its own file */
2507 
2508  /* The header is the first line which contains the spatial separations */
2509  header = str(format("#%15.3E") % 0.0);
2510  for (int n = 1; n < NPCFSEP; n++)
2511  header.append(str(format("%16.3E") % ((n)*dR)));
2512 
2513  /* The normalization factor for the pair correlation function depends
2514  * on the dimensionality */
2515 // TinyVector<double,3> gNorm;
2516 // gNorm[0] = 0.5;
2517 // gNorm[1] = 1.0/(4.0*M_PI);
2518 // gNorm[2] = 1.0/(8.0*M_PI);
2519 // norm(0) = 1.0;
2520 // for (int n = 1; n < NPCFSEP; n++)
2521 // norm(n) = (gNorm[NDIM-1]*path.boxPtr->volume) / (dR*pow(n*dR,NDIM-1));
2522 
2523  /* The normalization factor for the pair correlation function depends
2524  * on the dimensionality, and container type */
2525  if (path.boxPtr->name == "Cylinder") {
2526  for (int n = 0; n < NPCFSEP; n++)
2527  norm(n) = 0.5*path.boxPtr->side[NDIM-1] / dR;
2528  }
2529  else {
2530  TinyVector<double,3> gNorm;
2531  gNorm[0] = 1.0;
2532  gNorm[1] = 1.0/(M_PI);
2533  gNorm[2] = 3.0/(2.0*M_PI);
2534  double dV;
2535  for (int n = 0; n < NPCFSEP; n++) {
2536  dV = pow((n+1)*dR,NDIM)-pow(n*dR,NDIM);
2537  norm(n) = 0.5*(gNorm[NDIM-1]*path.boxPtr->volume) / dV;
2538  }
2539  }
2540 }
double volume
The volume of the container in A^3.
Definition: container.h:35
TinyVector< unsigned int, NDIM > periodic
Determines which dimensions have periodic bc.
Definition: container.h:29
string name
The name of the container.
Definition: container.h:39
dVec side
The linear dimensions of the box.
Definition: container.h:31
Array< double, 1 > norm
The normalization factor for each estimator.
Definition: estimator.h:91
string header
The data file header.
Definition: estimator.h:110
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 NPCFSEP
Spatial separations to be used in the pair correlation function.
Definition: common.h:90
+ Here is the call graph for this function:

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