QMCPACK
QMCMain.h
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: Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
8 // Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
9 // Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Laboratory
10 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
11 //
12 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
13 //////////////////////////////////////////////////////////////////////////////////////
14 
15 
16 /**@file QMCMain.h
17  * @brief Declaration of QMCMain class
18  */
19 #ifndef QMCPLUSPLUS_MAINAPPLICATIONS_H
20 #define QMCPLUSPLUS_MAINAPPLICATIONS_H
21 
22 #include "Message/MPIObjectBase.h"
23 #include "QMCApp/QMCAppBase.h"
26 
27 namespace qmcplusplus
28 {
29 /** @ingroup qmcapp
30  * @brief Main application to perform QMC simulations
31  *
32  * This is a generalized QMC application which can handle multiple ParticleSet,
33  * TrialWaveFunction and QMCHamiltonian objects.
34  */
35 class QMCMain : public MPIObjectBase, public QMCAppBase
36 {
37 public:
38  QMCMain(Communicate* c);
39 
40  ~QMCMain() override;
41 
42  bool validateXML() override;
43  bool execute() override;
44 
46 
47 private:
48  /// ParticleSet Pool
49  std::unique_ptr<ParticleSetPool> particle_set_pool_;
50 
51  /// TrialWaveFunction Pool
52  std::unique_ptr<WaveFunctionPool> psi_pool_;
53 
54  /// QMCHamiltonian Pool
55  std::unique_ptr<HamiltonianPool> ham_pool_;
56 
57  /// current MCWalkerConfiguration
59 
60  ///Global estimators defined outside of <qmc> nodes
61  std::optional<EstimatorManagerInput> estimator_manager_input_;
62 
63  ///flag to indicate that a qmc is the first QMC
64  bool first_qmc_;
65 
66  /// the last driver object. Should be in a loop only.
67  std::unique_ptr<QMCDriverInterface> last_driver_;
68 
69  /// last branch engine used by legacy drivers
70  std::unique_ptr<SimpleFixedNodeBranch> last_branch_engine_legacy_driver_;
71 
72  ///xml mcwalkerset elements for output
73  std::vector<xmlNodePtr> walker_set_;
74 
75  ///xml mcwalkerset read-in elements
76  std::vector<xmlNodePtr> walker_set_in_;
77 
78  ///walkerlogs xml
79  xmlNodePtr walker_logs_xml_;
80 
81  ///traces xml
82  xmlNodePtr traces_xml_;
83 
84  ///qmc sections
85  std::vector<std::pair<xmlNodePtr, bool>> qmc_action_;
86 
87  ///pointer to the last node of the main inputfile
88  xmlNodePtr last_input_node_;
89 
90  /** execute <qmc/> element
91  * @param cur qmc xml node
92  * @param reuse if true, reuse the driver built from the last QMC section. This should be used by loop only.
93  *
94  * Ye: I think this can be merged with executeQMCSection
95  */
96  bool runQMC(xmlNodePtr cur, bool reuse);
97 
98  ///add <mcwalkerset/> elements to continue a run
99  bool setMCWalkers(xmlXPathContextPtr cur);
100 
101  /** add unique ParticleSet, TrialWaveFunction and QMCHamiltonian elements to Pool objects
102  * @param cur xml node
103  * @return false, if contains qmc actions
104  */
105  bool processPWH(xmlNodePtr cur);
106 
107  /** execute loop **/
108  void executeLoop(xmlNodePtr cur);
109 
110  ///execute <debug/> element
111  bool executeDebugSection(xmlNodePtr cur);
112 
113  /** execute qmc
114  * @param cur qmc xml node
115  * @param reuse if true, reuse the driver built from the last QMC section. This should be used by loop only.
116  * @return true, if a section is successfully executed.
117  */
118  bool executeQMCSection(xmlNodePtr cur, bool reuse = false);
119 
120  ///execute <cmc/> element
121  bool executeCMCSection(xmlNodePtr cur);
122 };
123 } // namespace qmcplusplus
124 #endif
bool runQMC(xmlNodePtr cur, bool reuse)
execute <qmc> element
Definition: QMCMain.cpp:586
A set of walkers that are to be advanced by Metropolis Monte Carlo.
Base class for any object which needs to know about a MPI communicator.
Definition: MPIObjectBase.h:26
std::vector< xmlNodePtr > walker_set_
xml mcwalkerset elements for output
Definition: QMCMain.h:73
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
~QMCMain() override
Definition: QMCMain.cpp:165
bool executeQMCSection(xmlNodePtr cur, bool reuse=false)
execute qmc
Definition: QMCMain.cpp:695
std::optional< EstimatorManagerInput > estimator_manager_input_
Global estimators defined outside of <qmc> nodes.
Definition: QMCMain.h:61
std::unique_ptr< ParticleSetPool > particle_set_pool_
ParticleSet Pool.
Definition: QMCMain.h:49
xmlNodePtr traces_xml_
traces xml
Definition: QMCMain.h:82
std::unique_ptr< SimpleFixedNodeBranch > last_branch_engine_legacy_driver_
last branch engine used by legacy drivers
Definition: QMCMain.h:70
declaration of MPIObjectBase
xmlNodePtr last_input_node_
pointer to the last node of the main inputfile
Definition: QMCMain.h:88
void executeLoop(xmlNodePtr cur)
execute loop
Definition: QMCMain.cpp:327
std::unique_ptr< WaveFunctionPool > psi_pool_
TrialWaveFunction Pool.
Definition: QMCMain.h:52
QMCMain(Communicate *c)
Definition: QMCMain.cpp:58
Main application to perform QMC simulations.
Definition: QMCMain.h:35
Wrapping information on parallelism.
Definition: Communicate.h:68
std::vector< std::pair< xmlNodePtr, bool > > qmc_action_
qmc sections
Definition: QMCMain.h:85
bool processPWH(xmlNodePtr cur)
add unique ParticleSet, TrialWaveFunction and QMCHamiltonian elements to Pool objects ...
Definition: QMCMain.cpp:522
bool first_qmc_
flag to indicate that a qmc is the first QMC
Definition: QMCMain.h:64
std::unique_ptr< HamiltonianPool > ham_pool_
QMCHamiltonian Pool.
Definition: QMCMain.h:55
bool execute() override
execute the main function
Definition: QMCMain.cpp:172
Manage a collection of ParticleSet objects.
std::vector< xmlNodePtr > walker_set_in_
xml mcwalkerset read-in elements
Definition: QMCMain.h:76
bool validateXML() override
validate the main document and (read the walker sets !)
Definition: QMCMain.cpp:376
std::unique_ptr< QMCDriverInterface > last_driver_
the last driver object. Should be in a loop only.
Definition: QMCMain.h:67
bool setMCWalkers(xmlXPathContextPtr cur)
add <mcwalkerset> elements to continue a run
Definition: QMCMain.cpp:663
MCWalkerConfiguration * qmc_system_
current MCWalkerConfiguration
Definition: QMCMain.h:58
declare a handler of DMC branching
bool executeCMCSection(xmlNodePtr cur)
execute <cmc> element
Definition: QMCMain.cpp:712
xmlNodePtr walker_logs_xml_
walkerlogs xml
Definition: QMCMain.h:79
ParticleSetPool & getParticlePool()
Definition: QMCMain.h:45
Base class for QMC applications and utilities.
Definition: QMCAppBase.h:34
bool executeDebugSection(xmlNodePtr cur)
execute <debug> element
Definition: QMCMain.cpp:687