30 #if !defined(REMOVE_TRACEMANAGER) 33 using TraceManager = int;
46 bool enable_profiling)
47 :
QMCDriver(project_data, w, psi, h,
comm,
"VMC", enable_profiling), UseDrift(
"yes"), rngs_(rngs)
67 #if !defined(REMOVE_TRACEMANAGER) 76 for (
int block = 0; block <
nBlocks; ++block)
89 for (
int step = 0; step <
nSteps; ++step)
91 Movers[ip]->set_step(now_loc);
93 wClones[ip]->resetCollectables();
96 Movers[ip]->advanceWalkers(wit, wit_end, recompute);
98 wClones[ip]->Collectables *= cnorm;
99 Movers[ip]->accumulate(wit, wit_end);
102 wClones[ip]->saveEnsemble(wit, wit_end);
106 Movers[ip]->stopBlock(
false);
111 #if !defined(REMOVE_TRACEMANAGER) 118 bool stop_requested =
false;
121 stop_requested = runtimeControl.checkStop(vmc_loop);
126 app_log() << runtimeControl.generateStopMessage(
"VMC", block);
134 #if !defined(REMOVE_TRACEMANAGER) 147 app_log() <<
" samples are written to the config.h5" << std::endl;
160 app_log() <<
" Initial partition of walkers ";
164 bool movers_created =
false;
165 bool spinors =
false;
168 movers_created =
true;
179 #pragma omp parallel for 182 std::ostringstream os;
185 #if !defined(REMOVE_TRACEMANAGER) 190 hClones[ip]->setRandomGenerator(
Rng[ip].
get());
216 app_log() << os.str() << std::endl;
219 #if !defined(REMOVE_TRACEMANAGER) 222 #pragma omp parallel for 229 app_log() <<
" Using Particle by Particle moves" << std::endl;
233 app_log() <<
" Using All Particle moves" << std::endl;
238 app_log() <<
" Walker moves with drift" << std::endl;
239 for (
int i = 0; i <
Movers.size(); i++)
244 app_log() <<
" Walker moves without drift" << std::endl;
245 for (
int i = 0; i <
Movers.size(); i++)
251 app_log() <<
" Spins treated as dynamic variable with SpinMass: " <<
SpinMass << std::endl;
252 for (
int i = 0; i <
Movers.size(); i++)
257 app_log() <<
" Walker distribution on root = ";
264 #pragma omp parallel for 277 for (
int prestep = 0; prestep <
nWarmupSteps; ++prestep)
285 app_log() <<
" Anonymous Buffer size per walker : " <<
W[0]->DataSet.byteSize() <<
" Bytes." << std::endl;
303 p.
add(target_min,
"minimumtargetwalkers");
304 p.
add(target_min,
"minimumsamples");
307 app_log() <<
"\n<vmc function=\"put\">" 330 int nwtot = nw * Nprocs;
341 int ns_per_step = Nprocs * nw;
354 app_log() <<
" time step = " <<
Tau << std::endl;
368 <<
" blocks" << std::endl;
372 app_log() <<
" DumpConfig==false Nothing (configurations, state) will be saved." << std::endl;
378 app_log() <<
"</vmc>" << std::endl;
size_type size() const
return the size of the data
UPtrVector< WalkerLogCollector > wlog_collectors
trace collectors
int MaxCPUSecs
maximum cpu in secs
A set of walkers that are to be advanced by Metropolis Monte Carlo.
static std::vector< TrialWaveFunction * > psiClones
std::vector< int > wPerRank
Walkers per MPI rank.
helper functions for EinsplineSetBuilder
int rank() const
return the rank
QTBase::RealType RealType
size_t getActiveWalkers() const
return the number of active walkers
void recordBlock(int block) override
record the state of the block
Implements the Spin VMC algorithm using particle-by-particle move.
bool DumpConfig
flag to turn off dumping configurations
std::string RootName
root of all the output files
static std::vector< MCWalkerConfiguration * > wClones
RealType nSamplesPerThread
samples per thread
xmlNodePtr qmcNode
pointer to qmc node in xml file
int prevStepsBetweenSamples
RunTimeManager< ChronoClock > run_time_manager
Collection of Local Energy Operators.
IndexType CurrentStep
current step
std::vector< std::unique_ptr< T > > UPtrVector
std::vector< QMCUpdateBase * > Movers
update engines
abstract base class for QMC engines
RealType SpinMass
spin mass for spinor calcs
int size() const
return the number of tasks
UPtrVector< RandomBase< QMCTraits::FullPrecRealType > > & rngs_
std::unique_ptr< TraceManager > Traces
Traces manager.
void stop()
stop a qmc run
bool put(std::istream &is) override
read from std::istream
void FairDivideLow(int ntot, int npart, IV &adist)
partition ntot elements among npart
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
void copy(const Array< T1, 3 > &src, Array< T2, 3 > &dest)
Wrapping information on parallelism.
omp_int_t omp_get_thread_num()
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
const std::string & getName() const
WalkerList_t::iterator iterator
FIX: a type alias of iterator for an object should not be for just one of many objects it holds...
VMC(const ProjectData &project_data_, MCWalkerConfiguration &w, TrialWaveFunction &psi, QMCHamiltonian &h, UPtrVector< RandomBase< QMCTraits::FullPrecRealType >> &rngs, Communicate *comm, bool enable_profiling)
Constructor.
A collection of functions for dividing fairly.
class to handle a set of parameters
MakeReturn< UnaryNode< FnCeil, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t ceil(const Vector< T1, C1 > &l)
omp_int_t omp_get_max_threads()
std::bitset< QMC_MODE_MAX > qmc_driver_mode
bits to classify QMCDriver
Communicate * myComm
pointer to Communicate
bool get(std::ostream &os) const override
write to a std::ostream
std::unique_ptr< BranchEngineType > branchEngine
branch engine
Implements the VMC algorithm using particle-by-particle move.
std::vector< EstimatorManagerBase * > estimatorClones
estimator managers
Implements the VMC algorithm using particle-by-particle move.
const IndexType NumThreads
number of threads
QMCHamiltonian & H
Hamiltonian.
DriftModifierBase * DriftModifier
drift modifer
void makeClones(MCWalkerConfiguration &w, TrialWaveFunction &psi, QMCHamiltonian &ham)
int qmc_counter
init for <qmc> section
MCWalkerConfiguration & W
walker ensemble
OHMMS_INDEXTYPE IndexType
define other types
Buffer_t Collectables
observables in addition to those registered in Properties/PropertyList
Class to manage a set of ScalarEstimators.
static bool dumpEnsemble(std::vector< MCWalkerConfiguration *> &others, HDFWalkerOutput &out, int np, int nBlock)
dump Samples to a file
static std::vector< QMCHamiltonian * > hClones
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>
void resetRun()
check the run-time environments
Implements the VMC algorithm using particle-by-particle move, including spin-moves ...
Class for determining elapsed run time enabling simulations to adjust to time limits.
Class to represent a many-body trial wave function.
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
void stopBlock(RealType accept, bool collectall=true)
stop a block
TrialWaveFunction & Psi
trial function
size_t memory_allocated
size of memory allocated in byte per MPI
void print_memory_change(const std::string &who, size_t before)
print memory increase
IndexType nStepsBetweenSamples
alternate method of setting QMC run parameters
IndexType nBlocks
maximum number of blocks
bool put(xmlNodePtr cur) override
int Period4WalkerDump
period of recording walker configurations
std::vector< TraceManager * > traceClones
trace managers
int Period4CheckProperties
period of dumping walker positions and IDs for Forward Walking
RefVector< WalkerLogCollector > getWalkerLogCollectorRefs()
QMCState qmc_common
a unique QMCState during a run
IndexType nWarmupSteps
number of warmup steps
UPtrVector< RandomBase< FullPrecRealType > > Rng
Random number generators.
std::unique_ptr< WalkerLogManager > wlog_manager_
Traces manager.
IndexType nBlocksBetweenRecompute
the number of blocks between recomptePsi
void start(int blocks, bool record=true)
start a run
int MyCounter
the number of times this QMCDriver is executed
target total number of walkers per mpi group
std::string UseDrift
option to enable/disable drift equation or RN for VMC
iterator begin()
return the first iterator