QMCPACK
CSVMCUpdateAllWithDrift Class Reference
+ Inheritance diagram for CSVMCUpdateAllWithDrift:
+ Collaboration diagram for CSVMCUpdateAllWithDrift:

Public Member Functions

 CSVMCUpdateAllWithDrift (MCWalkerConfiguration &w, std::vector< TrialWaveFunction *> &psi, std::vector< QMCHamiltonian *> &h, RandomBase< FullPrecRealType > &rg)
 Constructor. More...
 
void advanceWalker (Walker_t &thisWalker, bool recompute) override
 move a walker More...
 
- Public Member Functions inherited from CSUpdateBase
 CSUpdateBase (MCWalkerConfiguration &w, std::vector< TrialWaveFunction *> &psi, std::vector< QMCHamiltonian *> &h, RandomBase< FullPrecRealType > &rg)
 
 ~CSUpdateBase () override
 
void computeSumRatio (const std::vector< RealType > &logpsi, const std::vector< RealType > &avgNorm, std::vector< RealType > &sumratio)
 
void computeSumRatio (const Matrix< RealType > &ratioij, std::vector< RealType > &sumratio)
 
void computeSumRatio (const std::vector< RealType > &logpsi, const std::vector< RealType > &avgNorm, Matrix< RealType > &ratioij, std::vector< RealType > &sumratio)
 
void updateRatioMatrix (const std::vector< RealType > &ratio_pbyp, Matrix< RealType > &ratioij)
 
void resizeWorkSpace (int nw, int nptcls)
 
void updateNorms ()
 
void updateAvgWeights ()
 
void initCSWalkers (WalkerIter_t it, WalkerIter_t it_end, bool resetNorms)
 
void initCSWalkersForPbyP (WalkerIter_t it, WalkerIter_t it_end, bool resetNorms)
 
void updateCSWalkers (WalkerIter_t it, WalkerIter_t it_end)
 
- Public Member Functions inherited from QMCUpdateBase
 QMCUpdateBase (MCWalkerConfiguration &w, TrialWaveFunction &psi, QMCHamiltonian &h, RandomBase< FullPrecRealType > &rg)
 Constructor. More...
 
 QMCUpdateBase (MCWalkerConfiguration &w, TrialWaveFunction &psi, TrialWaveFunction &guide, QMCHamiltonian &h, RandomBase< FullPrecRealType > &rg)
 Alt Constructor. More...
 
virtual ~QMCUpdateBase ()
 destructor More...
 
RealType acceptRatio () const
 
void resetRun (BranchEngineType *brancher, EstimatorManagerBase *est, TraceManager *traces, const DriftModifierBase *driftmodifer)
 reset the QMCUpdateBase parameters More...
 
void resetRun2 (BranchEngineType *brancher, EstimatorManagerBase *est, TraceManager *traces, WalkerLogCollector *wlog_collector_, const DriftModifierBase *driftmodifer)
 
RealType getTau ()
 
void setTau (RealType t)
 
RealType getSpinMass ()
 
void setSpinMass (RealType m)
 
void getLogs (std::vector< RealType > &logs)
 
void set_step (int step)
 
void startRun (int blocks, bool record)
 start a run More...
 
void stopRun ()
 stop a run More...
 
void stopRun2 ()
 
void startBlock (int steps)
 prepare to start a block More...
 
void stopBlock (bool collectall=true)
 stop a block More...
 
void setMultiplicity (WalkerIter_t it, WalkerIter_t it_end)
 set the multiplicity of the walkers to branch More...
 
void setMultiplicity (Walker_t &awalker) const
 
virtual void initWalkersForPbyP (WalkerIter_t it, WalkerIter_t it_end)
 initialize Walker buffers for PbyP update More...
 
virtual void initWalkers (WalkerIter_t it, WalkerIter_t it_end)
 initialize Walker for walker update More...
 
virtual bool put (xmlNodePtr cur)
 process options More...
 
void accumulate (WalkerIter_t it, WalkerIter_t it_end)
 
virtual void advanceWalkers (WalkerIter_t it, WalkerIter_t it_end, bool recompute)
 advance walkers executed at each step More...
 
virtual RealType advanceWalkerForEE (Walker_t &w1, std::vector< PosType > &dR, std::vector< int > &iats, std::vector< int > &rs, std::vector< RealType > &ratios)
 
int RMC_checkIndex (int N, int NMax)
 
void RMC_checkWalkerBounds (WalkerIter_t &it, WalkerIter_t first, WalkerIter_t last)
 
RealType logBackwardGF (const ParticleSet::ParticlePos &displ)
 

Additional Inherited Members

- Public Types inherited from QMCUpdateBase
using Walker_t = MCWalkerConfiguration::Walker_t
 
using WalkerIter_t = MCWalkerConfiguration::iterator
 
using BranchEngineType = SimpleFixedNodeBranch
 
using mPosType = PosType
 
using mTensorType = TensorType
 
- Public Types inherited from QMCTraits
enum  { DIM = OHMMS_DIM, DIM_VGL = OHMMS_DIM + 2 }
 
using QTBase = QMCTypes< OHMMS_PRECISION, DIM >
 
using QTFull = QMCTypes< OHMMS_PRECISION_FULL, DIM >
 
using RealType = QTBase::RealType
 
using ComplexType = QTBase::ComplexType
 
using ValueType = QTBase::ValueType
 
using PosType = QTBase::PosType
 
using GradType = QTBase::GradType
 
using TensorType = QTBase::TensorType
 
using IndexType = OHMMS_INDEXTYPE
 define other types More...
 
using FullPrecRealType = QTFull::RealType
 
using FullPrecValueType = QTFull::ValueType
 
using PropertySetType = RecordNamedProperty< FullPrecRealType >
 define PropertyList_t More...
 
using PtclGrpIndexes = std::vector< std::pair< int, int > >
 
- Public Attributes inherited from CSUpdateBase
int nPsi
 
bool useDrift
 
std::vector< RealTypelogpsi
 
std::vector< RealTypesumratio
 
std::vector< RealTypeinvsumratio
 
std::vector< RealTypeavgNorm
 
std::vector< RealTypeavgWeight
 
std::vector< RealTypelogNorm
 
std::vector< RealTypecumNorm
 
std::vector< RealTypeinstRij
 
std::vector< RealTyperatio
 
Matrix< RealTyperatioIJ
 
std::string useDriftOption
 
Matrix< RealTypeRatioIJ
 
CSEnergyEstimatormultiEstimator
 multiple estimator More...
 
std::vector< QMCHamiltonian * > H1
 a list of QMCHamiltonians for multiple method More...
 
std::vector< TrialWaveFunction * > Psi1
 a list of TrialWaveFunctions for multiple method More...
 
std::vector< ParticleSet::ParticleGradient * > G1
 
std::vector< ParticleSet::ParticleLaplacian * > L1
 
std::vector< GradTypeg1_old
 
std::vector< GradTypeg1_new
 
- Public Attributes inherited from QMCUpdateBase
int nSubSteps
 number of steps per measurement More...
 
DriverDebugChecks debug_checks_ = DriverDebugChecks::ALL_OFF
 determine additional checks for debugging purpose More...
 
std::string debug_checks_str_
 
IndexType MaxAge
 MaxAge>0 indicates branch is done. More...
 
IndexType nAccept
 counter for number of moves accepted More...
 
IndexType nReject
 counter for number of moves rejected More...
 
IndexType nAllRejected
 Total number of the steps when all the particle moves are rejected. More...
 
IndexType nNodeCrossing
 Total number of node crossings per block. More...
 
IndexType NonLocalMoveAccepted
 Total numer of non-local moves accepted. More...
 
RealType Tau
 timestep More...
 
RealType spinMass
 spin mass More...
 
bool UseDrift
 use Drift More...
 
RealType csoffset
 normalization offset for cs type runs. More...
 
TraceManagerTraces
 traces More...
 
WalkerLogCollectorwlog_collector
 
- Protected Member Functions inherited from QMCUpdateBase
RealType getNodeCorrection (const ParticleSet::ParticleGradient &g, ParticleSet::ParticlePos &gscaled)
 evaluate the ratio of scaled velocity and velocity More...
 
 QMCUpdateBase (const QMCUpdateBase &)=delete
 copy constructor (disabled) More...
 
- Static Protected Member Functions inherited from QMCUpdateBase
static void checkLogAndGL (ParticleSet &pset, TrialWaveFunction &twf, const std::string_view location)
 check logpsi and grad and lap against values computed from scratch More...
 
- Protected Attributes inherited from QMCUpdateBase
bool UpdatePbyP
 update particle-by-particle More...
 
IndexType NumPtcl
 number of particles More...
 
RealType m_oneover2tau
 Time-step factor $ 1/(2\tau)$. More...
 
RealType m_sqrttau
 Time-step factor $ \sqrt{\tau}$. More...
 
RealType m_tauovermass
 tau/mass More...
 
RealType m_r2max
 maximum displacement^2 More...
 
MCWalkerConfigurationW
 walker ensemble More...
 
TrialWaveFunctionPsi
 trial function More...
 
TrialWaveFunctionGuide
 guide function More...
 
QMCHamiltonianH
 Hamiltonian. More...
 
RandomBase< FullPrecRealType > & RandomGen
 random number generator More...
 
const BranchEngineTypebranchEngine
 branch engine, stateless reference to the one in QMCDriver More...
 
const DriftModifierBaseDriftModifier
 drift modifer, stateless reference to the one in QMCDriver More...
 
EstimatorManagerBaseEstimators
 estimator More...
 
ParameterSet myParams
 parameters More...
 
std::vector< RealTypeMassInvS
 1/Mass per species More...
 
std::vector< RealTypeMassInvP
 1/Mass per particle More...
 
std::vector< RealTypeSqrtTauOverMass
 sqrt(tau/Mass) per particle More...
 
ParticleSet::ParticlePos drift
 temporary storage for drift More...
 
ParticleSet::ParticlePos deltaR
 temporary storage for random displacement More...
 
ParticleSet::ParticleScalar deltaS
 temporart storage for spin displacement More...
 
ParticleSet::ParticleGradient G
 storage for differential gradients for PbyP update More...
 
ParticleSet::ParticleGradient dG
 
ParticleSet::ParticleLaplacian L
 storage for differential laplacians for PbyP update More...
 
ParticleSet::ParticleLaplacian dL
 

Detailed Description

Definition at line 47 of file CSVMCUpdateAll.h.

Constructor & Destructor Documentation

◆ CSVMCUpdateAllWithDrift()

CSVMCUpdateAllWithDrift ( MCWalkerConfiguration w,
std::vector< TrialWaveFunction *> &  psi,
std::vector< QMCHamiltonian *> &  h,
RandomBase< FullPrecRealType > &  rg 
)

Constructor.

Definition at line 120 of file CSVMCUpdateAll.cpp.

References QMCUpdateBase::UpdatePbyP.

124  : CSUpdateBase(w, psi, h, rg)
125 {
126  UpdatePbyP = false;
127 }
CSUpdateBase(MCWalkerConfiguration &w, std::vector< TrialWaveFunction *> &psi, std::vector< QMCHamiltonian *> &h, RandomBase< FullPrecRealType > &rg)
bool UpdatePbyP
update particle-by-particle

Member Function Documentation

◆ advanceWalker()

void advanceWalker ( Walker_t thisWalker,
bool  recompute 
)
overridevirtual

move a walker

Implements QMCUpdateBase.

Definition at line 129 of file CSVMCUpdateAll.cpp.

References Walker< t_traits, p_traits >::Age, qmcplusplus::assignDrift(), CSUpdateBase::avgNorm, CSUpdateBase::cumNorm, QMCUpdateBase::deltaR, qmcplusplus::Dot(), QMCUpdateBase::drift, qmcplusplus::exp(), ParticleSet::G, CSUpdateBase::G1, Walker< t_traits, p_traits >::getPropertyBase(), CSUpdateBase::H1, CSUpdateBase::invsumratio, ParticleSet::L, CSUpdateBase::L1, ParticleSet::loadWalker(), QMCUpdateBase::logBackwardGF(), CSUpdateBase::logpsi, qmcplusplus::makeGaussRandomWithEngine(), ParticleSet::makeMoveAllParticlesWithDrift(), QMCUpdateBase::MassInvP, QMCUpdateBase::MassInvS, Walker< t_traits, p_traits >::Multiplicity, QMCUpdateBase::nAccept, CSUpdateBase::nPsi, QMCUpdateBase::nReject, Walker< t_traits, p_traits >::Properties, CSUpdateBase::Psi1, ParticleSet::R, Walker< t_traits, p_traits >::R, Random, QMCUpdateBase::RandomGen, qmcplusplus::sqrt(), QMCUpdateBase::SqrtTauOverMass, CSUpdateBase::sumratio, QMCUpdateBase::Tau, and QMCUpdateBase::W.

130 {
131  //create a 3N-Dimensional Gaussian with variance=1
132  W.loadWalker(thisWalker, false);
135 
136  Walker_t::ParticleGradient cumGrad(W.G);
137  cumGrad = 0.0;
138 
139  RealType tau_over_mass = std::sqrt(Tau * MassInvS[0]);
140 
142  {
143  for (int ipsi = 1; ipsi < nPsi; ipsi++)
144  H1[ipsi]->rejectedMove(W, thisWalker);
145  return;
146  }
147 
148 
149  RealType logGf = -0.5 * Dot(deltaR, deltaR);
150 
151  //Evaluate Psi and graidients and laplacians
152  //\f$\sum_i \ln(|psi_i|)\f$ and catching the sign separately
153  for (int ipsi = 0; ipsi < nPsi; ipsi++)
154  {
155  logpsi[ipsi] = Psi1[ipsi]->evaluateLog(W);
156  Psi1[ipsi]->L = W.L;
157  Psi1[ipsi]->G = W.G;
158  *G1[ipsi] = W.G;
159  *L1[ipsi] = W.L;
160  sumratio[ipsi] = 1.0;
161  }
162  // Compute the sum over j of Psi^2[j]/Psi^2[i] for each i
163  for (int ipsi = 0; ipsi < nPsi - 1; ipsi++)
164  {
165  for (int jpsi = ipsi + 1; jpsi < nPsi; jpsi++)
166  {
167  RealType ratioij = avgNorm[ipsi] / avgNorm[jpsi] * std::exp(2.0 * (logpsi[jpsi] - logpsi[ipsi]));
168  sumratio[ipsi] += ratioij;
169  sumratio[jpsi] += 1.0 / ratioij;
170  }
171  }
172  for (int ipsi = 0; ipsi < nPsi; ipsi++)
173  {
174  invsumratio[ipsi] = 1.0 / sumratio[ipsi];
175  cumGrad += Psi1[ipsi]->G * static_cast<Walker_t::SingleParticleValue>(invsumratio[ipsi]);
176  }
177 
178  for (int ipsi = 0; ipsi < nPsi; ipsi++)
179  cumNorm[ipsi] += invsumratio[ipsi];
180 
181  assignDrift(Tau, MassInvP, cumGrad, drift);
182 
183  deltaR = thisWalker.R - W.R - drift;
184 
185  RealType logGb = logBackwardGF(deltaR);
186 
187  RealType g = sumratio[0] / thisWalker.Multiplicity *
188  std::exp(logGb - logGf + 2.0 * (logpsi[0] - thisWalker.Properties(WP::LOGPSI)));
189 
190  if (Random() > g)
191  {
192  thisWalker.Age++;
193  ++nReject;
194  for (int ipsi = 1; ipsi < nPsi; ipsi++)
195  H1[ipsi]->rejectedMove(W, thisWalker);
196  }
197  else
198  {
199  thisWalker.Age = 0;
200  thisWalker.Multiplicity = sumratio[0];
201  thisWalker.R = W.R;
202  thisWalker.G = cumGrad;
203  for (int ipsi = 0; ipsi < nPsi; ipsi++)
204  {
205  W.L = *L1[ipsi];
206  W.G = *G1[ipsi];
207  RealType et = H1[ipsi]->evaluate(W);
208  thisWalker.Properties(ipsi, WP::LOGPSI) = logpsi[ipsi];
209  thisWalker.Properties(ipsi, WP::SIGN) = Psi1[ipsi]->getPhase();
210  thisWalker.Properties(ipsi, WP::UMBRELLAWEIGHT) = invsumratio[ipsi];
211  thisWalker.Properties(ipsi, WP::LOCALENERGY) = et;
212  H1[ipsi]->auxHevaluate(W, thisWalker);
213  H1[ipsi]->saveProperty(thisWalker.getPropertyBase(ipsi));
214  }
215  ++nAccept;
216  }
217 }
ParticleSet::ParticlePos drift
temporary storage for drift
std::vector< RealType > sumratio
Definition: CSUpdateBase.h:40
typename p_traits::ParticleGradient ParticleGradient
array of gradients
Definition: Walker.h:68
std::vector< RealType > cumNorm
Definition: CSUpdateBase.h:45
void assignDrift(T s, const ParticleAttrib< TinyVector< TG, D >> &ga, ParticleAttrib< TinyVector< T, D >> &da)
#define Random
ParticleSet::ParticlePos deltaR
temporary storage for random displacement
ParticleLaplacian L
laplacians of the particles
Definition: ParticleSet.h:85
std::vector< TrialWaveFunction * > Psi1
a list of TrialWaveFunctions for multiple method
Definition: CSUpdateBase.h:57
T Dot(const ParticleAttrib< TinyVector< T, D >> &pa, const ParticleAttrib< TinyVector< T, D >> &pb)
std::vector< RealType > logpsi
Definition: CSUpdateBase.h:39
std::vector< RealType > invsumratio
Definition: CSUpdateBase.h:41
std::vector< RealType > SqrtTauOverMass
sqrt(tau/Mass) per particle
ParticleGradient G
gradients of the particles
Definition: ParticleSet.h:83
RealType Tau
timestep
Definition: QMCUpdateBase.h:73
RealType logBackwardGF(const ParticleSet::ParticlePos &displ)
ParticlePos R
Position.
Definition: ParticleSet.h:79
std::vector< ParticleSet::ParticleGradient * > G1
Definition: CSUpdateBase.h:59
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t exp(const Vector< T1, C1 > &l)
MCWalkerConfiguration & W
walker ensemble
std::vector< RealType > MassInvP
1/Mass per particle
void loadWalker(Walker_t &awalker, bool pbyp)
load a Walker_t to the current ParticleSet
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
QMCTraits::RealType RealType
RandomBase< FullPrecRealType > & RandomGen
random number generator
typename p_traits::SingleParticleValue SingleParticleValue
typedef for value data type.
Definition: Walker.h:72
std::vector< RealType > avgNorm
Definition: CSUpdateBase.h:42
bool makeMoveAllParticlesWithDrift(const Walker_t &awalker, const ParticlePos &drift, const ParticlePos &deltaR, RealType dt)
move all the particles including the drift
std::vector< ParticleSet::ParticleLaplacian * > L1
Definition: CSUpdateBase.h:60
IndexType nAccept
counter for number of moves accepted
Definition: QMCUpdateBase.h:63
IndexType nReject
counter for number of moves rejected
Definition: QMCUpdateBase.h:65
std::vector< RealType > MassInvS
1/Mass per species
std::vector< QMCHamiltonian * > H1
a list of QMCHamiltonians for multiple method
Definition: CSUpdateBase.h:55
void makeGaussRandomWithEngine(ParticleAttrib< TinyVector< T, D >> &a, RG &rng)

The documentation for this class was generated from the following files: