00001 // QMcBeaver 00002 // 00003 // Constructed by 00004 // 00005 // Michael Todd Feldmann 00006 // and 00007 // David Randall "Chip" Kent IV 00008 // 00009 // Copyright 2000. All rights reserved. 00010 // 00011 // drkent@users.sourceforge.net mtfeldmann@users.sourceforge.net 00012 00013 #ifndef QMCReadAndEvaluateConfigs_H 00014 #define QMCReadAndEvaluateConfigs_H 00015 00016 // Define the energy and log weight values to use when there is an attempt 00017 // to evaluate a singular Jastrow 00018 #define MAXIMUM_ENERGY_VALUE 1.0e20 00019 #define MAXIMUM_LOG_WEIGHT_VALUE 50 00020 00021 #include <iostream> 00022 #include <math.h> 00023 00024 #include "Array1D.h" 00025 #include "QMCInput.h" 00026 #include "QMCProperties.h" 00027 #include "QMCJastrow.h" 00028 00029 using namespace std; 00030 00036 class QMCReadAndEvaluateConfigs 00037 { 00038 public: 00042 QMCReadAndEvaluateConfigs(); 00043 00044 00049 QMCReadAndEvaluateConfigs(QMCInput *input, int cfgsToSkip); 00050 00055 void initialize(QMCInput *input, int cfgsToSkip); 00056 00066 void rootCalculateProperties(Array1D < Array1D<double> > ¶ms, 00067 Array1D<QMCProperties> & properties); 00068 00075 void workerCalculateProperties(); 00076 00077 private: 00078 // The input information 00079 QMCInput *Input; 00080 00081 // The Jastrow to be calculated 00082 QMCJastrow Jastrow; 00083 00084 // The number of configurations to be skipped. 00085 int configsToSkip; 00086 00087 int Nelectrons; 00088 int Natoms; 00089 00090 // Values read in from the configuration file 00091 Array2D<double> R; 00092 double D1; 00093 Array2D<double> D2; 00094 double lnJ; 00095 double PE; 00096 double weight; 00097 00104 bool AddNewConfigToProperites(Array1D<double> &Params, 00105 QMCProperties &Properties); 00106 00107 // Calculate the local energy of the current configuration with the currently 00108 // calculated jastrow 00109 double calc_E_Local_current(); 00110 00111 // Calculate the weight of the current configuration with the currently 00112 // calculated jastrow 00113 double calc_log_weight_current(); 00114 00115 // Calculate the properites from the configs for all the parameters in params 00116 // on the current node 00117 void locally_CalculateProperties(Array1D < Array1D<double> > &Params, 00118 Array1D<QMCProperties> & Properties); 00119 00120 // perform an mpi reduce operation on the properties collected on each 00121 // processor 00122 void MPI_reduce( Array1D <QMCProperties> &local_Properties, 00123 Array1D < QMCProperties> &global_Properties); 00124 }; 00125 00126 #endif