34 #if !defined(REMOVE_TRACEMANAGER) 37 using TraceManager = int;
50 bool enable_profiling)
51 :
QMCDriver(project_data, w, psi, h,
comm,
"DMC", enable_profiling),
56 Reconfiguration(
"no"),
75 throw std::runtime_error(
"Reconfiguration is currently broken and gives incorrect results. Use dynamic " 76 "population control by setting reconfiguration=\"no\" or removing the reconfiguration " 77 "option from the DMC input section. If accessing the broken reconfiguration code path " 78 "is still desired, set reconfiguration to \"runwhileincorrect\" instead of \"yes\".");
86 int nw_multi =
branchEngine->initWalkerController(
W, fixW,
false);
102 std::ostringstream o;
103 o <<
" Initial partition of walkers on a node: ";
108 o <<
" Updates by particle-by-particle moves";
110 app_log() <<
"Using DMCUpdatePbyPL2" << std::endl;
112 app_log() <<
"Using DMCUpdatePbyPWithRejectionFast" << std::endl;
115 o <<
" Updates by walker moves";
118 o <<
"\n Walkers are killed when a node crossing is detected";
120 o <<
"\n DMC moves are rejected when a node crossing is detected";
121 app_log() << o.str() << std::endl;
128 #pragma omp parallel for 132 #if !defined(REMOVE_TRACEMANAGER) 137 hClones[ip]->setRandomGenerator(
Rng[ip].
get());
152 APP_ABORT(
"SODMC Driver Mode must be PbyP\n");
183 #if !defined(REMOVE_TRACEMANAGER) 186 #pragma omp parallel for 192 app_log() <<
" Spins treated as dynamic variable with SpinMass: " <<
SpinMass << std::endl;
201 for (
int ip = 0; ip <
Movers.size(); ++ip)
202 Movers[ip]->MaxAge = mxage;
211 Movers[i]->MaxAge = mxage;
214 std::ostringstream o;
216 o <<
" Fixed population using reconfiguration method\n";
218 o <<
" Fluctuating population\n";
219 o <<
" Persistent walkers are killed after " << mxage <<
" MC sweeps\n";
221 o <<
" Steps per block = " <<
nSteps <<
"\n";
222 o <<
" Number of blocks = " <<
nBlocks <<
"\n";
223 app_log() << o.str() << std::endl;
225 app_log() <<
" DMC Engine Initialization = " << init_timer.
elapsed() <<
" secs" << std::endl;
239 #if !defined(REMOVE_TRACEMANAGER) 266 Movers[ip]->set_step(sample);
269 wClones[ip]->resetCollectables();
271 #pragma omp for nowait 272 for (
size_t iw = 0; iw < nw; ++iw)
275 Movers[ip]->advanceWalker(thisWalker, recompute);
297 #if !defined(REMOVE_TRACEMANAGER) 310 bool stop_requested =
false;
313 stop_requested = runtimeControl.checkStop(dmc_loop);
319 app_log() << runtimeControl.generateStopMessage(
"DMC", block - 1);
331 #if !defined(REMOVE_TRACEMANAGER)
size_type size() const
return the size of the data
UPtrVector< WalkerLogCollector > wlog_collectors
trace collectors
int MaxCPUSecs
maximum cpu in secs
A set of walkers that are to be advanced by Metropolis Monte Carlo.
static std::vector< TrialWaveFunction * > psiClones
std::vector< int > wPerRank
Walkers per MPI rank.
helper functions for EinsplineSetBuilder
int rank() const
return the rank
size_t getActiveWalkers() const
return the number of active walkers
void recordBlock(int block) override
record the state of the block
bool DumpConfig
flag to turn off dumping configurations
std::string RootName
root of all the output files
static std::vector< MCWalkerConfiguration * > wClones
xmlNodePtr qmcNode
pointer to qmc node in xml file
void resetUpdateEngines()
RunTimeManager< ChronoClock > run_time_manager
Collection of Local Energy Operators.
IndexType CurrentStep
current step
std::vector< std::unique_ptr< T > > UPtrVector
std::vector< QMCUpdateBase * > Movers
update engines
abstract base class for QMC engines
IndexType mover_MaxAge
input to control maximum age allowed for walkers.
RealType SpinMass
spin mass for spinor calcs
UPtrVector< RandomBase< QMCTraits::FullPrecRealType > > & rngs_
void loadEnsemble()
load SampleStack data to the current list of walker configurations
std::unique_ptr< TraceManager > Traces
Traces manager.
void stop()
stop a qmc run
bool put(std::istream &is) override
read from std::istream
DMC(const ProjectData &project_data, MCWalkerConfiguration &w, TrialWaveFunction &psi, QMCHamiltonian &h, UPtrVector< RandomBase< QMCTraits::FullPrecRealType >> &rngs, Communicate *comm, bool enable_profiling)
Constructor.
void FairDivideLow(int ntot, int npart, IV &adist)
partition ntot elements among npart
ParameterSet m_param
store any parameter that has to be read from a file
void copy(const Array< T1, 3 > &src, Array< T2, 3 > &dest)
Wrapping information on parallelism.
omp_int_t omp_get_thread_num()
IndexType nSteps
maximum number of steps
void startBlock(int steps)
start a block
bool finalize(int block, bool dumpwalkers=true)
finalize a qmc section
const std::string & getName() const
A collection of functions for dividing fairly.
class to handle a set of parameters
void setCollectionMode(bool collect)
set CollectSum
std::bitset< QMC_MODE_MAX > qmc_driver_mode
bits to classify QMCDriver
Final class and should not be derived.
Communicate * myComm
pointer to Communicate
std::unique_ptr< BranchEngineType > branchEngine
branch engine
declaration of ProgressReportEngine
std::vector< EstimatorManagerBase * > estimatorClones
estimator managers
std::string Reconfiguration
input std::string to determine to use reconfiguration
const IndexType NumThreads
number of threads
QMCHamiltonian & H
Hamiltonian.
DriftModifierBase * DriftModifier
drift modifer
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
void makeClones(MCWalkerConfiguration &w, TrialWaveFunction &psi, QMCHamiltonian &ham)
MCWalkerConfiguration & W
walker ensemble
OHMMS_INDEXTYPE IndexType
define other types
Buffer_t Collectables
observables in addition to those registered in Properties/PropertyList
Class to manage a set of ScalarEstimators.
static std::vector< QMCHamiltonian * > hClones
void add(PDT &aparam, const std::string &aname_in, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new parameter corresponding to an xmlNode <parameter>
Declaration of HamiltonianPool.
Class for determining elapsed run time enabling simulations to adjust to time limits.
Class to represent a many-body trial wave function.
EstimatorManagerBase * Estimators
Observables manager.
int Period4CheckPoint
period of dumping walker configurations and everything else for restart
void stopBlock(RealType accept, bool collectall=true)
stop a block
TrialWaveFunction & Psi
trial function
RealType acceptRatio() const
IndexType nBlocks
maximum number of blocks
bool put(xmlNodePtr cur) override
void createWalkers(int numWalkers)
create numWalkers Walkers
std::vector< TraceManager * > traceClones
trace managers
int Period4CheckProperties
period of dumping walker positions and IDs for Forward Walking
RefVector< WalkerLogCollector > getWalkerLogCollectorRefs()
void setWalkerOffsets()
set global offsets of the walkers
IndexType BranchInterval
Interval between branching.
UPtrVector< RandomBase< FullPrecRealType > > Rng
Random number generators.
std::unique_ptr< WalkerLogManager > wlog_manager_
Traces manager.
IndexType nBlocksBetweenRecompute
the number of blocks between recomptePsi
void start(int blocks, bool record=true)
start a run
std::string KillWalker
input std::string to determine kill walkers or not
A container class to represent a walker.
std::string L2
input to control diffusion with L2 operator
Define OpenMP-able DMC Driver.
IndexType KillNodeCrossing
Index to determine what to do when node crossing is detected.
std::string NonLocalMove
input std::string to determine to use nonlocal move
iterator begin()
return the first iterator