QMCPACK
SoaCuspCorrection Class Reference

A localized basis set derived from BasisSetBase<typename COT::ValueType> More...

+ Collaboration diagram for SoaCuspCorrection:

Public Member Functions

 SoaCuspCorrection (ParticleSet &ions, ParticleSet &els, size_t norbs)
 constructor More...
 
 SoaCuspCorrection (const SoaCuspCorrection &a)
 copy constructor More...
 
void evaluateVGL (const ParticleSet &P, int iat, VGLVector &vgl)
 compute VGL More...
 
void evaluate_vgl (const ParticleSet &P, int iat, ValueVector &psi, GradVector &dpsi, ValueVector &d2psi)
 
void evaluate_vgl (const ParticleSet &P, int iat, int idx, ValueMatrix &psi, GradMatrix &dpsi, ValueMatrix &d2psi)
 
void evaluateV (const ParticleSet &P, int iat, ValueVector &psi)
 compute values for the iat-paricle move More...
 
void add (int icenter, std::unique_ptr< COT > aos)
 add a new set of Centered Atomic Orbitals More...
 
void addVGL (const ParticleSet &P, int iat, VGLVector &vgl)
 
void addV (const ParticleSet &P, int iat, ValueVector &psi)
 
void add_vgl (const ParticleSet &P, int iat, int idx, ValueMatrix &vals, GradMatrix &dpsi, ValueMatrix &d2psi)
 
void add_vector_vgl (const ParticleSet &P, int iat, ValueVector &vals, GradVector &dpsi, ValueVector &d2psi)
 

Private Types

using ValueType = QMCTraits::ValueType
 
using RealType = QMCTraits::RealType
 
using VGLVector = VectorSoaContainer< ValueType, 5 >
 
using ValueMatrix = SPOSet::ValueMatrix
 
using GradMatrix = SPOSet::GradMatrix
 
using GradVector = SPOSet::GradVector
 
using ValueVector = SPOSet::ValueVector
 
using PosType = ParticleSet::PosType
 
using COT = CuspCorrectionAtomicBasis< RealType >
 COMPLEX WON'T WORK. More...
 

Private Attributes

size_t NumCenters
 number of centers, e.g., ions More...
 
size_t NumTargets
 number of quantum particles More...
 
const int myTableIndex
 number of quantum particles More...
 
const size_t MaxOrbSize
 Maximal number of supported MOs this is not the AO basis because cusp correction is applied on the MO directly. More...
 
std::vector< std::shared_ptr< const COT > > LOBasisSet
 container of the unique pointers to the Atomic Orbitals More...
 
Matrix< RealTypemyVGL
 

Detailed Description

A localized basis set derived from BasisSetBase<typename COT::ValueType>

This class performs the evaluation of the basis functions and their derivatives for each of the N-particles in a configuration. The template parameter COT denotes Centered-Orbital-Type which provides a set of localized orbitals associated with a center.

Definition at line 33 of file SoaCuspCorrection.h.

Member Typedef Documentation

◆ COT

COMPLEX WON'T WORK.

Definition at line 56 of file SoaCuspCorrection.h.

◆ GradMatrix

using GradMatrix = SPOSet::GradMatrix
private

Definition at line 39 of file SoaCuspCorrection.h.

◆ GradVector

using GradVector = SPOSet::GradVector
private

Definition at line 40 of file SoaCuspCorrection.h.

◆ PosType

using PosType = ParticleSet::PosType
private

Definition at line 42 of file SoaCuspCorrection.h.

◆ RealType

using RealType = QMCTraits::RealType
private

Definition at line 36 of file SoaCuspCorrection.h.

◆ ValueMatrix

Definition at line 38 of file SoaCuspCorrection.h.

◆ ValueType

Definition at line 35 of file SoaCuspCorrection.h.

◆ ValueVector

Definition at line 41 of file SoaCuspCorrection.h.

◆ VGLVector

using VGLVector = VectorSoaContainer<ValueType, 5>
private

Definition at line 37 of file SoaCuspCorrection.h.

Constructor & Destructor Documentation

◆ SoaCuspCorrection() [1/2]

SoaCuspCorrection ( ParticleSet ions,
ParticleSet els,
size_t  norbs 
)

constructor

Parameters
ionsionic system
elselectronic system
norbsthe number of orbitals this cusp correction may serve

Definition at line 20 of file SoaCuspCorrection.cpp.

References ParticleSet::getTotalNum(), SoaCuspCorrection::LOBasisSet, SoaCuspCorrection::MaxOrbSize, SoaCuspCorrection::myVGL, SoaCuspCorrection::NumCenters, SoaCuspCorrection::NumTargets, and Matrix< T, Alloc >::resize().

21  : myTableIndex(els.addTable(ions)), MaxOrbSize(norbs)
22 {
23  NumCenters = ions.getTotalNum();
24  NumTargets = els.getTotalNum();
25  LOBasisSet.resize(NumCenters);
27 }
size_t NumCenters
number of centers, e.g., ions
void resize(size_type n, size_type m)
Resize the container.
Definition: OhmmsMatrix.h:99
const size_t MaxOrbSize
Maximal number of supported MOs this is not the AO basis because cusp correction is applied on the MO...
const int myTableIndex
number of quantum particles
size_t NumTargets
number of quantum particles
std::vector< std::shared_ptr< const COT > > LOBasisSet
container of the unique pointers to the Atomic Orbitals

◆ SoaCuspCorrection() [2/2]

SoaCuspCorrection ( const SoaCuspCorrection a)
default

copy constructor

Member Function Documentation

◆ add()

void add ( int  icenter,
std::unique_ptr< COT aos 
)

add a new set of Centered Atomic Orbitals

Parameters
icenterthe index of the center
aosa set of Centered Atomic Orbitals

Definition at line 150 of file SoaCuspCorrection.cpp.

References SoaCuspCorrection::LOBasisSet, and SoaCuspCorrection::MaxOrbSize.

Referenced by qmcplusplus::applyCuspCorrection().

151 {
152  assert(MaxOrbSize == aos->getNumOrbs() && "All the centers should support the same number of orbitals!");
153  LOBasisSet[icenter].reset(aos.release());
154 }
const size_t MaxOrbSize
Maximal number of supported MOs this is not the AO basis because cusp correction is applied on the MO...
std::vector< std::shared_ptr< const COT > > LOBasisSet
container of the unique pointers to the Atomic Orbitals

◆ add_vector_vgl()

void add_vector_vgl ( const ParticleSet P,
int  iat,
ValueVector vals,
GradVector dpsi,
ValueVector d2psi 
)
inline

Definition at line 108 of file SoaCuspCorrection.h.

References SoaCuspCorrection::evaluate_vgl().

Referenced by LCAOrbitalSetWithCorrection::evaluateVGL().

109  {
110  evaluate_vgl(P, iat, vals, dpsi, d2psi);
111  }
void evaluate_vgl(const ParticleSet &P, int iat, ValueVector &psi, GradVector &dpsi, ValueVector &d2psi)

◆ add_vgl()

void add_vgl ( const ParticleSet P,
int  iat,
int  idx,
ValueMatrix vals,
GradMatrix dpsi,
ValueMatrix d2psi 
)
inline

Definition at line 104 of file SoaCuspCorrection.h.

References SoaCuspCorrection::evaluate_vgl().

Referenced by LCAOrbitalSetWithCorrection::evaluate_notranspose().

105  {
106  evaluate_vgl(P, iat, idx, vals, dpsi, d2psi);
107  }
void evaluate_vgl(const ParticleSet &P, int iat, ValueVector &psi, GradVector &dpsi, ValueVector &d2psi)

◆ addV()

void addV ( const ParticleSet P,
int  iat,
ValueVector psi 
)
inline

Definition at line 103 of file SoaCuspCorrection.h.

References SoaCuspCorrection::evaluateV().

Referenced by LCAOrbitalSetWithCorrection::evaluateValue().

103 { evaluateV(P, iat, psi); }
void evaluateV(const ParticleSet &P, int iat, ValueVector &psi)
compute values for the iat-paricle move

◆ addVGL()

void addVGL ( const ParticleSet P,
int  iat,
VGLVector vgl 
)
inline

Definition at line 102 of file SoaCuspCorrection.h.

References SoaCuspCorrection::evaluateVGL().

102 { evaluateVGL(P, iat, vgl); }
void evaluateVGL(const ParticleSet &P, int iat, VGLVector &vgl)
compute VGL

◆ evaluate_vgl() [1/2]

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

Definition at line 65 of file SoaCuspCorrection.cpp.

References ParticleSet::getActivePtcl(), ParticleSet::getDistTableAB(), DistanceTableAB::getTempDists(), SoaCuspCorrection::LOBasisSet, SoaCuspCorrection::MaxOrbSize, SoaCuspCorrection::myTableIndex, SoaCuspCorrection::myVGL, and SoaCuspCorrection::NumCenters.

Referenced by SoaCuspCorrection::add_vector_vgl(), and SoaCuspCorrection::add_vgl().

70 {
71  assert(MaxOrbSize >= psi.size());
72  myVGL = 0.0;
73 
74  const auto& d_table = P.getDistTableAB(myTableIndex);
75  const auto& dist = (P.getActivePtcl() == iat) ? d_table.getTempDists() : d_table.getDistRow(iat);
76  const auto& displ = (P.getActivePtcl() == iat) ? d_table.getTempDispls() : d_table.getDisplRow(iat);
77  for (int c = 0; c < NumCenters; c++)
78  if (LOBasisSet[c])
79  LOBasisSet[c]->evaluate_vgl(dist[c], displ[c], myVGL[0], myVGL[1], myVGL[2], myVGL[3], myVGL[4]);
80 
81  const auto v_in = myVGL[0];
82  const auto gx_in = myVGL[1];
83  const auto gy_in = myVGL[2];
84  const auto gz_in = myVGL[3];
85  const auto l_in = myVGL[4];
86  for (size_t i = 0; i < psi.size(); ++i)
87  {
88  psi[i] += v_in[i];
89  dpsi[i][0] += gx_in[i];
90  dpsi[i][1] += gy_in[i];
91  dpsi[i][2] += gz_in[i];
92  d2psi[i] += l_in[i];
93  }
94 }
size_t NumCenters
number of centers, e.g., ions
const size_t MaxOrbSize
Maximal number of supported MOs this is not the AO basis because cusp correction is applied on the MO...
const int myTableIndex
number of quantum particles
std::vector< std::shared_ptr< const COT > > LOBasisSet
container of the unique pointers to the Atomic Orbitals

◆ evaluate_vgl() [2/2]

void evaluate_vgl ( const ParticleSet P,
int  iat,
int  idx,
ValueMatrix psi,
GradMatrix dpsi,
ValueMatrix d2psi 
)

Definition at line 96 of file SoaCuspCorrection.cpp.

References ParticleSet::getActivePtcl(), ParticleSet::getDistTableAB(), DistanceTableAB::getTempDists(), SoaCuspCorrection::LOBasisSet, SoaCuspCorrection::MaxOrbSize, SoaCuspCorrection::myTableIndex, SoaCuspCorrection::myVGL, and SoaCuspCorrection::NumCenters.

102 {
103  assert(MaxOrbSize >= psi.cols());
104  myVGL = 0.0;
105 
106  const auto& d_table = P.getDistTableAB(myTableIndex);
107  const auto& dist = (P.getActivePtcl() == iat) ? d_table.getTempDists() : d_table.getDistRow(iat);
108  const auto& displ = (P.getActivePtcl() == iat) ? d_table.getTempDispls() : d_table.getDisplRow(iat);
109  for (int c = 0; c < NumCenters; c++)
110  if (LOBasisSet[c])
111  LOBasisSet[c]->evaluate_vgl(dist[c], displ[c], myVGL[0], myVGL[1], myVGL[2], myVGL[3], myVGL[4]);
112 
113  const auto v_in = myVGL[0];
114  const auto gx_in = myVGL[1];
115  const auto gy_in = myVGL[2];
116  const auto gz_in = myVGL[3];
117  const auto l_in = myVGL[4];
118  for (size_t i = 0; i < psi.cols(); ++i)
119  {
120  psi[idx][i] += v_in[i];
121  dpsi[idx][i][0] += gx_in[i];
122  dpsi[idx][i][1] += gy_in[i];
123  dpsi[idx][i][2] += gz_in[i];
124  d2psi[idx][i] += l_in[i];
125  }
126 }
size_t NumCenters
number of centers, e.g., ions
const size_t MaxOrbSize
Maximal number of supported MOs this is not the AO basis because cusp correction is applied on the MO...
const int myTableIndex
number of quantum particles
std::vector< std::shared_ptr< const COT > > LOBasisSet
container of the unique pointers to the Atomic Orbitals

◆ evaluateV()

void evaluateV ( const ParticleSet P,
int  iat,
ValueVector psi 
)

compute values for the iat-paricle move

Always uses getTempDists() and getTempDispls()

Definition at line 128 of file SoaCuspCorrection.cpp.

References OMPstd::fill_n(), ParticleSet::getActivePtcl(), ParticleSet::getDistTableAB(), DistanceTableAB::getTempDists(), SoaCuspCorrection::LOBasisSet, SoaCuspCorrection::MaxOrbSize, SoaCuspCorrection::myTableIndex, SoaCuspCorrection::myVGL, SoaCuspCorrection::NumCenters, and Matrix< T, Alloc >::size().

Referenced by SoaCuspCorrection::addV().

129 {
130  assert(MaxOrbSize >= psi.size());
131  ValueType* tmp_vals = myVGL[0];
132 
133  std::fill_n(tmp_vals, myVGL.size(), 0.0);
134 
135  const auto& d_table = P.getDistTableAB(myTableIndex);
136  const auto& dist = (P.getActivePtcl() == iat) ? d_table.getTempDists() : d_table.getDistRow(iat);
137 
138  //THIS IS SERIAL, only way to avoid this is to use myVGL
139  for (int c = 0; c < NumCenters; c++)
140  if (LOBasisSet[c])
141  LOBasisSet[c]->evaluate(dist[c], tmp_vals);
142 
143  { //collect
144  const auto v_in = myVGL[0];
145  for (size_t i = 0; i < psi.size(); ++i)
146  psi[i] += v_in[i];
147  }
148 }
size_t NumCenters
number of centers, e.g., ions
void fill_n(T *x, size_t count, const T &value)
Definition: OMPstd.hpp:21
size_type size() const
Definition: OhmmsMatrix.h:76
const size_t MaxOrbSize
Maximal number of supported MOs this is not the AO basis because cusp correction is applied on the MO...
QMCTraits::ValueType ValueType
const int myTableIndex
number of quantum particles
std::vector< std::shared_ptr< const COT > > LOBasisSet
container of the unique pointers to the Atomic Orbitals

◆ evaluateVGL()

void evaluateVGL ( const ParticleSet P,
int  iat,
VGLVector vgl 
)
inline

compute VGL

Parameters
Pquantum particleset
iatactive particle
vglMatrix(5,BasisSetSize)
trialMoveif true, use getTempDists()/getTempDispls()

Definition at line 31 of file SoaCuspCorrection.cpp.

References VectorSoaContainer< T, D, Alloc >::data(), ParticleSet::getActivePtcl(), ParticleSet::getDistTableAB(), DistanceTableAB::getTempDists(), SoaCuspCorrection::LOBasisSet, SoaCuspCorrection::MaxOrbSize, SoaCuspCorrection::myTableIndex, SoaCuspCorrection::myVGL, SoaCuspCorrection::NumCenters, and VectorSoaContainer< T, D, Alloc >::size().

Referenced by SoaCuspCorrection::addVGL().

32 {
33  assert(MaxOrbSize >= vgl.size());
34  myVGL = 0.0;
35 
36  const auto& d_table = P.getDistTableAB(myTableIndex);
37  const auto& dist = (P.getActivePtcl() == iat) ? d_table.getTempDists() : d_table.getDistRow(iat);
38  const auto& displ = (P.getActivePtcl() == iat) ? d_table.getTempDispls() : d_table.getDisplRow(iat);
39  for (int c = 0; c < NumCenters; c++)
40  if (LOBasisSet[c])
41  LOBasisSet[c]->evaluate_vgl(dist[c], displ[c], myVGL[0], myVGL[1], myVGL[2], myVGL[3], myVGL[4]);
42 
43  {
44  const auto v_in = myVGL[0];
45  const auto gx_in = myVGL[1];
46  const auto gy_in = myVGL[2];
47  const auto gz_in = myVGL[3];
48  const auto l_in = myVGL[4];
49  auto v_out = vgl.data(0);
50  auto gx_out = vgl.data(1);
51  auto gy_out = vgl.data(2);
52  auto gz_out = vgl.data(3);
53  auto l_out = vgl.data(4);
54  for (size_t i = 0; i < vgl.size(); ++i)
55  {
56  v_out[i] += v_in[i];
57  gx_out[i] += gx_in[i];
58  gy_out[i] += gy_in[i];
59  gz_out[i] += gz_in[i];
60  l_out[i] += l_in[i];
61  }
62  }
63 }
size_t NumCenters
number of centers, e.g., ions
const size_t MaxOrbSize
Maximal number of supported MOs this is not the AO basis because cusp correction is applied on the MO...
const int myTableIndex
number of quantum particles
std::vector< std::shared_ptr< const COT > > LOBasisSet
container of the unique pointers to the Atomic Orbitals

Member Data Documentation

◆ LOBasisSet

std::vector<std::shared_ptr<const COT> > LOBasisSet
private

container of the unique pointers to the Atomic Orbitals

size of LOBasisSet = number of centers (atoms) should use unique_ptr once COT is fixed for better performance

Definition at line 63 of file SoaCuspCorrection.h.

Referenced by SoaCuspCorrection::add(), SoaCuspCorrection::evaluate_vgl(), SoaCuspCorrection::evaluateV(), SoaCuspCorrection::evaluateVGL(), and SoaCuspCorrection::SoaCuspCorrection().

◆ MaxOrbSize

const size_t MaxOrbSize
private

Maximal number of supported MOs this is not the AO basis because cusp correction is applied on the MO directly.

Definition at line 53 of file SoaCuspCorrection.h.

Referenced by SoaCuspCorrection::add(), SoaCuspCorrection::evaluate_vgl(), SoaCuspCorrection::evaluateV(), SoaCuspCorrection::evaluateVGL(), and SoaCuspCorrection::SoaCuspCorrection().

◆ myTableIndex

const int myTableIndex
private

number of quantum particles

Definition at line 49 of file SoaCuspCorrection.h.

Referenced by SoaCuspCorrection::evaluate_vgl(), SoaCuspCorrection::evaluateV(), and SoaCuspCorrection::evaluateVGL().

◆ myVGL

◆ NumCenters

size_t NumCenters
private

◆ NumTargets

size_t NumTargets
private

number of quantum particles

Definition at line 47 of file SoaCuspCorrection.h.

Referenced by SoaCuspCorrection::SoaCuspCorrection().


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