34 #if !defined(REMOVE_TRACEMANAGER) 37 using TraceManager = int;
49 const std::string& QMC_driver_type,
50 bool enable_profiling)
52 project_data_(project_data),
55 QMCType(QMC_driver_type),
60 driver_scope_profiler_(enable_profiling)
131 #ifdef MIXED_PRECISION 182 int numCopies = (
H1.empty()) ? 1 :
H1.size();
202 #if !defined(REMOVE_TRACEMANAGER) 223 app_log() <<
" Regenerate random seeds." << std::endl;
237 app_log() <<
"\n=========================================================" 243 app_log() <<
"\n=========================================================" << std::endl;
257 int nfile = wset.size();
259 for (
int i = 0; i < wset.size(); i++)
260 if (W_in.put(wset[i]))
269 std::vector<int> nw(np, 0), nwoff(np + 1, 0);
272 for (
int ip = 0; ip < np; ++ip)
273 nwoff[ip + 1] = nwoff[ip] + nw[ip];
280 std::string r_RootName;
295 std::string r_RootName;
312 wOut->dump(
W, block);
321 wOut->dump(
W, block);
344 app_log() <<
" Adding " << nwalkers <<
" walkers to " << nold <<
" existing sets" << std::endl;
350 (*it)->R =
W[iw % nold]->
R;
353 else if (nwalkers < 0)
376 nwoff[ip + 1] = nwoff[ip] + nw[ip];
379 for (
int iw = 0; iw < nw[
myComm->
rank()]; ++iw, ++id)
381 W[iw]->setWalkerID(
id);
382 W[iw]->setParentID(
id);
403 app_log() <<
getName() <<
" Skip QMCDriver::putQMCInfo " << std::endl;
423 xmlNodePtr tcur = cur->children;
427 std::string cname((
const char*)(tcur->name));
428 if (cname ==
"record")
436 else if (cname ==
"checkpoint")
444 else if (cname ==
"dumpconfig")
451 else if (cname ==
"random")
463 app_warning() <<
"Input parameter \"blocks\" must be positive! Set to 1. User input value " <<
nBlocks << std::endl;
470 app_warning() <<
"Input parameter \"steps\" must be positive! Set to 1. User input value " <<
nSteps << std::endl;
477 app_warning() <<
"Input parameter \"substeps\" must be positive! Set to 1. User input value " <<
nSubSteps 492 app_log() <<
"Using existing walkers " << std::endl;
496 app_log() <<
"Resetting walkers" << std::endl;
518 xmlNodePtr newqmc = xmlCopyNode(
qmcNode, 1);
519 xmlNodePtr current_ptr = NULL;
520 xmlNodePtr cur = newqmc->children;
521 while (cur != NULL && current_ptr == NULL)
523 std::string cname((
const char*)(cur->name));
524 if (cname ==
"parameter")
527 if (name ==
"current")
532 if (current_ptr == NULL)
534 current_ptr = xmlNewTextChild(newqmc, NULL, (
const xmlChar*)
"parameter", (
const xmlChar*)
"0");
535 xmlNewProp(current_ptr, (
const xmlChar*)
"name", (
const xmlChar*)
"current");
NewTimer & checkpoint_timer_
std::string getRotationName(std::string RootName)
std::string h5FileRoot
the root of h5File
int MaxCPUSecs
maximum cpu in secs
A set of walkers that are to be advanced by Metropolis Monte Carlo.
std::ostream & app_warning()
Base class for any object which needs to know about a MPI communicator.
helper functions for EinsplineSetBuilder
int rank() const
return the rank
QMCDriver(const ProjectData &project_data, MCWalkerConfiguration &w, TrialWaveFunction &psi, QMCHamiltonian &h, Communicate *comm, const std::string &QMC_driver_type, bool enable_profiling=false)
Constructor.
std::string getLastRotationName(std::string RootName)
std::vector< TrialWaveFunction * > Psi1
a list of TrialWaveFunctions for multiple method
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
size_t getTotalNum() const
RealType nSamplesPerThread
samples per thread
xmlNodePtr qmcNode
pointer to qmc node in xml file
bool put(xmlNodePtr cur)
assign attributes to the set
Collection of Local Energy Operators.
ParticleSet::ParticlePos drift
temporary storage for drift
IndexType CurrentStep
current step
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
RealType SpinMass
spin mass for spinor calcs
static void write(const std::string &fname, Communicate *comm)
write in parallel or serial
int size() const
return the number of tasks
IndexType nReject
counter for number of moves /rejected
IndexType nTargetWalkers
the number of walkers
std::unique_ptr< TraceManager > Traces
Traces manager.
size_t getGlobalNumWalkers() const
return the total number of active walkers among a MPI group
virtual bool put(xmlNodePtr cur)=0
bool put(std::istream &is) override
read from std::istream
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
ParameterSet m_param
store any parameter that has to be read from a file
IndexType nSubSteps
number of steps between a step: VMCs do not evaluate energies
Wrapping information on parallelism.
IndexType nSteps
maximum number of steps
std::unique_ptr< HDFWalkerOutput > wOut
record engine for walkers
bool finalize(int block, bool dumpwalkers=true)
finalize a qmc section
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
Declaration of QMCDriver.
virtual bool parseXML(xmlNodePtr cur)
int kDelay
the number to delay updates by
omp_int_t omp_get_max_threads()
Communicate * myComm
pointer to Communicate
class to handle a set of attributes of an xmlNode
std::unique_ptr< BranchEngineType > branchEngine
branch engine
bool putQMCInfo(xmlNodePtr cur)
Parses the xml input file for parameter definitions for a single qmc simulation.
NewTimer & createGlobalTimer(const std::string &myname, timer_levels mylevel)
QMCHamiltonian & H
Hamiltonian.
void setStatus(const std::string &aname, const std::string &h5name, bool append) override
Set the status of the QMCDriver.
DriftModifierBase * DriftModifier
drift modifer
int qmc_counter
init for <qmc> section
MCWalkerConfiguration & W
walker ensemble
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
xmlNodePtr walker_logs_xml
traces xml
void add_H_and_Psi(QMCHamiltonian *h, TrialWaveFunction *psi) override
add QMCHamiltonian/TrialWaveFunction pair for multiple
bool IsQMCDriver
true, if it is a real QMC engine
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.
void flush()
flush stream buffer
Class to represent a many-body trial wave function.
std::vector< QMCHamiltonian * > H1
a list of QMCHamiltonians for multiple method
IndexType nTargetSamples
the number of saved samples
EstimatorManagerBase * Estimators
Observables manager.
int Period4CheckPoint
period of dumping walker configurations and everything else for restart
RealType nTargetPopulation
target population
IndexType nAccept
counter for number of moves accepted
const std::string & getName() const
return the name
IndexType nStepsBetweenSamples
alternate method of setting QMC run parameters
IndexType nBlocks
maximum number of blocks
void createWalkers(int numWalkers)
create numWalkers Walkers
int Period4WalkerDump
period of recording walker configurations
MCDataType< FullPrecRealType > EnsembleProperty
int Period4CheckProperties
period of dumping walker positions and IDs for Forward Walking
void addWalkers(int nwalkers)
Add walkers to the end of the ensemble of walkers.
QMCState qmc_common
a unique QMCState during a run
void setWalkerOffsets()
set global offsets of the walkers
IndexType nWarmupSteps
number of warmup steps
std::unique_ptr< WalkerLogManager > wlog_manager_
Traces manager.
IndexType nBlocksBetweenRecompute
the number of blocks between recomptePsi
xmlNodePtr traces_xml
traces xml
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
int MyCounter
the number of times this QMCDriver is executed
ParticleSet::ParticlePos deltaR
temporary storage for random displacement
Declaration of a MCWalkerConfiguration.
void putWalkers(std::vector< xmlNodePtr > &wset) override
Read walker configurations from *.config.h5 files.
void process(xmlNodePtr cur) override
initialize with xmlNode
bool allow_traces
whether to allow traces
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
DriftModifierBase * createDriftModifier(xmlNodePtr cur, const Communicate *myComm)
create DriftModifier
bool ResetRandom
randomize it
iterator begin()
return the first iterator