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

Public Types

using BasisSetType = BasisSetBase< RealType >
 define BasisSetType with RealType More...
 
using IndexVector = BasisSetType::IndexVector
 
using ValueVector = BasisSetType::ValueVector
 
using ValueMatrix = BasisSetType::ValueMatrix
 
using GradVector = BasisSetType::GradVector
 
using GradMatrix = BasisSetType::GradMatrix
 
- Public Types inherited from WaveFunctionComponent
enum  {
  ORB_PBYP_RATIO, ORB_PBYP_ALL, ORB_PBYP_PARTIAL, ORB_WALKER,
  ORB_ALLWALKER
}
 enum for a update mode More...
 
using Walker_t = ParticleSet::Walker_t
 
using WFBufferType = Walker_t::WFBuffer_t
 
using BufferType = Walker_t::Buffer_t
 
using RealMatrix_t = OrbitalSetTraits< RealType >::ValueMatrix
 
using ValueVector = OrbitalSetTraits< ValueType >::ValueVector
 
using ValueMatrix = OrbitalSetTraits< ValueType >::ValueMatrix
 
using GradMatrix = OrbitalSetTraits< ValueType >::GradMatrix
 
using HessType = OrbitalSetTraits< ValueType >::HessType
 
using HessVector = OrbitalSetTraits< ValueType >::HessVector
 
using LogValue = std::complex< QTFull::RealType >
 
using PsiValue = QTFull::ValueType
 
- 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 Member Functions

 AGPDeterminant (BasisSetType *bs=nullptr)
 constructor More...
 
 ~AGPDeterminant () override
 default destructor More...
 
std::string getClassName () const override
 return class name More...
 
void resize (int nup, int ndown)
 reset the size: with the number of particles and number of orbtials More...
 
void registerData (ParticleSet &P, WFBufferType &buf) override
 For particle-by-particle move. More...
 
LogValue updateBuffer (ParticleSet &P, WFBufferType &buf, bool fromscratch=false) override
 For particle-by-particle move. More...
 
void copyFromBuffer (ParticleSet &P, WFBufferType &buf) override
 For particle-by-particle move. More...
 
PsiValue ratio (ParticleSet &P, int iat) override
 return the ratio only for the iat-th partcle move More...
 
void ratioUp (ParticleSet &P, int iat)
 
void ratioDown (ParticleSet &P, int iat)
 
void acceptMove (ParticleSet &P, int iat, bool safe_to_delay=false) override
 move was accepted, update the real container More...
 
void restore (int iat) override
 move was rejected. More...
 
void resizeByWalkers (int nwalkers)
 
LogValue evaluateLog (const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L) override
 Calculate the log value of the Dirac determinant for particles. More...
 
std::unique_ptr< WaveFunctionComponentmakeClone (ParticleSet &tqp) const override
 make clone More...
 
void evaluateDerivatives (ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi) override
 Compute the derivatives of both the log of the wavefunction and kinetic energy with respect to optimizable parameters. More...
 
void evaluateLogAndStore (const ParticleSet &P)
 
- Public Member Functions inherited from WaveFunctionComponent
const LogValueget_log_value () const
 
 WaveFunctionComponent (const std::string &obj_name="")
 default constructor More...
 
virtual ~WaveFunctionComponent ()
 default destructor More...
 
virtual void checkSanity () const
 Validate the internal consistency of the object. More...
 
const std::string & getName () const
 return object name More...
 
PsiValue getValue () const
 assembles the full value More...
 
virtual bool isFermionic () const
 true, if this component is fermionic More...
 
virtual bool isMultiDet () const
 true, if this component is multi-determinant More...
 
virtual void checkOutVariables (const opt_variables_type &active)
 check out variational optimizable variables More...
 
virtual void registerTWFFastDerivWrapper (const ParticleSet &P, TWFFastDerivWrapper &twf) const
 Register the component with the TWFFastDerivWrapper wrapper. More...
 
virtual void mw_evaluateLog (const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, const RefVector< ParticleSet::ParticleGradient > &G_list, const RefVector< ParticleSet::ParticleLaplacian > &L_list) const
 evaluate from scratch the same type WaveFunctionComponent of multiple walkers More...
 
virtual void recompute (const ParticleSet &P)
 recompute the value of the WaveFunctionComponents which require critical accuracy. More...
 
virtual void mw_recompute (const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, const std::vector< bool > &recompute) const
 
virtual void evaluateHessian (ParticleSet &P, HessVector &grad_grad_psi_all)
 
virtual void prepareGroup (ParticleSet &P, int ig)
 Prepare internal data for updating WFC correspond to a particle group It should be called before moving particles of a given group. More...
 
virtual void mw_prepareGroup (const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int ig) const
 
virtual GradType evalGrad (ParticleSet &P, int iat)
 return the current gradient for the iat-th particle More...
 
virtual GradType evalGradWithSpin (ParticleSet &P, int iat, ComplexType &spingrad)
 return the current spin gradient for the iat-th particle Default implementation assumes that WaveFunctionComponent does not explicitly depend on Spin. More...
 
template<CoordsType CT>
void mw_evalGrad (const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, const int iat, TWFGrads< CT > &grads_now) const
 compute the current gradients for the iat-th particle of multiple walkers More...
 
virtual void mw_evalGrad (const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< GradType > &grad_now) const
 compute the current gradients for the iat-th particle of multiple walkers More...
 
virtual GradType evalGradSource (ParticleSet &P, ParticleSet &source, int iat)
 return the logarithmic gradient for the iat-th particle of the source particleset More...
 
virtual GradType evalGradSource (ParticleSet &P, ParticleSet &source, int iat, TinyVector< ParticleSet::ParticleGradient, OHMMS_DIM > &grad_grad, TinyVector< ParticleSet::ParticleLaplacian, OHMMS_DIM > &lapl_grad)
 Adds the gradient w.r.t. More...
 
virtual PsiValue ratioGrad (ParticleSet &P, int iat, GradType &grad_iat)
 evaluate the ratio of the new to old WaveFunctionComponent value and the new gradient More...
 
virtual PsiValue ratioGradWithSpin (ParticleSet &P, int iat, GradType &grad_iat, ComplexType &spingrad_iat)
 evaluate the ratio of the new to old WaveFunctionComponent value and the new spin gradient Default implementation assumes that WaveFunctionComponent does not explicitly depend on Spin. More...
 
template<CoordsType CT>
void mw_ratioGrad (const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, TWFGrads< CT > &grad_new) const
 
virtual void mw_ratioGrad (const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, std::vector< GradType > &grad_new) const
 compute the ratio of the new to old WaveFunctionComponent value and the new gradient of multiple walkers More...
 
virtual void mw_accept_rejectMove (const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, const std::vector< bool > &isAccepted, bool safe_to_delay=false) const
 moves of the iat-th particle on some walkers in a batch is accepted. More...
 
virtual void completeUpdates ()
 complete all the delayed or asynchronous operations before leaving the p-by-p move region. More...
 
virtual void mw_completeUpdates (const RefVectorWithLeader< WaveFunctionComponent > &wfc_list) const
 complete all the delayed or asynchronous operations for all the walkers in a batch before leaving the p-by-p move region. More...
 
virtual void mw_calcRatio (const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios) const
 compute the ratio of the new to old WaveFunctionComponent value of multiple walkers More...
 
virtual LogValue evaluateGL (const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L, bool fromscratch)
 compute gradients and laplacian of the TWF with respect to each particle. More...
 
virtual void mw_evaluateGL (const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, const RefVector< ParticleSet::ParticleGradient > &G_list, const RefVector< ParticleSet::ParticleLaplacian > &L_list, bool fromscratch) const
 evaluate gradients and laplacian of the same type WaveFunctionComponent of multiple walkers More...
 
virtual void createResource (ResourceCollection &collection) const
 initialize a shared resource and hand it to a collection More...
 
virtual void acquireResource (ResourceCollection &collection, const RefVectorWithLeader< WaveFunctionComponent > &wfc_list) const
 acquire a shared resource from a collection More...
 
virtual void releaseResource (ResourceCollection &collection, const RefVectorWithLeader< WaveFunctionComponent > &wfc_list) const
 return a shared resource to a collection More...
 
virtual RealType KECorrection ()
 Return the Chiesa kinetic energy correction. More...
 
virtual bool isOptimizable () const
 if true, this contains optimizable components More...
 
virtual void extractOptimizableObjectRefs (UniqueOptObjRefs &opt_obj_refs)
 extract underlying OptimizableObject references More...
 
virtual void evaluateDerivativesWF (ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi)
 Compute the derivatives of the log of the wavefunction with respect to optimizable parameters. More...
 
virtual void evaluateGradDerivatives (const ParticleSet::ParticleGradient &G_in, std::vector< ValueType > &dgradlogpsi)
 Calculates the derivatives of $ \nabla \textnormal{log} \psi_f $ with respect to the optimizable parameters, and the dot product of this is then performed with the passed-in G_in gradient vector. More...
 
virtual void finalizeOptimization ()
 
virtual void evaluateRatiosAlltoOne (ParticleSet &P, std::vector< ValueType > &ratios)
 evaluate the ratios of one virtual move with respect to all the particles More...
 
virtual void evaluateRatios (const VirtualParticleSet &VP, std::vector< ValueType > &ratios)
 evaluate ratios to evaluate the non-local PP More...
 
virtual void evaluateSpinorRatios (const VirtualParticleSet &VP, const std::pair< ValueVector, ValueVector > &spinor_multiplier, std::vector< ValueType > &ratios)
 Used by SOECPComponent for faster SOC evaluation. More...
 
virtual void mw_evaluateRatios (const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< const VirtualParticleSet > &vp_list, std::vector< std::vector< ValueType >> &ratios) const
 evaluate ratios to evaluate the non-local PP multiple walkers More...
 
virtual void evaluateDerivRatios (const VirtualParticleSet &VP, const opt_variables_type &optvars, std::vector< ValueType > &ratios, Matrix< ValueType > &dratios)
 evaluate ratios to evaluate the non-local PP More...
 
virtual void mw_evalGradWithSpin (const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< GradType > &grad_now, std::vector< ComplexType > &spingrad_now) const
 compute the current gradients and spin gradients for the iat-th particle of multiple walkers More...
 
virtual void mw_ratioGradWithSpin (const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, std::vector< GradType > &grad_new, std::vector< ComplexType > &spingrad_new) const
 compute the ratio of the new to old WaveFunctionComponent value and the new gradient/spingradient of multiple walkers More...
 

Public Attributes

BasisSetTypeGeminalBasis
 
int NumPtcls
 Total number of particles. More...
 
int Nup
 number of major spins More...
 
int Ndown
 number of minor spins More...
 
int BasisSize
 size of the basis set More...
 
int WorkingIndex
 index of the particle (or row) More...
 
ValueMatrix Lambda
 coefficient of the up/down block More...
 
ValueMatrix LambdaUP
 coefficient of the major block More...
 
Matrix< ValueTypepsiM
 psiM(j,i) $= \psi_j({\bf r}_i)$ More...
 
Matrix< ValueTypepsiM_temp
 
ValueMatrix phiT
 Transient data for gradient and laplacian evaluation. More...
 
ValueMatrix psiMinv
 temporary container for testing More...
 
GradMatrix dY
 store gradients More...
 
ValueMatrix d2Y
 store laplacians More...
 
GradMatrix dpsiU
 temporary determinant-related matrix for gradients More...
 
GradMatrix dpsiD
 
ValueMatrix d2psiU
 temporary determinant-related matrix for laplacians More...
 
ValueMatrix d2psiD
 
ValueVector phiTv
 value of single-particle orbital for particle-by-particle update More...
 
ValueVector psiU
 
Vector< ValueTypepsiD
 
GradVector dpsiUv
 
GradVector dpsiDv
 
ValueVector d2psiUv
 
ValueVector d2psiDv
 
Vector< ValueTypeworkV1
 
Vector< ValueTypeworkV2
 
ValueVector WorkSpace
 
IndexVector Pivot
 
PsiValue curRatio
 current ratio More...
 
RealType cumRatio
 cummulate ratio for particle-by-particle update More...
 
BasisSetType::ValueTypeFirstAddressOfdVU
 address of dpsiU[0][0] More...
 
BasisSetType::ValueTypeLastAddressOfdVU
 address of FirstAddressOfdVU+OHMMS_DIM*Nup*Nup More...
 
BasisSetType::ValueTypeFirstAddressOfdVD
 address of dpsiD[0][0] More...
 
BasisSetType::ValueTypeLastAddressOfdVD
 address of FirstAddressOfdVD+OHMMS_DIM*Ndown*Nup More...
 
ParticleSet::SingleParticleValueFirstAddressOfG
 address of myG[0][0] More...
 
ParticleSet::SingleParticleValueLastAddressOfG
 address of FirstAddressOfG+OHMMS_DIM*NumPtcls More...
 
BasisSetType::ValueTypeFirstAddressOfdY
 address of dY[0][0] More...
 
BasisSetType::ValueTypeLastAddressOfdY
 address of FirstAddressOfdY+NumPtcls*BasisSize More...
 
ParticleSet::ParticleGradient myG
 
ParticleSet::ParticleGradient myG_temp
 
ParticleSet::ParticleLaplacian myL
 
ParticleSet::ParticleLaplacian myL_temp
 
- Public Attributes inherited from WaveFunctionComponent
int UpdateMode
 current update mode More...
 
opt_variables_type myVars
 list of variables this WaveFunctionComponent handles More...
 
size_t Bytes_in_WFBuffer
 Bytes in WFBuffer. More...
 

Additional Inherited Members

- Protected Attributes inherited from WaveFunctionComponent
const std::string my_name_
 Name of the object It is required to be different for objects of the same derived type like multiple J1. More...
 
LogValue log_value_
 Current $\log\phi $. More...
 

Detailed Description

Definition at line 27 of file AGPDeterminant.h.

Member Typedef Documentation

◆ BasisSetType

define BasisSetType with RealType

Definition at line 31 of file AGPDeterminant.h.

◆ GradMatrix

Definition at line 36 of file AGPDeterminant.h.

◆ GradVector

Definition at line 35 of file AGPDeterminant.h.

◆ IndexVector

Definition at line 32 of file AGPDeterminant.h.

◆ ValueMatrix

Definition at line 34 of file AGPDeterminant.h.

◆ ValueVector

Definition at line 33 of file AGPDeterminant.h.

Constructor & Destructor Documentation

◆ AGPDeterminant()

AGPDeterminant ( BasisSetType bs = nullptr)

constructor

Parameters
sposthe single-particle orbital set
firstindex of the first particle

Definition at line 24 of file AGPDeterminant.cpp.

24 : GeminalBasis(bs), NumPtcls(0) {}
int NumPtcls
Total number of particles.

◆ ~AGPDeterminant()

~AGPDeterminant ( )
override

default destructor

Definition at line 25 of file AGPDeterminant.cpp.

25 {}

Member Function Documentation

◆ acceptMove()

void acceptMove ( ParticleSet P,
int  iat,
bool  safe_to_delay = false 
)
overridevirtual

move was accepted, update the real container

Implements WaveFunctionComponent.

Definition at line 337 of file AGPDeterminant.cpp.

References APP_ABORT, qmcplusplus::convertValueToLog(), copy(), AGPDeterminant::curRatio, BasisSetBase< T >::d2Phi, AGPDeterminant::d2Y, BasisSetBase< T >::dPhi, AGPDeterminant::dY, AGPDeterminant::GeminalBasis, qmcplusplus::InverseUpdateByColumn(), qmcplusplus::InverseUpdateByRow(), WaveFunctionComponent::log_value_, AGPDeterminant::myG, AGPDeterminant::myG_temp, AGPDeterminant::myL, AGPDeterminant::myL_temp, AGPDeterminant::Nup, WaveFunctionComponent::ORB_PBYP_RATIO, AGPDeterminant::psiD, AGPDeterminant::psiM, AGPDeterminant::psiM_temp, AGPDeterminant::psiU, WaveFunctionComponent::UpdateMode, AGPDeterminant::workV1, and AGPDeterminant::workV2.

338 {
340  //CurrentDet *= curRatio;
341  if (UpdateMode == ORB_PBYP_RATIO)
342  {
343  APP_ABORT("Incomplete AGPDeterminant::acceptMove Turn on useDrift ");
344  if (iat < Nup)
345  InverseUpdateByRow(psiM, psiU, workV1, workV2, iat, static_cast<ValueType>(curRatio));
346  else
347  InverseUpdateByColumn(psiM, psiD, workV1, workV2, iat - Nup, static_cast<ValueType>(curRatio));
348  psiM_temp = psiM;
349  //psiM = psiM_temp;
350  }
351  else
352  {
353  psiM = psiM_temp;
354  myG = myG_temp;
355  myL = myL_temp;
356  //std::copy(GeminalBasis->dy(0),GeminalBasis->dy(0)+BasisSize,dY[iat]);
357  //std::copy(GeminalBasis->d2y(0),GeminalBasis->d2y(0)+BasisSize,d2Y[iat]);
358  std::copy(GeminalBasis->dPhi.begin(), GeminalBasis->dPhi.end(), dY[iat]); //@@
359  std::copy(GeminalBasis->d2Phi.begin(), GeminalBasis->d2Phi.end(), d2Y[iat]); //@@
360  }
361  curRatio = 1.0;
362 }
Vector< ValueType > workV2
GradVector dPhi
dphi[i] the gradient of the i-th basis set
Definition: BasisSetBase.h:69
void InverseUpdateByRow(Matrix< T, ALLOC > &Minv, Vector< T, ALLOC > &newrow, Vector< T, ALLOC > &rvec, Vector< T, ALLOC > &rvecinv, int rowchanged, T c_ratio)
update a inverse matrix by a row substitution
ValueMatrix d2Y
store laplacians
ParticleSet::ParticleLaplacian myL
PsiValue curRatio
current ratio
ParticleSet::ParticleGradient myG
ParticleSet::ParticleGradient myG_temp
std::complex< T > convertValueToLog(const std::complex< T > &logpsi)
evaluate log(psi) as log(|psi|) and phase
void copy(const Array< T1, 3 > &src, Array< T2, 3 > &dest)
Definition: Blitz.h:639
Matrix< ValueType > psiM_temp
Vector< ValueType > psiD
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27
int Nup
number of major spins
GradMatrix dY
store gradients
Vector< ValueType > workV1
Matrix< ValueType > psiM
psiM(j,i)
ValueVector d2Phi
d2phi[i] the laplacian of the i-th basis set
Definition: BasisSetBase.h:71
ParticleSet::ParticleLaplacian myL_temp
void InverseUpdateByColumn(Matrix< T, ALLOC > &Minv, Vector< T, ALLOC > &newcol, Vector< T, ALLOC > &rvec, Vector< T, ALLOC > &rvecinv, int colchanged, T c_ratio)

◆ copyFromBuffer()

void copyFromBuffer ( ParticleSet P,
WFBufferType buf 
)
overridevirtual

For particle-by-particle move.

Copy data or attach memory from a walker buffer to the objects of this class. The log value, P.G and P.L contribution from the objects of this class are also added.

Parameters
Pparticle set
bufAnonymous storage

Implements WaveFunctionComponent.

Definition at line 200 of file AGPDeterminant.cpp.

References Matrix< T, Alloc >::begin(), AGPDeterminant::d2psiD, AGPDeterminant::d2psiU, AGPDeterminant::d2Y, Matrix< T, Alloc >::end(), Vector< T, Alloc >::first_address(), AGPDeterminant::FirstAddressOfdVD, AGPDeterminant::FirstAddressOfdVU, AGPDeterminant::FirstAddressOfdY, AGPDeterminant::FirstAddressOfG, PooledMemory< T_scalar, Alloc >::get(), Vector< T, Alloc >::last_address(), AGPDeterminant::LastAddressOfdVD, AGPDeterminant::LastAddressOfdVU, AGPDeterminant::LastAddressOfdY, AGPDeterminant::LastAddressOfG, WaveFunctionComponent::log_value_, AGPDeterminant::myL, AGPDeterminant::phiT, AGPDeterminant::psiM, and AGPDeterminant::psiM_temp.

201 {
202  //if(UseBuffer)
203  {
204  //buf.get(CurrentDet);
205  buf.get(log_value_);
206  buf.get(psiM.begin(), psiM.end());
207  buf.get(phiT.begin(), phiT.end());
208  buf.get(d2psiU.begin(), d2psiU.end());
209  buf.get(d2psiD.begin(), d2psiD.end());
212  buf.get(d2Y.begin(), d2Y.end());
215  buf.get(myL.first_address(), myL.last_address());
216  //buf.get(myL.begin(), myL.end());
217  //copy current inverse of the determinant
218  psiM_temp = psiM;
219  }
220 }
Container_t::iterator begin()
Definition: OhmmsMatrix.h:89
ValueMatrix phiT
Transient data for gradient and laplacian evaluation.
ValueMatrix d2Y
store laplacians
ParticleSet::SingleParticleValue * FirstAddressOfG
address of myG[0][0]
ParticleSet::ParticleLaplacian myL
BasisSetType::ValueType * LastAddressOfdVD
address of FirstAddressOfdVD+OHMMS_DIM*Ndown*Nup
BasisSetType::ValueType * FirstAddressOfdVD
address of dpsiD[0][0]
ValueMatrix d2psiU
temporary determinant-related matrix for laplacians
Matrix< ValueType > psiM_temp
BasisSetType::ValueType * LastAddressOfdY
address of FirstAddressOfdY+NumPtcls*BasisSize
BasisSetType::ValueType * FirstAddressOfdY
address of dY[0][0]
pointer last_address()
Definition: OhmmsVector.h:258
BasisSetType::ValueType * FirstAddressOfdVU
address of dpsiU[0][0]
ParticleSet::SingleParticleValue * LastAddressOfG
address of FirstAddressOfG+OHMMS_DIM*NumPtcls
Matrix< ValueType > psiM
psiM(j,i)
BasisSetType::ValueType * LastAddressOfdVU
address of FirstAddressOfdVU+OHMMS_DIM*Nup*Nup
Container_t::iterator end()
Definition: OhmmsMatrix.h:90
pointer first_address()
Definition: OhmmsVector.h:255

◆ evaluateDerivatives()

void evaluateDerivatives ( ParticleSet P,
const opt_variables_type optvars,
Vector< ValueType > &  dlogpsi,
Vector< ValueType > &  dhpsioverpsi 
)
inlineoverridevirtual

Compute the derivatives of both the log of the wavefunction and kinetic energy with respect to optimizable parameters.

Parameters
Pparticle set
optvarsoptimizable parameters
dlogpsiarray of derivatives of the log of the wavefunction. Add the contribution from this component.
dhpsioverpsiarray of Hamiltonian derivatives. Add the kinetic energy derivatives contribution from this component. $ -\frac{1}{2}{\partial}_\alpha \tilde L - G \cdot {\partial}_\alpha \tilde G $. $ \tilde L $ and $ \tilde G $ are from this WaveFunctionComponent. $ G $ is from TrialWaveFunction. The 1/m factor is applied in TrialWaveFunction. This is a bug when the particle set doesn't hold equal mass particles.

Implements WaveFunctionComponent.

Definition at line 96 of file AGPDeterminant.h.

100  {}

◆ evaluateLog()

AGPDeterminant::LogValue evaluateLog ( const ParticleSet P,
ParticleSet::ParticleGradient G,
ParticleSet::ParticleLaplacian L 
)
overridevirtual

Calculate the log value of the Dirac determinant for particles.

Parameters
Pinput configuration containing N particles
Ga vector containing N gradients
La vector containing N laplacians
Returns
the value of the determinant

$ (first,first+nel). $ Add the gradient and laplacian contribution of the determinant to G(radient) and L(aplacian) for local energy calculations.

Implements WaveFunctionComponent.

Definition at line 83 of file AGPDeterminant.cpp.

References AGPDeterminant::evaluateLogAndStore(), WaveFunctionComponent::log_value_, AGPDeterminant::myG, and AGPDeterminant::myL.

86 {
88  G += myG;
89  L += myL;
90  return log_value_;
91 }
ParticleSet::ParticleLaplacian myL
ParticleSet::ParticleGradient myG
void evaluateLogAndStore(const ParticleSet &P)

◆ evaluateLogAndStore()

void evaluateLogAndStore ( const ParticleSet P)

Definition at line 93 of file AGPDeterminant.cpp.

References AGPDeterminant::BasisSize, AGPDeterminant::d2psiD, AGPDeterminant::d2psiU, BasisSetBase< T >::d2Y, AGPDeterminant::d2Y, Matrix< T, Alloc >::data(), qmcplusplus::simd::dot(), qmcplusplus::dot(), AGPDeterminant::dpsiD, AGPDeterminant::dpsiU, BasisSetBase< T >::dY, AGPDeterminant::dY, BasisSetBase< T >::evaluateForWalkerMove(), AGPDeterminant::GeminalBasis, qmcplusplus::InvertWithLog(), AGPDeterminant::Lambda, AGPDeterminant::LambdaUP, WaveFunctionComponent::log_value_, AGPDeterminant::myG, AGPDeterminant::myL, AGPDeterminant::Ndown, AGPDeterminant::NumPtcls, AGPDeterminant::Nup, AGPDeterminant::phiT, AGPDeterminant::Pivot, qmcplusplus::MatrixOperators::product(), AGPDeterminant::psiM, AGPDeterminant::WorkSpace, and BasisSetBase< T >::Y.

Referenced by AGPDeterminant::evaluateLog(), and AGPDeterminant::updateBuffer().

94 {
95  //GeminalBasis->evaluate(P);
97  /* evaluate \f$ psi_{up}(iat)= \sum_{j} C_{ij} \phi_j^{u}({\bf r}_{iat}) \f$
98  * \f$ psi_{down}(iat-Nup) = \sum_{j} C_{ij} \phi_j^{d}({\bf r}_{iat})\f$
99  */
101  for (int u = 0; u < Nup; u++) //paired block
102  {
103  for (int d = 0, jat = Nup; d < Ndown; d++, jat++)
104  {
105  //psiM(d,u) = BLAS::dot(BasisSize,phiT[u],GeminalBasis->Y[jat]);//@@
106  psiM(d, u) = simd::dot(phiT[u], GeminalBasis->Y[jat], BasisSize); //@@
107  }
108  //unpaired block Ndown x unpaired
109  for (int d = Ndown, unpaired = 0; d < Nup; d++, unpaired++)
110  {
111  //psiM(d,u) = BLAS::dot(BasisSize,LambdaUP[unpaired],GeminalBasis->Y[u]);//@@
112  psiM(d, u) = simd::dot(LambdaUP[unpaired], GeminalBasis->Y[u], BasisSize); //@@
113  }
114  }
115  //CurrentDet = Invert(psiM.data(),Nup,Nup,WorkSpace.data(),Pivot.data());
116  InvertWithLog(psiM.data(), Nup, Nup, WorkSpace.data(), Pivot.data(), log_value_);
117  for (int iat = 0; iat < Nup; iat++)
118  {
119  for (int d = 0, jat = Nup; d < Ndown; d++, jat++)
120  {
121  //dpsiU(iat,d)=dot(phiT[jat],GeminalBasis->dy(iat),BasisSize);
122  //d2psiU(iat,d)=dot(phiT[jat],GeminalBasis->d2y(iat),BasisSize);
123  dpsiU(iat, d) = simd::dot(phiT[jat], GeminalBasis->dY[iat], BasisSize); //@@
124  d2psiU(iat, d) = simd::dot(phiT[jat], GeminalBasis->d2Y[iat], BasisSize); //@@
125  }
126  for (int d = Ndown, unpaired = 0; d < Nup; d++, unpaired++)
127  {
128  //dpsiU(iat,d)=dot(LambdaUP[unpaired],GeminalBasis->dy(iat),BasisSize);
129  //d2psiU(iat,d)=dot(LambdaUP[unpaired],GeminalBasis->d2y(iat),BasisSize);
130  dpsiU(iat, d) = simd::dot(LambdaUP[unpaired], GeminalBasis->dY[iat], BasisSize); //@@
131  d2psiU(iat, d) = simd::dot(LambdaUP[unpaired], GeminalBasis->d2Y[iat], BasisSize); //@@
132  }
133  GradType rv = simd::dot(psiM[iat], dpsiU[iat], Nup);
134  ValueType lap = simd::dot(psiM[iat], d2psiU[iat], Nup);
135  myG[iat] = rv;
136  myL[iat] = lap - dot(rv, rv);
137  }
138  for (int jat = Nup, d = 0; jat < NumPtcls; jat++, d++)
139  {
140  GradType rv;
141  ValueType lap = 0;
142  for (int u = 0; u < Nup; u++)
143  {
144  ValueType dfac = psiM(u, d);
145  //rv += dfac*(dpsiD(d,u)=dot(phiT[u],GeminalBasis->dy(jat),BasisSize));
146  //lap += dfac*(d2psiD(d,u)=dot(phiT[u],GeminalBasis->d2y(jat),BasisSize));
147  rv += dfac * (dpsiD(d, u) = simd::dot(phiT[u], GeminalBasis->dY[jat], BasisSize)); //@@
148  lap += dfac * (d2psiD(d, u) = simd::dot(phiT[u], GeminalBasis->d2Y[jat], BasisSize)); //@@
149  }
150  myG[jat] = rv;
151  myL[jat] = lap - dot(rv, rv);
152  }
153  dY = GeminalBasis->dY;
154  d2Y = GeminalBasis->d2Y;
155 }
ValueMatrix phiT
Transient data for gradient and laplacian evaluation.
virtual void evaluateForWalkerMove(const ParticleSet &P)=0
QTBase::GradType GradType
Definition: Configuration.h:62
T dot(const T *restrict a, const T *restrict b, int n, TRES res=TRES())
dot product
ValueMatrix d2Y
store laplacians
ParticleSet::ParticleLaplacian myL
ParticleSet::ParticleGradient myG
ValueMatrix d2psiU
temporary determinant-related matrix for laplacians
QTBase::ValueType ValueType
Definition: Configuration.h:60
void product(const Matrix< T > &A, const Matrix< T > &B, Matrix< T > &C)
static function to perform C=AB for real matrices
void InvertWithLog(T *restrict x, int n, int m, T *restrict work, int *restrict pivot, std::complex< T1 > &logdet)
ValueMatrix Lambda
coefficient of the up/down block
GradMatrix dpsiU
temporary determinant-related matrix for gradients
int Nup
number of major spins
int BasisSize
size of the basis set
GradMatrix dY
store gradients
ValueMatrix LambdaUP
coefficient of the major block
Matrix< ValueType > psiM
psiM(j,i)
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)
int Ndown
number of minor spins
int NumPtcls
Total number of particles.

◆ getClassName()

std::string getClassName ( ) const
inlineoverridevirtual

return class name

Implements WaveFunctionComponent.

Definition at line 49 of file AGPDeterminant.h.

49 { return "AGPDeterminant"; }

◆ makeClone()

std::unique_ptr< WaveFunctionComponent > makeClone ( ParticleSet tqp) const
overridevirtual

make clone

Parameters
tqptarget Quantum ParticleSet
deepcopyif true, make a decopy

If not true, return a proxy class

Reimplemented from WaveFunctionComponent.

Definition at line 397 of file AGPDeterminant.cpp.

References AGPDeterminant::GeminalBasis, AGPDeterminant::Lambda, AGPDeterminant::LambdaUP, BasisSetBase< T >::makeClone(), AGPDeterminant::Ndown, AGPDeterminant::Nup, and BasisSetBase< T >::resize().

398 {
399  auto myclone = std::make_unique<AGPDeterminant>(nullptr);
400  myclone->GeminalBasis = GeminalBasis->makeClone();
401  myclone->resize(Nup, Ndown);
402  myclone->Lambda = Lambda;
403  if (Nup != Ndown)
404  myclone->LambdaUP = LambdaUP;
405  return myclone;
406 }
virtual BasisSetBase * makeClone() const =0
clone the basis set
ValueMatrix Lambda
coefficient of the up/down block
int Nup
number of major spins
ValueMatrix LambdaUP
coefficient of the major block
int Ndown
number of minor spins
void resize(int ntargets)
resize the container
Definition: BasisSetBase.h:88

◆ ratio()

AGPDeterminant::PsiValue ratio ( ParticleSet P,
int  iat 
)
overridevirtual

return the ratio only for the iat-th partcle move

Parameters
Pcurrent configuration
iatthe particle thas is being moved

Implements WaveFunctionComponent.

Definition at line 227 of file AGPDeterminant.cpp.

References AGPDeterminant::BasisSize, AGPDeterminant::curRatio, qmcplusplus::DetRatioByColumn(), qmcplusplus::DetRatioByRow(), qmcplusplus::simd::dot(), BasisSetBase< T >::evaluateForPtclMove(), AGPDeterminant::GeminalBasis, AGPDeterminant::LambdaUP, AGPDeterminant::Ndown, AGPDeterminant::Nup, WaveFunctionComponent::ORB_PBYP_RATIO, BasisSetBase< T >::Phi, AGPDeterminant::phiT, AGPDeterminant::psiD, AGPDeterminant::psiM, AGPDeterminant::psiU, and WaveFunctionComponent::UpdateMode.

228 {
230  //GeminalBasis->evaluate(P,iat);
231  GeminalBasis->evaluateForPtclMove(P, iat); //@@
232  //To dune with gemv
233  //BLAS::gemv(Lambda.rows(),Lambda.cols(), Lambda.data(), GeminalBasis->y(0), phiT[iat]);
234  //const ValueType* restrict y_ptr=GeminalBasis->y(0);
235  const BasisSetType::ValueType* restrict y_ptr = GeminalBasis->Phi.data(); //@@
236  if (iat < Nup)
237  {
238  for (int d = 0, jat = Nup; d < Ndown; d++, jat++)
239  psiU[d] = simd::dot(y_ptr, phiT[jat], BasisSize);
240  //psiU[d]=BLAS::dot(BasisSize,y_ptr,phiT[jat]);
241  //unpaired block Ndown x unpaired
242  for (int d = Ndown, unpaired = 0; d < Nup; d++, unpaired++)
243  //psiU[d] = BLAS::dot(BasisSize,LambdaUP[unpaired],y_ptr);
244  psiU[d] = simd::dot(LambdaUP[unpaired], y_ptr, BasisSize);
245  //curRatio=DetRatio(psiM, psiU.data(),iat);
246  curRatio = DetRatioByRow(psiM, psiU, iat);
247  }
248  else
249  {
250  for (int u = 0; u < Nup; u++)
251  //psiD[u]=BLAS::dot(BasisSize,y_ptr,phiT[u]);
252  psiD[u] = simd::dot(y_ptr, phiT[u], BasisSize);
253  //curRatio=DetRatioTranspose(psiM, psiD.data(),iat-Nup);
255  }
256  return curRatio;
257 }
ValueMatrix phiT
Transient data for gradient and laplacian evaluation.
ValueVector Phi
phi[i] the value of the i-th basis set
Definition: BasisSetBase.h:67
T dot(const T *restrict a, const T *restrict b, int n, TRES res=TRES())
dot product
PsiValue curRatio
current ratio
MatA::value_type DetRatioByRow(const MatA &Minv, const VecB &newv, int rowchanged)
determinant ratio with a row substitution
typename OrbitalSetTraits< T >::ValueType ValueType
Definition: BasisSetBase.h:45
MatA::value_type DetRatioByColumn(const MatA &Minv, const VecB &newv, int colchanged)
determinant ratio with a column substitution
Vector< ValueType > psiD
int Nup
number of major spins
int BasisSize
size of the basis set
ValueMatrix LambdaUP
coefficient of the major block
Matrix< ValueType > psiM
psiM(j,i)
int Ndown
number of minor spins
virtual void evaluateForPtclMove(const ParticleSet &P, int iat)=0

◆ ratioDown()

void ratioDown ( ParticleSet P,
int  iat 
)

Definition at line 302 of file AGPDeterminant.cpp.

References AGPDeterminant::BasisSize, copy(), AGPDeterminant::curRatio, BasisSetBase< T >::d2Phi, AGPDeterminant::d2psiD, AGPDeterminant::d2psiDv, AGPDeterminant::d2psiU, AGPDeterminant::d2psiUv, AGPDeterminant::d2Y, qmcplusplus::DetRatioByColumn(), qmcplusplus::simd::dot(), BasisSetBase< T >::dPhi, AGPDeterminant::dpsiD, AGPDeterminant::dpsiDv, AGPDeterminant::dpsiU, AGPDeterminant::dpsiUv, AGPDeterminant::dY, AGPDeterminant::GeminalBasis, qmcplusplus::InverseUpdateByColumn(), AGPDeterminant::Nup, BasisSetBase< T >::Phi, AGPDeterminant::phiT, AGPDeterminant::psiD, AGPDeterminant::psiM_temp, AGPDeterminant::workV1, and AGPDeterminant::workV2.

303 {
304  //const ValueType* restrict y_ptr=GeminalBasis->y(0);
305  const BasisSetType::ValueType* restrict y_ptr = GeminalBasis->Phi.data(); //@@
306  int d = iat - Nup;
307  for (int u = 0; u < Nup; u++)
308  {
309  psiD[u] = simd::dot(y_ptr, phiT[u], BasisSize);
310  //psiD[u]=BLAS::dot(BasisSize,y_ptr,phiT[u]);
311  }
312  //curRatio = DetRatioTranspose(psiM_temp, psiD.data(),d);
314  InverseUpdateByColumn(psiM_temp, psiD, workV1, workV2, d, static_cast<ValueType>(curRatio));
315  std::copy(dpsiD[d], dpsiD[d] + Nup, dpsiDv.begin());
316  std::copy(d2psiD[d], d2psiD[d] + Nup, d2psiDv.begin());
317  //const GradType* restrict dy_ptr = GeminalBasis->dy(0);
318  //const ValueType* restrict d2y_ptr = GeminalBasis->d2y(0);
319  const BasisSetType::GradType* restrict dy_ptr = GeminalBasis->dPhi.data(); //@@
320  const BasisSetType::ValueType* restrict d2y_ptr = GeminalBasis->d2Phi.data(); //@@
321  for (int u = 0; u < Nup; u++)
322  {
323  dpsiD(d, u) = simd::dot(phiT[u], dy_ptr, BasisSize);
324  d2psiD(d, u) = simd::dot(phiT[u], d2y_ptr, BasisSize);
325  }
326  for (int kat = 0; kat < Nup; kat++)
327  {
328  dpsiUv[kat] = dpsiU(kat, d);
329  dpsiU(kat, d) = simd::dot(phiT[iat], dY[kat], BasisSize);
330  d2psiUv[kat] = d2psiU(kat, d);
331  d2psiU(kat, d) = simd::dot(phiT[iat], d2Y[kat], BasisSize);
332  }
333 }
Vector< ValueType > workV2
ValueMatrix phiT
Transient data for gradient and laplacian evaluation.
GradVector dPhi
dphi[i] the gradient of the i-th basis set
Definition: BasisSetBase.h:69
ValueVector Phi
phi[i] the value of the i-th basis set
Definition: BasisSetBase.h:67
T dot(const T *restrict a, const T *restrict b, int n, TRES res=TRES())
dot product
ValueMatrix d2Y
store laplacians
PsiValue curRatio
current ratio
void copy(const Array< T1, 3 > &src, Array< T2, 3 > &dest)
Definition: Blitz.h:639
ValueMatrix d2psiU
temporary determinant-related matrix for laplacians
Matrix< ValueType > psiM_temp
typename OrbitalSetTraits< T >::ValueType ValueType
Definition: BasisSetBase.h:45
MatA::value_type DetRatioByColumn(const MatA &Minv, const VecB &newv, int colchanged)
determinant ratio with a column substitution
Vector< ValueType > psiD
GradMatrix dpsiU
temporary determinant-related matrix for gradients
int Nup
number of major spins
int BasisSize
size of the basis set
GradMatrix dY
store gradients
Vector< ValueType > workV1
TinyVector< ValueType, DIM > GradType
ValueVector d2Phi
d2phi[i] the laplacian of the i-th basis set
Definition: BasisSetBase.h:71
void InverseUpdateByColumn(Matrix< T, ALLOC > &Minv, Vector< T, ALLOC > &newcol, Vector< T, ALLOC > &rvec, Vector< T, ALLOC > &rvecinv, int colchanged, T c_ratio)

◆ ratioUp()

void ratioUp ( ParticleSet P,
int  iat 
)

Definition at line 259 of file AGPDeterminant.cpp.

References AGPDeterminant::BasisSize, copy(), AGPDeterminant::curRatio, BasisSetBase< T >::d2Phi, AGPDeterminant::d2psiD, AGPDeterminant::d2psiDv, AGPDeterminant::d2psiU, AGPDeterminant::d2psiUv, AGPDeterminant::d2Y, qmcplusplus::DetRatioByRow(), qmcplusplus::simd::dot(), BasisSetBase< T >::dPhi, AGPDeterminant::dpsiD, AGPDeterminant::dpsiDv, AGPDeterminant::dpsiU, AGPDeterminant::dpsiUv, AGPDeterminant::dY, AGPDeterminant::GeminalBasis, qmcplusplus::InverseUpdateByRow(), AGPDeterminant::LambdaUP, AGPDeterminant::Ndown, AGPDeterminant::NumPtcls, AGPDeterminant::Nup, BasisSetBase< T >::Phi, AGPDeterminant::phiT, AGPDeterminant::psiM_temp, AGPDeterminant::psiU, AGPDeterminant::workV1, and AGPDeterminant::workV2.

260 {
261  //const ValueType* restrict y_ptr=GeminalBasis->y(0);
262  const BasisSetType::ValueType* restrict y_ptr = GeminalBasis->Phi.data(); //@@
263  for (int d = 0, jat = Nup; d < Ndown; d++, jat++)
264  {
265  psiU[d] = simd::dot(y_ptr, phiT[jat], BasisSize);
266  //psiU[d]=BLAS::dot(BasisSize,y_ptr,phiT[jat]);
267  }
268  //unpaired block Ndown x unpaired
269  for (int d = Ndown, unpaired = 0; d < Nup; d++, unpaired++)
270  {
271  psiU[d] = simd::dot(LambdaUP[unpaired], y_ptr, BasisSize);
272  //psiU[d] = BLAS::dot(BasisSize,LambdaUP[unpaired],y_ptr);
273  }
274  //curRatio = DetRatio(psiM_temp, psiU.data(),iat);
276  InverseUpdateByRow(psiM_temp, psiU, workV1, workV2, iat, static_cast<ValueType>(curRatio));
277  std::copy(dpsiU[iat], dpsiU[iat] + Nup, dpsiUv.begin());
278  std::copy(d2psiU[iat], d2psiU[iat] + Nup, d2psiUv.begin());
279  //const GradType* restrict dy_ptr = GeminalBasis->dy(0);
280  //const ValueType* restrict d2y_ptr = GeminalBasis->d2y(0);
281  const BasisSetType::GradType* restrict dy_ptr = GeminalBasis->dPhi.data(); //@@
282  const BasisSetType::ValueType* restrict d2y_ptr = GeminalBasis->d2Phi.data(); //@@
283  for (int d = 0, jat = Nup; d < Ndown; d++, jat++)
284  {
285  dpsiU(iat, d) = simd::dot(phiT[jat], dy_ptr, BasisSize);
286  d2psiU(iat, d) = simd::dot(phiT[jat], d2y_ptr, BasisSize);
287  }
288  for (int d = Ndown, unpaired = 0; d < Nup; d++, unpaired++)
289  {
290  dpsiU(iat, d) = simd::dot(LambdaUP[unpaired], dy_ptr, BasisSize);
291  d2psiU(iat, d) = simd::dot(LambdaUP[unpaired], d2y_ptr, BasisSize);
292  }
293  for (int jat = Nup, d = 0; jat < NumPtcls; jat++, d++)
294  {
295  dpsiDv[d] = dpsiD(d, iat);
296  dpsiD(d, iat) = simd::dot(phiT[iat], dY[jat], BasisSize);
297  d2psiDv[d] = d2psiD(d, iat);
298  d2psiD(d, iat) = simd::dot(phiT[iat], d2Y[jat], BasisSize);
299  }
300 }
Vector< ValueType > workV2
ValueMatrix phiT
Transient data for gradient and laplacian evaluation.
GradVector dPhi
dphi[i] the gradient of the i-th basis set
Definition: BasisSetBase.h:69
ValueVector Phi
phi[i] the value of the i-th basis set
Definition: BasisSetBase.h:67
T dot(const T *restrict a, const T *restrict b, int n, TRES res=TRES())
dot product
void InverseUpdateByRow(Matrix< T, ALLOC > &Minv, Vector< T, ALLOC > &newrow, Vector< T, ALLOC > &rvec, Vector< T, ALLOC > &rvecinv, int rowchanged, T c_ratio)
update a inverse matrix by a row substitution
ValueMatrix d2Y
store laplacians
PsiValue curRatio
current ratio
MatA::value_type DetRatioByRow(const MatA &Minv, const VecB &newv, int rowchanged)
determinant ratio with a row substitution
void copy(const Array< T1, 3 > &src, Array< T2, 3 > &dest)
Definition: Blitz.h:639
ValueMatrix d2psiU
temporary determinant-related matrix for laplacians
Matrix< ValueType > psiM_temp
typename OrbitalSetTraits< T >::ValueType ValueType
Definition: BasisSetBase.h:45
GradMatrix dpsiU
temporary determinant-related matrix for gradients
int Nup
number of major spins
int BasisSize
size of the basis set
GradMatrix dY
store gradients
Vector< ValueType > workV1
ValueMatrix LambdaUP
coefficient of the major block
TinyVector< ValueType, DIM > GradType
int Ndown
number of minor spins
ValueVector d2Phi
d2phi[i] the laplacian of the i-th basis set
Definition: BasisSetBase.h:71
int NumPtcls
Total number of particles.

◆ registerData()

void registerData ( ParticleSet P,
WFBufferType buf 
)
overridevirtual

For particle-by-particle move.

Requests space in the buffer based on the data type sizes of the objects in this class.

Parameters
Pparticle set
bufAnonymous storage

Implements WaveFunctionComponent.

Definition at line 157 of file AGPDeterminant.cpp.

References PooledMemory< T_scalar, Alloc >::add(), Matrix< T, Alloc >::begin(), AGPDeterminant::d2psiD, AGPDeterminant::d2psiU, AGPDeterminant::d2Y, Matrix< T, Alloc >::end(), Vector< T, Alloc >::first_address(), AGPDeterminant::FirstAddressOfdVD, AGPDeterminant::FirstAddressOfdVU, AGPDeterminant::FirstAddressOfdY, AGPDeterminant::FirstAddressOfG, Vector< T, Alloc >::last_address(), AGPDeterminant::LastAddressOfdVD, AGPDeterminant::LastAddressOfdVU, AGPDeterminant::LastAddressOfdY, AGPDeterminant::LastAddressOfG, WaveFunctionComponent::log_value_, AGPDeterminant::myL, AGPDeterminant::phiT, and AGPDeterminant::psiM.

158 {
159  //add the data: determinant, inverse, gradient and laplacians
160  //buf.add(CurrentDet);
161  buf.add(log_value_);
162  buf.add(psiM.begin(), psiM.end());
163  buf.add(phiT.begin(), phiT.end());
164  buf.add(d2psiU.begin(), d2psiU.end());
165  buf.add(d2psiD.begin(), d2psiD.end());
168  buf.add(d2Y.begin(), d2Y.end());
171  buf.add(myL.first_address(), myL.last_address());
172  //buf.add(myL.begin(), myL.end());
173 }
Container_t::iterator begin()
Definition: OhmmsMatrix.h:89
ValueMatrix phiT
Transient data for gradient and laplacian evaluation.
ValueMatrix d2Y
store laplacians
ParticleSet::SingleParticleValue * FirstAddressOfG
address of myG[0][0]
ParticleSet::ParticleLaplacian myL
BasisSetType::ValueType * LastAddressOfdVD
address of FirstAddressOfdVD+OHMMS_DIM*Ndown*Nup
BasisSetType::ValueType * FirstAddressOfdVD
address of dpsiD[0][0]
ValueMatrix d2psiU
temporary determinant-related matrix for laplacians
BasisSetType::ValueType * LastAddressOfdY
address of FirstAddressOfdY+NumPtcls*BasisSize
BasisSetType::ValueType * FirstAddressOfdY
address of dY[0][0]
pointer last_address()
Definition: OhmmsVector.h:258
BasisSetType::ValueType * FirstAddressOfdVU
address of dpsiU[0][0]
ParticleSet::SingleParticleValue * LastAddressOfG
address of FirstAddressOfG+OHMMS_DIM*NumPtcls
Matrix< ValueType > psiM
psiM(j,i)
BasisSetType::ValueType * LastAddressOfdVU
address of FirstAddressOfdVU+OHMMS_DIM*Nup*Nup
Container_t::iterator end()
Definition: OhmmsMatrix.h:90
pointer first_address()
Definition: OhmmsVector.h:255

◆ resize()

void resize ( int  nup,
int  ndown 
)

reset the size: with the number of particles and number of orbtials

Definition at line 27 of file AGPDeterminant.cpp.

References qmcplusplus::app_log(), AGPDeterminant::BasisSize, AGPDeterminant::d2psiD, AGPDeterminant::d2psiDv, AGPDeterminant::d2psiU, AGPDeterminant::d2psiUv, AGPDeterminant::d2Y, QMCTraits::DIM, AGPDeterminant::dpsiD, AGPDeterminant::dpsiDv, AGPDeterminant::dpsiU, AGPDeterminant::dpsiUv, AGPDeterminant::dY, AGPDeterminant::FirstAddressOfdVD, AGPDeterminant::FirstAddressOfdVU, AGPDeterminant::FirstAddressOfdY, AGPDeterminant::FirstAddressOfG, AGPDeterminant::GeminalBasis, BasisSetBase< T >::getBasisSetSize(), AGPDeterminant::Lambda, AGPDeterminant::LambdaUP, AGPDeterminant::LastAddressOfdVD, AGPDeterminant::LastAddressOfdVU, AGPDeterminant::LastAddressOfdY, AGPDeterminant::LastAddressOfG, AGPDeterminant::myG, AGPDeterminant::myG_temp, AGPDeterminant::myL, AGPDeterminant::myL_temp, AGPDeterminant::Ndown, AGPDeterminant::NumPtcls, AGPDeterminant::Nup, AGPDeterminant::phiT, AGPDeterminant::phiTv, AGPDeterminant::Pivot, AGPDeterminant::psiD, AGPDeterminant::psiM, AGPDeterminant::psiM_temp, AGPDeterminant::psiU, Matrix< T, Alloc >::resize(), Vector< T, Alloc >::resize(), and AGPDeterminant::WorkSpace.

28 {
29  BasisSize = GeminalBasis->getBasisSetSize(); //BasisSize=GeminalBasis->size();
30  app_log() << " AGPDetermiant::resize checking size nup, ndown, basis " << nup << " " << ndown << " " << BasisSize
31  << std::endl;
32  if (NumPtcls == 0) //use Numptcls to ensure resizing only once
33  {
34  Lambda.resize(BasisSize, BasisSize);
35  if (nup > ndown)
36  LambdaUP.resize(nup - ndown, BasisSize);
37  Nup = nup;
38  Ndown = ndown;
39  NumPtcls = nup + ndown;
40  psiM.resize(nup, nup);
41  psiM_temp.resize(nup, nup);
42  psiU.resize(nup);
43  psiD.resize(ndown);
44  phiT.resize(NumPtcls, BasisSize);
45  phiTv.resize(BasisSize);
46  WorkSpace.resize(nup);
47  Pivot.resize(nup);
48  dY.resize(NumPtcls, BasisSize);
49  d2Y.resize(NumPtcls, BasisSize);
50  dpsiU.resize(Nup, Nup);
51  dpsiD.resize(Ndown, Nup);
52  d2psiU.resize(Nup, Nup);
53  d2psiD.resize(Ndown, Nup);
54  dpsiUv.resize(Nup);
55  d2psiUv.resize(Nup);
56  dpsiDv.resize(Nup);
57  d2psiDv.resize(Nup);
58  FirstAddressOfdVU = &(dpsiU(0, 0)[0]);
60  FirstAddressOfdVD = &(dpsiD(0, 0)[0]);
62  FirstAddressOfdY = &(dY(0, 0)[0]);
68  FirstAddressOfG = &myG[0][0];
70  }
71 }
void resize(size_type n, Type_t val=Type_t())
Resize the container.
Definition: OhmmsVector.h:166
ValueMatrix phiT
Transient data for gradient and laplacian evaluation.
ValueVector phiTv
value of single-particle orbital for particle-by-particle update
ValueMatrix d2Y
store laplacians
ParticleSet::SingleParticleValue * FirstAddressOfG
address of myG[0][0]
std::ostream & app_log()
Definition: OutputManager.h:65
ParticleSet::ParticleLaplacian myL
BasisSetType::ValueType * LastAddressOfdVD
address of FirstAddressOfdVD+OHMMS_DIM*Ndown*Nup
ParticleSet::ParticleGradient myG
ParticleSet::ParticleGradient myG_temp
void resize(size_type n, size_type m)
Resize the container.
Definition: OhmmsMatrix.h:99
BasisSetType::ValueType * FirstAddressOfdVD
address of dpsiD[0][0]
ValueMatrix d2psiU
temporary determinant-related matrix for laplacians
Matrix< ValueType > psiM_temp
BasisSetType::ValueType * LastAddressOfdY
address of FirstAddressOfdY+NumPtcls*BasisSize
BasisSetType::ValueType * FirstAddressOfdY
address of dY[0][0]
ValueMatrix Lambda
coefficient of the up/down block
Vector< ValueType > psiD
BasisSetType::ValueType * FirstAddressOfdVU
address of dpsiU[0][0]
GradMatrix dpsiU
temporary determinant-related matrix for gradients
int Nup
number of major spins
int BasisSize
size of the basis set
GradMatrix dY
store gradients
IndexType getBasisSetSize() const
return the basis set size
Definition: BasisSetBase.h:111
ParticleSet::SingleParticleValue * LastAddressOfG
address of FirstAddressOfG+OHMMS_DIM*NumPtcls
ValueMatrix LambdaUP
coefficient of the major block
Matrix< ValueType > psiM
psiM(j,i)
int Ndown
number of minor spins
int NumPtcls
Total number of particles.
BasisSetType::ValueType * LastAddressOfdVU
address of FirstAddressOfdVU+OHMMS_DIM*Nup*Nup
ParticleSet::ParticleLaplacian myL_temp

◆ resizeByWalkers()

void resizeByWalkers ( int  nwalkers)

◆ restore()

void restore ( int  iat)
overridevirtual

move was rejected.

copy the real container to the temporary to move on

Implements WaveFunctionComponent.

Definition at line 366 of file AGPDeterminant.cpp.

References copy(), AGPDeterminant::curRatio, AGPDeterminant::d2psiD, AGPDeterminant::d2psiDv, AGPDeterminant::d2psiU, AGPDeterminant::d2psiUv, AGPDeterminant::dpsiD, AGPDeterminant::dpsiDv, AGPDeterminant::dpsiU, AGPDeterminant::dpsiUv, AGPDeterminant::Ndown, AGPDeterminant::Nup, WaveFunctionComponent::ORB_PBYP_RATIO, AGPDeterminant::phiT, AGPDeterminant::phiTv, AGPDeterminant::psiM, AGPDeterminant::psiM_temp, and WaveFunctionComponent::UpdateMode.

367 {
368  if (UpdateMode != ORB_PBYP_RATIO)
369  {
370  std::copy(phiTv.begin(), phiTv.end(), phiT[iat]);
371  psiM_temp = psiM;
372  if (iat < Nup)
373  {
374  std::copy(dpsiUv.begin(), dpsiUv.end(), dpsiU[iat]);
375  std::copy(d2psiUv.begin(), d2psiUv.end(), d2psiU[iat]);
376  for (int d = 0; d < Ndown; d++)
377  {
378  dpsiD(d, iat) = dpsiDv[d];
379  d2psiD(d, iat) = d2psiDv[d];
380  }
381  }
382  else
383  {
384  int d = iat - Nup;
385  std::copy(dpsiDv.begin(), dpsiDv.end(), dpsiD[d]);
386  std::copy(d2psiDv.begin(), d2psiDv.end(), d2psiD[d]);
387  for (int kat = 0; kat < Nup; kat++)
388  {
389  dpsiU(kat, d) = dpsiUv[kat];
390  d2psiU(kat, d) = d2psiUv[kat];
391  }
392  }
393  }
394  curRatio = 1.0;
395 }
ValueMatrix phiT
Transient data for gradient and laplacian evaluation.
ValueVector phiTv
value of single-particle orbital for particle-by-particle update
PsiValue curRatio
current ratio
void copy(const Array< T1, 3 > &src, Array< T2, 3 > &dest)
Definition: Blitz.h:639
ValueMatrix d2psiU
temporary determinant-related matrix for laplacians
Matrix< ValueType > psiM_temp
GradMatrix dpsiU
temporary determinant-related matrix for gradients
int Nup
number of major spins
Matrix< ValueType > psiM
psiM(j,i)
int Ndown
number of minor spins

◆ updateBuffer()

AGPDeterminant::LogValue updateBuffer ( ParticleSet P,
WFBufferType buf,
bool  fromscratch = false 
)
overridevirtual

For particle-by-particle move.

Put the objects of this class in the walker buffer or forward the memory cursor.

Parameters
Pparticle set
bufAnonymous storage
fromscratchrequest recomputing the precision critical pieces of wavefunction from scratch
Returns
log value of the wavefunction.

Implements WaveFunctionComponent.

Definition at line 175 of file AGPDeterminant.cpp.

References Matrix< T, Alloc >::begin(), AGPDeterminant::d2psiD, AGPDeterminant::d2psiU, AGPDeterminant::d2Y, Matrix< T, Alloc >::end(), AGPDeterminant::evaluateLogAndStore(), Vector< T, Alloc >::first_address(), AGPDeterminant::FirstAddressOfdVD, AGPDeterminant::FirstAddressOfdVU, AGPDeterminant::FirstAddressOfdY, AGPDeterminant::FirstAddressOfG, ParticleSet::G, ParticleSet::L, Vector< T, Alloc >::last_address(), AGPDeterminant::LastAddressOfdVD, AGPDeterminant::LastAddressOfdVU, AGPDeterminant::LastAddressOfdY, AGPDeterminant::LastAddressOfG, WaveFunctionComponent::log_value_, AGPDeterminant::myG, AGPDeterminant::myL, AGPDeterminant::phiT, AGPDeterminant::psiM, and PooledMemory< T_scalar, Alloc >::put().

176 {
178  P.G += myG;
179  P.L += myL;
180  //if(UseBuffer)
181  {
182  //buf.put(CurrentDet);
183  buf.put(log_value_);
184  buf.put(psiM.begin(), psiM.end());
185  buf.put(phiT.begin(), phiT.end());
186  buf.put(d2psiU.begin(), d2psiU.end());
187  buf.put(d2psiD.begin(), d2psiD.end());
190  buf.put(d2Y.begin(), d2Y.end());
193  buf.put(myL.first_address(), myL.last_address());
194  //buf.put(myL.begin(), myL.end());
195  }
196  return log_value_;
197  //return CurrentDet;
198 }
Container_t::iterator begin()
Definition: OhmmsMatrix.h:89
ValueMatrix phiT
Transient data for gradient and laplacian evaluation.
ValueMatrix d2Y
store laplacians
ParticleSet::SingleParticleValue * FirstAddressOfG
address of myG[0][0]
ParticleSet::ParticleLaplacian myL
BasisSetType::ValueType * LastAddressOfdVD
address of FirstAddressOfdVD+OHMMS_DIM*Ndown*Nup
ParticleSet::ParticleGradient myG
bool put(std::istream &is) override
Specialized to read the unit.
BasisSetType::ValueType * FirstAddressOfdVD
address of dpsiD[0][0]
ValueMatrix d2psiU
temporary determinant-related matrix for laplacians
BasisSetType::ValueType * LastAddressOfdY
address of FirstAddressOfdY+NumPtcls*BasisSize
BasisSetType::ValueType * FirstAddressOfdY
address of dY[0][0]
pointer last_address()
Definition: OhmmsVector.h:258
BasisSetType::ValueType * FirstAddressOfdVU
address of dpsiU[0][0]
ParticleSet::SingleParticleValue * LastAddressOfG
address of FirstAddressOfG+OHMMS_DIM*NumPtcls
Matrix< ValueType > psiM
psiM(j,i)
void evaluateLogAndStore(const ParticleSet &P)
BasisSetType::ValueType * LastAddressOfdVU
address of FirstAddressOfdVU+OHMMS_DIM*Nup*Nup
Container_t::iterator end()
Definition: OhmmsMatrix.h:90
pointer first_address()
Definition: OhmmsVector.h:255

Member Data Documentation

◆ BasisSize

◆ cumRatio

RealType cumRatio

cummulate ratio for particle-by-particle update

Definition at line 162 of file AGPDeterminant.h.

◆ curRatio

◆ d2psiD

◆ d2psiDv

◆ d2psiU

◆ d2psiUv

◆ d2Y

◆ dpsiD

◆ dpsiDv

◆ dpsiU

GradMatrix dpsiU

temporary determinant-related matrix for gradients

Definition at line 141 of file AGPDeterminant.h.

Referenced by AGPDeterminant::evaluateLogAndStore(), AGPDeterminant::ratioDown(), AGPDeterminant::ratioUp(), AGPDeterminant::resize(), and AGPDeterminant::restore().

◆ dpsiUv

◆ dY

◆ FirstAddressOfdVD

◆ FirstAddressOfdVU

◆ FirstAddressOfdY

◆ FirstAddressOfG

◆ GeminalBasis

◆ Lambda

ValueMatrix Lambda

coefficient of the up/down block

Definition at line 118 of file AGPDeterminant.h.

Referenced by AGPDeterminant::evaluateLogAndStore(), AGPDeterminant::makeClone(), and AGPDeterminant::resize().

◆ LambdaUP

◆ LastAddressOfdVD

BasisSetType::ValueType* LastAddressOfdVD

address of FirstAddressOfdVD+OHMMS_DIM*Ndown*Nup

Definition at line 170 of file AGPDeterminant.h.

Referenced by AGPDeterminant::copyFromBuffer(), AGPDeterminant::registerData(), AGPDeterminant::resize(), and AGPDeterminant::updateBuffer().

◆ LastAddressOfdVU

BasisSetType::ValueType* LastAddressOfdVU

address of FirstAddressOfdVU+OHMMS_DIM*Nup*Nup

Definition at line 166 of file AGPDeterminant.h.

Referenced by AGPDeterminant::copyFromBuffer(), AGPDeterminant::registerData(), AGPDeterminant::resize(), and AGPDeterminant::updateBuffer().

◆ LastAddressOfdY

BasisSetType::ValueType* LastAddressOfdY

address of FirstAddressOfdY+NumPtcls*BasisSize

Definition at line 178 of file AGPDeterminant.h.

Referenced by AGPDeterminant::copyFromBuffer(), AGPDeterminant::registerData(), AGPDeterminant::resize(), and AGPDeterminant::updateBuffer().

◆ LastAddressOfG

address of FirstAddressOfG+OHMMS_DIM*NumPtcls

Definition at line 174 of file AGPDeterminant.h.

Referenced by AGPDeterminant::copyFromBuffer(), AGPDeterminant::registerData(), AGPDeterminant::resize(), and AGPDeterminant::updateBuffer().

◆ myG

◆ myG_temp

◆ myL

◆ myL_temp

◆ Ndown

◆ NumPtcls

int NumPtcls

Total number of particles.

Definition at line 103 of file AGPDeterminant.h.

Referenced by AGPDeterminant::evaluateLogAndStore(), AGPDeterminant::ratioUp(), and AGPDeterminant::resize().

◆ Nup

◆ phiT

◆ phiTv

ValueVector phiTv

value of single-particle orbital for particle-by-particle update

temporary vector for a particle-by-particle move

phiTv = Lambda Y(iat)

Definition at line 150 of file AGPDeterminant.h.

Referenced by AGPDeterminant::resize(), and AGPDeterminant::restore().

◆ Pivot

◆ psiD

◆ psiM

◆ psiM_temp

◆ psiMinv

ValueMatrix psiMinv

temporary container for testing

Definition at line 135 of file AGPDeterminant.h.

◆ psiU

◆ WorkingIndex

int WorkingIndex

index of the particle (or row)

Definition at line 112 of file AGPDeterminant.h.

◆ WorkSpace

ValueVector WorkSpace

◆ workV1

◆ workV2


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