QMCPACK
PWRealOrbitalSet.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 // Miguel Morales, moralessilva2@llnl.gov, Lawrence Livermore National Laboratory
9 // Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
10 // Mark Dewing, markdewing@gmail.com, University of Illinois at Urbana-Champaign
11 //
12 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
13 //////////////////////////////////////////////////////////////////////////////////////
14 
15 
16 /** @file PWRealOrbitalSet.h
17  * @brief Define PWRealOrbitalSet derived from SPOSet
18  *
19  * This is a specialized single-particle orbital set for real trial
20  * wavefunctions and enabled with QMC_COMPLEX=0
21  */
22 #ifndef QMCPLUSPLUS_PLANEWAVE_REALORBITALSET_BLAS_H
23 #define QMCPLUSPLUS_PLANEWAVE_REALORBITALSET_BLAS_H
24 
27 #include "CPU/BLAS.hpp"
28 
29 namespace qmcplusplus
30 {
31 class PWRealOrbitalSet : public SPOSet
32 {
33 public:
35  using PWBasisPtr = PWBasis*;
36 
37  /** inherit the enum of BasisSet_t */
38  enum
39  {
46  };
47 
48  /** default constructor
49  */
50  PWRealOrbitalSet(const std::string& my_name)
51  : SPOSet(my_name), OwnBasisSet(false), myBasisSet(nullptr), BasisSetSize(0)
52  {}
53 
54  std::string getClassName() const override { return "PWRealOrbitalSet"; }
55 
56  /** delete BasisSet only it owns this
57  *
58  * Builder takes care of who owns what
59  */
60  ~PWRealOrbitalSet() override;
61 
62  std::unique_ptr<SPOSet> makeClone() const override;
63 
64  /** resize the orbital base
65  * @param bset PWBasis
66  * @param nbands number of bands
67  * @param cleaup if true, owns PWBasis. Will clean up.
68  */
69  void resize(PWBasisPtr bset, int nbands, bool cleanup = false);
70 
71  /** add eigenstate for jorb-th orbital
72  * @param coefs real input data
73  * @param jorb orbital index
74  */
75  void addVector(const std::vector<RealType>& coefs, int jorb);
76 
77  /** add eigenstate for jorb-th orbital
78  * @param coefs complex input data
79  * @param jorb orbital index
80  */
81  void addVector(const std::vector<ComplexType>& coefs, int jorb);
82 
83  void setOrbitalSetSize(int norbs) override;
84 
85  inline ValueType evaluate(int ib, const PosType& pos)
86  {
87  myBasisSet->evaluate(pos);
88  return real(BLAS::dot(BasisSetSize, CC[ib], myBasisSet->Zv.data()));
89  }
90 
91  void evaluateValue(const ParticleSet& P, int iat, ValueVector& psi) override;
92 
93  void evaluateVGL(const ParticleSet& P, int iat, ValueVector& psi, GradVector& dpsi, ValueVector& d2psi) override;
94 
95  void evaluate_notranspose(const ParticleSet& P,
96  int first,
97  int last,
98  ValueMatrix& logdet,
99  GradMatrix& dlogdet,
100  ValueMatrix& d2logdet) override;
101 
103  int first,
104  int last,
105  ValueMatrix& logdet,
106  GradMatrix& dlogdet,
107  HessMatrix& grad_grad_logdet) override
108  {
109  APP_ABORT("Need specialization of evaluate_notranspose() for grad_grad_logdet. \n");
110  }
111 
112 
113  /** boolean
114  *
115  * If true, this has to delete the BasisSet
116  */
118  ///TwistAngle of this PWRealOrbitalSet
120  ///My basis set
122  ///number of basis
124  ///Plane-wave coefficients of complex: (iband,g-vector)
126  /// temporary array to perform gemm operation
128  ///temporary complex vector before assigning to a real psi
130 };
131 } // namespace qmcplusplus
132 #endif
base class for Single-particle orbital sets
Definition: SPOSet.h:46
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
void evaluate(const PosType &pos)
Definition: PWBasis.h:284
void addVector(const std::vector< RealType > &coefs, int jorb)
add eigenstate for jorb-th orbital
void evaluateVGL(const ParticleSet &P, int iat, ValueVector &psi, GradVector &dpsi, ValueVector &d2psi) override
evaluate the values, gradients and laplacians of this single-particle orbital set ...
ValueType evaluate(int ib, const PosType &pos)
OrbitalSetTraits< ValueType >::ValueMatrix ValueMatrix
Definition: SPOSet.h:50
~PWRealOrbitalSet() override
delete BasisSet only it owns this
float real(const float &c)
real part of a scalar. Cannot be replaced by std::real due to AFQMC specific needs.
PosType TwistAngle
TwistAngle of this PWRealOrbitalSet.
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Matrix< ComplexType > Temp
temporary array to perform gemm operation
Vector< ComplexType > Zv
Definition: PWBasis.h:89
OrbitalSetTraits< ValueType >::GradMatrix GradMatrix
Definition: SPOSet.h:52
std::unique_ptr< SPOSet > makeClone() const override
make a clone of itself every derived class must implement this to have threading working correctly...
void resize(PWBasisPtr bset, int nbands, bool cleanup=false)
resize the orbital base
Matrix< ComplexType > CC
Plane-wave coefficients of complex: (iband,g-vector)
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
QTBase::ValueType ValueType
Definition: Configuration.h:60
PWBasisPtr myBasisSet
My basis set.
void evaluateValue(const ParticleSet &P, int iat, ValueVector &psi) override
evaluate the values of this single-particle orbital set
PWRealOrbitalSet(const std::string &my_name)
default constructor
static T dot(int n, const T *restrict a, const T *restrict b)
Definition: BLAS.hpp:304
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27
OHMMS_INDEXTYPE IndexType
define other types
Definition: Configuration.h:65
void evaluate_notranspose(const ParticleSet &P, int first, int last, ValueMatrix &logdet, GradMatrix &dlogdet, ValueMatrix &d2logdet) override
evaluate the values, gradients and laplacians of this single-particle orbital for [first...
IndexType BasisSetSize
number of basis
OrbitalSetTraits< ValueType >::GradVector GradVector
Definition: SPOSet.h:51
Plane-wave basis set.
Definition: PWBasis.h:40
Declaration of Plane-wave basis set.
Vector< ComplexType > tempPsi
temporary complex vector before assigning to a real psi
std::string getClassName() const override
return class name
OrbitalSetTraits< ValueType >::HessMatrix HessMatrix
Definition: SPOSet.h:54
void setOrbitalSetSize(int norbs) override
set the OrbitalSetSize
void evaluate_notranspose(const ParticleSet &P, int first, int last, ValueMatrix &logdet, GradMatrix &dlogdet, HessMatrix &grad_grad_logdet) override
evaluate the values, gradients and hessians of this single-particle orbital for [first,last) particles