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: Bryan Clark, bclark@Princeton.edu, Princeton University
8 //                    Ken Esler, kpesler@gmail.com, University of Illinois at Urbana-Champaign
9 //                    Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
10 //                    Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
11 //                    Raymond Clay III, j.k.rofling@gmail.com, Lawrence Livermore National Laboratory
12 //                    Mark Dewing, markdewing@gmail.com, University of Illinois at Urbana-Champaign
13 //
14 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
15 //////////////////////////////////////////////////////////////////////////////////////
16 
17 
18 #ifndef QMCPLUSPLUS_QMCDRIVER_FACTORY_H
19 #define QMCPLUSPLUS_QMCDRIVER_FACTORY_H
20 #include <bitset>
21 #include <string>
22 
23 #include "OhmmsData/OhmmsElementBase.h"
24 #include "QMCDrivers/DriverTraits.h"
25 #include "QMCDrivers/MCPopulation.h"
26 #include "Particle/ParticleSetPool.h"
27 
28 class Communicate;
29 
30 namespace qmcplusplus
31 {
32 //forward declaration
33 class MCWalkerConfiguration;
34 class QMCDriverInterface;
35 class WaveFunctionPool;
36 class HamiltonianPool;
37 class ProjectData;
38 
39 class QMCDriverFactory
40 {
41 public:
42   struct DriverAssemblyState
43   {
44     std::bitset<QMC_MODE_MAX> what_to_do;
45     bool append_run         = false;
46     bool enable_profiling   = false;
47     std::string traces_tag  = "none";
48     QMCRunType new_run_type = QMCRunType::DUMMY;
49   };
50 
51   QMCDriverFactory(const ProjectData& project_data);
52 
53   /** default constructor **/
54   //QMCDriverFactory() ;
55 
56   /** read the current QMC Section */
57   DriverAssemblyState readSection(xmlNodePtr cur) const;
58 
59   /** create a new QMCDriver
60    *
61    *  Broken out for unit tests
62    */
63   std::unique_ptr<QMCDriverInterface> createQMCDriver(xmlNodePtr cur,
64                                                       DriverAssemblyState& das,
65                                                       MCWalkerConfiguration& qmc_system,
66                                                       ParticleSetPool& particle_pool,
67                                                       WaveFunctionPool& wave_function_pool,
68                                                       HamiltonianPool& hamiltonian_pool,
69                                                       Communicate* comm) const;
70 
71 private:
72   /// project info for accessing global fileroot and series id
73   const ProjectData& project_data_;
74 };
75 } // namespace qmcplusplus
76 #endif
77