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

Compute the local superfluid density. More...

#include <estimator.h>

+ Inheritance diagram for LocalSuperfluidDensityEstimator:
+ Collaboration diagram for LocalSuperfluidDensityEstimator:

Public Member Functions

 LocalSuperfluidDensityEstimator (const Path &, ActionBase *, const MTRand &, double, int _frequency=1, string _label="locsuper")
 Constructor. More...
 
 ~LocalSuperfluidDensityEstimator ()
 Destructor.
 
void output ()
 overload the output More...
 
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 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 local superfluid density.

Definition at line 439 of file estimator.h.

Constructor & Destructor Documentation

◆ LocalSuperfluidDensityEstimator()

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

Constructor.

Initialize the variables needed to measure the local superfluid density as described in:

See also
E. W. Draeger and D. M. Ceperley, Phys. Rev. Lett. 90, 065301 (2003).

Definition at line 1768 of file estimator.cpp.

1770  :
1771  EstimatorBase(_path,_actionPtr,_random,_maxR,_frequency,_label) {
1772 
1773  /* This is a 'local' histogram estimator so we use the defined grid */
1774  numGrid = path.boxPtr->numGrid;
1775  initialize(3*numGrid);
1776 
1777  /* The smallest allowed radius */
1778  dR = 0.5*path.boxPtr->side[0]/numGrid;
1779 
1780  header = str(format("#%15d\n") % NGRIDSEP);
1781  header += str(format("#%15s%16s%16s") % "W:rho_s" % "A:rho_s" % "A^2");
1782 
1783  double C = 0.5*constants()->T()/constants()->lambda();
1784 
1785  /* The normalization constant for the local winding and area estimators. */
1786  for (int n = 0; n < numGrid; n++) {
1787  double dV = path.boxPtr->gridBoxVolume(n);
1788  norm(n) = C/dV;
1789  norm(n+numGrid) = C/dV;
1790  norm(n+2*numGrid) = C/dV;
1791  }
1792 
1793  /* Initialize the local arrays */
1794  locWz.resize(numGrid);
1795  locWz = 0.0;
1796 
1797  locAz.resize(numGrid);
1798  locAz = 0.0;
1799 
1800  locA2.resize(numGrid);
1801  locA2 = 0.0;
1802 
1803 }
double T() const
Get temperature.
Definition: constants.h:41
double lambda() const
Get lambda = hbar^2/(2mk_B)
Definition: constants.h:46
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.
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 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 LocalSuperfluidDensityEstimator::output ( )
virtual

overload the output

Overload the output of the base class so that a running average is kept rather than keeping all data.

Reimplemented from EstimatorBase.

Definition at line 1818 of file estimator.cpp.

1818  {
1819 
1820  /* Prepare the position file for writing over old data */
1821  communicate()->file(label)->reset();
1822 
1823  (*outFilePtr) << header;
1824  if (endLine)
1825  (*outFilePtr) << endl;
1826 
1827  /* Now write the running average of the estimator to disk */
1828  for (int n = 0; n < numGrid; n++) {
1829  for (int i = 0; i < int(numEst/numGrid); i++)
1830  (*outFilePtr) << format("%16.8E") %
1831  (norm(n+i*numGrid)*estimator(n+i*numGrid)/totNumAccumulated);
1832  (*outFilePtr) << endl;
1833  }
1834 
1835  communicate()->file(label)->rename();
1836 }
File * file(string type)
Get method returning file object.
Definition: communicator.h:85
Array< double, 1 > estimator
The estimator array.
Definition: estimator.h:90
bool endLine
Should we output a carriage return?
Definition: estimator.h:107
int numEst
The number of individual quantities measured.
Definition: estimator.h:93
uint32 totNumAccumulated
The total number of accumulated values.
Definition: estimator.h:103
fstream * outFilePtr
The output fie.
Definition: estimator.h:86
string label
The label used for the output file.
Definition: estimator.h:99
void reset()
Reset a file.
void rename()
Rename a file.
Communicator * communicate()
Global public access to the communcator singleton.
Definition: communicator.h:121
+ Here is the call graph for this function:

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