24 #if !defined(REMOVE_TRACEMANAGER) 27 using TraceManager = int;
91 assert(tspecies.getTotalNum() ==
W.
groups());
93 MassInvS.resize(tspecies.getTotalNum());
94 for (
int ig = 0; ig < tspecies.getTotalNum(); ++ig)
95 MassInvS[ig] = 1.0 / tspecies(massind, ig);
97 for (
int ig = 0; ig <
W.
groups(); ++ig)
98 for (
int iat =
W.
first(ig); iat <
W.
last(ig); ++iat)
127 resetRun(brancher,est,traces,driftmodifer);
169 #if !defined(REMOVE_TRACEMANAGER) 173 "QMCUpdateBase::startRun\n derived QMCDriver class has not setup trace clones properly\n null TraceManager " 174 "pointer encountered in derived QMCUpdateBase class\n see VMCLinearOptOMP.cpp for a correct minimal interface " 175 "(search on 'trace')\n refer to changes made in SVN revision 6597 for further guidance");
188 #if !defined(REMOVE_TRACEMANAGER) 197 #if !defined(REMOVE_TRACEMANAGER) 212 #if !defined(REMOVE_TRACEMANAGER) 223 for (; it != it_end; ++it)
252 dummy_walker.registerData();
255 for (; it != it_end; ++it)
304 if constexpr (std::is_same<RealType, FullPrecRealType>::value)
305 threshold = 100 * std::numeric_limits<float>::epsilon();
307 threshold = 500 * std::numeric_limits<float>::epsilon();
309 std::ostringstream msg;
316 msg <<
"Logpsi " << log_value <<
" ref " << ref_log << std::endl;
319 for (
int iel = 0; iel < ref_G.size(); iel++)
321 auto grad_diff = ref_G[iel] - G_saved[iel];
325 msg <<
"Grad[" << iel <<
"] ref = " << ref_G[iel] <<
" wrong = " << G_saved[iel] <<
" Delta " << grad_diff
329 auto lap_diff = ref_L[iel] - L_saved[iel];
333 if (std::is_same<RealType, FullPrecRealType>::value)
335 msg <<
"lap[" << iel <<
"] ref = " << ref_L[iel] <<
" wrong = " << L_saved[iel] <<
" Delta " << lap_diff
340 std::cerr << msg.str();
342 throw std::runtime_error(std::string(
"checkLogAndGL failed at ") + std::string(location) + std::string(
"\n"));
347 for (; it != it_end; ++it)
361 for (; it != it_end; ++it)
TraceManager * Traces
traces
RealType evaluateLog(ParticleSet &P)
evalaute the log (internally gradients and laplacian) of the trial wavefunction.
const BranchEngineType * branchEngine
branch engine, stateless reference to the one in QMCDriver
ParticleSet::ParticlePos drift
temporary storage for drift
WalkerLogCollector * wlog_collector
std::string debug_checks_str_
RealType m_tauovermass
tau/mass
PropertyContainer_t Properties
scalar properties of a walker
void setNonLocalMoves(xmlNodePtr cur)
set non local moves options
WFBuffer_t DataSet
buffer for the data for particle-by-particle update
A set of walkers that are to be advanced by Metropolis Monte Carlo.
MCWalkerConfiguration::iterator WalkerIter_t
void copyFromBuffer(ParticleSet &P, WFBufferType &buf)
copy all the wavefunction components from buffer.
helper functions for EinsplineSetBuilder
ParticleScalar spins
internal spin variables for dynamical spin calculations
PropertyContainer_t Properties
properties of the current walker
QTBase::RealType RealType
TrialWaveFunction & Psi
trial function
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
size_t getTotalNum() const
ParticleSet::ParticleScalar deltaS
temporart storage for spin displacement
void saveProperty(IT first)
save the values of Hamiltonian elements to the Properties
virtual bool put(xmlNodePtr cur)
process options
WaveFunctionComponent::LogValue LogValue
Collection of Local Energy Operators.
ParticleAttrib< QTFull::ValueType > ParticleLaplacian
this class implements drift modification
void allocate()
allocate the data
Crowd-level resource for walker log collection.
int first(int igroup) const
return the first index of a group i
RealType m_sqrttau
Time-step factor .
void update(bool skipSK=false)
update the internal data
ParticleSet::ParticlePos deltaR
temporary storage for random displacement
ParticleLaplacian L
laplacians of the particles
int addAttribute(const std::string &aname)
for a new attribute, allocate the data, !More often used to get the index of a species ...
void print_mem(const std::string &title, std::ostream &log)
RealType updateBuffer(ParticleSet &P, WFBufferType &buf, bool fromscratch=false)
update all the wavefunction components in buffer.
void startBlock(int nsteps)
void stop()
stop a qmc run
DriverDebugChecks debug_checks_
determine additional checks for debugging purpose
bool put(std::istream &is) override
read from std::istream
void startBlock(int steps)
prepare to start a block
IndexType nNodeCrossing
Total number of node crossings per block.
int groups() const
return the number of groups
void resetRun(BranchEngineType *brancher, EstimatorManagerBase *est, TraceManager *traces, const DriftModifierBase *driftmodifer)
reset the QMCUpdateBase parameters
void startBlock(int steps)
start a block
Specialized paritlce class for atomistic simulations.
Manages the state of QMC sections and handles population control for DMCs.
T setScaledDriftPbyPandNodeCorr(T tau, const ParticleAttrib< TinyVector< T1, D >> &qf, ParticleAttrib< TinyVector< T, D >> &drift)
scale drift
EstimatorManagerBase * Estimators
estimator
virtual void initWalkers(WalkerIter_t it, WalkerIter_t it_end)
initialize Walker for walker update
std::vector< RealType > SqrtTauOverMass
sqrt(tau/Mass) per particle
ParticleGradient G
gradients of the particles
void saveWalker(Walker_t &awalker)
save this to awalker
virtual void advanceWalker(Walker_t &thisWalker, bool recompute)=0
move a walker
NewTimer & createGlobalTimer(const std::string &myname, timer_levels mylevel)
void registerData(ParticleSet &P, WFBufferType &buf)
register all the wavefunction components in buffer.
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
void stopBlock(bool collectall=true)
stop a block
int last(int igroup) const
return the last index of a group i
ParticleSet::ParticleLaplacian dL
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t exp(const Vector< T1, C1 > &l)
MCWalkerConfiguration & W
walker ensemble
void setDefaults()
set default parameters
std::vector< RealType > MassInvP
1/Mass per particle
static void checkLogAndGL(ParticleSet &pset, TrialWaveFunction &twf, const std::string_view location)
check logpsi and grad and lap against values computed from scratch
RealType getNodeCorrection(const ParticleSet::ParticleGradient &g, ParticleSet::ParticlePos &gscaled)
evaluate the ratio of scaled velocity and velocity
QMCUpdateBase(MCWalkerConfiguration &w, TrialWaveFunction &psi, QMCHamiltonian &h, RandomBase< FullPrecRealType > &rg)
Constructor.
SpeciesSet & getSpeciesSet()
retrun the SpeciesSet of this particle set
void initialize_traces(TraceManager &tm, ParticleSet &P)
initialize trace data
Class to manage a set of ScalarEstimators.
void auxHevaluate(ParticleSet &P)
int nSubSteps
number of steps per measurement
RealType getPhase() const
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>
IndexType MaxAge
MaxAge>0 indicates branch is done.
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
virtual ~QMCUpdateBase()
destructor
size_type size() const
return the size of the data
Class to represent a many-body trial wave function.
RandomBase< FullPrecRealType > & RandomGen
random number generator
FullPrecRealType evaluate(ParticleSet &P)
evaluate Local Energy
void stopBlock(RealType accept, bool collectall=true)
stop a block
ParticleAttrib< SingleParticlePos > ParticlePos
void startBlock()
resize buffers to zero rows at beginning of each MC block
virtual void initWalkersForPbyP(WalkerIter_t it, WalkerIter_t it_end)
initialize Walker buffers for PbyP update
FullPrecRealType Weight
Weight of the walker.
const auto & getLattice() const
void finalize_traces()
finalize trace data
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)
ParticleAttrib< QTFull::GradType > ParticleGradient
NewTimer & initWalkers_timer_
Custom container for set of attributes for a set of species.
IndexType nAccept
counter for number of moves accepted
RealType m_oneover2tau
Time-step factor .
IndexType nReject
counter for number of moves rejected
virtual void advanceWalkers(WalkerIter_t it, WalkerIter_t it_end, bool recompute)
advance walkers executed at each step
ParticleSet::ParticleLaplacian L
storage for differential laplacians for PbyP update
FullPrecRealType * getPropertyBase()
ParticleSet::ParticleGradient dG
ParticleSet::ParticleGradient G
storage for differential gradients for PbyP update
void start(int blocks, bool record=true)
start a run
Declare QMCUpdateBase class.
void clear()
clear the data and set Current=0
std::vector< RealType > MassInvS
1/Mass per species
void setMultiplicity(WalkerIter_t it, WalkerIter_t it_end)
set the multiplicity of the walkers to branch
void rewind(size_type cur=0, size_type cur_scalar=0)
set the cursors
IndexType NumPtcl
number of particles
A container class to represent a walker.
QMCHamiltonian & H
Hamiltonian.
ParameterSet myParams
parameters
RealType m_r2max
maximum displacement^2
RealType acceptRatio() const
void resetProperty(FullPrecRealType logpsi, FullPrecRealType sigN, FullPrecRealType ene)
reset the property of a walker
void startRun(int blocks, bool record)
start a run
IndexType NonLocalMoveAccepted
Total numer of non-local moves accepted.
ParticlePos R
The configuration vector (3N-dimensional vector to store the positions of all the particles for a sin...
IndexType nAllRejected
Total number of the steps when all the particle moves are rejected.
void resetRun2(BranchEngineType *brancher, EstimatorManagerBase *est, TraceManager *traces, WalkerLogCollector *wlog_collector_, const DriftModifierBase *driftmodifer)
bool UpdatePbyP
update particle-by-particle
const DriftModifierBase * DriftModifier
drift modifer, stateless reference to the one in QMCDriver