80 : BranchMode(abranch.BranchMode),
81 iParam(abranch.iParam),
82 vParam(abranch.vParam),
83 branching_cutoff_scheme(abranch.branching_cutoff_scheme),
84 sParam(abranch.sParam)
133 bool fromscratch =
false;
136 int nwtot_now =
walkers.getGlobalNumWalkers();
144 int ncontexts = acomm->
size();
145 std::vector<int> nw(ncontexts, 0), nwoff(ncontexts + 1, 0);
148 for (
int ip = 0; ip < ncontexts; ++ip)
149 nwoff[ip + 1] = nwoff[ip] + nw[ip];
150 walkers.setWalkerOffsets(nwoff);
158 app_log() <<
" START ALL OVER " << std::endl;
212 app_log() <<
" Disable branching for debugging as the user input request." << std::endl;
225 bool fromscratch =
false;
245 app_log() <<
" START ALL OVER " << std::endl;
365 app_log() <<
"Switching to DMC with fluctuating populations" << std::endl;
380 walkers.Collectables *= wgt_inv;
525 app_log() <<
"BRANCH resetRun" << std::endl;
539 p.
add(target_min,
"minimumtargetwalkers");
540 p.
add(target_min,
"minimumsamples");
551 std::string reconfig(
"no");
554 reconfig =
"runwhileincorrect";
555 std::string reconfig_prev(reconfig);
557 p.
add(reconfig,
"reconfiguration");
559 if (reconfig !=
"no" && reconfig !=
"runwhileincorrect")
562 throw std::runtime_error(
"Reconfiguration is currently broken and gives incorrect results. Use dynamic " 563 "population control by setting reconfiguration=\"no\" or removing the reconfiguration " 564 "option from the DMC input section. If accessing the broken reconfiguration code path " 565 "is still desired, set reconfiguration to \"runwhileincorrect\" instead of \"yes\".");
567 same_wc = (reconfig == reconfig_prev);
572 std::equal(
vParam.begin(),
vParam.end(), vparam_old.begin()))
574 app_log() <<
" Continue with the same input as the previous block." << std::endl;
578 app_log() <<
" SimpleFixedNodeBranch::resetRun detected changes in <parameter>'s " << std::endl;
584 app_log() <<
" iParam (old): " << iparam_old << std::endl;
586 app_log() <<
" vParam (old): " << vparam_old << std::endl;
594 APP_ABORT(
"SimpleFixedNodeBranch::resetRun cannot initialize WalkerController");
629 app_log() <<
" iParam (old): " << iparam_old << std::endl;
631 app_log() <<
" vParam (old): " << vparam_old << std::endl;
639 return static_cast<int>(round(static_cast<double>(
iParam[
B_TARGETWALKERS] / static_cast<double>(nw_target))));
644 std::ostringstream o;
657 o <<
"SimpleFixedNodeBranch::checkParameters " << std::endl;
658 o <<
" Average Energy of a population = " <<
e << std::endl;
661 app_log() << o.str() << std::endl;
667 std::ostringstream o;
670 o <<
"====================================================";
671 o <<
"\n SimpleFixedNodeBranch::finalize after a DMC block";
682 o <<
"\n QMC Status (BranchMode) = " <<
BranchMode;
683 o <<
"\n====================================================";
688 o <<
"====================================================";
689 o <<
"\n SimpleFixedNodeBranch::finalize after a RMC block";
696 o <<
"\n QMC Status (BranchMode) = " <<
BranchMode;
697 o <<
"\n====================================================";
710 o <<
"====================================================";
711 o <<
"\n SimpleFixedNodeBranch::finalize after a VMC block";
716 o <<
"\n====================================================";
718 app_log() << o.str() << std::endl;
752 bool success = hh.
write(fname);
765 bool success = hh.read(fname);
769 app_log() <<
" Restarting, cummulative properties:" 824 for (
auto value : rhs)
825 os << std::setw(18) << std::setprecision(10) << value;
void collect(int iter, MCWalkerConfiguration &w)
update RMC counters and running averages.
HamiltonianRef::FullPrecRealType FullPrecRealType
PropertyContainer_t Properties
scalar properties of a walker
std::bitset< B_MODE_MAX > BranchModeType
booleans to set the branch modes
A set of walkers that are to be advanced by Metropolis Monte Carlo.
helper functions for EinsplineSetBuilder
int rank() const
return the rank
void reset()
reset the internal parameters
void checkParameters(MCWalkerConfiguration &w)
determine trial and reference energies
BranchModeType BranchMode
std::string branching_cutoff_scheme
scheme of branching cutoff
accumulator_set< RealType > R2Proposed
a simple accumulator for energy
void branch(int iter, MCWalkerConfiguration &w)
perform branching
counter for tracking object state
void start(const std::string &froot, bool append=false)
start a run
1 for dmc, 0 for anything else
xmlNodePtr myNode
save xml element
SimpleFixedNodeBranch(RealType tau, int nideal)
Constructor.
int size() const
return the number of tasks
maximum number of walkers per node
bool good() const
return true if Weight!= 0
void write(const std::string &fname, bool overwrite=true)
write the state
bool put(std::istream &is) override
read from std::istream
accumulator_set< FullPrecRealType > EnergyHist
a simple accumulator for energy
void setBranchCutoff(FullPrecRealType variance, FullPrecRealType targetSigma, FullPrecRealType maxSigma, int Nelec=0)
set branch cutoff, max, filter
void flush(int counter)
restart averaging
ParameterSet m_param
set of parameters
Wrapping information on parallelism.
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t pow(const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
FullPrecRealType logN
Feed*log(N)
std::unique_ptr< WalkerControlBase > BackupWalkerController
Backup WalkerController for mixed DMC.
Manages the state of QMC sections and handles population control for DMCs.
1 to use taueff accordning to JCP 93, 0 to use tau
frequency of the trial energy updates, default 1
class to handle a set of parameters
WalkerProperties::Indexes WP
int initWalkerController(MCWalkerConfiguration &mcwc, bool fixW, bool killwalker)
initialize the WalkerController
1 for rmc, 0 for anything else
1 to kill walkers when a node crossing is detected
1 for the standard dmc, 0 for the comb method
std::ostream & operator<<(std::ostream &out, const AntiSymTensor< T, D > &rhs)
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
minimum number of walkers per node
Manager class of scalar estimators.
warmup steps, valid when BranchMode[D_DMCSTAGE] == 0
void registerParameters()
create map between the parameter name and variables
void read(const std::string &fname)
std::string RootName
root name
MakeReturn< UnaryNode< FnLog, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t log(const Vector< T1, C1 > &l)
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>
return_type mean() const
return the mean
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
return_type result() const
return the sum
std::vector< std::string > sParam
string parameters
Indexes
an enum denoting index of physical properties
bool write(const std::string &fname)
void initReptile(MCWalkerConfiguration &w)
initialize reptile stats
bool put(xmlNodePtr cur)
Parse the xml file for parameters.
return_type count() const
return the count
declare a handler of DMC branching
interval between branch, see population control
std::unique_ptr< EstimatorManagerBase > MyEstimator
std::unique_ptr< WalkerControlBase > WalkerController
WalkerController.
accumulator_set< RealType > R2Accepted
a simple accumulator for energy
int resetRun(xmlNodePtr cur)
reset the internal parameters
target total number of walkers per mpi group
Declare a global Random Number Generator.
A container class to represent a walker.
WalkerControlBase * createWalkerController(int nwtot, Communicate *comm, xmlNodePtr cur, bool reconfig)
function to create WalkerControlBase or its derived class
int ToDoSteps
number of remaning steps for a specific tasks
void finalize(MCWalkerConfiguration &w)
finalize the simulation
accumulator_set< FullPrecRealType > VarianceHist
a simple accumulator for variance
std::string debug_disable_branching_
disable branching for debugging