LRTwoBodyJastrow::ValueType LRTwoBodyJastrow::evaluate(ParticleSet& P, PooledData<RealType>& buf) { buf.put(Rhok.first_address(), Rhok.last_address()); buf.put(U.first_address(), U.last_address()); buf.put(d2U.first_address(), d2U.last_address()); buf.put(FirstAddressOfdU,LastAddressOfdU); return LogValue; }
void SpaceWarp::copyToBuffer(PooledData<RealType>& buf) { vector<ParticleSet*>::iterator pit(PtclRefs.begin()), pit_end(PtclRefs.end()); while(pit != pit_end) { RealType* first=&((**pit).R[0][0]); buf.put(first,first+SizeOfR); ++pit; } buf.put(one_ptcl_Jacob.begin(),one_ptcl_Jacob.end()); }
AGPDeterminant::ValueType AGPDeterminant::updateBuffer(ParticleSet& P, PooledData<RealType>& buf, bool fromscratch) { evaluateLogAndStore(P); P.G += myG; P.L += myL; if(UseBuffer) { buf.put(CurrentDet); buf.put(psiM.begin(),psiM.end()); buf.put(phiT.begin(),phiT.end()); buf.put(d2psiU.begin(),d2psiU.end()); buf.put(d2psiD.begin(),d2psiD.end()); buf.put(FirstAddressOfdVU,LastAddressOfdVU); buf.put(FirstAddressOfdVD,LastAddressOfdVD); buf.put(d2Y.begin(),d2Y.end()); buf.put(FirstAddressOfdY,LastAddressOfdY); buf.put(FirstAddressOfG,LastAddressOfG); buf.put(myL.first_address(), myL.last_address()); //buf.put(myL.begin(), myL.end()); } return CurrentDet; }
TrialWaveFunction::RealType TrialWaveFunction::evaluateLog(ParticleSet& P, PooledData<RealType>& buf) { LogValue=0.0; PhaseValue=0.0; for(int i=0; i<Z.size(); i++) { LogValue += Z[i]->evaluateLog(P,buf); PhaseValue += Z[i]->PhaseValue; } buf.put(&(P.G[0][0]), &(P.G[0][0])+TotalDim); buf.put(&(P.L[0]), &(P.L[0])+NumPtcls); return real(LogValue); }
RNDiracDeterminantBase::RealType RNDiracDeterminantBase::evaluateLog(ParticleSet& P, PooledData<RealType>& buf) { buf.put(psiM.first_address(),psiM.last_address()); buf.put(FirstAddressOfdV,LastAddressOfdV); buf.put(d2psiM.first_address(),d2psiM.last_address()); buf.put(myL.first_address(), myL.last_address()); buf.put(FirstAddressOfG,LastAddressOfG); buf.put(LogValue); buf.put(alternateLogValue); buf.put(alternatePhaseValue); return LogValue; }
OrbitalBase::RealType ThreeBodyGeminal::updateBuffer(ParticleSet& P, PooledData<RealType>& buf, bool fromscratch) { evaluateLogAndStore(P); buf.put(LogValue); buf.put(V.begin(), V.end()); buf.put(Y.begin(), Y.end()); buf.put(FirstAddressOfdY,LastAddressOfdY); buf.put(d2Y.begin(),d2Y.end()); buf.put(Uk.begin(), Uk.end()); buf.put(FirstAddressOfgU,LastAddressOfgU); buf.put(d2Uk.begin(), d2Uk.end()); return LogValue; }
OrbitalBase::RealType ThreeBodyGeminal::evaluateLog(ParticleSet& P, PooledData<RealType>& buf) { buf.put(LogValue); buf.put(V.begin(), V.end()); buf.put(Y.begin(), Y.end()); buf.put(FirstAddressOfdY,LastAddressOfdY); buf.put(d2Y.begin(),d2Y.end()); buf.put(Uk.begin(), Uk.end()); buf.put(FirstAddressOfgU,LastAddressOfgU); buf.put(d2Uk.begin(), d2Uk.end()); return LogValue; //return std::exp(LogValue); }
TrialWaveFunction::RealType TrialWaveFunction::updateBuffer(ParticleSet& P, PooledData<RealType>& buf, bool fromscratch) { P.G = 0.0; P.L = 0.0; ValueType logpsi(0.0); PhaseValue=0.0; vector<OrbitalBase*>::iterator it(Z.begin()); vector<OrbitalBase*>::iterator it_end(Z.end()); for(int ii=1; it!=it_end; ++it,ii+=TIMER_SKIP) { myTimers[ii]->start(); logpsi += (*it)->updateBuffer(P,buf,fromscratch); PhaseValue += (*it)->PhaseValue; myTimers[ii]->stop(); } LogValue=real(logpsi); buf.put(&(P.G[0][0]), &(P.G[0][0])+TotalDim); buf.put(&(P.L[0]), &(P.L[0])+NumPtcls); return LogValue; }
TrialWaveFunction::RealType TrialWaveFunction::updateBuffer(ParticleSet& P , PooledData<RealType>& buf, bool fromscratch) { //TAU_PROFILE("TrialWaveFunction::updateBuffer","(P,..)", TAU_USER); P.G = 0.0; P.L = 0.0; buf.rewind(BufferCursor); ValueType logpsi(0.0); PhaseValue=0.0; vector<OrbitalBase*>::iterator it(Z.begin()); vector<OrbitalBase*>::iterator it_end(Z.end()); for (; it!=it_end; ++it) { logpsi += (*it)->updateBuffer(P,buf,fromscratch); PhaseValue += (*it)->PhaseValue; } convert(logpsi,LogValue); //LogValue=real(logpsi); buf.put(PhaseValue); buf.put(LogValue); buf.put(&(P.G[0][0]), &(P.G[0][0])+TotalDim); buf.put(&(P.L[0]), &(P.L[0])+NumPtcls); return LogValue; }
DiracDeterminantBase::ValueType DiracDeterminantBase::evaluate(ParticleSet& P, PooledData<RealType>& buf) { buf.put(psiM.first_address(),psiM.last_address()); buf.put(FirstAddressOfdV,LastAddressOfdV); buf.put(d2psiM.first_address(),d2psiM.last_address()); buf.put(myL.first_address(), myL.last_address()); buf.put(FirstAddressOfG,LastAddressOfG); buf.put(CurrentDet); return CurrentDet; }
AGPDeterminant::ValueType AGPDeterminant::evaluateLog(ParticleSet& P, PooledData<RealType>& buf) { if(UseBuffer) { buf.put(CurrentDet); buf.put(psiM.begin(),psiM.end()); buf.put(phiT.begin(),phiT.end()); buf.put(d2psiU.begin(),d2psiU.end()); buf.put(d2psiD.begin(),d2psiD.end()); buf.put(FirstAddressOfdVU,LastAddressOfdVU); buf.put(FirstAddressOfdVD,LastAddressOfdVD); buf.put(d2Y.begin(),d2Y.end()); buf.put(FirstAddressOfdY,LastAddressOfdY); buf.put(FirstAddressOfG,LastAddressOfG); buf.put(myL.first_address(), myL.last_address()); //buf.put(myL.begin(), myL.end()); } return evaluateLogAndPhase(CurrentDet,PhaseValue); //return CurrentDet; }
DiracDeterminantBase::ValueType DiracDeterminantBase::updateBuffer(ParticleSet& P, PooledData<RealType>& buf) { myG=0.0; myL=0.0; ValueType x=evaluate(P,myG,myL); P.G += myG; P.L += myL; buf.put(psiM.first_address(),psiM.last_address()); buf.put(FirstAddressOfdV,LastAddressOfdV); buf.put(d2psiM.first_address(),d2psiM.last_address()); buf.put(myL.first_address(), myL.last_address()); buf.put(FirstAddressOfG,LastAddressOfG); buf.put(CurrentDet); return CurrentDet; }
RNDiracDeterminantBase::RealType RNDiracDeterminantBase::updateBuffer(ParticleSet& P, PooledData<RealType>& buf, bool fromscratch) { myG=0.0; myL=0.0; myG_alternate=0.0; myL_alternate=0.0; if (fromscratch) { evaluateLog(P,myG,myL); UpdateTimer.start(); } else { if (UpdateMode == ORB_PBYP_RATIO) Phi->evaluate(P, FirstIndex, LastIndex, psiM_temp,dpsiM, d2psiM); RealType cp = std::exp(logepsilon -2.0*alternateLogValue); RealType bp = 1.0/(1+cp); UpdateTimer.start(); if (NumPtcls==1) { ValueType y=psiM(0,0); GradType rv = y*dpsiM(0,0); ValueType rv2=dot(rv,rv); myG_alternate(FirstIndex) += rv; myL_alternate(FirstIndex) += y*d2psiM(0,0) - rv2; myG(FirstIndex) += bp*rv; myL(FirstIndex) += bp*(y*d2psiM(0,0) + (1-2*bp)*rv2); } else { const ValueType* restrict yptr=psiM.data(); const ValueType* restrict d2yptr=d2psiM.data(); const GradType* restrict dyptr=dpsiM.data(); for (int i=0, iat=FirstIndex; i<NumPtcls; i++, iat++) { GradType rv; ValueType lap=0.0; for (int j=0; j<NumOrbitals; j++,yptr++) { rv += *yptr * *dyptr++; lap += *yptr * *d2yptr++; } ValueType rv2=dot(rv,rv); myG_alternate(iat) += rv; myL_alternate(iat) += lap - rv2; myG(iat) += bp*rv; myL(iat) += bp*(lap + (1-2*bp)*rv2); } } } P.G += myG; P.L += myL; //copy psiM to psiM_temp psiM_temp=psiM; buf.put(psiM.first_address(),psiM.last_address()); buf.put(FirstAddressOfdV,LastAddressOfdV); buf.put(d2psiM.first_address(),d2psiM.last_address()); buf.put(myL.first_address(), myL.last_address()); buf.put(FirstAddressOfG,LastAddressOfG); buf.put(LogValue); buf.put(alternateLogValue); buf.put(alternatePhaseValue); UpdateTimer.stop(); return LogValue; }
DiracDeterminantBase::RealType DiracDeterminantBase::updateBuffer(ParticleSet& P, PooledData<RealType>& buf, bool fromscratch) { myG=0.0; myL=0.0; if(fromscratch) { LogValue=evaluateLog(P,myG,myL); UpdateTimer.start(); } else { if(UpdateMode == ORB_PBYP_RATIO) Phi->evaluate(P, FirstIndex, LastIndex, psiM_temp,dpsiM, d2psiM); UpdateTimer.start(); if(NumPtcls==1) { // ValueType y=1.0/psiM_temp(0,0); // psiM(0,0)=y; // GradType rv = y*dpsiM(0,0); // myG(FirstIndex) += rv; // myL(FirstIndex) += y*d2psiM(0,0) - dot(rv,rv); ValueType y=psiM(0,0); GradType rv = y*dpsiM(0,0); myG(FirstIndex) += rv; myL(FirstIndex) += y*d2psiM(0,0) - dot(rv,rv); } else { const ValueType* restrict yptr=psiM.data(); const ValueType* restrict d2yptr=d2psiM.data(); const GradType* restrict dyptr=dpsiM.data(); for(int i=0, iat=FirstIndex; i<NumPtcls; i++, iat++) { GradType rv; ValueType lap=0.0; for(int j=0; j<NumOrbitals; j++,yptr++) { rv += *yptr * *dyptr++; lap += *yptr * *d2yptr++; } myG(iat) += rv; myL(iat) += lap - dot(rv,rv); } } } P.G += myG; P.L += myL; //copy psiM to psiM_temp psiM_temp=psiM; buf.put(psiM.first_address(),psiM.last_address()); buf.put(FirstAddressOfdV,LastAddressOfdV); buf.put(d2psiM.first_address(),d2psiM.last_address()); buf.put(myL.first_address(), myL.last_address()); buf.put(FirstAddressOfG,LastAddressOfG); buf.put(LogValue); buf.put(PhaseValue); UpdateTimer.stop(); return LogValue; }