28 #if !defined(REMOVE_TRACEMANAGER) 31 using TraceManager = int;
42 :
QMCDriver(project_data, w, psi, h,
comm,
"CSVMC"), UseDrift(
"yes"), multiEstimator(0), Mover(0)
62 p.
add(target_min,
"minimumtargetwalkers");
63 p.
add(target_min,
"minimumsamples");
66 app_log() <<
"\n<vmc function=\"put\">" 85 int nwtot = nw * Nprocs;
96 int ns_per_step = Nprocs * nw;
109 app_log() <<
" time step = " <<
Tau << std::endl;
123 <<
" blocks" << std::endl;
127 app_log() <<
" DumpConfig==false Nothing (configurations, state) will be saved." << std::endl;
133 app_log() <<
"</vmc>" << std::endl;
151 #if !defined(REMOVE_TRACEMANAGER) 155 for (
int block = 0; block <
nBlocks; ++block)
166 for (
int step = 0; step <
nSteps; ++step)
170 wClones[ip]->resetCollectables();
171 CSMovers[ip]->advanceWalkers(wit, wit_end,
false);
172 if (has_collectables)
173 wClones[ip]->Collectables *= cnorm;
174 CSMovers[ip]->accumulate(wit, wit_end);
177 wClones[ip]->saveEnsemble(wit, wit_end);
184 #if !defined(REMOVE_TRACEMANAGER) 192 #if !defined(REMOVE_TRACEMANAGER) 204 app_log() <<
" samples are written to the config.h5" << std::endl;
212 H1[0]->setPrimary(
true);
214 for (
int ipsi = 1; ipsi < nPsi; ipsi++)
215 H1[ipsi]->setPrimary(
false);
222 APP_ABORT(
"OpenMP Parallelization for CSVMC not working at the moment");
224 app_log() <<
" Initial partition of walkers ";
240 #pragma omp parallel for 243 std::ostringstream os;
246 #if !defined(REMOVE_TRACEMANAGER) 254 os <<
" Using particle-by-particle update with drift " << std::endl;
259 os <<
" Using particle-by-particle update with no drift" << std::endl;
267 os <<
" Using walker-by-walker update with Drift " << std::endl;
272 os <<
" Using walker-by-walker update " << std::endl;
277 app_log() << os.str() << std::endl;
283 #if !defined(REMOVE_TRACEMANAGER) 286 #pragma omp parallel for 295 app_log() <<
" Walker distribution on root = ";
300 #pragma omp parallel for 311 for (
int prestep = 0; prestep <
nWarmupSteps; ++prestep)
bool run() override
Run the CSVMC algorithm.
size_type size() const
return the size of the data
A set of walkers that are to be advanced by Metropolis Monte Carlo.
int equilBlocks
blocks over which normalization factors are accumulated
std::vector< int > wPerRank
Walkers per MPI rank.
helper functions for EinsplineSetBuilder
QTBase::RealType RealType
std::vector< TrialWaveFunction * > Psi1
a list of TrialWaveFunctions for multiple method
size_t getActiveWalkers() const
return the number of active walkers
static std::vector< std::vector< TrialWaveFunction * > > PsiPoolClones
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
static std::vector< MCWalkerConfiguration * > wClones
RealType nSamplesPerThread
samples per thread
xmlNodePtr qmcNode
pointer to qmc node in xml file
int prevStepsBetweenSamples
Collection of Local Energy Operators.
IndexType CurrentStep
current step
UPtrVector< CSUpdateBase > CSMovers
std::vector< QMCUpdateBase * > Movers
update engines
Definition of CSVMCUpdateAll.
abstract base class for QMC engines
int size() const
return the number of tasks
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
WalkerList_t::iterator iterator
FIX: a type alias of iterator for an object should not be for just one of many objects it holds...
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
std::vector< EstimatorManagerBase * > estimatorClones
estimator managers
const IndexType NumThreads
number of threads
DriftModifierBase * DriftModifier
drift modifer
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
void makeClones(MCWalkerConfiguration &w, TrialWaveFunction &psi, QMCHamiltonian &ham)
int qmc_counter
init for <qmc> section
MCWalkerConfiguration & W
walker ensemble
static UPtrVector< RandomBase< FullPrecRealType > > Children
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
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>
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
void stopBlock(RealType accept, bool collectall=true)
stop a block
CSVMC(const ProjectData &project_data, MCWalkerConfiguration &w, TrialWaveFunction &psi, QMCHamiltonian &h, Communicate *comm)
Constructor.
IndexType nStepsBetweenSamples
alternate method of setting QMC run parameters
IndexType nBlocks
maximum number of blocks
bool put(xmlNodePtr cur) override
allocate internal data here before run() is called
static std::vector< std::vector< QMCHamiltonian * > > HPoolClones
std::vector< TraceManager * > traceClones
trace managers
int Period4WalkerDump
period of recording walker configurations
int Period4CheckProperties
period of dumping walker positions and IDs for Forward Walking
QMCState qmc_common
a unique QMCState during a run
IndexType nWarmupSteps
number of warmup steps
UPtrVector< RandomBase< FullPrecRealType > > Rng
Random number generators.
void start(int blocks, bool record=true)
start a run
int MyCounter
the number of times this QMCDriver is executed
iterator begin()
return the first iterator