QMCPACK
LPQHISRCoulombBasis Class Reference

A derivative of LRBasis class to provide the functionality of the LPQHI basis. More...

+ Inheritance diagram for LPQHISRCoulombBasis:
+ Collaboration diagram for LPQHISRCoulombBasis:

Public Member Functions

 LPQHISRCoulombBasis (const LPQHISRCoulombBasis &b, const ParticleLayout &ref)
 
mRealType get_delta () const
 
void set_NumKnots (int n)
 
void set_rc (mRealType rc) override
 
mRealType h (int n, mRealType r) const override
 
mRealType rh (int n, mRealType r) const
 
mRealType dh_dr (int n, mRealType r) const override
 
mRealType dh_ddelta (int n, mRealType r) const
 
mRealType hintr2 (int n) const override
 
mRealType c (int n, mRealType k) const override
 
mRealType dc_dk (int n, mRealType k) const override
 
 LPQHISRCoulombBasis (const ParticleLayout &ref)
 
- Public Member Functions inherited from LRBasis
 LRBasis (const ParticleLayout &ref)
 
virtual ~LRBasis ()=default
 
int NumBasisElem () const
 
mRealType df (int m, mRealType r) const
 
mRealType f (mRealType r, const std::vector< mRealType > &coefs) const
 $f(r,{tn})$ returns the value of $ t_n*h_{ n}(r)$ r is radial position (scalar) std::vector<RealType> coefs are the {tn} optimized breakup coefficients. More...
 
mRealType df_dr (mRealType r, const std::vector< mRealType > &coefs) const
 
mRealType fk (mRealType k, const std::vector< mRealType > coefs) const
 
mRealType dfk_dk (mRealType k, const std::vector< mRealType > coefs) const
 
mRealType get_rc () const
 
mRealType get_CellVolume () const
 
void set_Lattice (const ParticleLayout &ref)
 
const ParticleLayoutget_Lattice () const
 

Private Member Functions

std::complex< mRealTypeEplus (int i, mRealType k, int n) const
 
std::complex< mRealTypeEminus (int i, mRealType k, int n) const
 
std::complex< mRealTypeEplus_dG (int i, mRealType k, int n) const
 
std::complex< mRealTypeEminus_dG (int i, mRealType k, int n) const
 
mRealType Dplus (int i, mRealType k, int n) const
 
mRealType Dminus (int i, mRealType k, int n) const
 
mRealType Dplus_dG (int i, mRealType k, int n) const
 
mRealType Dminus_dG (int i, mRealType k, int n) const
 

Private Attributes

int NumKnots
 
mRealType delta
 
mRealType deltainv
 
Matrix< mRealTypeS
 
Matrix< mRealTypeS1
 
Matrix< mRealTypeS2
 
mRealType Mfactor [3]
 
std::vector< mRealTypetvec
 

Additional Inherited Members

- Public Types inherited from LRBasis
using ParticleLayout = ParticleSet::ParticleLayout
 Typedef for the lattice-type. We don't need the full particle-set. More...
 
- Public Attributes inherited from LRBasis
DECLARE_COULOMB_TYPES int BasisSize
 size of the basis elements More...
 
mRealType m_rc
 Real-space cutoff for short-range part. More...
 
ParticleLayout Lattice
 

Detailed Description

A derivative of LRBasis class to provide the functionality of the LPQHI basis.

A 1/r factor is incorporated into the basis functions to facilitate real space representation of the short-ranged coulomb potential, following Natoli & Ceperley's 1995 paper on Optimized Breakup. http://dx.doi.org/10.1006/jcph.1995.1054.

Definition at line 29 of file LPQHISRCoulombBasis.h.

Constructor & Destructor Documentation

◆ LPQHISRCoulombBasis() [1/2]

LPQHISRCoulombBasis ( const LPQHISRCoulombBasis b,
const ParticleLayout ref 
)
inline

Definition at line 52 of file LPQHISRCoulombBasis.h.

References LRBasis::BasisSize, LRBasis::m_rc, and LPQHISRCoulombBasis::Mfactor.

53  : LRBasis(ref),
54  NumKnots(b.NumKnots),
55  delta(b.delta),
56  deltainv(b.deltainv),
57  S(b.S),
58  S1(b.S1),
59  S2(b.S2),
60  tvec(b.tvec)
61  {
62  Mfactor[0] = 1.0;
63  Mfactor[1] = -1.0;
64  Mfactor[2] = 1.0;
65  BasisSize = b.BasisSize;
66  m_rc = b.m_rc;
67  }
LRBasis(const ParticleLayout &ref)
Definition: LRBasis.h:50
mRealType m_rc
Real-space cutoff for short-range part.
Definition: LRBasis.h:40
DECLARE_COULOMB_TYPES int BasisSize
size of the basis elements
Definition: LRBasis.h:38

◆ LPQHISRCoulombBasis() [2/2]

LPQHISRCoulombBasis ( const ParticleLayout ref)
inline

Definition at line 195 of file LPQHISRCoulombBasis.h.

References LPQHISRCoulombBasis::Mfactor, Matrix< T, Alloc >::resize(), LPQHISRCoulombBasis::S, and LPQHISRCoulombBasis::S1.

195  : LRBasis(ref), NumKnots(0), delta(0.0)
196  {
197  S.resize(3, 6);
198  S(0, 0) = 1.0;
199  S(0, 1) = 0.0;
200  S(0, 2) = 0.0;
201  S(0, 3) = -10.0;
202  S(0, 4) = 15.0;
203  S(0, 5) = -6.0;
204  S(1, 0) = 0.0;
205  S(1, 1) = 1.0;
206  S(1, 2) = 0.0;
207  S(1, 3) = -6.0;
208  S(1, 4) = 8.0;
209  S(1, 5) = -3.0;
210  S(2, 0) = 0.0;
211  S(2, 1) = 0.0;
212  S(2, 2) = 0.5;
213  S(2, 3) = -1.5;
214  S(2, 4) = 1.5;
215  S(2, 5) = -0.5;
216  S1.resize(3, 5);
217  for (int i = 0; i < 5; i++)
218  {
219  for (int j = 0; j < 3; j++)
220  {
221  S1(j, i) = static_cast<double>(i + 1.0) * S(j, i + 1);
222  }
223  }
224  Mfactor[0] = 1.0;
225  Mfactor[1] = -1.0;
226  Mfactor[2] = 1.0;
227  }
LRBasis(const ParticleLayout &ref)
Definition: LRBasis.h:50
void resize(size_type n, size_type m)
Resize the container.
Definition: OhmmsMatrix.h:99

Member Function Documentation

◆ c()

LPQHISRCoulombBasis::mRealType c ( int  n,
mRealType  k 
) const
overridevirtual

Implements LRBasis.

Definition at line 99 of file LPQHISRCoulombBasis.cpp.

References LPQHISRCoulombBasis::delta, LPQHISRCoulombBasis::Dminus(), LPQHISRCoulombBasis::Dplus(), qmcplusplus::Units::distance::m, qmcplusplus::n, LPQHISRCoulombBasis::NumKnots, qmcplusplus::pow(), LPQHISRCoulombBasis::S, and sign().

100 {
101  int i = m / 3;
102  int alpha = m - 3 * i;
103  mRealType sum = 0.0;
104  if (i == 0)
105  {
106  for (int n = 0; n <= 5; n++)
107  {
108  sum += S(alpha, n) * (Dplus(i, k, n));
109  }
110  }
111  else if (i == (NumKnots - 1))
112  {
113  for (int n = 0; n <= 5; n++)
114  {
115  mRealType sign = ((alpha + n) & 1) ? -1.0 : 1.0;
116  sum += S(alpha, n) * (Dminus(i, k, n) * sign);
117  }
118  }
119  else
120  {
121  for (int n = 0; n <= 5; n++)
122  {
123  mRealType sign = ((alpha + n) & 1) ? -1.0 : 1.0;
124  sum += S(alpha, n) * (Dplus(i, k, n) + Dminus(i, k, n) * sign);
125  }
126  }
127  return std::pow(delta, alpha) * (sum);
128 }
mRealType Dminus(int i, mRealType k, int n) const
EwaldHandler3D::mRealType mRealType
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t pow(const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
double sign(double x)
Definition: Standard.h:73
mRealType Dplus(int i, mRealType k, int n) const

◆ dc_dk()

LPQHISRCoulombBasis::mRealType dc_dk ( int  n,
mRealType  k 
) const
overridevirtual

Reimplemented from LRBasis.

Definition at line 184 of file LPQHISRCoulombBasis.cpp.

References LPQHISRCoulombBasis::delta, LPQHISRCoulombBasis::Dminus_dG(), LPQHISRCoulombBasis::Dplus_dG(), qmcplusplus::Units::distance::m, qmcplusplus::n, LPQHISRCoulombBasis::NumKnots, qmcplusplus::pow(), LPQHISRCoulombBasis::S, and sign().

185 {
186  int i = m / 3;
187  int alpha = m - 3 * i;
188  mRealType sum = 0.0;
189  if (i == 0)
190  {
191  for (int n = 0; n <= 5; n++)
192  {
193  sum += S(alpha, n) * (Dplus_dG(i, k, n));
194  }
195  }
196  else if (i == (NumKnots - 1))
197  {
198  for (int n = 0; n <= 5; n++)
199  {
200  mRealType sign = ((alpha + n) & 1) ? -1.0 : 1.0;
201  sum += S(alpha, n) * (Dminus_dG(i, k, n) * sign);
202  }
203  }
204  else
205  {
206  for (int n = 0; n <= 5; n++)
207  {
208  mRealType sign = ((alpha + n) & 1) ? -1.0 : 1.0;
209  sum += S(alpha, n) * (Dplus_dG(i, k, n) + Dminus_dG(i, k, n) * sign);
210  }
211  }
212  return std::pow(delta, alpha) * (sum);
213 }
EwaldHandler3D::mRealType mRealType
mRealType Dplus_dG(int i, mRealType k, int n) const
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t pow(const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
double sign(double x)
Definition: Standard.h:73
mRealType Dminus_dG(int i, mRealType k, int n) const

◆ dh_ddelta()

mRealType dh_ddelta ( int  n,
mRealType  r 
) const
inline

Definition at line 154 of file LPQHISRCoulombBasis.h.

References LPQHISRCoulombBasis::delta, LPQHISRCoulombBasis::dh_dr(), LPQHISRCoulombBasis::h(), and qmcplusplus::n.

155  {
156  int i = n / 3;
157  int alpha = n - 3 * i;
158 
159  return h(n, r) * alpha / double(delta) - dh_dr(n, r) * r / double(delta);
160  }
mRealType h(int n, mRealType r) const override
mRealType dh_dr(int n, mRealType r) const override

◆ dh_dr()

mRealType dh_dr ( int  n,
mRealType  r 
) const
inlineoverridevirtual

Reimplemented from LRBasis.

Definition at line 123 of file LPQHISRCoulombBasis.h.

References LPQHISRCoulombBasis::delta, LPQHISRCoulombBasis::deltainv, LPQHISRCoulombBasis::h(), LRBasis::m_rc, LPQHISRCoulombBasis::Mfactor, omptarget::min(), qmcplusplus::n, qmcplusplus::pow(), and LPQHISRCoulombBasis::S1.

Referenced by LPQHISRCoulombBasis::dh_ddelta().

124  {
125  int i = n / 3;
126  int alpha = n - 3 * i;
127  mRealType ra = delta * (i - 1);
128  mRealType rb = delta * i;
129  mRealType rc = delta * (i + 1);
130  rc = std::min(m_rc, rc);
131 
132  mRealType polyderiv = 0.0;
133  mRealType rinv = 1.0 / r;
134  mRealType hval = h(n, r);
135 
136  const mRealType* restrict Sa(S1[alpha]);
137  if (r < ra || r > rc)
138  return 0.0;
139  if (r <= rb)
140  {
141  mRealType x = (rb - r) * deltainv;
142  polyderiv =
143  -std::pow(delta, alpha - 1) * Mfactor[alpha] * (Sa[0] + x * (Sa[1] + x * (Sa[2] + x * (Sa[3] + x * Sa[4]))));
144  }
145  else
146  {
147  mRealType x = (r - rb) * deltainv;
148  polyderiv = std::pow(delta, alpha - 1) * (Sa[0] + x * (Sa[1] + x * (Sa[2] + x * (Sa[3] + x * Sa[4]))));
149  }
150 
151  return rinv * (polyderiv - hval);
152  }
EwaldHandler3D::mRealType mRealType
T min(T a, T b)
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t pow(const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
mRealType m_rc
Real-space cutoff for short-range part.
Definition: LRBasis.h:40
mRealType h(int n, mRealType r) const override

◆ Dminus()

LPQHISRCoulombBasis::mRealType Dminus ( int  i,
mRealType  k,
int  n 
) const
inlineprivate

Definition at line 178 of file LPQHISRCoulombBasis.cpp.

References LPQHISRCoulombBasis::Eminus(), qmcplusplus::n, and CrystalLattice< T, D >::Volume.

Referenced by LPQHISRCoulombBasis::c(), and LPQHISRCoulombBasis::Dminus_dG().

179 {
180  std::complex<mRealType> Z1 = Eminus(i, k, n);
181  return -4.0 * M_PI / (k * Lattice.Volume) * (Z1.imag());
182 }
std::complex< mRealType > Eminus(int i, mRealType k, int n) const
ParticleLayout Lattice
Definition: LRBasis.h:46
Scalar_t Volume
Physical properties of a supercell.

◆ Dminus_dG()

LPQHISRCoulombBasis::mRealType Dminus_dG ( int  i,
mRealType  k,
int  n 
) const
inlineprivate

Definition at line 260 of file LPQHISRCoulombBasis.cpp.

References LPQHISRCoulombBasis::Dminus(), LPQHISRCoulombBasis::Eminus_dG(), qmcplusplus::n, and CrystalLattice< T, D >::Volume.

Referenced by LPQHISRCoulombBasis::dc_dk().

261 {
262  mRealType kinv = 1.0 / mRealType(k);
263  std::complex<mRealType> Z1 = Eminus_dG(i, k, n);
264  return -4.0 * M_PI / (k * Lattice.Volume) * Z1.imag() - kinv * Dminus(i, k, n);
265 }
mRealType Dminus(int i, mRealType k, int n) const
EwaldHandler3D::mRealType mRealType
ParticleLayout Lattice
Definition: LRBasis.h:46
Scalar_t Volume
Physical properties of a supercell.
std::complex< mRealType > Eminus_dG(int i, mRealType k, int n) const

◆ Dplus()

LPQHISRCoulombBasis::mRealType Dplus ( int  i,
mRealType  k,
int  n 
) const
inlineprivate

Definition at line 171 of file LPQHISRCoulombBasis.cpp.

References LPQHISRCoulombBasis::Eplus(), qmcplusplus::n, and CrystalLattice< T, D >::Volume.

Referenced by LPQHISRCoulombBasis::c(), and LPQHISRCoulombBasis::Dplus_dG().

172 {
173  std::complex<mRealType> Z1 = Eplus(i, k, n);
174  return 4.0 * M_PI / (k * Lattice.Volume) * (Z1.imag());
175 }
ParticleLayout Lattice
Definition: LRBasis.h:46
Scalar_t Volume
Physical properties of a supercell.
std::complex< mRealType > Eplus(int i, mRealType k, int n) const

◆ Dplus_dG()

LPQHISRCoulombBasis::mRealType Dplus_dG ( int  i,
mRealType  k,
int  n 
) const
inlineprivate

Definition at line 251 of file LPQHISRCoulombBasis.cpp.

References LPQHISRCoulombBasis::Dplus(), LPQHISRCoulombBasis::Eplus_dG(), qmcplusplus::n, and CrystalLattice< T, D >::Volume.

Referenced by LPQHISRCoulombBasis::dc_dk().

252 {
253  mRealType kinv = 1.0 / mRealType(k);
254  std::complex<mRealType> Z1 = Eplus_dG(i, k, n);
255 
256  return 4.0 * M_PI / (k * Lattice.Volume) * Z1.imag() - kinv * Dplus(i, k, n);
257 }
EwaldHandler3D::mRealType mRealType
ParticleLayout Lattice
Definition: LRBasis.h:46
Scalar_t Volume
Physical properties of a supercell.
mRealType Dplus(int i, mRealType k, int n) const
std::complex< mRealType > Eplus_dG(int i, mRealType k, int n) const

◆ Eminus()

std::complex< LPQHISRCoulombBasis::mRealType > Eminus ( int  i,
mRealType  k,
int  n 
) const
inlineprivate

Definition at line 151 of file LPQHISRCoulombBasis.cpp.

References qmcplusplus::cos(), LPQHISRCoulombBasis::delta, qmcplusplus::n, sign(), and qmcplusplus::sin().

Referenced by LPQHISRCoulombBasis::Dminus(), and LPQHISRCoulombBasis::Eminus_dG().

152 {
153  std::complex<mRealType> eye(0.0, 1.0);
154  if (n == 0)
155  {
156  std::complex<mRealType> e1(cos(k * delta) - 1.0, -sin(k * delta));
157  std::complex<mRealType> e2(cos(k * delta * i), sin(k * delta * i));
158  return (-(eye / k) * e1 * e2);
159  }
160  else
161  {
162  std::complex<mRealType> t1, t2;
163  mRealType sign = (n & 1) ? -1.0 : 1.0;
164  t1 = sign * std::complex<mRealType>(cos(k * delta * (i - 1)), sin(k * delta * (i - 1)));
165  t2 = -(mRealType)n / delta * Eminus(i, k, n - 1);
166  return (-(eye / k) * (t1 + t2));
167  }
168 }
std::complex< mRealType > Eminus(int i, mRealType k, int n) const
MakeReturn< UnaryNode< FnSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sin(const Vector< T1, C1 > &l)
EwaldHandler3D::mRealType mRealType
MakeReturn< UnaryNode< FnCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t cos(const Vector< T1, C1 > &l)
double sign(double x)
Definition: Standard.h:73

◆ Eminus_dG()

std::complex< LPQHISRCoulombBasis::mRealType > Eminus_dG ( int  i,
mRealType  k,
int  n 
) const
inlineprivate

Definition at line 230 of file LPQHISRCoulombBasis.cpp.

References qmcplusplus::cos(), LPQHISRCoulombBasis::delta, LPQHISRCoulombBasis::Eminus(), qmcplusplus::n, qmcplusplus::pow(), and qmcplusplus::sin().

Referenced by LPQHISRCoulombBasis::Dminus_dG().

231 {
232  std::complex<mRealType> eye(0.0, 1.0);
233  mRealType ri = i * delta;
234  mRealType kinv = 1.0 / mRealType(k);
235  std::complex<mRealType> eigd(cos(k * delta), -sin(k * delta));
236  std::complex<mRealType> eigr(cos(k * ri), sin(k * ri));
237 
238  if (n == 0)
239  {
240  std::complex<mRealType> eigd(cos(k * delta), -sin(k * delta));
241  std::complex<mRealType> eigr(cos(k * ri), sin(k * ri));
242  return Eminus(i, k, n) * (eye * ri - kinv) - delta * kinv * eigr * eigd;
243  }
244  else
245  return -kinv * Eminus(i, k, n) -
246  eye * kinv *
247  (mRealType(pow(-1.0, n)) * eye * (ri - delta) * eigd * eigr - (n / mRealType(delta)) * Eminus_dG(i, k, n - 1));
248 }
std::complex< mRealType > Eminus(int i, mRealType k, int n) const
MakeReturn< UnaryNode< FnSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sin(const Vector< T1, C1 > &l)
EwaldHandler3D::mRealType mRealType
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t pow(const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
MakeReturn< UnaryNode< FnCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t cos(const Vector< T1, C1 > &l)
std::complex< mRealType > Eminus_dG(int i, mRealType k, int n) const

◆ Eplus()

std::complex< LPQHISRCoulombBasis::mRealType > Eplus ( int  i,
mRealType  k,
int  n 
) const
inlineprivate

Definition at line 131 of file LPQHISRCoulombBasis.cpp.

References qmcplusplus::cos(), LPQHISRCoulombBasis::delta, qmcplusplus::n, and qmcplusplus::sin().

Referenced by LPQHISRCoulombBasis::Dplus(), and LPQHISRCoulombBasis::Eplus_dG().

132 {
133  std::complex<mRealType> eye(0.0, 1.0);
134  if (n == 0)
135  {
136  std::complex<mRealType> e1(cos(k * delta) - 1.0, sin(k * delta));
137  std::complex<mRealType> e2(cos(k * delta * i), sin(k * delta * i));
138  return (-(eye / k) * e1 * e2);
139  }
140  else
141  {
142  std::complex<mRealType> t1, t2;
143  t1 = std::complex<mRealType>(cos(k * delta * (i + 1)), sin(k * delta * (i + 1)));
144  t2 = -(mRealType)n / delta * Eplus(i, k, n - 1);
145  ;
146  return (-(eye / k) * (t1 + t2));
147  }
148 }
MakeReturn< UnaryNode< FnSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sin(const Vector< T1, C1 > &l)
EwaldHandler3D::mRealType mRealType
MakeReturn< UnaryNode< FnCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t cos(const Vector< T1, C1 > &l)
std::complex< mRealType > Eplus(int i, mRealType k, int n) const

◆ Eplus_dG()

std::complex< LPQHISRCoulombBasis::mRealType > Eplus_dG ( int  i,
mRealType  k,
int  n 
) const
inlineprivate

Definition at line 215 of file LPQHISRCoulombBasis.cpp.

References qmcplusplus::cos(), LPQHISRCoulombBasis::delta, LPQHISRCoulombBasis::Eplus(), qmcplusplus::n, and qmcplusplus::sin().

Referenced by LPQHISRCoulombBasis::Dplus_dG().

216 {
217  std::complex<mRealType> eye(0.0, 1.0);
218  mRealType ri = i * delta;
219  mRealType kinv = 1 / mRealType(k);
220  std::complex<mRealType> eigd(cos(k * delta), sin(k * delta));
221  std::complex<mRealType> eigr(cos(k * ri), sin(k * ri));
222 
223  if (n == 0)
224  return Eplus(i, k, n) * (eye * ri - kinv) + delta * kinv * eigr * eigd;
225  else
226  return -kinv * Eplus(i, k, n) -
227  eye * kinv * (eye * (ri + delta) * eigd * eigr - (n / mRealType(delta)) * Eplus_dG(i, k, n - 1));
228 }
MakeReturn< UnaryNode< FnSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sin(const Vector< T1, C1 > &l)
EwaldHandler3D::mRealType mRealType
MakeReturn< UnaryNode< FnCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t cos(const Vector< T1, C1 > &l)
std::complex< mRealType > Eplus(int i, mRealType k, int n) const
std::complex< mRealType > Eplus_dG(int i, mRealType k, int n) const

◆ get_delta()

mRealType get_delta ( ) const
inline

Definition at line 69 of file LPQHISRCoulombBasis.h.

References LPQHISRCoulombBasis::delta.

◆ h()

mRealType h ( int  n,
mRealType  r 
) const
inlineoverridevirtual

Implements LRBasis.

Definition at line 73 of file LPQHISRCoulombBasis.h.

References LPQHISRCoulombBasis::delta, LPQHISRCoulombBasis::deltainv, LRBasis::m_rc, LPQHISRCoulombBasis::Mfactor, omptarget::min(), qmcplusplus::n, qmcplusplus::pow(), and LPQHISRCoulombBasis::S.

Referenced by LPQHISRCoulombBasis::dh_ddelta(), and LPQHISRCoulombBasis::dh_dr().

74  {
75  int i = n / 3;
76  int alpha = n - 3 * i;
77  mRealType ra = delta * (i - 1);
78  mRealType rb = delta * i;
79  mRealType rc = delta * (i + 1);
80  mRealType rinv = 1.0 / r;
81  rc = std::min(m_rc, rc);
82  const mRealType* restrict Sa(S[alpha]);
83  if (r < ra || r > rc)
84  return 0.0;
85  if (r <= rb)
86  {
87  mRealType x = (rb - r) * deltainv;
88  return std::pow(delta, alpha) * Mfactor[alpha] * rinv *
89  (Sa[0] + x * (Sa[1] + x * (Sa[2] + x * (Sa[3] + x * (Sa[4] + x * Sa[5])))));
90  }
91  else
92  {
93  mRealType x = (r - rb) * deltainv;
94  return std::pow(delta, alpha) * rinv *
95  (Sa[0] + x * (Sa[1] + x * (Sa[2] + x * (Sa[3] + x * (Sa[4] + x * Sa[5])))));
96  }
97  }
EwaldHandler3D::mRealType mRealType
T min(T a, T b)
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t pow(const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
mRealType m_rc
Real-space cutoff for short-range part.
Definition: LRBasis.h:40

◆ hintr2()

LPQHISRCoulombBasis::mRealType hintr2 ( int  n) const
overridevirtual

Implements LRBasis.

Definition at line 79 of file LPQHISRCoulombBasis.cpp.

References LPQHISRCoulombBasis::delta, qmcplusplus::n, LPQHISRCoulombBasis::NumKnots, qmcplusplus::pow(), and LPQHISRCoulombBasis::S.

80 {
81  int j = n / 3;
82  int alpha = n - 3 * j;
83  mRealType deltaa2 = std::pow(delta, alpha + 2.0);
84  int mysign = 1 - 2 * (alpha % 2);
85  mRealType sum = 0.0;
86 
87  for (int i = 0; i <= 5; i++)
88  {
89  if (j < NumKnots - 1)
90  sum += S(alpha, i) * deltaa2 * (1.0 / mRealType(i + 2) + mRealType(j) / mRealType(i + 1));
91  if (j > 0)
92  sum += mysign * S(alpha, i) * deltaa2 * (-1.0 / mRealType(i + 2) + mRealType(j) / mRealType(i + 1));
93  }
94 
95  return (sum);
96 }
EwaldHandler3D::mRealType mRealType
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t pow(const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)

◆ rh()

mRealType rh ( int  n,
mRealType  r 
) const
inline

Definition at line 99 of file LPQHISRCoulombBasis.h.

References LPQHISRCoulombBasis::delta, LPQHISRCoulombBasis::deltainv, LRBasis::m_rc, LPQHISRCoulombBasis::Mfactor, omptarget::min(), qmcplusplus::n, qmcplusplus::pow(), and LPQHISRCoulombBasis::S.

100  {
101  int i = n / 3;
102  int alpha = n - 3 * i;
103  mRealType ra = delta * (i - 1);
104  mRealType rb = delta * i;
105  mRealType rc = delta * (i + 1);
106  rc = std::min(m_rc, rc);
107  const mRealType* restrict Sa(S[alpha]);
108  if (r < ra || r > rc)
109  return 0.0;
110  if (r <= rb)
111  {
112  mRealType x = (rb - r) * deltainv;
113  return std::pow(delta, alpha) * Mfactor[alpha] *
114  (Sa[0] + x * (Sa[1] + x * (Sa[2] + x * (Sa[3] + x * (Sa[4] + x * Sa[5])))));
115  }
116  else
117  {
118  mRealType x = (r - rb) * deltainv;
119  return std::pow(delta, alpha) * (Sa[0] + x * (Sa[1] + x * (Sa[2] + x * (Sa[3] + x * (Sa[4] + x * Sa[5])))));
120  }
121  }
EwaldHandler3D::mRealType mRealType
T min(T a, T b)
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t pow(const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
mRealType m_rc
Real-space cutoff for short-range part.
Definition: LRBasis.h:40

◆ set_NumKnots()

void set_NumKnots ( int  n)

Definition at line 22 of file LPQHISRCoulombBasis.cpp.

References LRBasis::BasisSize, LPQHISRCoulombBasis::delta, LPQHISRCoulombBasis::deltainv, LRBasis::m_rc, qmcplusplus::n, and LPQHISRCoulombBasis::NumKnots.

23 {
24  assert(n > 1);
25  NumKnots = n;
26  if (m_rc != 0.0)
27  {
28  delta = m_rc / (NumKnots - 1);
29  deltainv = 1.0 / delta;
30  }
31  //set the BasisSize to 3*NumKnots
32  BasisSize = 3 * NumKnots;
33 }
mRealType m_rc
Real-space cutoff for short-range part.
Definition: LRBasis.h:40
DECLARE_COULOMB_TYPES int BasisSize
size of the basis elements
Definition: LRBasis.h:38

◆ set_rc()

void set_rc ( mRealType  rc)
overridevirtual

Implements LRBasis.

Definition at line 36 of file LPQHISRCoulombBasis.cpp.

References LPQHISRCoulombBasis::delta, LPQHISRCoulombBasis::deltainv, LRBasis::m_rc, and LPQHISRCoulombBasis::NumKnots.

37 {
38  m_rc = rc;
39  if (NumKnots != 0)
40  {
41  delta = m_rc / (NumKnots - 1);
42  deltainv = 1.0 / delta;
43  }
44 }
mRealType m_rc
Real-space cutoff for short-range part.
Definition: LRBasis.h:40

Member Data Documentation

◆ delta

◆ deltainv

◆ Mfactor

◆ NumKnots

◆ S

◆ S1

◆ S2

Matrix<mRealType> S2
private

Definition at line 36 of file LPQHISRCoulombBasis.h.

◆ tvec

std::vector<mRealType> tvec
private

Definition at line 38 of file LPQHISRCoulombBasis.h.


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