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

Compute the intermediate scattering function F(q,\tau) More...

#include <estimator.h>

+ Inheritance diagram for IntermediateScatteringFunctionEstimator:
+ Collaboration diagram for IntermediateScatteringFunctionEstimator:

Public Member Functions

 IntermediateScatteringFunctionEstimator (const Path &, ActionBase *, const MTRand &, double, int _frequency=1, string _label="isf")
 Constructor. More...
 
 ~IntermediateScatteringFunctionEstimator ()
 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 intermediate scattering function F(q,\tau)

Definition at line 734 of file estimator.h.

Constructor & Destructor Documentation

◆ IntermediateScatteringFunctionEstimator()

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

Constructor.

Measure the intermediate scattering function at a hardcoded wavevector N.B. BROKEN: Doesn't work in general dimensions.

Definition at line 2668 of file estimator.cpp.

2670  :
2671  EstimatorBase(_path,_actionPtr,_random,_maxR,_frequency,_label)
2672 {
2673 
2674  int numTimeSlices = constants()->numTimeSlices();
2675 
2676  /* these are the hard-coded q-vectors for now */
2677  numq = 3;
2678  Array <double, 1> qMag(numq); // the q-vector magnitudes
2679  /* qMag.resize(numq); */
2680  qMag = 0.761,1.75,1.81;
2681 
2682  /* initialize the number of vectors with each magnitude */
2683  numqVecs.resize(numq);
2684  numqVecs = 0;
2685 
2686  /* The allowable error in the q-vector magnitude */
2687  double eps = 2.0*M_PI/min(path.boxPtr->side)/sqrt(NDIM);
2688  eps *= eps;
2689 
2690  /* Determine the set of q-vectors that have these magintudes */
2691  for (int nq = 0; nq < numq; nq++)
2692  {
2693  double cq = qMag(nq);
2694  vector <dVec> qvecs;
2695 
2696  int maxComp = ceil(cq*blitz::min(path.boxPtr->side)/(2.0*M_PI))+1;
2697  int maxNumQ = ipow(2*maxComp + 1,NDIM);
2698 
2699  iVec qi;
2700  for (int n = 0; n < maxNumQ; n++) {
2701  for (int i = 0; i < NDIM; i++) {
2702  int scale = 1;
2703  for (int j = i+1; j < NDIM; j++)
2704  scale *= (2*maxComp + 1);
2705  qi[i] = (n/scale) % (2*maxComp + 1);
2706 
2707  /* Wrap into the appropriate winding sector */
2708  qi[i] -= (qi[i] > maxComp)*(2*maxComp + 1);
2709  }
2710  dVec qd = 2.0*M_PI*qi/path.boxPtr->side;
2711 
2712  /* Store the winding number */
2713  if (abs(dot(qd,qd)-cq*cq) < eps) {
2714  qvecs.push_back(qd);
2715  numqVecs(nq)++;
2716  }
2717  }
2718 
2719  /* Make sure we have some q-vectors */
2720  if (qvecs.size() < 1) {
2721  cerr << "\nERROR: Intermediate Scattering function: "
2722  << "No valid q-vectors were added to the list for measurment."
2723  << endl << "Action: modify q-magintudes." << endl;
2724  exit(0);
2725  }
2726 
2727  q.push_back(qvecs);
2728  }
2729 
2730  /* get more accurate q-magnitudes */
2731  for (int nq = 0; nq < numq; nq++)
2732  qMag(nq) = sqrt(dot(q[nq][0],q[nq][0]));
2733 
2734  /* Initialize the accumulator for the intermediate scattering function*/
2735  /* N.B. for now we hard-code three wave-vectors */
2736  isf.resize(numq*numTimeSlices);
2737  isf = 0.0;
2738 
2739  /* This is a diagonal estimator that gets its own file */
2740  initialize(numq*numTimeSlices);
2741 
2742  /* the q-values */
2743  header = str(format("#%15.6E") % qMag(0));
2744  for (int n = 1; n < numq; n++)
2745  header.append(str(format("%16.6E") % qMag(n)));
2746  header.append("\n");
2747 
2748  /* The imaginary time values */
2749  header.append(str(format("#%15.6E") % 0.0));
2750  for (int n = 1; n < numTimeSlices; n++)
2751  header.append(str(format("%16.6E") % (constants()->tau()*n)));
2752 
2753  for (int nq = 1; nq < numq; nq++) {
2754  for (int n = 0; n < numTimeSlices; n++)
2755  header.append(str(format("%16.6E") % (constants()->tau()*n)));
2756  }
2757 
2758  /* utilize imaginary time translational symmetry */
2759  norm = 1.0/numTimeSlices;
2760 }
int numTimeSlices()
Get number of time slices.
Definition: constants.h:99
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
int ipow(int base, int power)
Return the integer value of a number raised to a power.
Definition: common.h:136
Ttype & min(Ttype &x, Ttype &y)
Minimum of two inputs.
Definition: common.h:142
TinyVector< double, NDIM > dVec
A NDIM-vector of type double.
Definition: common.h:111
TinyVector< int, NDIM > iVec
A NDIM-vector of type integer.
Definition: common.h:114
ConstantParameters * constants()
Global public access to the constants.
Definition: constants.h:201
+ Here is the call graph for this function:

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