QMCPACK
AGPDeterminant.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
8 // Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
9 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
10 //
11 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
12 //////////////////////////////////////////////////////////////////////////////////////
13 
14 
15 /** @file AGPDeterminant.h
16  * @brief Declaration of AGPDeterminant for pairing orbitals.
17  */
18 #ifndef QMCPLUSPLUS_AGP_DIRACDETERMINANT_H
19 #define QMCPLUSPLUS_AGP_DIRACDETERMINANT_H
21 #include "OhmmsPETE/OhmmsMatrix.h"
22 #include "OhmmsPETE/OhmmsVector.h"
24 
25 namespace qmcplusplus
26 {
28 {
29 public:
30  ///define BasisSetType with RealType
37 
39 
40  /** constructor
41  *@param spos the single-particle orbital set
42  *@param first index of the first particle
43  */
44  AGPDeterminant(BasisSetType* bs = nullptr);
45 
46  ///default destructor
47  ~AGPDeterminant() override;
48 
49  std::string getClassName() const override { return "AGPDeterminant"; }
50 
51  ///reset the size: with the number of particles and number of orbtials
52  void resize(int nup, int ndown);
53 
54  void registerData(ParticleSet& P, WFBufferType& buf) override;
55 
56  LogValue updateBuffer(ParticleSet& P, WFBufferType& buf, bool fromscratch = false) override;
57 
58  void copyFromBuffer(ParticleSet& P, WFBufferType& buf) override;
59 
60  /** return the ratio only for the iat-th partcle move
61  * @param P current configuration
62  * @param iat the particle thas is being moved
63  */
64  PsiValue ratio(ParticleSet& P, int iat) override;
65 
66  void ratioUp(ParticleSet& P, int iat);
67 
68  void ratioDown(ParticleSet& P, int iat);
69 
70  /** move was accepted, update the real container
71  */
72  void acceptMove(ParticleSet& P, int iat, bool safe_to_delay = false) override;
73 
74  /** move was rejected. copy the real container to the temporary to move on
75  */
76  void restore(int iat) override;
77 
78  void resizeByWalkers(int nwalkers);
79 
80  /** Calculate the log value of the Dirac determinant for particles
81  *@param P input configuration containing N particles
82  *@param G a vector containing N gradients
83  *@param L a vector containing N laplacians
84  *@return the value of the determinant
85  *
86  *\f$ (first,first+nel). \f$ Add the gradient and laplacian
87  *contribution of the determinant to G(radient) and L(aplacian)
88  *for local energy calculations.
89  */
92  ParticleSet::ParticleLaplacian& L) override;
93 
94  std::unique_ptr<WaveFunctionComponent> makeClone(ParticleSet& tqp) const override;
95 
97  const opt_variables_type& optvars,
98  Vector<ValueType>& dlogpsi,
99  Vector<ValueType>& dhpsioverpsi) override
100  {}
101 
102  ///Total number of particles
103  int NumPtcls;
104  ///number of major spins
105  int Nup;
106  ///number of minor spins
107  int Ndown;
108  ///size of the basis set
110 
111  ///index of the particle (or row)
113 
114  /////Current determinant value
115  //ValueType CurrentDet;
116 
117  ///coefficient of the up/down block
119 
120  ///coefficient of the major block
122 
123  /// psiM(j,i) \f$= \psi_j({\bf r}_i)\f$
125 
126 
127  /** Transient data for gradient and laplacian evaluation
128  *
129  * \f$phiD(j,k) = \sum_{j^{'}} \lambda_{j^{'},j} \phi_k(r_j) \f$
130  * j runs over the particle index index
131  */
133 
134  /// temporary container for testing
136  /// store gradients
138  /// store laplacians
140  /// temporary determinant-related matrix for gradients
142  /// temporary determinant-related matrix for laplacians
144 
145  /// value of single-particle orbital for particle-by-particle update
146  /** temporary vector for a particle-by-particle move
147  *
148  * phiTv = Lambda Y(iat)
149  */
158 
159  ///current ratio
161  ///cummulate ratio for particle-by-particle update
163  ///address of dpsiU[0][0]
165  ///address of FirstAddressOfdVU+OHMMS_DIM*Nup*Nup
167  ///address of dpsiD[0][0]
169  ///address of FirstAddressOfdVD+OHMMS_DIM*Ndown*Nup
171  ///address of myG[0][0]
173  ///address of FirstAddressOfG+OHMMS_DIM*NumPtcls
175  ///address of dY[0][0]
177  ///address of FirstAddressOfdY+NumPtcls*BasisSize
179 
182 
183  void evaluateLogAndStore(const ParticleSet& P);
184 };
185 } // namespace qmcplusplus
186 #endif
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 optimi...
Vector< ValueType > workV2
void resize(int nup, int ndown)
reset the size: with the number of particles and number of orbtials
ValueMatrix phiT
Transient data for gradient and laplacian evaluation.
WaveFunctionComponent::PsiValue PsiValue
Definition: SlaterDet.cpp:25
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
ValueVector phiTv
value of single-particle orbital for particle-by-particle update
QTBase::RealType RealType
Definition: Configuration.h:58
ValueMatrix d2Y
store laplacians
ParticleSet::SingleParticleValue * FirstAddressOfG
address of myG[0][0]
ParticleSet::ParticleLaplacian myL
void copyFromBuffer(ParticleSet &P, WFBufferType &buf) override
For particle-by-particle move.
BasisSetType::ValueType * LastAddressOfdVD
address of FirstAddressOfdVD+OHMMS_DIM*Ndown*Nup
PsiValue curRatio
current ratio
RealType cumRatio
cummulate ratio for particle-by-particle update
ParticleSet::ParticleGradient myG
ParticleSet::ParticleGradient myG_temp
std::string getClassName() const override
return class name
base class for a basis set
Definition: BasisSetBase.h:38
Attaches a unit to a Vector for IO.
QTFull::ValueType SingleParticleValue
Definition: Configuration.h:97
typename OrbitalSetTraits< T >::GradMatrix GradMatrix
Definition: BasisSetBase.h:52
typename OrbitalSetTraits< T >::ValueVector ValueVector
Definition: BasisSetBase.h:49
An abstract class for a component of a many-body trial wave function.
ValueMatrix psiMinv
temporary container for testing
typename OrbitalSetTraits< T >::GradVector GradVector
Definition: BasisSetBase.h:51
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
typename OrbitalSetTraits< T >::ValueMatrix ValueMatrix
Definition: BasisSetBase.h:50
void resizeByWalkers(int nwalkers)
void ratioDown(ParticleSet &P, int iat)
BasisSetType::ValueType * FirstAddressOfdVD
address of dpsiD[0][0]
ValueMatrix d2psiU
temporary determinant-related matrix for laplacians
Matrix< ValueType > psiM_temp
typename OrbitalSetTraits< T >::ValueType ValueType
Definition: BasisSetBase.h:45
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]
class to handle a set of variables that can be modified during optimizations
Definition: VariableSet.h:49
GradMatrix dpsiU
temporary determinant-related matrix for gradients
void acceptMove(ParticleSet &P, int iat, bool safe_to_delay=false) override
move was accepted, update the real container
void restore(int iat) override
move was rejected.
int Nup
number of major spins
BasisSetType::GradVector GradVector
int BasisSize
size of the basis set
GradMatrix dY
store gradients
int WorkingIndex
index of the particle (or row)
std::unique_ptr< WaveFunctionComponent > makeClone(ParticleSet &tqp) const override
make clone
BasisSetType::ValueVector ValueVector
typename OrbitalSetTraits< T >::IndexVector IndexVector
Definition: BasisSetBase.h:48
~AGPDeterminant() override
default destructor
ParticleSet::SingleParticleValue * LastAddressOfG
address of FirstAddressOfG+OHMMS_DIM*NumPtcls
Declaraton of Vector<T,Alloc> Manage memory through Alloc directly and allow referencing an existing ...
void ratioUp(ParticleSet &P, int iat)
Vector< ValueType > workV1
BasisSetType::IndexVector IndexVector
ValueMatrix LambdaUP
coefficient of the major block
Matrix< ValueType > psiM
psiM(j,i)
void evaluateLogAndStore(const ParticleSet &P)
int Ndown
number of minor spins
int NumPtcls
Total number of particles.
Declaration of WaveFunctionComponent.
std::complex< double > LogValue
BasisSetType::ValueMatrix ValueMatrix
PsiValue ratio(ParticleSet &P, int iat) override
return the ratio only for the iat-th partcle move
BasisSetType::ValueType * LastAddressOfdVU
address of FirstAddressOfdVU+OHMMS_DIM*Nup*Nup
LogValue evaluateLog(const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L) override
Calculate the log value of the Dirac determinant for particles.
void registerData(ParticleSet &P, WFBufferType &buf) override
For particle-by-particle move.
AGPDeterminant(BasisSetType *bs=nullptr)
constructor
ParticleSet::ParticleLaplacian myL_temp
BasisSetType::GradMatrix GradMatrix
LogValue updateBuffer(ParticleSet &P, WFBufferType &buf, bool fromscratch=false) override
For particle-by-particle move.
Declaration of a base class of BasisSet.