00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef QMCWALKER_H
00014 #define QMCWALKER_H
00015
00016 #include <string>
00017
00018 #include "IeeeMath.h"
00019 #include "QMCFunctions.h"
00020 #include "QMCInitializeWalkerFactory.h"
00021 #include "QMCProperties.h"
00022 #include "MathFunctions.h"
00023 #include "QMCDouble.h"
00024 #include "QMCPropertyArrays.h"
00025 #include "QMCNuclearForces.h"
00026
00027 using namespace std;
00028
00034 class QMCWalker
00035 {
00036 public:
00037
00041 QMCWalker();
00042
00048 QMCWalker( const QMCWalker & rhs );
00049
00053 ~QMCWalker();
00054
00063 void initialize(QMCInput *input);
00064
00071 void initializeWalkerPosition(QMCFunctions & QMF);
00072
00093 void initializePropagation(QMCWalkerData * &data, Array2D<double> * &R, int iteration);
00094
00101 void processPropagation(QMCFunctions & QMF, bool writeConfigs);
00102
00109 void calculateObservables( QMCProperties & props );
00110
00117 void calculateObservables( QMCPropertyArrays & props );
00118
00127 void calculateDerivatives( QMCPropertyArrays & props );
00128
00133 void operator=(const QMCWalker & rhs );
00134
00139 double getWeight();
00140
00145 void setWeight(double val);
00146
00150 double getTrailWeight(double energy);
00151
00157 bool isSingular();
00158
00167 bool branchRecommended();
00168
00176 string ID(bool showTrial);
00177
00178
00179
00180
00181
00182 void branchID();
00183
00188 void newID();
00189
00195 void calculateElectronDensities(double max_pair_distance, double dr,
00196 Array1D<double> &pll_spin, Array1D<double> &opp_spin,
00197 Array1D< Array1D<double> > &alpha_density,
00198 Array1D< Array1D<double> > &beta_density);
00199
00208 void calculatePllCorrelationDiagram(int coord, double min, double max,
00209 Array1D< Array1D<double> > &CorrelationDiagram);
00210
00219 void calculateOppCorrelationDiagram(int coord, double min, double max,
00220 Array1D< Array1D<double> > &CorrelationDiagram);
00221
00226 void toXML(ostream& strm);
00227
00235 bool readXML(istream& strm, QMCFunctions & QMF);
00236
00240 double getLocalEnergyEstimator();
00241
00245 Array2D<double> * getR();
00246
00252 bool setR(Array2D<double> temp_R);
00253
00258 QMCWalkerData* getWalkerData();
00259
00260 void resetFutureWalking(int whichStage, int whichBlock);
00261 void resetFutureWalking();
00262
00263 private:
00264 static const double pi = 3.14159265359;
00265
00266
00267
00268
00269 int iteration;
00270
00271 double tr_w_ratio;
00272 double tr_w;
00273 double weight;
00274 int age;
00275 int ageMoved;
00276 bool locationWarned;
00277 double dW;
00278
00279 int numWarnings;
00280
00287 static const int numAncestors = 5;
00288 long int genealogy[numAncestors];
00289
00294 double localEnergy;
00295 double kineticEnergy;
00296 double kineticEnergy_grad;
00297 double potentialEnergy;
00298
00299 Array1D<double> cs_Energies;
00300 Array1D<double> cs_Weights;
00301 Array1D<double> p3_xxa;
00302 Array1D<double> rp_a;
00303
00304 double r12;
00305 double r2;
00306 double ir12;
00307 double ir;
00308
00309 double neEnergy;
00310 double eeEnergy;
00311
00312 static const double maxFWAsymp;
00313
00314 Array1D<int> numFWSteps;
00315
00316 enum fwStage { ACCUM, ASYMP, DONE };
00317
00318 Array2D<fwStage> isCollectingFWResults;
00319
00320
00321
00322
00323 #ifdef USE_QMCPROPERTY
00324 Array2D<QMCProperty> fwNormalization;
00325 Array2D<QMCProperty> fwR12;
00326 Array2D<QMCProperty> fwR2;
00327 Array2D<QMCProperty> fwKineticEnergy;
00328 Array2D<QMCProperty> fwPotentialEnergy;
00329
00330
00331 Array2D< Array2D<QMCProperty> > fwNuclearForces;
00332 #else
00333 Array2D<double> fwNormalization;
00334 Array2D<double> fwEnergy;
00335 Array2D<double> fwKineticEnergy;
00336 Array2D<double> fwKineticEnergy_grad;
00337 Array2D<double> fwPotentialEnergy;
00338 Array2D<double> fwR12;
00339 Array2D<double> fwR2;
00340 Array2D<double> fwiR12;
00341 Array2D<double> fwiR;
00342
00343
00344 Array2D< Array2D<double> > fwNuclearForces;
00345 #endif
00346
00347 double distanceMovedAccepted;
00348 double AcceptanceProbability;
00349
00354 QMCWalkerData walkerData;
00355
00360 QMCDouble forwardGreensFunction;
00361
00362 Array2D<double> R;
00363
00364
00365 double dR2;
00366
00367 QMCWalker *TrialWalker;
00368 QMCWalker *OriginalWalker;
00369
00370 bool move_accepted;
00371
00372 QMCInput* Input;
00373
00374 void setAcceptanceProbability(double p);
00375 void createChildWalkers();
00376 void calculateMoveAcceptanceProbability(double GreensRatio);
00377 void acceptOrRejectMove();
00378
00386 QMCDouble moveElectrons();
00387
00395 QMCDouble moveElectronsNoImportanceSampling();
00396
00404 QMCDouble moveElectronsImportanceSampling();
00405
00413 QMCDouble moveElectronsUmrigar93ImportanceSampling();
00414
00421 QMCDouble moveElectronsUmrigar93AcceleratedSampling();
00422
00428 QMCDouble calculateReverseGreensFunction();
00429
00435 QMCDouble calculateReverseGreensFunctionNoImportanceSampling();
00436
00442 QMCDouble calculateReverseGreensFunctionImportanceSampling();
00443
00449 QMCDouble calculateReverseGreensFunctionUmrigar93ImportanceSampling();
00450
00451 QMCDouble calculateReverseGreensFunctionUmrigar93AcceleratedSampling();
00452
00453 int getAge();
00454 double getAcceptanceProbability();
00455
00459 void reweight_walker();
00460
00464 void calculateObservables();
00465
00466 protected:
00467
00472 static long int nextID;
00473
00474 };
00475
00476 #endif