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

Public Member Functions

 FreeOrbital (const std::string &my_name, const std::vector< PosType > &kpts_cart)
 
 ~FreeOrbital ()
 
std::string getClassName () const override
 return class name More...
 
void evaluate_notranspose (const ParticleSet &P, int first, int last, ValueMatrix &phi, GradMatrix &dphi, ValueMatrix &d2phi) override
 evaluate the values, gradients and laplacians of this single-particle orbital for [first,last) particles More...
 
void evaluateVGL (const ParticleSet &P, int i, ValueVector &pvec, GradVector &dpvec, ValueVector &d2pvec) override
 evaluate the values, gradients and laplacians of this single-particle orbital set More...
 
void evaluateValue (const ParticleSet &P, int iat, ValueVector &pvec) override
 evaluate the values of this single-particle orbital set More...
 
void evaluate_notranspose (const ParticleSet &P, int first, int last, ValueMatrix &phi, GradMatrix &dphi, HessMatrix &d2phi_mat) override
 evaluate the values, gradients and hessians of this single-particle orbital for [first,last) particles More...
 
void evaluate_notranspose (const ParticleSet &P, int first, int last, ValueMatrix &phi, GradMatrix &dphi, HessMatrix &d2phi_mat, GGGMatrix &d3phi_mat) override
 evaluate the values, gradients, hessians and third derivatives of this single-particle orbital for [first,last) particles More...
 
void report (const std::string &pad) const override
 print SPOSet information More...
 
std::unique_ptr< SPOSetmakeClone () const override
 make a clone of itself every derived class must implement this to have threading working correctly. More...
 
void setOrbitalSetSize (int norbs) override
 set the OrbitalSetSize More...
 
- Public Member Functions inherited from SPOSet
 SPOSet (const std::string &my_name)
 constructor More...
 
virtual ~SPOSet ()=default
 destructor More...
 
int size () const
 return the size of the orbital set Ye: this needs to be replaced by getOrbitalSetSize(); More...
 
void basic_report (const std::string &pad="") const
 print basic SPOSet information More...
 
int getOrbitalSetSize () const
 return the size of the orbitals More...
 
virtual bool isOptimizable () const
 Query if this SPOSet is optimizable. More...
 
virtual void extractOptimizableObjectRefs (UniqueOptObjRefs &opt_obj_refs)
 extract underlying OptimizableObject references More...
 
virtual void checkOutVariables (const opt_variables_type &active)
 check out variational optimizable variables More...
 
virtual bool isOMPoffload () const
 Query if this SPOSet uses OpenMP offload. More...
 
virtual bool hasIonDerivs () const
 Query if this SPOSet has an explicit ion dependence. More...
 
virtual void checkObject () const
 check a few key parameters before putting the SPO into a determinant More...
 
virtual bool isRotationSupported () const
 return true if this SPOSet can be wrappered by RotatedSPO More...
 
virtual void storeParamsBeforeRotation ()
 store parameters before getting destroyed by rotation. More...
 
virtual void applyRotation (const ValueMatrix &rot_mat, bool use_stored_copy=false)
 apply rotation to all the orbitals More...
 
virtual void evaluateDerivatives (ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi, const int &FirstIndex, const int &LastIndex)
 Parameter derivatives of the wavefunction and the Laplacian of the wavefunction. More...
 
virtual void evaluateDerivativesWF (ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, int FirstIndex, int LastIndex)
 Parameter derivatives of the wavefunction. More...
 
virtual void evaluateDerivatives (ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi, const ValueType &psiCurrent, const std::vector< ValueType > &Coeff, const std::vector< size_t > &C2node_up, const std::vector< size_t > &C2node_dn, const ValueVector &detValues_up, const ValueVector &detValues_dn, const GradMatrix &grads_up, const GradMatrix &grads_dn, const ValueMatrix &lapls_up, const ValueMatrix &lapls_dn, const ValueMatrix &M_up, const ValueMatrix &M_dn, const ValueMatrix &Minv_up, const ValueMatrix &Minv_dn, const GradMatrix &B_grad, const ValueMatrix &B_lapl, const std::vector< int > &detData_up, const size_t N1, const size_t N2, const size_t NP1, const size_t NP2, const std::vector< std::vector< int >> &lookup_tbl)
 Evaluate the derivative of the optimized orbitals with respect to the parameters this is used only for MSD, to be refined for better serving both single and multi SD. More...
 
virtual void evaluateDerivativesWF (ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, const QTFull::ValueType &psiCurrent, const std::vector< ValueType > &Coeff, const std::vector< size_t > &C2node_up, const std::vector< size_t > &C2node_dn, const ValueVector &detValues_up, const ValueVector &detValues_dn, const ValueMatrix &M_up, const ValueMatrix &M_dn, const ValueMatrix &Minv_up, const ValueMatrix &Minv_dn, const std::vector< int > &detData_up, const std::vector< std::vector< int >> &lookup_tbl)
 Evaluate the derivative of the optimized orbitals with respect to the parameters this is used only for MSD, to be refined for better serving both single and multi SD. More...
 
virtual void evaluateDetRatios (const VirtualParticleSet &VP, ValueVector &psi, const ValueVector &psiinv, std::vector< ValueType > &ratios)
 evaluate determinant ratios for virtual moves, e.g., sphere move for nonlocalPP More...
 
virtual void evaluateDetSpinorRatios (const VirtualParticleSet &VP, ValueVector &psi, const std::pair< ValueVector, ValueVector > &spinor_multiplier, const ValueVector &invrow, std::vector< ValueType > &ratios)
 evaluate determinant ratios for virtual moves, specifically for Spinor SPOSets More...
 
virtual void evaluateDerivRatios (const VirtualParticleSet &VP, const opt_variables_type &optvars, ValueVector &psi, const ValueVector &psiinv, std::vector< ValueType > &ratios, Matrix< ValueType > &dratios, int FirstIndex, int LastIndex)
 Determinant ratios and parameter derivatives of the wavefunction for virtual moves. More...
 
virtual void mw_evaluateDetRatios (const RefVectorWithLeader< SPOSet > &spo_list, const RefVectorWithLeader< const VirtualParticleSet > &vp_list, const RefVector< ValueVector > &psi_list, const std::vector< const ValueType *> &invRow_ptr_list, std::vector< std::vector< ValueType >> &ratios_list) const
 evaluate determinant ratios for virtual moves, e.g., sphere move for nonlocalPP, of multiple walkers More...
 
virtual void evaluateVGL_spin (const ParticleSet &P, int iat, ValueVector &psi, GradVector &dpsi, ValueVector &d2psi, ValueVector &dspin)
 evaluate the values, gradients and laplacians and spin gradient of this single-particle orbital set More...
 
virtual void mw_evaluateValue (const RefVectorWithLeader< SPOSet > &spo_list, const RefVectorWithLeader< ParticleSet > &P_list, int iat, const RefVector< ValueVector > &psi_v_list) const
 evaluate the values this single-particle orbital sets of multiple walkers More...
 
virtual void mw_evaluateVGL (const RefVectorWithLeader< SPOSet > &spo_list, const RefVectorWithLeader< ParticleSet > &P_list, int iat, const RefVector< ValueVector > &psi_v_list, const RefVector< GradVector > &dpsi_v_list, const RefVector< ValueVector > &d2psi_v_list) const
 evaluate the values, gradients and laplacians of this single-particle orbital sets of multiple walkers More...
 
virtual void mw_evaluateVGLWithSpin (const RefVectorWithLeader< SPOSet > &spo_list, const RefVectorWithLeader< ParticleSet > &P_list, int iat, const RefVector< ValueVector > &psi_v_list, const RefVector< GradVector > &dpsi_v_list, const RefVector< ValueVector > &d2psi_v_list, OffloadMatrix< ComplexType > &mw_dspin) const
 evaluate the values, gradients and laplacians and spin gradient of this single-particle orbital sets of multiple walkers More...
 
virtual void mw_evaluateVGLandDetRatioGrads (const RefVectorWithLeader< SPOSet > &spo_list, const RefVectorWithLeader< ParticleSet > &P_list, int iat, const std::vector< const ValueType *> &invRow_ptr_list, OffloadMWVGLArray &phi_vgl_v, std::vector< ValueType > &ratios, std::vector< GradType > &grads) const
 evaluate the values, gradients and laplacians of this single-particle orbital sets and determinant ratio and grads of multiple walkers. More...
 
virtual void mw_evaluateVGLandDetRatioGradsWithSpin (const RefVectorWithLeader< SPOSet > &spo_list, const RefVectorWithLeader< ParticleSet > &P_list, int iat, const std::vector< const ValueType *> &invRow_ptr_list, OffloadMWVGLArray &phi_vgl_v, std::vector< ValueType > &ratios, std::vector< GradType > &grads, std::vector< ValueType > &spingrads) const
 evaluate the values, gradients and laplacians of this single-particle orbital sets and determinant ratio and grads of multiple walkers. More...
 
virtual void evaluateVGH (const ParticleSet &P, int iat, ValueVector &psi, GradVector &dpsi, HessVector &grad_grad_psi)
 evaluate the values, gradients and hessians of this single-particle orbital set More...
 
virtual void evaluateVGHGH (const ParticleSet &P, int iat, ValueVector &psi, GradVector &dpsi, HessVector &grad_grad_psi, GGGVector &grad_grad_grad_psi)
 evaluate the values, gradients, hessians, and grad hessians of this single-particle orbital set More...
 
virtual void evaluate_spin (const ParticleSet &P, int iat, ValueVector &psi, ValueVector &dpsi)
 evaluate the values of this single-particle orbital set More...
 
virtual void evaluateThirdDeriv (const ParticleSet &P, int first, int last, GGGMatrix &grad_grad_grad_logdet)
 evaluate the third derivatives of this single-particle orbital set More...
 
virtual void evaluate_notranspose_spin (const ParticleSet &P, int first, int last, ValueMatrix &logdet, GradMatrix &dlogdet, ValueMatrix &d2logdet, ValueMatrix &dspinlogdet)
 evaluate the values, gradients and laplacians of this single-particle orbital for [first,last) particles, including the spin gradient More...
 
virtual void mw_evaluate_notranspose (const RefVectorWithLeader< SPOSet > &spo_list, const RefVectorWithLeader< ParticleSet > &P_list, int first, int last, const RefVector< ValueMatrix > &logdet_list, const RefVector< GradMatrix > &dlogdet_list, const RefVector< ValueMatrix > &d2logdet_list) const
 
virtual void evaluateGradSource (const ParticleSet &P, int first, int last, const ParticleSet &source, int iat_src, GradMatrix &gradphi)
 evaluate the gradients of this single-particle orbital for [first,last) target particles with respect to the given source particle More...
 
virtual void evaluateGradSource (const ParticleSet &P, int first, int last, const ParticleSet &source, int iat_src, GradMatrix &grad_phi, HessMatrix &grad_grad_phi, GradMatrix &grad_lapl_phi)
 evaluate the gradients of values, gradients, laplacians of this single-particle orbital for [first,last) target particles with respect to the given source particle More...
 
virtual void evaluateGradSourceRow (const ParticleSet &P, int iel, const ParticleSet &source, int iat_src, GradVector &gradphi)
 Returns a row of d/dR_iat phi_j(r) evaluated at position r. More...
 
virtual PosType get_k (int orb)
 access the k point related to the given orbital More...
 
virtual void createResource (ResourceCollection &collection) const
 initialize a shared resource and hand it to collection More...
 
virtual void acquireResource (ResourceCollection &collection, const RefVectorWithLeader< SPOSet > &spo_list) const
 acquire a shared resource from collection More...
 
virtual void releaseResource (ResourceCollection &collection, const RefVectorWithLeader< SPOSet > &spo_list) const
 return a shared resource to collection More...
 
virtual bool transformSPOSet ()
 Used only by cusp correction in AOS LCAO. More...
 
virtual void finalizeConstruction ()
 finalize the construction of SPOSet More...
 
const std::string & getName () const
 return object name More...
 

Private Attributes

const std::vector< PosTypekvecs
 
const int mink
 
const int maxk
 
std::vector< RealTypek2neg
 

Additional Inherited Members

- Public Types inherited from SPOSet
using ValueVector = OrbitalSetTraits< ValueType >::ValueVector
 
using ValueMatrix = OrbitalSetTraits< ValueType >::ValueMatrix
 
using GradVector = OrbitalSetTraits< ValueType >::GradVector
 
using GradMatrix = OrbitalSetTraits< ValueType >::GradMatrix
 
using HessVector = OrbitalSetTraits< ValueType >::HessVector
 
using HessMatrix = OrbitalSetTraits< ValueType >::HessMatrix
 
using GGGVector = OrbitalSetTraits< ValueType >::GradHessVector
 
using GGGMatrix = OrbitalSetTraits< ValueType >::GradHessMatrix
 
using SPOMap = std::map< std::string, const std::unique_ptr< const SPOSet > >
 
using OffloadMWVGLArray = Array< ValueType, 3, OffloadPinnedAllocator< ValueType > >
 
using OffloadMWVArray = Array< ValueType, 2, OffloadPinnedAllocator< ValueType > >
 
template<typename DT >
using OffloadMatrix = Matrix< DT, OffloadPinnedAllocator< DT > >
 
- 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 > >
 
- Protected Attributes inherited from SPOSet
const std::string my_name_
 name of the object, unique identifier More...
 
IndexType OrbitalSetSize
 number of Single-particle orbitals More...
 
opt_variables_type myVars
 Optimizable variables. More...
 

Detailed Description

Definition at line 24 of file FreeOrbital.h.

Constructor & Destructor Documentation

◆ FreeOrbital()

FreeOrbital ( const std::string &  my_name,
const std::vector< PosType > &  kpts_cart 
)

Definition at line 6 of file FreeOrbital.cpp.

References qmcplusplus::dot(), FreeOrbital::k2neg, FreeOrbital::kvecs, FreeOrbital::maxk, and SPOSet::OrbitalSetSize.

7  : SPOSet(my_name),
8  kvecs(kpts_cart),
9 #ifdef QMC_COMPLEX
10  mink(0), // first k at twist may not be 0
11 #else
12  mink(1), // treat k=0 as special case
13 #endif
14  maxk(kpts_cart.size())
15 {
16 #ifdef QMC_COMPLEX
18 #else
19  OrbitalSetSize = 2 * maxk - 1; // k=0 has no (cos, sin) split
20 #endif
21  k2neg.resize(maxk);
22  for (int ik = 0; ik < maxk; ik++)
23  k2neg[ik] = -dot(kvecs[ik], kvecs[ik]);
24 }
SPOSet(const std::string &my_name)
constructor
Definition: SPOSet.cpp:29
std::vector< RealType > k2neg
Definition: FreeOrbital.h:71
const std::vector< PosType > kvecs
Definition: FreeOrbital.h:68
IndexType OrbitalSetSize
number of Single-particle orbitals
Definition: SPOSet.h:566
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)

◆ ~FreeOrbital()

Definition at line 26 of file FreeOrbital.cpp.

26 {}

Member Function Documentation

◆ evaluate_notranspose() [1/3]

void evaluate_notranspose ( const ParticleSet P,
int  first,
int  last,
ValueMatrix logdet,
GradMatrix dlogdet,
ValueMatrix d2logdet 
)
overridevirtual

evaluate the values, gradients and laplacians of this single-particle orbital for [first,last) particles

Parameters
[in]Pcurrent ParticleSet
[in]firststarting index of the particles
[in]lastending index of the particles
[out]logdetdeterminant matrix to be inverted
[out]dlogdetgradients
[out]d2logdetlaplacians

Implements SPOSet.

Definition at line 78 of file FreeOrbital.cpp.

References FreeOrbital::evaluateVGL(), and SPOSet::OrbitalSetSize.

84 {
85  for (int iat = first, i = 0; iat < last; iat++, i++)
86  {
87  ValueVector p(phi[i], OrbitalSetSize);
88  GradVector dp(dphi[i], OrbitalSetSize);
89  ValueVector d2p(d2phi[i], OrbitalSetSize);
90  evaluateVGL(P, iat, p, dp, d2p);
91  }
92 }
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Definition: SPOSet.h:49
void evaluateVGL(const ParticleSet &P, int i, ValueVector &pvec, GradVector &dpvec, ValueVector &d2pvec) override
evaluate the values, gradients and laplacians of this single-particle orbital set ...
Definition: FreeOrbital.cpp:28
IndexType OrbitalSetSize
number of Single-particle orbitals
Definition: SPOSet.h:566
OrbitalSetTraits< ValueType >::GradVector GradVector
Definition: SPOSet.h:51

◆ evaluate_notranspose() [2/3]

void evaluate_notranspose ( const ParticleSet P,
int  first,
int  last,
ValueMatrix logdet,
GradMatrix dlogdet,
HessMatrix grad_grad_logdet 
)
overridevirtual

evaluate the values, gradients and hessians of this single-particle orbital for [first,last) particles

Parameters
Pcurrent ParticleSet
firststarting index of the particles
lastending index of the particles
logdetdeterminant matrix to be inverted
dlogdetgradients
grad_grad_logdethessians

Reimplemented from SPOSet.

Definition at line 94 of file FreeOrbital.cpp.

References ParticleSet::activeR(), qmcplusplus::dot(), FreeOrbital::kvecs, FreeOrbital::maxk, FreeOrbital::mink, OHMMS_DIM, SPOSet::OrbitalSetSize, and qmcplusplus::sincos().

100 {
101  RealType sinkr, coskr;
102  ValueType phi_of_r;
103  for (int iat = first, i = 0; iat < last; iat++, i++)
104  {
105  ValueVector p(phi[i], OrbitalSetSize);
106  GradVector dp(dphi[i], OrbitalSetSize);
107  HessVector hess(d2phi_mat[i], OrbitalSetSize);
108 
109  const PosType& r = P.activeR(iat);
110  for (int ik = mink; ik < maxk; ik++)
111  {
112  sincos(dot(kvecs[ik], r), &sinkr, &coskr);
113 #ifdef QMC_COMPLEX
114  // phi(r) = cos(kr)+i*sin(kr)
115  phi_of_r = ValueType(coskr, sinkr);
116  p[ik] = phi_of_r;
117  // i*phi(r) = -sin(kr) + i*cos(kr)
118  dp[ik] = ValueType(-sinkr, coskr) * kvecs[ik];
119  for (int la = 0; la < OHMMS_DIM; la++)
120  {
121  hess[ik](la, la) = -phi_of_r * (kvecs[ik])[la] * (kvecs[ik])[la];
122  for (int lb = la + 1; lb < OHMMS_DIM; lb++)
123  {
124  hess[ik](la, lb) = -phi_of_r * (kvecs[ik])[la] * (kvecs[ik])[lb];
125  hess[ik](lb, la) = hess[ik](la, lb);
126  }
127  }
128 #else
129  const int j2 = 2 * ik;
130  const int j1 = j2 - 1;
131  p[j1] = coskr;
132  p[j2] = sinkr;
133  dp[j1] = -sinkr * kvecs[ik];
134  dp[j2] = coskr * kvecs[ik];
135  for (int la = 0; la < OHMMS_DIM; la++)
136  {
137  hess[j1](la, la) = -coskr * (kvecs[ik])[la] * (kvecs[ik])[la];
138  hess[j2](la, la) = -sinkr * (kvecs[ik])[la] * (kvecs[ik])[la];
139  for (int lb = la + 1; lb < OHMMS_DIM; lb++)
140  {
141  hess[j1](la, lb) = -coskr * (kvecs[ik])[la] * (kvecs[ik])[lb];
142  hess[j2](la, lb) = -sinkr * (kvecs[ik])[la] * (kvecs[ik])[lb];
143  hess[j1](lb, la) = hess[j1](la, lb);
144  hess[j2](lb, la) = hess[j2](la, lb);
145  }
146  }
147 #endif
148  }
149 #ifndef QMC_COMPLEX
150  p[0] = 1.0;
151  dp[0] = 0.0;
152  hess[0] = 0.0;
153 #endif
154  }
155 }
OrbitalSetTraits< ValueType >::HessVector HessVector
Definition: SPOSet.h:53
const std::vector< PosType > kvecs
Definition: FreeOrbital.h:68
#define OHMMS_DIM
Definition: config.h:64
QMCTraits::PosType PosType
QTBase::ValueType ValueType
Definition: Configuration.h:60
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Definition: SPOSet.h:49
IndexType OrbitalSetSize
number of Single-particle orbitals
Definition: SPOSet.h:566
QMCTraits::RealType RealType
OrbitalSetTraits< ValueType >::GradVector GradVector
Definition: SPOSet.h:51
void sincos(T a, T *restrict s, T *restrict c)
sincos function wrapper
Definition: math.hpp:62
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)

◆ evaluate_notranspose() [3/3]

void evaluate_notranspose ( const ParticleSet P,
int  first,
int  last,
ValueMatrix logdet,
GradMatrix dlogdet,
HessMatrix grad_grad_logdet,
GGGMatrix grad_grad_grad_logdet 
)
overridevirtual

evaluate the values, gradients, hessians and third derivatives of this single-particle orbital for [first,last) particles

Parameters
Pcurrent ParticleSet
firststarting index of the particles
lastending index of the particles
logdetdeterminant matrix to be inverted
dlogdetgradients
grad_grad_logdethessians
grad_grad_grad_logdetthird derivatives

Reimplemented from SPOSet.

Definition at line 157 of file FreeOrbital.cpp.

References ParticleSet::activeR(), qmcplusplus::dot(), FreeOrbital::kvecs, FreeOrbital::maxk, FreeOrbital::mink, OHMMS_DIM, SPOSet::OrbitalSetSize, and qmcplusplus::sincos().

164 {
165  RealType sinkr, coskr;
166  ValueType phi_of_r;
167  for (int iat = first, i = 0; iat < last; iat++, i++)
168  {
169  ValueVector p(phi[i], OrbitalSetSize);
170  GradVector dp(dphi[i], OrbitalSetSize);
171  HessVector hess(d2phi_mat[i], OrbitalSetSize);
172  GGGVector ggg(d3phi_mat[i], OrbitalSetSize);
173 
174  const PosType& r = P.activeR(iat);
175  for (int ik = mink; ik < maxk; ik++)
176  {
177  sincos(dot(kvecs[ik], r), &sinkr, &coskr);
178 #ifdef QMC_COMPLEX
179  const ValueType compi(0, 1);
180  phi_of_r = ValueType(coskr, sinkr);
181  p[ik] = phi_of_r;
182  dp[ik] = compi * phi_of_r * kvecs[ik];
183  for (int la = 0; la < OHMMS_DIM; la++)
184  {
185  hess[ik](la, la) = -phi_of_r * (kvecs[ik])[la] * (kvecs[ik])[la];
186  for (int lb = la + 1; lb < OHMMS_DIM; lb++)
187  {
188  hess[ik](la, lb) = -phi_of_r * (kvecs[ik])[la] * (kvecs[ik])[lb];
189  hess[ik](lb, la) = hess[ik](la, lb);
190  }
191  }
192  for (int la = 0; la < OHMMS_DIM; la++)
193  {
194  ggg[ik][la] = compi * (kvecs[ik])[la] * hess[ik];
195  }
196 #else
197  const int j2 = 2 * ik;
198  const int j1 = j2 - 1;
199  p[j1] = coskr;
200  p[j2] = sinkr;
201  dp[j1] = -sinkr * kvecs[ik];
202  dp[j2] = coskr * kvecs[ik];
203  for (int la = 0; la < OHMMS_DIM; la++)
204  {
205  hess[j1](la, la) = -coskr * (kvecs[ik])[la] * (kvecs[ik])[la];
206  hess[j2](la, la) = -sinkr * (kvecs[ik])[la] * (kvecs[ik])[la];
207  ggg[j1][la](la, la) = sinkr * (kvecs[ik])[la] * (kvecs[ik])[la] * (kvecs[ik])[la];
208  ggg[j2][la](la, la) = -coskr * (kvecs[ik])[la] * (kvecs[ik])[la] * (kvecs[ik])[la];
209  for (int lb = la + 1; lb < OHMMS_DIM; lb++)
210  {
211  hess[j1](la, lb) = -coskr * (kvecs[ik])[la] * (kvecs[ik])[lb];
212  hess[j2](la, lb) = -sinkr * (kvecs[ik])[la] * (kvecs[ik])[lb];
213  hess[j1](lb, la) = hess[j1](la, lb);
214  hess[j2](lb, la) = hess[j2](la, lb);
215  ggg[j1][la](lb, la) = sinkr * (kvecs[ik])[la] * (kvecs[ik])[lb] * (kvecs[ik])[la];
216  ggg[j2][la](lb, la) = -coskr * (kvecs[ik])[la] * (kvecs[ik])[lb] * (kvecs[ik])[la];
217  ggg[j1][la](la, lb) = ggg[j1][la](lb, la);
218  ggg[j2][la](la, lb) = ggg[j2][la](lb, la);
219  ggg[j1][lb](la, la) = ggg[j1][la](lb, la);
220  ggg[j2][lb](la, la) = ggg[j2][la](lb, la);
221  ggg[j1][la](lb, lb) = sinkr * (kvecs[ik])[la] * (kvecs[ik])[lb] * (kvecs[ik])[lb];
222  ggg[j2][la](lb, lb) = -coskr * (kvecs[ik])[la] * (kvecs[ik])[lb] * (kvecs[ik])[lb];
223  ggg[j1][lb](la, lb) = ggg[j1][la](lb, lb);
224  ggg[j2][lb](la, lb) = ggg[j2][la](lb, lb);
225  ggg[j1][lb](lb, la) = ggg[j1][la](lb, lb);
226  ggg[j2][lb](lb, la) = ggg[j2][la](lb, lb);
227  for (int lc = lb + 1; lc < OHMMS_DIM; lc++)
228  {
229  ggg[j1][la](lb, lc) = sinkr * (kvecs[ik])[la] * (kvecs[ik])[lb] * (kvecs[ik])[lc];
230  ggg[j2][la](lb, lc) = -coskr * (kvecs[ik])[la] * (kvecs[ik])[lb] * (kvecs[ik])[lc];
231  ggg[j1][la](lc, lb) = ggg[j1][la](lb, lc);
232  ggg[j2][la](lc, lb) = ggg[j2][la](lb, lc);
233  ggg[j1][lb](la, lc) = ggg[j1][la](lb, lc);
234  ggg[j2][lb](la, lc) = ggg[j2][la](lb, lc);
235  ggg[j1][lb](lc, la) = ggg[j1][la](lb, lc);
236  ggg[j2][lb](lc, la) = ggg[j2][la](lb, lc);
237  ggg[j1][lc](la, lb) = ggg[j1][la](lb, lc);
238  ggg[j2][lc](la, lb) = ggg[j2][la](lb, lc);
239  ggg[j1][lc](lb, la) = ggg[j1][la](lb, lc);
240  ggg[j2][lc](lb, la) = ggg[j2][la](lb, lc);
241  }
242  }
243  }
244 #endif
245  }
246 #ifndef QMC_COMPLEX
247  p[0] = 1.0;
248  dp[0] = 0.0;
249  hess[0] = 0.0;
250  ggg[0] = 0.0;
251 #endif
252  }
253 }
OrbitalSetTraits< ValueType >::HessVector HessVector
Definition: SPOSet.h:53
const std::vector< PosType > kvecs
Definition: FreeOrbital.h:68
#define OHMMS_DIM
Definition: config.h:64
QMCTraits::PosType PosType
QTBase::ValueType ValueType
Definition: Configuration.h:60
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Definition: SPOSet.h:49
IndexType OrbitalSetSize
number of Single-particle orbitals
Definition: SPOSet.h:566
QMCTraits::RealType RealType
OrbitalSetTraits< ValueType >::GradHessVector GGGVector
Definition: SPOSet.h:55
OrbitalSetTraits< ValueType >::GradVector GradVector
Definition: SPOSet.h:51
void sincos(T a, T *restrict s, T *restrict c)
sincos function wrapper
Definition: math.hpp:62
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)

◆ evaluateValue()

void evaluateValue ( const ParticleSet P,
int  iat,
ValueVector psi 
)
overridevirtual

evaluate the values of this single-particle orbital set

Parameters
Pcurrent ParticleSet
iatactive particle
psivalues of the SPO

Implements SPOSet.

Definition at line 57 of file FreeOrbital.cpp.

References ParticleSet::activeR(), qmcplusplus::dot(), FreeOrbital::kvecs, FreeOrbital::maxk, FreeOrbital::mink, and qmcplusplus::sincos().

58 {
59  const PosType& r = P.activeR(iat);
60  RealType sinkr, coskr;
61  for (int ik = mink; ik < maxk; ik++)
62  {
63  sincos(dot(kvecs[ik], r), &sinkr, &coskr);
64 #ifdef QMC_COMPLEX
65  pvec[ik] = ValueType(coskr, sinkr);
66 #else
67  const int j2 = 2 * ik;
68  const int j1 = j2 - 1;
69  pvec[j1] = coskr;
70  pvec[j2] = sinkr;
71 #endif
72  }
73 #ifndef QMC_COMPLEX
74  pvec[0] = 1.0;
75 #endif
76 }
const std::vector< PosType > kvecs
Definition: FreeOrbital.h:68
QMCTraits::PosType PosType
QTBase::ValueType ValueType
Definition: Configuration.h:60
QMCTraits::RealType RealType
void sincos(T a, T *restrict s, T *restrict c)
sincos function wrapper
Definition: math.hpp:62
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)

◆ evaluateVGL()

void evaluateVGL ( const ParticleSet P,
int  iat,
ValueVector psi,
GradVector dpsi,
ValueVector d2psi 
)
overridevirtual

evaluate the values, gradients and laplacians of this single-particle orbital set

Parameters
Pcurrent ParticleSet
iatactive particle
psivalues of the SPO
dpsigradients of the SPO
d2psilaplacians of the SPO

Implements SPOSet.

Definition at line 28 of file FreeOrbital.cpp.

References ParticleSet::activeR(), qmcplusplus::dot(), FreeOrbital::k2neg, FreeOrbital::kvecs, FreeOrbital::maxk, FreeOrbital::mink, and qmcplusplus::sincos().

Referenced by FreeOrbital::evaluate_notranspose().

29 {
30  const PosType& r = P.activeR(iat);
31  RealType sinkr, coskr;
32  for (int ik = mink; ik < maxk; ik++)
33  {
34  sincos(dot(kvecs[ik], r), &sinkr, &coskr);
35 #ifdef QMC_COMPLEX
36  pvec[ik] = ValueType(coskr, sinkr);
37  dpvec[ik] = ValueType(-sinkr, coskr) * kvecs[ik];
38  d2pvec[ik] = ValueType(k2neg[ik] * coskr, k2neg[ik] * sinkr);
39 #else
40  const int j2 = 2 * ik;
41  const int j1 = j2 - 1;
42  pvec[j1] = coskr;
43  pvec[j2] = sinkr;
44  dpvec[j1] = -sinkr * kvecs[ik];
45  dpvec[j2] = coskr * kvecs[ik];
46  d2pvec[j1] = k2neg[ik] * coskr;
47  d2pvec[j2] = k2neg[ik] * sinkr;
48 #endif
49  }
50 #ifndef QMC_COMPLEX
51  pvec[0] = 1.0;
52  dpvec[0] = 0.0;
53  d2pvec[0] = 0.0;
54 #endif
55 }
std::vector< RealType > k2neg
Definition: FreeOrbital.h:71
const std::vector< PosType > kvecs
Definition: FreeOrbital.h:68
QMCTraits::PosType PosType
QTBase::ValueType ValueType
Definition: Configuration.h:60
QMCTraits::RealType RealType
void sincos(T a, T *restrict s, T *restrict c)
sincos function wrapper
Definition: math.hpp:62
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)

◆ getClassName()

std::string getClassName ( ) const
inlineoverridevirtual

return class name

Implements SPOSet.

Definition at line 30 of file FreeOrbital.h.

30 { return "FreeOrbital"; }

◆ makeClone()

std::unique_ptr<SPOSet> makeClone ( ) const
inlineoverridevirtual

make a clone of itself every derived class must implement this to have threading working correctly.

Reimplemented from SPOSet.

Definition at line 64 of file FreeOrbital.h.

64 { return std::make_unique<FreeOrbital>(*this); }

◆ report()

void report ( const std::string &  pad) const
overridevirtual

print SPOSet information

Reimplemented from SPOSet.

Definition at line 255 of file FreeOrbital.cpp.

References qmcplusplus::app_log(), and FreeOrbital::kvecs.

256 {
257  app_log() << pad << "FreeOrbital report" << std::endl;
258  for (int ik = 0; ik < kvecs.size(); ik++)
259  {
260  app_log() << pad << ik << " " << kvecs[ik] << std::endl;
261  }
262  app_log() << pad << "end FreeOrbital report" << std::endl;
263  app_log().flush();
264 }
std::ostream & app_log()
Definition: OutputManager.h:65
const std::vector< PosType > kvecs
Definition: FreeOrbital.h:68

◆ setOrbitalSetSize()

void setOrbitalSetSize ( int  norbs)
inlineoverridevirtual

set the OrbitalSetSize

Parameters
norbsnumber of single-particle orbitals Ye: I prefer to remove this interface in the future. SPOSet builders need to handle the size correctly. It doesn't make sense allowing to set the value at any place in the code.

Implements SPOSet.

Definition at line 65 of file FreeOrbital.h.

65 { throw std::runtime_error("not implemented"); }

Member Data Documentation

◆ k2neg

std::vector<RealType> k2neg
private

Definition at line 71 of file FreeOrbital.h.

Referenced by FreeOrbital::evaluateVGL(), and FreeOrbital::FreeOrbital().

◆ kvecs

◆ maxk

◆ mink

const int mink
private

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