本文整理汇总了C++中MCWalkerConfiguration::updateBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ MCWalkerConfiguration::updateBuffer方法的具体用法?C++ MCWalkerConfiguration::updateBuffer怎么用?C++ MCWalkerConfiguration::updateBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCWalkerConfiguration
的用法示例。
在下文中一共展示了MCWalkerConfiguration::updateBuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: numPtcls
// old ones
void
RQMCEstimator
::initialize(MCWalkerConfiguration& W,
vector<QMCHamiltonian*>& h,
vector<TrialWaveFunction*>& psi,
RealType tau,vector<RealType>& Norm,
bool require_register) {
NumWalkers = W.getActiveWalkers();
//allocate UmbrellaEnergy
int numPtcls(W.getTotalNum());
RatioIJ.resize(NumWalkers,NumCopies*(NumCopies-1)/2);
MCWalkerConfiguration::iterator it(W.begin());
MCWalkerConfiguration::iterator it_end(W.end());
vector<RealType> sumratio(NumCopies), logpsi(NumCopies);
int iw(0);
int DataSetSize((*it)->DataSet.size());
while(it != it_end) {
Walker_t& thisWalker(**it);
(*it)->DataSet.rewind();
if(require_register) {
W.registerData(thisWalker,(*it)->DataSet);
} else {
W.R = thisWalker.R;
W.update();
if(DataSetSize) W.updateBuffer((*it)->DataSet);
}
//evalaute the wavefunction and hamiltonian
for(int ipsi=0; ipsi< NumCopies;ipsi++) {
psi[ipsi]->G.resize(numPtcls);
psi[ipsi]->L.resize(numPtcls);
//Need to modify the return value of OrbitalBase::registerData
if(require_register) {
logpsi[ipsi]=psi[ipsi]->registerData(W,(*it)->DataSet);
} else {
if(DataSetSize)logpsi[ipsi]=psi[ipsi]->updateBuffer(W,(*it)->DataSet);
else logpsi[ipsi]=psi[ipsi]->evaluateLog(W);
}
psi[ipsi]->G=W.G;
thisWalker.Properties(ipsi,LOGPSI)=logpsi[ipsi];
thisWalker.Properties(ipsi,LOCALENERGY)=h[ipsi]->evaluate(W);
h[ipsi]->saveProperty(thisWalker.getPropertyBase(ipsi));
sumratio[ipsi]=1.0;
}
//Check SIMONE's note
//Compute the sum over j of Psi^2[j]/Psi^2[i] for each i
int indexij(0);
RealType *rPtr=RatioIJ[iw];
for(int ipsi=0; ipsi< NumCopies-1; ipsi++) {
for(int jpsi=ipsi+1; jpsi< NumCopies; jpsi++){
RealType r= std::exp(2.0*(logpsi[jpsi]-logpsi[ipsi]));
rPtr[indexij++]=r*Norm[ipsi]/Norm[jpsi];
sumratio[ipsi] += r;
sumratio[jpsi] += 1.0/r;
}
}
//Re-use Multiplicity as the sumratio
thisWalker.Multiplicity=sumratio[0];
//DON't forget DRIFT!!!
thisWalker.Drift=0.0;
for(int ipsi=0; ipsi< NumCopies; ipsi++) {
RealType wgt=1.0/sumratio[ipsi];
thisWalker.Properties(ipsi,UMBRELLAWEIGHT)=wgt;
//thisWalker.Drift += wgt*psi[ipsi]->G;
PAOps<RealType,DIM>::axpy(wgt,psi[ipsi]->G,thisWalker.Drift);
}
thisWalker.Drift *= tau;
++it;++iw;
}
}