64 std::string update_mode(
"pbyp");
66 std::string multi_tag(
"no");
67 std::string warp_tag(
"no");
68 std::string append_tag(
"no");
69 std::string profiling_tag(
"no");
71 aAttrib.
add(qmc_mode,
"method",
72 {
"",
"vmc",
"vmc_batch",
"dmc",
"dmc_batch",
"csvmc",
"rmc",
"linear",
"linear_batch",
"wftest"});
73 aAttrib.
add(update_mode,
"move");
74 aAttrib.
add(multi_tag,
"multiple");
75 aAttrib.
add(warp_tag,
"warp");
76 aAttrib.
add(append_tag,
"append");
77 aAttrib.
add(profiling_tag,
"profiling");
94 const int nchars = qmc_mode.size();
100 if (qmc_mode.find(
"vmc") < nchars)
102 else if (qmc_mode.find(
"dmc") < nchars)
104 else if (qmc_mode.find(
"linear") < nchars)
111 if (qmc_mode.find(
"linear_batch") < nchars)
113 else if (qmc_mode.find(
"linear") < nchars)
117 if (qmc_mode.find(
"ptcl") < nchars)
119 if (qmc_mode.find(
"mul") < nchars)
121 if (qmc_mode.find(
"warp") < nchars)
123 if (qmc_mode.find(
"rmc") < nchars)
125 else if (qmc_mode.find(
"vmc_batch") < nchars)
127 else if (qmc_mode.find(
"vmc") < nchars)
129 else if (qmc_mode.find(
"dmc_batch") < nchars)
131 else if (qmc_mode.find(
"dmc") < nchars)
133 else if (qmc_mode ==
"wftest")
136 throw std::runtime_error(
"qmc method cannot be empty!");
142 std::unique_ptr<QMCDriverInterface> QMCDriverFactory::createQMCDriver(xmlNodePtr cur,
144 const std::optional<EstimatorManagerInput>&
emi,
156 std::queue<TrialWaveFunction*> targetPsi;
157 std::queue<QMCHamiltonian*> targetH;
158 xmlNodePtr tcur = cur->children;
159 std::unique_ptr<QMCDriverInterface> new_driver;
162 if (xmlStrEqual(tcur->name, (
const xmlChar*)
"qmcsystem"))
165 if (!wf_name.empty())
171 app_warning() <<
" qmcsystem does not have wavefunction. Assign 0" << std::endl;
175 if (!ham_name.empty())
181 app_warning() <<
" qmcsystem does not have hamiltonian. Assign 0" << std::endl;
195 primaryPsi = targetPsi.front();
197 primaryH = targetH.front();
226 new_driver = fac.
create(project_data_,
emi, qmc_system,
238 new_driver = fac.
create(project_data_,
emi, qmc_system,
244 new_driver = fac.
create(project_data_, qmc_system, *primaryPsi, *primaryH,
comm);
246 else if (das.
new_run_type == QMCRunType::LINEAR_OPTIMIZE)
248 #ifdef MIXED_PRECISION 249 APP_ABORT(
"QMCDriverFactory::createQMCDriver : method=\"linear\" is not safe with CPU mixed precision. Please use " 250 "full precision build instead.");
256 new_driver.reset(opt);
258 else if (das.
new_run_type == QMCRunType::LINEAR_OPTIMIZE_BATCH)
260 #ifdef MIXED_PRECISION 261 APP_ABORT(
"QMCDriverFactory::createQMCDriver : method=\"linear_batch\" is not safe with CPU mixed precision. " 262 "Please use full precision build instead.");
268 new_driver = std::move(opt);
272 app_log() <<
"Testing wavefunctions." << std::endl;
275 new_driver.reset(temp_ptr);
283 while (targetH.size())
285 new_driver->add_H_and_Psi(targetH.front(), targetPsi.front());
294 bool allow_traces = das.
traces_tag ==
"yes" ||
296 new_driver->requestTraces(allow_traces);
301 new_driver->requestWalkerLogs(allow_walker_logs);
std::unique_ptr< QMCDriver > create(const ProjectData &project_data, MCWalkerConfiguration &w, TrialWaveFunction &psi, QMCHamiltonian &h, Communicate *comm, bool enable_profiling)
QMCDriverFactory(const ProjectData &project_data)
Application uses this constructor param[in] project_data this is stored as a reference and this state...
std::unique_ptr< QMCFixedSampleLinearOptimizeBatched > QMCWFOptLinearFactoryNew(xmlNodePtr cur, const ProjectData &project_data, const std::optional< EstimatorManagerInput > &global_emi, WalkerConfigurations &wc, MCPopulation &&pop, SampleStack &samples, Communicate *comm)
A set of walkers that are to be advanced by Metropolis Monte Carlo.
std::ostream & app_warning()
helper functions for EinsplineSetBuilder
int rank() const
return the rank
DriverAssemblyState readSection(xmlNodePtr cur) const
default constructor
std::unique_ptr< QMCDriverInterface > create(const ProjectData &project_data, const std::optional< EstimatorManagerInput > &global_emi, WalkerConfigurations &wc, MCPopulation &&pop, SampleStack &samples, Communicate *comm)
create a VMCBatched driver.
bit for move: walker or pbyp
bool put(xmlNodePtr cur)
assign attributes to the set
Collection of Local Energy Operators.
EstimatorManagerInput emi(estimators_doc.getRoot())
int size() const
return the number of tasks
Creates a common base class pointer for QMCDriver and QMCDriverNew to share.
std::unique_ptr< QMCDriverInterface > create(const ProjectData &project_data, const std::optional< EstimatorManagerInput > global_emi, WalkerConfigurations &wc, MCPopulation &&pop, Communicate *comm)
create a DMCBatched driver.
Wrapping information on parallelism.
std::bitset< QMC_MODE_MAX > what_to_do
DriverVersion getDriverVersion() const noexcept
DriverVersion
Enum for global scope switch of design from legacy driver based to batch driver based.
Compilation units that construct QMCDriverInput need visibility to the actual input classes types in ...
Test the correctness of TrialWaveFunction for the values, gradients and laplacians.
const ProjectData & project_data_
project info for accessing global fileroot and series id
Declaration of WaveFunctionPool.
class to handle a set of attributes of an xmlNode
bit for multple configuration
This a subclass for runtime errors that will occur on all ranks.
Manage a collection of ParticleSet objects.
Definition of QMCDriver which performs VMC and optimization.
char * castXMLCharToChar(xmlChar *c)
assign a value from a node. Use specialization for classes.
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
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...
std::unique_ptr< QMCDriver > create(const ProjectData &project_data, MCWalkerConfiguration &w, TrialWaveFunction &psi, QMCHamiltonian &h, Communicate *comm)
Declaration of a TrialWaveFunction.
std::unique_ptr< QMCDriverInterface > create(const ProjectData &project_data, MCWalkerConfiguration &w, TrialWaveFunction &psi, QMCHamiltonian &h, Communicate *comm, bool enable_profiling)
Declaration of HamiltonianPool.
void flush()
flush stream buffer
Class to represent a many-body trial wave function.
const SampleStack & getSampleStack() const
Definition of QMCDriver which performs VMC and optimization.
void setWaveFunctionNode(xmlNodePtr cur)
Implements wave-function optimization.
VMC type: vmc, vmc-ptcl, vmc-multiple, vmc-ptcl-multiple.
void setPrimary(bool primary)
set PRIMARY bit of all the components
void add(PDT &aparam, const std::string &aname, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new attribute
std::string walkerlogs_tag
Manage a collection of TrialWaveFunction objects.
Manage a collection of QMCHamiltonian objects.