void TrialWaveFunction::evaluateDeltaLog(ParticleSet& P , RealType& logpsi_fixed_r, RealType& logpsi_opt_r , ParticleSet::ParticleGradient_t& fixedG , ParticleSet::ParticleLaplacian_t& fixedL , PooledData<RealType>& buf) { //TAU_PROFILE("TrialWaveFunction::evaluateDeltaLog","ParticleSet& P", TAU_USER); P.G = 0.0; P.L = 0.0; fixedG = 0.0; fixedL = 0.0; ValueType logpsi_fixed(0.0); ValueType logpsi_opt(0.0); buf.rewind(); vector<OrbitalBase*>::iterator it(Z.begin()); vector<OrbitalBase*>::iterator it_end(Z.end()); for (; it!=it_end; ++it) { if ((*it)->Optimizable) logpsi_opt += (*it)->evaluateLog(P, P.G, P.L,buf,true); else logpsi_fixed += (*it)->evaluateLog(P, fixedG, fixedL,buf,true); } P.G += fixedG; P.L += fixedL; convert(logpsi_fixed,logpsi_fixed_r); convert(logpsi_opt,logpsi_opt_r); //logpsi_fixed_r = real(logpsi_fixed); //logpsi_opt_r = real(logpsi_opt); }
TrialWaveFunction::RealType TrialWaveFunction::evaluateDeltaLog(ParticleSet& P, PooledData<RealType>& buf) { P.G = 0.0; P.L = 0.0; ValueType logpsi(0.0); PhaseValue=0.0; buf.rewind(); vector<OrbitalBase*>::iterator it(Z.begin()); vector<OrbitalBase*>::iterator it_end(Z.end()); for (; it!=it_end; ++it) { // mmorales: I don't remember if I did this, but eliminating the "if ((*it)->Optimizable)" // forces everything to be evaluated. This was probably done because for optm with the // nonlocal component in the cost function, the slater determinant might not be optimizable // but this must be called anyway to load the inverse. CHECK CHECK CHECK, FIX FIX FIX if ((*it)->Optimizable) { logpsi += (*it)->evaluateLog(P, P.G, P.L,buf,false); PhaseValue += (*it)->PhaseValue; } else // ValueType x = (*it)->evaluateLog(P, P.G, P.L,buf,false); (*it)->copyFromDerivativeBuffer(P,buf);//keep buffer synched } convert(logpsi,LogValue); return LogValue; //return LogValue=real(logpsi); }
void TrialWaveFunction::copyFromBuffer(ParticleSet& P, PooledData<RealType>& buf) { buf.rewind(BufferCursor); //TAU_PROFILE("TrialWaveFunction::copyFromBuffer","(P,..)", TAU_USER); for (int i=0; i<Z.size(); i++) Z[i]->copyFromBuffer(P,buf); //get the gradients and laplacians from the buffer buf.get(PhaseValue); buf.get(LogValue); buf.get(&(P.G[0][0]), &(P.G[0][0])+TotalDim); buf.get(&(P.L[0]), &(P.L[0])+NumPtcls); }
TrialWaveFunction::RealType TrialWaveFunction::evaluateLog(ParticleSet& P, PooledData<RealType>& buf) { buf.rewind(BufferCursor); 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(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; }
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; }