QMCPACK
QMCDriver.cpp
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Ken Esler, kpesler@gmail.com, University of Illinois at Urbana-Champaign
8 // Luke Shulenburger, lshulen@sandia.gov, Sandia National Laboratories
9 // Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
10 // Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
11 // Cynthia Gu, zg1@ornl.gov, Oak Ridge National Laboratory
12 // Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Laboratory
13 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
14 //
15 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
16 //////////////////////////////////////////////////////////////////////////////////////
17 
18 
19 #include "QMCDriver.h"
21 #include "Particle/HDFWalkerIO.h"
24 #include "OhmmsData/AttributeSet.h"
25 #include "Message/Communicate.h"
26 #include "Message/CommOperators.h"
27 #include "RandomNumberControl.h"
28 #include "hdf/HDFVersion.h"
29 #include "Utilities/qmc_common.h"
30 #include <limits>
31 #include <typeinfo>
32 
34 #if !defined(REMOVE_TRACEMANAGER)
36 #else
37 using TraceManager = int;
38 #endif
39 #include "WalkerLogInput.h"
40 #include "WalkerLogManager.h"
41 
42 namespace qmcplusplus
43 {
44 QMCDriver::QMCDriver(const ProjectData& project_data,
46  TrialWaveFunction& psi,
47  QMCHamiltonian& h,
49  const std::string& QMC_driver_type,
50  bool enable_profiling)
52  project_data_(project_data),
53  DriftModifier(0),
54  qmcNode(NULL),
55  QMCType(QMC_driver_type),
56  W(w),
57  Psi(psi),
58  H(h),
59  checkpoint_timer_(createGlobalTimer("checkpoint::recordBlock", timer_level_medium)),
60  driver_scope_profiler_(enable_profiling)
61 {
62  ResetRandom = false;
63  AppendRun = false;
64  DumpConfig = false;
65  IsQMCDriver = true;
66  allow_traces = false;
67  allow_walker_logs = false;
68  walker_logs_xml = NULL;
69  MyCounter = 0;
70  //<parameter name=" "> value </parameter>
71  //accept multiple names for the same value
72  //recommend using all lower cases for a new parameter
75  m_param.add(Period4CheckProperties, "checkProperties");
76  m_param.add(Period4CheckProperties, "checkproperties");
77  m_param.add(Period4CheckProperties, "check_properties");
79  //m_param.add(Period4WalkerDump,"recordWalkers");
80  m_param.add(Period4WalkerDump, "record_walkers");
81  m_param.add(Period4WalkerDump, "recordwalkers");
83  //m_param.add(Period4ConfigDump,"recordConfigs");
84  m_param.add(Period4ConfigDump, "recordconfigs");
85  m_param.add(Period4ConfigDump, "record_configs");
86  CurrentStep = 0;
87  m_param.add(CurrentStep, "current");
88  nBlocks = 1;
89  m_param.add(nBlocks, "blocks");
90  nSteps = 1;
91  m_param.add(nSteps, "steps");
92  nSubSteps = 1;
93  m_param.add(nSubSteps, "substeps");
94  //m_param.add(nSubSteps,"subSteps");
95  m_param.add(nSubSteps, "sub_steps");
96  nWarmupSteps = 0;
97  m_param.add(nWarmupSteps, "warmupsteps");
98  //m_param.add(nWarmupSteps,"warmupSteps");
99  m_param.add(nWarmupSteps, "warmup_steps");
100  nAccept = 0;
101  nReject = 0;
103  m_param.add(nTargetWalkers, "walkers");
104  //sample-related parameters
105  //samples will set nTargetPopulation
106  nTargetSamples = 0;
108  m_param.add(nStepsBetweenSamples, "stepsbetweensamples");
109  nSamplesPerThread = 0;
110  m_param.add(nSamplesPerThread, "samplesperthread");
111  m_param.add(nSamplesPerThread, "dmcwalkersperthread");
112 
113  nTargetPopulation = 0;
114 
115  m_param.add(nTargetPopulation, "samples");
116 
117  SpinMass = 1.0;
118  m_param.add(SpinMass, "SpinMass");
119  m_param.add(SpinMass, "spin_mass");
120 
121  Tau = 0.1;
122  //m_param.add(Tau,"timeStep");
123  m_param.add(Tau, "timestep");
124  m_param.add(Tau, "time_step");
125  //m_param.add(Tau,"Tau");
126  m_param.add(Tau, "tau");
127  MaxCPUSecs = 360000; //100 hours
128  m_param.add(MaxCPUSecs, "maxcpusecs", {}, TagStatus::DEPRECATED);
129  m_param.add(MaxCPUSecs, "max_seconds");
130  // by default call recompute at the end of each block in the mixed precision case.
131 #ifdef MIXED_PRECISION
132  // cpu mixed precision
134 #else
135  // cpu double precision
137 #endif
138  m_param.add(nBlocksBetweenRecompute, "blocks_between_recompute");
139  ////add each OperatorBase to W.PropertyList so that averages can be taken
140  //H.add2WalkerProperty(W);
141  //if (storeConfigs) ForwardWalkingHistory.storeConfigsForForwardWalking(w);
142  rotation = 0;
143 }
144 
146 {
147  if (DriftModifier)
148  delete DriftModifier;
149 }
150 
152 {
153  H1.push_back(h);
154  Psi1.push_back(psi);
155 }
156 
157 /** process a <qmc/> element
158  * @param cur xmlNode with qmc tag
159  *
160  * This function is called before QMCDriver::run and following actions are taken:
161  * - Initialize basic data to execute run function.
162  * -- distance tables
163  * -- resize deltaR and drift with the number of particles
164  * -- assign cur to qmcNode
165  * - process input file
166  * -- putQMCInfo: <parameter/> s for generic QMC
167  * -- put : extra data by derived classes
168  * - initialize branchEngine to accumulate energies
169  * - initialize Estimators
170  * - initialize Walkers
171  */
172 void QMCDriver::process(xmlNodePtr cur)
173 {
174  deltaR.resize(W.getTotalNum());
175  drift.resize(W.getTotalNum());
176  qmcNode = cur;
177  //process common parameters
178  putQMCInfo(cur);
179  ////set the Tau parameter inside the Hamiltonian
180  //H.setTau(Tau);
181  //need to initialize properties
182  int numCopies = (H1.empty()) ? 1 : H1.size();
183  W.resetWalkerProperty(numCopies);
184  //create branchEngine first
185  if (!branchEngine)
186  {
187  branchEngine = std::make_unique<BranchEngineType>(Tau, W.getGlobalNumWalkers());
188  }
189  //execute the put function implemented by the derived classes
190  put(cur);
191  //create and initialize estimator
192  Estimators = branchEngine->getEstimatorManager();
193  if (Estimators == nullptr)
194  {
195  branchEngine->setEstimatorManager(std::make_unique<EstimatorManagerBase>(myComm));
196  Estimators = branchEngine->getEstimatorManager();
197  branchEngine->read(h5FileRoot);
198  }
199  if (DriftModifier == 0)
201  DriftModifier->parseXML(cur);
202 #if !defined(REMOVE_TRACEMANAGER)
203  //create and initialize traces
204  if (!Traces)
205  Traces = std::make_unique<TraceManager>(myComm);
207 #endif
208  //create and initialize traces
209  if (!wlog_manager_)
210  {
211  WalkerLogInput walker_logs_input(walker_logs_xml);
212  wlog_manager_ = std::make_unique<WalkerLogManager>(walker_logs_input, allow_walker_logs, RootName, myComm);
213  }
214  branchEngine->put(cur);
215  Estimators->put(H, cur);
216  if (!wOut)
217  wOut = std::make_unique<HDFWalkerOutput>(W.getTotalNum(), RootName, myComm);
218  branchEngine->start(RootName);
219  branchEngine->write(RootName);
220  //use new random seeds
221  if (ResetRandom)
222  {
223  app_log() << " Regenerate random seeds." << std::endl;
225  ResetRandom = false;
226  }
227  //flush the std::ostreams
228  infoSummary.flush();
229  infoLog.flush();
230  //increment QMCCounter of the branch engine
231  branchEngine->advanceQMCCounter();
232 }
233 
234 void QMCDriver::setStatus(const std::string& aname, const std::string& h5name, bool append)
235 {
236  RootName = aname;
237  app_log() << "\n========================================================="
238  << "\n Start " << QMCType << "\n File Root " << RootName;
239  if (append)
240  app_log() << " append = yes ";
241  else
242  app_log() << " append = no ";
243  app_log() << "\n=========================================================" << std::endl;
244  if (h5name.size())
245  h5FileRoot = h5name;
246  AppendRun = append;
247 }
248 
249 
250 /** Read walker configurations from *.config.h5 files
251  * @param wset list of xml elements containing mcwalkerset
252  */
253 void QMCDriver::putWalkers(std::vector<xmlNodePtr>& wset)
254 {
255  if (wset.empty())
256  return;
257  int nfile = wset.size();
259  for (int i = 0; i < wset.size(); i++)
260  if (W_in.put(wset[i]))
261  h5FileRoot = W_in.getFileRoot();
262  //clear the walker set
263  wset.clear();
264  int nwtot = W.getActiveWalkers();
265  myComm->bcast(nwtot);
266  if (nwtot)
267  {
268  int np = myComm->size();
269  std::vector<int> nw(np, 0), nwoff(np + 1, 0);
270  nw[myComm->rank()] = W.getActiveWalkers();
271  myComm->allreduce(nw);
272  for (int ip = 0; ip < np; ++ip)
273  nwoff[ip + 1] = nwoff[ip] + nw[ip];
274  W.setWalkerOffsets(nwoff);
275  }
276 }
277 
278 std::string QMCDriver::getRotationName(std::string RootName)
279 {
280  std::string r_RootName;
281  if (rotation % 2 == 0)
282  {
283  r_RootName = RootName;
284  }
285  else
286  {
287  r_RootName = RootName + ".bk";
288  }
289  rotation++;
290  return r_RootName;
291 }
292 
293 std::string QMCDriver::getLastRotationName(std::string RootName)
294 {
295  std::string r_RootName;
296  if ((rotation - 1) % 2 == 0)
297  {
298  r_RootName = RootName;
299  }
300  else
301  {
302  r_RootName = RootName + ".bk";
303  }
304  return r_RootName;
305 }
306 
307 void QMCDriver::recordBlock(int block)
308 {
309  if (DumpConfig && block % Period4CheckPoint == 0)
310  {
312  wOut->dump(W, block);
313  branchEngine->write(RootName, true); //save energy_history
315  }
316 }
317 
318 bool QMCDriver::finalize(int block, bool dumpwalkers)
319 {
320  if (DumpConfig && dumpwalkers)
321  wOut->dump(W, block);
323  MyCounter++;
324  infoSummary.flush();
325  infoLog.flush();
326 
327  branchEngine->finalize(W);
328 
329  if (DumpConfig)
331 
332  return true;
333 }
334 
335 /** Add walkers to the end of the ensemble of walkers.
336  * @param nwalkers number of walkers to add
337  */
338 void QMCDriver::addWalkers(int nwalkers)
339 {
340  if (nwalkers > 0)
341  {
342  //add nwalkers walkers to the end of the ensemble
343  int nold = W.getActiveWalkers();
344  app_log() << " Adding " << nwalkers << " walkers to " << nold << " existing sets" << std::endl;
345  W.createWalkers(nwalkers);
346  if (nold)
347  {
348  int iw = nold;
349  for (MCWalkerConfiguration::iterator it = W.begin() + nold; it != W.end(); ++it, ++iw)
350  (*it)->R = W[iw % nold]->R; //assign existing walker configurations when the number of walkers change
351  }
352  }
353  else if (nwalkers < 0)
354  {
355  W.destroyWalkers(-nwalkers);
356  app_log() << " Removed " << -nwalkers << " walkers. Current number of walkers =" << W.getActiveWalkers()
357  << std::endl;
358  }
359  else
360  {
361  app_log() << " Using the current " << W.getActiveWalkers() << " walkers." << std::endl;
362  }
364 
365  ////update the global number of walkers
366  ////int nw=W.getActiveWalkers();
367  ////myComm->allreduce(nw);
368 }
369 
371 {
372  std::vector<int> nw(myComm->size(), 0), nwoff(myComm->size() + 1, 0);
373  nw[myComm->rank()] = W.getActiveWalkers();
374  myComm->allreduce(nw);
375  for (int ip = 0; ip < myComm->size(); ip++)
376  nwoff[ip + 1] = nwoff[ip] + nw[ip];
377  W.setWalkerOffsets(nwoff);
378  long id = nwoff[myComm->rank()];
379  for (int iw = 0; iw < nw[myComm->rank()]; ++iw, ++id)
380  {
381  W[iw]->setWalkerID(id);
382  W[iw]->setParentID(id);
383  }
384  app_log() << " Total number of walkers: " << W.EnsembleProperty.NumSamples << std::endl;
385  app_log() << " Total weight: " << W.EnsembleProperty.Weight << std::endl;
386 }
387 
388 
389 /** Parses the xml input file for parameter definitions for a single qmc simulation.
390  *
391  * Basic parameters are handled here and each driver will perform its own initialization with the input
392  * attribute list
393  * - checkpoint="-1|0|n" default=-1
394  * -- 1 = do not write anything
395  * -- 0 = dump after the completion of a qmc section
396  * -- n = dump after n blocks
397  * - kdelay = "0|1|n" default=0
398  */
399 bool QMCDriver::putQMCInfo(xmlNodePtr cur)
400 {
401  if (!IsQMCDriver)
402  {
403  app_log() << getName() << " Skip QMCDriver::putQMCInfo " << std::endl;
404  return true;
405  }
406 
407  ////store the current nSteps and nStepsBetweenSamples
408  //int oldStepsBetweenSamples=nStepsBetweenSamples;
409  //int oldSteps=nSteps;
410 
411  //set the default walker to the number of threads times 10
412  Period4CheckPoint = 0;
413  int defaultw = omp_get_max_threads();
414  OhmmsAttributeSet aAttrib;
415  aAttrib.add(Period4CheckPoint, "checkpoint");
416  aAttrib.add(kDelay, "kdelay");
417  aAttrib.put(cur);
418  if (cur != NULL)
419  {
420  //initialize the parameter set
421  m_param.put(cur);
422 
423  xmlNodePtr tcur = cur->children;
424  //determine how often to print walkers to hdf5 file
425  while (tcur != NULL)
426  {
427  std::string cname((const char*)(tcur->name));
428  if (cname == "record")
429  {
430  //dump walkers for optimization
431  OhmmsAttributeSet rAttrib;
432  rAttrib.add(Period4WalkerDump, "stride");
433  rAttrib.add(Period4WalkerDump, "period");
434  rAttrib.put(tcur);
435  }
436  else if (cname == "checkpoint")
437  {
438  OhmmsAttributeSet rAttrib;
439  rAttrib.add(Period4CheckPoint, "stride");
440  rAttrib.add(Period4CheckPoint, "period");
441  rAttrib.put(tcur);
442  //DumpConfig=(Period4CheckPoint>0);
443  }
444  else if (cname == "dumpconfig")
445  {
446  OhmmsAttributeSet rAttrib;
447  rAttrib.add(Period4ConfigDump, "stride");
448  rAttrib.add(Period4ConfigDump, "period");
449  rAttrib.put(tcur);
450  }
451  else if (cname == "random")
452  {
453  ResetRandom = true;
454  }
455  tcur = tcur->next;
456  }
457  }
458 
459  // check input parameters collected by m_param
460  //set the minimum blocks
461  if (nBlocks < 1)
462  {
463  app_warning() << "Input parameter \"blocks\" must be positive! Set to 1. User input value " << nBlocks << std::endl;
464  nBlocks = 1;
465  }
466 
467  //set the minimum nSteps
468  if (nSteps < 1)
469  {
470  app_warning() << "Input parameter \"steps\" must be positive! Set to 1. User input value " << nSteps << std::endl;
471  nSteps = 1;
472  }
473 
474  //set the minimum nSubSteps
475  if (nSubSteps < 1)
476  {
477  app_warning() << "Input parameter \"substeps\" must be positive! Set to 1. User input value " << nSubSteps
478  << std::endl;
479  nSubSteps = 1;
480  }
481 
482  DumpConfig = (Period4CheckPoint >= 0);
483  if (Period4CheckPoint < 1)
485  //reset CurrentStep to zero if qmc/@continue='no'
486  if (!AppendRun)
487  CurrentStep = 0;
488 
489  //if walkers are initialized via <mcwalkerset/>, use the existing one
491  {
492  app_log() << "Using existing walkers " << std::endl;
493  }
494  else
495  {
496  app_log() << "Resetting walkers" << std::endl;
497  int nths(omp_get_max_threads());
498  nTargetWalkers = (std::max(nths, (nTargetWalkers / nths) * nths));
499  int nw = W.getActiveWalkers();
500  int ndiff = 0;
501  if (nw)
502  {
503  // nTargetWalkers == 0, if it is not set by the input file
504  ndiff = (nTargetWalkers) ? nTargetWalkers - nw : 0;
505  }
506  else
507  {
508  ndiff = (nTargetWalkers) ? nTargetWalkers : defaultw;
509  }
510  addWalkers(ndiff);
511  }
512 
513  return (W.getActiveWalkers() > 0);
514 }
515 
517 {
518  xmlNodePtr newqmc = xmlCopyNode(qmcNode, 1);
519  xmlNodePtr current_ptr = NULL;
520  xmlNodePtr cur = newqmc->children;
521  while (cur != NULL && current_ptr == NULL)
522  {
523  std::string cname((const char*)(cur->name));
524  if (cname == "parameter")
525  {
526  const std::string name(getXMLAttributeValue(cur, "name"));
527  if (name == "current")
528  current_ptr = cur;
529  }
530  cur = cur->next;
531  }
532  if (current_ptr == NULL)
533  {
534  current_ptr = xmlNewTextChild(newqmc, NULL, (const xmlChar*)"parameter", (const xmlChar*)"0");
535  xmlNewProp(current_ptr, (const xmlChar*)"name", (const xmlChar*)"current");
536  }
537  getContent(CurrentStep, current_ptr);
538  return newqmc;
539 }
540 
541 
542 } // namespace qmcplusplus
NewTimer & checkpoint_timer_
Definition: QMCDriver.h:381
std::string getRotationName(std::string RootName)
Definition: QMCDriver.cpp:278
std::string h5FileRoot
the root of h5File
Definition: QMCDriver.h:315
int MaxCPUSecs
maximum cpu in secs
Definition: QMCDriver.h:302
A set of walkers that are to be advanced by Metropolis Monte Carlo.
std::ostream & app_warning()
Definition: OutputManager.h:69
Base class for any object which needs to know about a MPI communicator.
Definition: MPIObjectBase.h:26
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
int rank() const
return the rank
Definition: Communicate.h:116
QMCDriver(const ProjectData &project_data, MCWalkerConfiguration &w, TrialWaveFunction &psi, QMCHamiltonian &h, Communicate *comm, const std::string &QMC_driver_type, bool enable_profiling=false)
Constructor.
Definition: QMCDriver.cpp:44
std::string getLastRotationName(std::string RootName)
Definition: QMCDriver.cpp:293
std::vector< TrialWaveFunction * > Psi1
a list of TrialWaveFunctions for multiple method
Definition: QMCDriver.h:335
size_t getActiveWalkers() const
return the number of active walkers
void recordBlock(int block) override
record the state of the block
Definition: QMCDriver.cpp:307
bool DumpConfig
flag to turn off dumping configurations
Definition: QMCDriver.h:226
std::string RootName
root of all the output files
Definition: QMCDriver.h:317
InfoStream infoSummary
size_t getTotalNum() const
Definition: ParticleSet.h:493
std::ostream & app_log()
Definition: OutputManager.h:65
RealType nSamplesPerThread
samples per thread
Definition: QMCDriver.h:293
xmlNodePtr qmcNode
pointer to qmc node in xml file
Definition: QMCDriver.h:310
class ProjectData
Definition: ProjectData.h:36
bool put(xmlNodePtr cur)
assign attributes to the set
Definition: AttributeSet.h:55
Collection of Local Energy Operators.
ParticleSet::ParticlePos drift
temporary storage for drift
Definition: QMCDriver.h:347
IndexType CurrentStep
current step
Definition: QMCDriver.h:263
void setWalkerOffsets(const std::vector< int > &o)
return the total number of active walkers among a MPI group
bool AppendRun
flag to append or restart the run
Definition: QMCDriver.h:224
RealType SpinMass
spin mass for spinor calcs
Definition: QMCDriver.h:353
static void write(const std::string &fname, Communicate *comm)
write in parallel or serial
int size() const
return the number of tasks
Definition: Communicate.h:118
IndexType nReject
counter for number of moves /rejected
Definition: QMCDriver.h:281
IndexType nTargetWalkers
the number of walkers
Definition: QMCDriver.h:287
std::unique_ptr< TraceManager > Traces
Traces manager.
Definition: QMCDriver.h:195
size_t getGlobalNumWalkers() const
return the total number of active walkers among a MPI group
virtual bool put(xmlNodePtr cur)=0
InfoStream infoLog
bool put(std::istream &is) override
read from std::istream
Definition: ParameterSet.h:42
iterator destroyWalkers(iterator first, iterator last)
destroy Walkers from itstart to itend
int Period4ConfigDump
period of recording walker positions and IDs for forward walking afterwards
Definition: QMCDriver.h:260
ParameterSet m_param
store any parameter that has to be read from a file
Definition: QMCDriver.h:320
IndexType nSubSteps
number of steps between a step: VMCs do not evaluate energies
Definition: QMCDriver.h:272
Wrapping information on parallelism.
Definition: Communicate.h:68
void allreduce(T &)
IndexType nSteps
maximum number of steps
Definition: QMCDriver.h:269
std::unique_ptr< HDFWalkerOutput > wOut
record engine for walkers
Definition: QMCDriver.h:332
bool finalize(int block, bool dumpwalkers=true)
finalize a qmc section
Definition: QMCDriver.cpp:318
WalkerList_t::iterator iterator
FIX: a type alias of iterator for an object should not be for just one of many objects it holds...
const std::string QMCType
type of QMC driver
Definition: QMCDriver.h:313
Declaration of QMCDriver.
virtual bool parseXML(xmlNodePtr cur)
int kDelay
the number to delay updates by
Definition: QMCDriver.h:237
omp_int_t omp_get_max_threads()
Definition: OpenMP.h:26
Communicate * myComm
pointer to Communicate
Definition: MPIObjectBase.h:62
class to handle a set of attributes of an xmlNode
Definition: AttributeSet.h:24
std::unique_ptr< BranchEngineType > branchEngine
branch engine
Definition: QMCDriver.h:218
bool putQMCInfo(xmlNodePtr cur)
Parses the xml input file for parameter definitions for a single qmc simulation.
Definition: QMCDriver.cpp:399
NewTimer & createGlobalTimer(const std::string &myname, timer_levels mylevel)
QMCHamiltonian & H
Hamiltonian.
Definition: QMCDriver.h:329
ParticlePos R
Position.
Definition: ParticleSet.h:79
void setStatus(const std::string &aname, const std::string &h5name, bool append) override
Set the status of the QMCDriver.
Definition: QMCDriver.cpp:234
DriftModifierBase * DriftModifier
drift modifer
Definition: QMCDriver.h:220
int qmc_counter
init for <qmc> section
Definition: qmc_common.h:31
MCWalkerConfiguration & W
walker ensemble
Definition: QMCDriver.h:323
std::string getXMLAttributeValue(const xmlNodePtr cur, const std::string_view name)
get the value string for attribute name if name is unfound in cur you get an empty string back this i...
bool put(QMCHamiltonian &H, xmlNodePtr cur)
process xml tag associated with estimators
bool allow_walker_logs
whether to allow traces
Definition: QMCDriver.h:101
xmlNodePtr walker_logs_xml
traces xml
Definition: QMCDriver.h:103
void add_H_and_Psi(QMCHamiltonian *h, TrialWaveFunction *psi) override
add QMCHamiltonian/TrialWaveFunction pair for multiple
Definition: QMCDriver.cpp:151
bool IsQMCDriver
true, if it is a real QMC engine
Definition: QMCDriver.h:228
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>
bool getContent(const T &a, xmlNodePtr cur)
write a value to a node.
Definition: libxmldefs.h:119
void flush()
flush stream buffer
Definition: InfoStream.cpp:39
Class to represent a many-body trial wave function.
std::vector< QMCHamiltonian * > H1
a list of QMCHamiltonians for multiple method
Definition: QMCDriver.h:338
IndexType nTargetSamples
the number of saved samples
Definition: QMCDriver.h:289
EstimatorManagerBase * Estimators
Observables manager.
Definition: QMCDriver.h:192
int Period4CheckPoint
period of dumping walker configurations and everything else for restart
Definition: QMCDriver.h:242
RealType nTargetPopulation
target population
Definition: QMCDriver.h:295
IndexType nAccept
counter for number of moves accepted
Definition: QMCDriver.h:278
const std::string & getName() const
return the name
Definition: MPIObjectBase.h:54
RealType Tau
timestep
Definition: QMCDriver.h:299
void bcast(T &)
IndexType nStepsBetweenSamples
alternate method of setting QMC run parameters
Definition: QMCDriver.h:291
IndexType nBlocks
maximum number of blocks
Definition: QMCDriver.h:266
void createWalkers(int numWalkers)
create numWalkers Walkers
int Period4WalkerDump
period of recording walker configurations
Definition: QMCDriver.h:255
MCDataType< FullPrecRealType > EnsembleProperty
int Period4CheckProperties
period of dumping walker positions and IDs for Forward Walking
Definition: QMCDriver.h:249
void addWalkers(int nwalkers)
Add walkers to the end of the ensemble of walkers.
Definition: QMCDriver.cpp:338
QMCState qmc_common
a unique QMCState during a run
Definition: qmc_common.cpp:111
void setWalkerOffsets()
set global offsets of the walkers
Definition: QMCDriver.cpp:370
IndexType nWarmupSteps
number of warmup steps
Definition: QMCDriver.h:275
std::unique_ptr< WalkerLogManager > wlog_manager_
Traces manager.
Definition: QMCDriver.h:198
IndexType nBlocksBetweenRecompute
the number of blocks between recomptePsi
Definition: QMCDriver.h:284
xmlNodePtr traces_xml
traces xml
Definition: QMCDriver.h:98
iterator end()
return the last iterator, [begin(), end())
static void make_seeds()
reset the generator
void add(PDT &aparam, const std::string &aname, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new attribute
Definition: AttributeSet.h:42
int MyCounter
the number of times this QMCDriver is executed
Definition: QMCDriver.h:235
ParticleSet::ParticlePos deltaR
temporary storage for random displacement
Definition: QMCDriver.h:350
Declaration of a MCWalkerConfiguration.
void putWalkers(std::vector< xmlNodePtr > &wset) override
Read walker configurations from *.config.h5 files.
Definition: QMCDriver.cpp:253
void process(xmlNodePtr cur) override
initialize with xmlNode
Definition: QMCDriver.cpp:172
bool allow_traces
whether to allow traces
Definition: QMCDriver.h:96
Native representation for walker logs input.
void resetWalkerProperty(int ncopy=1)
reset the Property container of all the walkers
xmlNodePtr getQMCNode()
return a xmlnode with update
Definition: QMCDriver.cpp:516
DriftModifierBase * createDriftModifier(xmlNodePtr cur, const Communicate *myComm)
create DriftModifier
bool ResetRandom
randomize it
Definition: QMCDriver.h:222
iterator begin()
return the first iterator