Пример #1
0
RNDiracDeterminantBase::GradType
RNDiracDeterminantBase::evalGradSource(ParticleSet& P, ParticleSet& source,
                                       int iat)
{
  APP_ABORT("What?! released node and forces?");
  return GradType();
}
Пример #2
0
 void 
 TrialWaveFunction::evaluateDeltaLog (MCWalkerConfiguration &W,  
				      vector<RealType>& logpsi_fixed,
				      vector<RealType>& logpsi_opt,  
				      GradMatrix_t&  fixedG,
				      ValueMatrix_t& fixedL)
 {
   for (int iw=0; iw<logpsi_fixed.size(); iw++) {
     logpsi_opt[iw] = RealType();
     logpsi_fixed[iw] = RealType();
   }
   fixedG = GradType();
   fixedL = RealType();

   // First, sum optimizable part, using fixedG and fixedL as temporaries
   for (int i=0,ii=RECOMPUTE_TIMER; i<Z.size(); i++,ii+=TIMER_SKIP) {
     myTimers[ii]->start();
     if (Z[i]->Optimizable) {
       Z[i]->addLog(W, logpsi_opt);
       Z[i]->gradLapl(W, fixedG, fixedL);
     }
   }
   for (int iw=0; iw<W.WalkerList.size(); iw++) 
     for (int ptcl=0; ptcl<fixedG.cols(); ptcl++) {
       W[iw]->Grad[ptcl] = fixedG(iw, ptcl);
       W[iw]->Lap[ptcl]  = fixedL(iw, ptcl);
     }
   
   // Reset them, then accumulate the fixe part
   fixedG = GradType();
   fixedL = RealType();
  
   for (int i=0,ii=NL_TIMER; i<Z.size(); i++,ii+=TIMER_SKIP) {
     if (!Z[i]->Optimizable) {
       Z[i]->addLog(W, logpsi_fixed);
       Z[i]->gradLapl(W, fixedG, fixedL);
     }
     myTimers[ii]->stop();	
   }
   
   // Add on the fixed part to the total laplacian and gradient
   for (int iw=0; iw<W.WalkerList.size(); iw++) 
     for (int ptcl=0; ptcl<fixedG.cols(); ptcl++) {
       W[iw]->Grad[ptcl] += fixedG(iw, ptcl);
       W[iw]->Lap[ptcl]  += fixedL(iw, ptcl);
     }
 }
Пример #3
0
TrialWaveFunction::GradType TrialWaveFunction::evalGradSource(ParticleSet& P
    , ParticleSet &source, int iat
    , TinyVector<ParticleSet::ParticleGradient_t, OHMMS_DIM> &grad_grad
    , TinyVector<ParticleSet::ParticleLaplacian_t,OHMMS_DIM> &lapl_grad)
{
  GradType grad_iat = GradType();
  for (int dim=0; dim<OHMMS_DIM; dim++)
    for (int i=0; i<grad_grad[0].size(); i++)
    {
      grad_grad[dim][i] = GradType();
      lapl_grad[dim][i] = 0.0;
    }
  for (int i=0; i<Z.size(); ++i)
    grad_iat += Z[i]->evalGradSource(P, source, iat,
                                     grad_grad, lapl_grad);
  return grad_iat;
}
Пример #4
0
// Evaluates the gradient w.r.t. to the source of the Laplacian
// w.r.t. to the electrons of the wave function.
TrialWaveFunction::GradType TrialWaveFunction::evalGradSource(ParticleSet& P
    , ParticleSet &source, int iat)
{
  GradType grad_iat = GradType();
  for (int i=0; i<Z.size(); ++i)
    grad_iat += Z[i]->evalGradSource(P, source, iat);
  return grad_iat;
}
Пример #5
0
RNDiracDeterminantBase::GradType
RNDiracDeterminantBase::evalGradSource
(ParticleSet& P, ParticleSet& source,int iat,
 TinyVector<ParticleSet::ParticleGradient_t, OHMMS_DIM> &grad_grad,
 TinyVector<ParticleSet::ParticleLaplacian_t,OHMMS_DIM> &lapl_grad)
{
  APP_ABORT("What?! released node and forces?");
  return GradType();
}
Пример #6
0
  void
  TrialWaveFunction::getGradient (MCWalkerConfiguration &W, int iat,
				  vector<GradType> &grad)
  {
    for (int iw=0; iw<grad.size(); iw++)
      grad[iw] = GradType();

    for(int i=0; i<Z.size(); i++) 
      Z[i]->addGradient(W, iat, grad);
  }
Пример #7
0
  void 
  PWRealOrbitalSet::evaluate(const ParticleSet& P, int iat, 
          ValueVector_t& psi, GradVector_t& dpsi, ValueVector_t& d2psi)
  {
    myBasisSet->evaluateAll(P,iat);
    MatrixOperators::product(CC,myBasisSet->Z,Temp);

    const ComplexType* restrict tptr=Temp.data();
    for(int j=0; j< OrbitalSetSize; j++, tptr+=PW_MAXINDEX) {
      psi[j]   =tptr[PW_VALUE].real();
      d2psi[j] =tptr[PW_LAP].real();
#if OHMMS_DIM==3
      dpsi[j]  =GradType(tptr[PW_GRADX].real(),tptr[PW_GRADY].real(),tptr[PW_GRADZ].real());
#elif OHMMS_DIM==2
      dpsi[j]  =GradType(tptr[PW_GRADX].real(),tptr[PW_GRADY].real());
#elif OHMMS_DIM==1
      dpsi[j]  =GradType(tptr[PW_GRADX].real());
#else
  #error "Only physical dimensions 1/2/3 are supported."
#endif
    }
  }
Пример #8
0
 void 
 PWOrbitalSet::evaluate(const ParticleSet& P, int iat, 
         ValueVector_t& psi, GradVector_t& dpsi, ValueVector_t& d2psi)
 {
   //Evaluate the orbitals and derivatives for particle iat only.
   myBasisSet->evaluateAll(P,iat);
   MatrixOperators::product(C,myBasisSet->Z,Temp);
   const ValueType* restrict tptr=Temp.data();
   for(int j=0; j< OrbitalSetSize; j++, tptr+=PW_MAXINDEX) {
     psi[j]    =tptr[PW_VALUE];
     d2psi[j]  =tptr[PW_LAP];
     dpsi[j]=GradType(tptr[PW_GRADX],tptr[PW_GRADY],tptr[PW_GRADZ]);
   }
 }
Пример #9
0
  void 
  PWRealOrbitalSet::evaluate_notranspose(const ParticleSet& P, int first, int last,
        ValueMatrix_t& logdet, GradMatrix_t& dlogdet, ValueMatrix_t& d2logdet)
  {
    for(int iat=first,i=0; iat<last; iat++,i++){
      myBasisSet->evaluateAll(P,iat);
      MatrixOperators::product(CC,myBasisSet->Z,Temp);
      const ComplexType* restrict tptr=Temp.data();
      for(int j=0; j< OrbitalSetSize; j++,tptr+=PW_MAXINDEX) 
      {
        convert(tptr[PW_VALUE],logdet(i,j));
        convert(tptr[PW_LAP],d2logdet(i,j));
#if OHMMS_DIM==3
        dlogdet(i,j) = GradType(tptr[PW_GRADX].real(),tptr[PW_GRADY].real(),tptr[PW_GRADZ].real());
#elif OHMMS_DIM==2
        dlogdet(i,j) = GradType(tptr[PW_GRADX].real(),tptr[PW_GRADY].real());
#elif OHMMS_DIM==1
        dlogdet(i,j) = GradType(tptr[PW_GRADX].real());
#else
  #error "Only physical dimensions 1/2/3 are supported."
#endif
      }
    }
  }
Пример #10
0
 void 
 PWOrbitalSet::evaluate(const ParticleSet& P, int first, int last,
       ValueMatrix_t& logdet, GradMatrix_t& dlogdet, ValueMatrix_t& d2logdet)
 {
   for(int iat=first,i=0; iat<last; iat++,i++){
     myBasisSet->evaluateAll(P,iat);
     MatrixOperators::product(C,myBasisSet->Z,Temp);
     const ValueType* restrict tptr=Temp.data();
     for(int j=0; j< OrbitalSetSize; j++,tptr+=PW_MAXINDEX) {
       logdet(j,i)= tptr[PW_VALUE];
       d2logdet(i,j)= tptr[PW_LAP];
       dlogdet(i,j)=GradType(tptr[PW_GRADX],tptr[PW_GRADY],tptr[PW_GRADZ]);
     }
   }
 }
Пример #11
0
  void
  TrialWaveFunction::ratio (vector<Walker_t*> &walkers, vector<int> &iatList,
			    vector<PosType> &rNew, vector<ValueType> &psi_ratios,
			    vector<GradType> &newG, vector<ValueType> &newL)
  {
    for (int iw=0; iw<walkers.size(); iw++) {
      psi_ratios[iw] = 1.0;
      newG[iw] = GradType();
      newL[iw] = ValueType();
    }
    for (int i=0,ii=1; i<Z.size(); i++,ii+=TIMER_SKIP) {
      myTimers[ii]->start();
      Z[i]->ratio (walkers, iatList, rNew, psi_ratios, newG, newL);
      myTimers[ii]->stop();
    } 
  }
Пример #12
0
  void
  TrialWaveFunction::ratio (MCWalkerConfiguration &W, int iat,
			    vector<ValueType> &psi_ratios,
			    vector<GradType> &newG)
  {

    for (int iw=0; iw<W.WalkerList.size(); iw++) {
      psi_ratios[iw] = 1.0;
      newG[iw] = GradType();
    }
    for (int i=0,ii=0; i<Z.size(); i++,ii+=TIMER_SKIP) {
      myTimers[ii]->start();
      Z[i]->ratio (W, iat, psi_ratios, newG);
      myTimers[ii]->stop();
    }
  }
Пример #13
0
  void   
  TrialWaveFunction::gradLapl (MCWalkerConfiguration &W, GradMatrix_t &grads,
			       ValueMatrix_t &lapl)
  {
    for (int i=0; i<grads.rows(); i++)
      for (int j=0; j<grads.cols(); j++) {
	grads(i,j) = GradType();
	lapl(i,j)  = ValueType();
      }
    for (int i=0,ii=VGL_TIMER; i<Z.size(); i++,ii+=TIMER_SKIP) {
      myTimers[ii]->start();
      Z[i]->gradLapl (W, grads, lapl);
      myTimers[ii]->stop();
    }     
    for (int iw=0; iw<W.WalkerList.size(); iw++) 
      for (int ptcl=0; ptcl<grads.cols(); ptcl++) {
	W[iw]->Grad[ptcl] = grads(iw, ptcl);
	W[iw]->Lap[ptcl]  = lapl(iw, ptcl);
      }
  }
Пример #14
0
 void 
 TrialWaveFunction::evaluateOptimizableLog (MCWalkerConfiguration &W,  
					    vector<RealType>& logpsi_opt,  
					    GradMatrix_t&  optG,
					    ValueMatrix_t& optL)
 {
   for (int iw=0; iw<W.getActiveWalkers(); iw++) 
     logpsi_opt[iw] = RealType();
   optG = GradType();
   optL = RealType();
   
   // Sum optimizable part of log Psi
   for (int i=0,ii=RECOMPUTE_TIMER; i<Z.size(); i++,ii+=TIMER_SKIP) {
     myTimers[ii]->start();
     if (Z[i]->Optimizable) {
       Z[i]->addLog(W, logpsi_opt);
       Z[i]->gradLapl(W, optG, optL);
     }
     myTimers[ii]->stop();
   }
 }