Path Integral Quantum Monte Carlo
constants.h
Go to the documentation of this file.
1 
9 #ifndef CONSTANTS_H
10 #define CONSTANTS_H
11 
12 #include "common.h"
13 #include <boost/program_options.hpp>
14 
15 /* For generating a unique GUID */
16 #include <boost/uuid/uuid.hpp>
17 #include <boost/uuid/uuid_generators.hpp>
18 #include <boost/uuid/uuid_io.hpp>
19 
20 namespace po = boost::program_options;
21 
22 // ========================================================================
23 // ConstantParameters Class
24 // ========================================================================
34 {
35  public:
37 
38  void initConstants(po::variables_map &);
39 
40  /* All the get methods */
41  double T() const {return T_;}
42  double imagTimeLength() const { return imagTimeLength_;}
43  double mu() const {return mu_;}
44  double tau() const {return tau_;}
45  double m() const {return m_;}
46  double lambda() const {return lambda_;}
47  double rc() const {return rc_;}
48  double rc2() const {return rc2_;}
49  double C0() const {return C0_;}
50  double C() const {return C_;}
51  double V() const {return V_;}
52  double L() const {return L_;}
53  double comDelta() const {return comDelta_;}
54  double displaceDelta() const {return displaceDelta_;}
55  int virialWindow() const {return virialWindow_;}
56 
58  double dBWavelength() const {return dBWavelength_;}
60  double rho0Norm(int M, int d) const {return ( pow((4.0*M_PI*lambda_*M*tau_),-0.5*d));}
62  double fourLambdaTauInv() const { return (0.25 / (lambda_ * tau_)); }
63 
64  /* Get the move attempt probability */
65  double attemptProb(string type) {
66  if (attemptProb_.count(type))
67  return attemptProb_[type];
68  else {
69  cerr << "Get: Attempt probability for " << type << " does not exist!" << endl;
70  exit(EXIT_FAILURE);
71  return 0.0;
72  }
73  }
74 
75  /* Set the move attempt probability */
76  void setAttemptProb(string type,double prob) {
77  attemptProb_[type] = prob;
78  /* if (attemptProb_.count(type)) */
79  /* attemptProb_[type] = prob; */
80  /* else { */
81  /* cerr << "Set: Attempt probability for " << type << " does not exist!" << endl; */
82  /* exit(EXIT_FAILURE); */
83  /* } */
84  }
85 
86  bool restart() const {return restart_;}
87  bool wallClockOn() const {return wallClockOn_;}
88  uint32 wallClock() const {return wallClock_;}
89  bool canonical() const { return canonical_;}
90  bool window() const { return window_;}
91  bool startWithState() const { return startWithState_;}
92  int windowWidth() const { return windowWidth_;}
93  bool gaussianEnsemble() const { return gaussianEnsemble_;}
94  double gaussianEnsembleSD() const { return gaussianEnsembleSD_;}
95  bool varUpdates() const {return varUpdates_;}
96 
97  int Mbar() {return Mbar_;}
98  int b() {return b_;}
99  int numTimeSlices() {return numTimeSlices_;}
100  int initialNumParticles() { return initialNumParticles_;}
101  int maxWind() { return maxWind_;}
102  string id() {return id_;}
103  uint32 numEqSteps() {return numEqSteps_;}
104  int numBroken() {return numBroken_;} //< Get number of broken paths
105  double spatialSubregion() {return spatialSubregion_;} //< Get size of subregion
106  bool spatialSubregionOn() {return spatialSubregionOn_;} //< Get subregion on/off
107  int Npaths() {return Npaths_;} //< Get number of paths
108 
109  string intPotentialType() const {return intPotentialType_;}
110  string extPotentialType() const {return extPotentialType_;}
111  string waveFunctionType() const {return waveFunctionType_;}
112  double endFactor() const {return endFactor_;}
113  string actionType() const {return actionType_;}
114  string graphenelut3d_file_prefix() const {return graphenelut3d_file_prefix_;}
115 
116  /* Trial wave funciton parameters */
117  double R_LL_wfn() const {return R_LL_wfn_;}
118  double k_LL_wfn() const {return k_LL_wfn_;}
119 
120  /* Set methods */
121  void setmu(double _mu) {mu_ = _mu;}
122  void setCoMDelta(double _comDelta) {comDelta_ = _comDelta;}
123  void setDisplaceDelta(double _displaceDelta) {displaceDelta_ = _displaceDelta;}
124 
125  /* Increment/decrement methods */
126  void shiftC0(double frac) {C0_ += frac*C0_; getC();}
127  void setC0(double _C0) {C0_ = _C0; getC();}
128  void getC() {C_ = C0_ / (1.0*Mbar_*numTimeSlices_*V_);}
129  void shiftCoMDelta(double frac) {comDelta_ += frac*comDelta_; }
130  void shiftDisplaceDelta(double frac) {displaceDelta_ += frac*displaceDelta_; }
131  void shiftmu (double frac) { mu_ += frac; }
132 
133  bool saveStateFiles() { return saveStateFiles_;}
134 
135  protected:
139 
140  private:
141  double T_; // Temperature [K]
142  double imagTimeLength_; // Temperature [K]
143  double mu_; // Chemical Potential [K]
144  double tau_; // Imaginary time step (tau = beta/numTimeSlices)
145  double lambda_; // hbar^2 / (2*mass*k_B) [K A^2]
146  double m_; // The particle mass
147  double dBWavelength_; // Thermal de Broglie wavelength
148  double comDelta_; // The size of center of mass move
149  double displaceDelta_; // The size of the displace move shift
150 
151  double rc_; // The potential cutoff length
152  double rc2_; // The potential cutoff length squared
153  double C0_; // Worm probability constant [PRE 74, 036701 (2006)]
154  double C_; // Worm normalization factor
155  double V_; // The volume of the system
156  double L_; // The linear 'length' of the system
157 
158  int Mbar_; // Maximum worm algorithm trial length
159  int b_; // The maximum number of levels
160  int numTimeSlices_; // Number of imaginary time slices
161  int initialNumParticles_; // The initial number of particles
162  int numBroken_; // The number of broken paths
163  double spatialSubregion_; // The limits of the spatial sub region for EE
164  bool spatialSubregionOn_; // True if using a spatial subregion for EE
165  int Npaths_; // Number of paths used
166 
167  uint32 numEqSteps_; // Number of equilibration steps
168 
169  bool restart_; // Are we restarting the simulation
170  uint32 wallClock_; // The wall clock limit in seconds
171  bool wallClockOn_; // Is the wall clock on?
172  bool canonical_; // Are we in the canonical ensemble?
173  bool window_; // Are we using a particle number window?
174  bool startWithState_; // Are we starting from a supplied state?
175  int windowWidth_; // Half width of particle number window
176  bool gaussianEnsemble_; // Are we using gaussian ensemble weight?
177  double gaussianEnsembleSD_; // Standard deviation of ensemble weight
178  bool varUpdates_; // Perform variable length diagonal updates
179 
180  string id_; // The unique simulation UUID
181  string intPotentialType_; // The type of interaction potential
182  string extPotentialType_; // The type of external potential
183  string waveFunctionType_; // The type of trial wave function
184  double R_LL_wfn_; // The length scale of the Lieb-Liniger wave function
185  double k_LL_wfn_; // The wave number of the Lieb-Liniger wave function
186  double endFactor_; // The multiplicative factor of the potential on end beads
187  string actionType_; // The type of action
188 
189  int virialWindow_; // Window size for centroid virial estimator
190  int maxWind_; // The maximum winding number sampled
191 
192  bool saveStateFiles_; // Are we saving a state file every MC bin?
193  string graphenelut3d_file_prefix_; // GrapheneLUT3D file prefix <prefix>_{V,gradV,grad2V}.npy
194 
195  map <string,double> attemptProb_; // The move attempt probabilities
196 };
197 
198 /**************************************************************************/
203  return temp;
204 }
205 
206 #endif
207 
Constant simulation parameters.
Definition: constants.h:34
int windowWidth() const
Get window 1/2 width.
Definition: constants.h:92
string waveFunctionType() const
Get wave function type.
Definition: constants.h:111
int numTimeSlices()
Get number of time slices.
Definition: constants.h:99
ConstantParameters()
An empty constructor which simply sets all constants to null.
Definition: constants.cpp:20
void setmu(double _mu)
Set the value of the chemical potential.
Definition: constants.h:121
double T() const
Get temperature.
Definition: constants.h:41
double endFactor() const
Get end factor.
Definition: constants.h:112
void shiftmu(double frac)
Shift the chemical potential.
Definition: constants.h:131
bool wallClockOn() const
Get wallclockOn.
Definition: constants.h:87
double dBWavelength() const
Get deBroglie wavelength.
Definition: constants.h:58
double R_LL_wfn() const
Get Lieb-Liniger length scale.
Definition: constants.h:117
double rho0Norm(int M, int d) const
Get density matrix normalization factor.
Definition: constants.h:60
int maxWind()
Get the maximum winding number sampled.
Definition: constants.h:101
double m() const
Get mass.
Definition: constants.h:45
string graphenelut3d_file_prefix() const
Get GrapheneLUT3D file prefix <prefix>_serialized.{dat|txt}.
Definition: constants.h:114
double mu() const
Get chemical potential.
Definition: constants.h:43
void setCoMDelta(double _comDelta)
Set the CoM move size.
Definition: constants.h:122
double lambda() const
Get lambda = hbar^2/(2mk_B)
Definition: constants.h:46
double V() const
Get cell volume.
Definition: constants.h:51
double rc2() const
Get potential cutoff squared.
Definition: constants.h:48
double rc() const
Get potential cutoff.
Definition: constants.h:47
double displaceDelta() const
Get center of mass shift.
Definition: constants.h:54
bool window() const
Get window on/off.
Definition: constants.h:90
double k_LL_wfn() const
Get Lieb-Liniger wave number.
Definition: constants.h:118
uint32 wallClock() const
Get wallclock limit.
Definition: constants.h:88
void shiftCoMDelta(double frac)
Shift the CoM move size.
Definition: constants.h:129
void shiftDisplaceDelta(double frac)
Shift the displace move size.
Definition: constants.h:130
ConstantParameters(const ConstantParameters &)
Protected constructor.
void setC0(double _C0)
Set the value of C0.
Definition: constants.h:127
double gaussianEnsembleSD() const
Get enesemble weight standard dev.
Definition: constants.h:94
string extPotentialType() const
Get external potential type.
Definition: constants.h:110
double imagTimeLength() const
Get the extent in imaginary time.
Definition: constants.h:42
int Mbar()
Get Mbar.
Definition: constants.h:97
int virialWindow() const
Get centroid virial window size.
Definition: constants.h:55
string id()
Get simulation UUID.
Definition: constants.h:102
static ConstantParameters * getInstance()
This public method returns an instance of the constant object, Only one can ever exist at a time.
Definition: constants.cpp:212
void initConstants(po::variables_map &)
Initialize all constants from command line, XMl and defaults.
Definition: constants.cpp:32
void shiftC0(double frac)
Shift the value of C0.
Definition: constants.h:126
double C0() const
Get worm factor C0.
Definition: constants.h:49
void getC()
Get the value of the worm constant.
Definition: constants.h:128
double L() const
Get maximum side length.
Definition: constants.h:52
double tau() const
Get imaginary time step.
Definition: constants.h:44
string intPotentialType() const
Get interaction potential type.
Definition: constants.h:109
ConstantParameters & operator=(const ConstantParameters &)
Overload Singleton equals.
bool startWithState() const
Are we starting from a state?
Definition: constants.h:91
int b()
Get bisection level.
Definition: constants.h:98
double comDelta() const
Get center of mass shift.
Definition: constants.h:53
uint32 numEqSteps()
Get the number of equilibration steps.
Definition: constants.h:103
double fourLambdaTauInv() const
Get (4lambda/tau)^{-1}.
Definition: constants.h:62
bool canonical() const
Get ensemble.
Definition: constants.h:89
bool varUpdates() const
Fixed or variable length diagonal updates.
Definition: constants.h:95
string actionType() const
Get wave action type.
Definition: constants.h:113
bool gaussianEnsemble() const
Get enesemble weight on/off.
Definition: constants.h:93
int initialNumParticles()
Get initial number of particles.
Definition: constants.h:100
void setDisplaceDelta(double _displaceDelta)
Set the displace move size.
Definition: constants.h:123
double C() const
Get full worm constant.
Definition: constants.h:50
bool saveStateFiles()
Are we saving states every MC bin?
Definition: constants.h:133
bool restart() const
Get restart state.
Definition: constants.h:86
Global common header with shared dependencies and methods.
unsigned long uint32
Unsigned integer type, at least 32 bits.
Definition: common.h:105
ConstantParameters * constants()
Global public access to the constants.
Definition: constants.h:201