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

Public Member Functions

 EwaldHandlerQuasi2D (ParticleSet &ref, mRealType kc_in=-1.0)
 
LRHandlerBasemakeClone (ParticleSet &ref) const override
 make clone More...
 
mRealType evaluate (mRealType r, mRealType rinv) const override
 
mRealType evaluateLR_r0 () const override
 evaluate $ v_s(r=0) $ for the self-interaction term More...
 
mRealType evaluateLR (mRealType r) const override
 
mRealType evaluateSR_k0 () const override
 evaluate $ v_{s}(k=0) = \frac{4\pi}{V}\int_0^{r_c} r^2 v_s(r) dr $ More...
 
void fillFk (const KContainer &KList)
 
mRealType evaluate_slab (pRealType z, const std::vector< int > &kshell, const pRealType *restrict rk1_r, const pRealType *restrict rk1_i, const pRealType *restrict rk2_r, const pRealType *restrict rk2_i) const override
 Evaluate the long-range potential with the open BC for the D-1 direction. More...
 
mRealType srDf (mRealType r, mRealType rinv) const override
 
mRealType lrDf (mRealType r) const override
 
virtual mRealType evaluate_vlr_k (mRealType k) const override
 
void initBreakup (ParticleSet &ref) override
 
void Breakup (ParticleSet &ref, mRealType rs_in) override
 
void resetTargetParticleSet (ParticleSet &ref) override
 
- Public Member Functions inherited from LRHandlerBase
 LRHandlerBase (mRealType kc)
 
virtual ~LRHandlerBase ()=default
 
mRealType get_rc () const
 
mRealType get_kc () const
 
mRealType evaluate_w_sk (const std::vector< int > &kshell, const pRealType *restrict sk) const
 
mRealType evaluate (const std::vector< int > &kshell, const pRealType *restrict rk1_r, const pRealType *restrict rk1_i, const pRealType *restrict rk2_r, const pRealType *restrict rk2_i) const
 evaluate $\sum_k F_{k} \rho^1_{-{\bf k}} \rho^2_{\bf k}$ More...
 
void evaluateGrad (const ParticleSet &A, const ParticleSet &B, int specB, std::vector< pRealType > &Zat, std::vector< TinyVector< pRealType, OHMMS_DIM >> &grad1) const
 evaluate $\sum_k F_{k} \rho^1_{-{\bf k}} \rho^2_{\bf k}$ and $\sum_k F_{k} \rho^1_{-{\bf k}} \rho^2_{\bf k}$ More...
 
SymTensor< pRealType, OHMMS_DIMevaluateStress (const std::vector< int > &kshell, const pRealType *rhokA_r, const pRealType *rhokA_i, const pRealType *rhokB_r, const pRealType *rhokB_i) const
 FIX_PRECISION. More...
 
virtual SymTensor< mRealType, OHMMS_DIMevaluateLR_r0_dstrain () const
 These functions return the strain derivatives of all corresponding quantities in total energy. More...
 
virtual SymTensor< mRealType, OHMMS_DIMevaluateSR_k0_dstrain () const
 
virtual SymTensor< mRealType, OHMMS_DIMevaluateLR_dstrain (TinyVector< pRealType, OHMMS_DIM > k, pRealType kmag) const
 
virtual SymTensor< mRealType, OHMMS_DIMevaluateSR_dstrain (TinyVector< pRealType, OHMMS_DIM > r, pRealType rmag) const
 

Private Member Functions

mRealType slabFunc (mRealType z, mRealType k) const
 
mRealType slabLogf (mRealType z, mRealType k) const
 
mRealType slab_vsr_k0 (mRealType z) const
 

Private Attributes

mRealType alpha
 
mRealType area
 
std::vector< mRealTypekmags
 store |k| More...
 

Additional Inherited Members

- Public Attributes inherited from LRHandlerBase
DECLARE_COULOMB_TYPES int MaxKshell
 Maxkimum Kshell for the given Kc. More...
 
mRealType LR_kc
 Maximum k cutoff. More...
 
mRealType LR_rc
 Maximum r cutoff. More...
 
Vector< mRealTypeFk
 Fourier component for all the k-point. More...
 
Vector< mRealTypeFkg
 Fourier component of the LR part, fit to optimize the gradients. More...
 
std::vector< SymTensor< mRealType, OHMMS_DIM > > dFk_dstrain
 Fourier component of the LR part of strain tensor, by optimized breakup. More...
 
Vector< mRealTypeFkgstrain
 Vector of df_k/dk, fit as to optimize strains. More...
 
Vector< mRealTypeFk_symm
 Fourier component for each k-shell. More...
 
std::vector< mRealTypecoefs
 Fourier component for each k-shell Coefficient. More...
 
std::vector< mRealTypegcoefs
 Coefficient for gradient fit. More...
 
std::vector< mRealTypegstraincoefs
 Coefficient for strain fit. More...
 
- Protected Attributes inherited from LRHandlerBase
std::string ClassName
 

Detailed Description

Definition at line 24 of file EwaldHandlerQuasi2D.h.

Constructor & Destructor Documentation

◆ EwaldHandlerQuasi2D()

EwaldHandlerQuasi2D ( ParticleSet ref,
mRealType  kc_in = -1.0 
)

Definition at line 20 of file EwaldHandlerQuasi2D.cpp.

References EwaldHandlerQuasi2D::alpha, qmcplusplus::app_log(), EwaldHandlerQuasi2D::area, EwaldHandlerQuasi2D::fillFk(), ParticleSet::getLattice(), ParticleSet::getSimulationCell(), LRHandlerBase::LR_kc, LRHandlerBase::LR_rc, qmcplusplus::sqrt(), and qmcplusplus::SUPERCELL_SLAB.

Referenced by EwaldHandlerQuasi2D::makeClone().

21  : LRHandlerBase(kc_in)
22 {
23  if (ref.getLattice().SuperCellEnum != SUPERCELL_SLAB)
24  throw std::runtime_error("Quasi2D Ewald requires ppn boundary.");
25  LR_rc = ref.getLattice().LR_rc; // CoulombPBC needs get_rc() to createSpline4RbyVs
26  LR_kc = ref.getLattice().LR_kc; // get_kc() is used in QMCFiniteSize
27  alpha = std::sqrt(LR_kc/2.0/LR_rc);
28  area = ref.getLattice().Volume/ref.getLattice().R(2,2);
29  // report
30  app_log() << " alpha = " << alpha << " area = " << area << std::endl;
31  fillFk(ref.getSimulationCell().getKLists());
32 }
mRealType LR_kc
Maximum k cutoff.
Definition: LRHandlerBase.h:37
std::ostream & app_log()
Definition: OutputManager.h:65
void fillFk(const KContainer &KList)
mRealType LR_rc
Maximum r cutoff.
Definition: LRHandlerBase.h:39
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

Member Function Documentation

◆ Breakup()

void Breakup ( ParticleSet ref,
mRealType  rs_in 
)
inlineoverridevirtual

Implements LRHandlerBase.

Definition at line 63 of file EwaldHandlerQuasi2D.h.

References EwaldHandlerQuasi2D::initBreakup().

63 { initBreakup(ref); }
void initBreakup(ParticleSet &ref) override

◆ evaluate()

mRealType evaluate ( mRealType  r,
mRealType  rinv 
) const
inlineoverridevirtual

Implements LRHandlerBase.

Definition at line 33 of file EwaldHandlerQuasi2D.h.

References EwaldHandlerQuasi2D::alpha.

33 { return erfc(alpha*r) * rinv; }

◆ evaluate_slab()

EwaldHandlerQuasi2D::mRealType evaluate_slab ( pRealType  z,
const std::vector< int > &  kshell,
const pRealType *restrict  rk1_r,
const pRealType *restrict  rk1_i,
const pRealType *restrict  rk2_r,
const pRealType *restrict  rk2_i 
) const
overridevirtual

Evaluate the long-range potential with the open BC for the D-1 direction.

Reimplemented from LRHandlerBase.

Definition at line 55 of file EwaldHandlerQuasi2D.cpp.

References qmcplusplus::abs(), EwaldHandlerQuasi2D::area, LRHandlerBase::Fk_symm, EwaldHandlerQuasi2D::kmags, LRHandlerBase::MaxKshell, EwaldHandlerQuasi2D::slab_vsr_k0(), and EwaldHandlerQuasi2D::slabFunc().

61 {
62  mRealType zmag = std::abs(z);
63  mRealType vk = -slab_vsr_k0(zmag)/area;
64  for (int ks = 0, ki = 0; ks < MaxKshell; ks++)
65  {
66  mRealType u = 0;
67  for (; ki < kshell[ks + 1]; ki++)
68  u += (*rk1_r++) * (*rk2_r++) + (*rk1_i++) * (*rk2_i++);
69  vk += u * Fk_symm[ks] * slabFunc(zmag, kmags[ks]);
70  }
71  return vk;
72 }
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
DECLARE_COULOMB_TYPES int MaxKshell
Maxkimum Kshell for the given Kc.
Definition: LRHandlerBase.h:35
EwaldHandler3D::mRealType mRealType
mRealType slab_vsr_k0(mRealType z) const
std::vector< mRealType > kmags
store |k|
mRealType slabFunc(mRealType z, mRealType k) const
Vector< mRealType > Fk_symm
Fourier component for each k-shell.
Definition: LRHandlerBase.h:49

◆ evaluate_vlr_k()

virtual mRealType evaluate_vlr_k ( mRealType  k) const
inlineoverridevirtual

Implements LRHandlerBase.

Definition at line 58 of file EwaldHandlerQuasi2D.h.

59  {
60  throw std::runtime_error("Quasi2D Ewald vlr_k not implemented");
61  }

◆ evaluateLR()

mRealType evaluateLR ( mRealType  r) const
inlineoverridevirtual

Implements LRHandlerBase.

Definition at line 37 of file EwaldHandlerQuasi2D.h.

References EwaldHandlerQuasi2D::alpha.

37 { return erf(alpha*r) / r; }

◆ evaluateLR_r0()

mRealType evaluateLR_r0 ( ) const
inlineoverridevirtual

evaluate $ v_s(r=0) $ for the self-interaction term

Reimplemented from LRHandlerBase.

Definition at line 34 of file EwaldHandlerQuasi2D.h.

References EwaldHandlerQuasi2D::alpha, and qmcplusplus::sqrt().

34 { return 2.0 * alpha / std::sqrt(M_PI); }
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

◆ evaluateSR_k0()

mRealType evaluateSR_k0 ( ) const
inlineoverridevirtual

evaluate $ v_{s}(k=0) = \frac{4\pi}{V}\int_0^{r_c} r^2 v_s(r) dr $

Reimplemented from LRHandlerBase.

Definition at line 38 of file EwaldHandlerQuasi2D.h.

References EwaldHandlerQuasi2D::area, and EwaldHandlerQuasi2D::slab_vsr_k0().

38 { return slab_vsr_k0(0)/area; }
mRealType slab_vsr_k0(mRealType z) const

◆ fillFk()

void fillFk ( const KContainer KList)

Definition at line 34 of file EwaldHandlerQuasi2D.cpp.

References EwaldHandlerQuasi2D::area, LRHandlerBase::Fk, LRHandlerBase::Fk_symm, EwaldHandlerQuasi2D::kmags, KContainer::kpts_cart, KContainer::kshell, KContainer::ksq, LRHandlerBase::MaxKshell, Vector< T, Alloc >::resize(), Vector< T, Alloc >::size(), and qmcplusplus::sqrt().

Referenced by EwaldHandlerQuasi2D::EwaldHandlerQuasi2D().

35 {
36  const mRealType knorm = M_PI / area;
37  mRealType kmag, uk;
38 
39  Fk.resize(KList.kpts_cart.size());
40  MaxKshell = KList.kshell.size() - 1;
42 
43  kmags.resize(MaxKshell);
44  for (int ks = 0, ki = 0; ks < Fk_symm.size(); ks++)
45  {
46  kmag = std::sqrt(KList.ksq[ki]);
47  kmags[ks] = kmag; // store k magnitutes
48  uk = knorm/kmag;
49  Fk_symm[ks] = uk;
50  while (ki < KList.kshell[ks + 1] && ki < Fk.size())
51  Fk[ki++] = uk;
52  }
53 }
void resize(size_type n, Type_t val=Type_t())
Resize the container.
Definition: OhmmsVector.h:166
DECLARE_COULOMB_TYPES int MaxKshell
Maxkimum Kshell for the given Kc.
Definition: LRHandlerBase.h:35
EwaldHandler3D::mRealType mRealType
size_type size() const
return the current size
Definition: OhmmsVector.h:162
Vector< mRealType > Fk
Fourier component for all the k-point.
Definition: LRHandlerBase.h:41
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
std::vector< mRealType > kmags
store |k|
Vector< mRealType > Fk_symm
Fourier component for each k-shell.
Definition: LRHandlerBase.h:49

◆ initBreakup()

void initBreakup ( ParticleSet ref)
inlineoverridevirtual

Implements LRHandlerBase.

Definition at line 62 of file EwaldHandlerQuasi2D.h.

Referenced by EwaldHandlerQuasi2D::Breakup().

62 {}

◆ lrDf()

mRealType lrDf ( mRealType  r) const
inlineoverridevirtual

Reimplemented from LRHandlerBase.

Definition at line 54 of file EwaldHandlerQuasi2D.h.

55  {
56  throw std::runtime_error("Quasi2D Ewald lr derivative not implemented");
57  }

◆ makeClone()

LRHandlerBase* makeClone ( ParticleSet ref) const
inlineoverridevirtual

make clone

Implements LRHandlerBase.

Definition at line 30 of file EwaldHandlerQuasi2D.h.

References EwaldHandlerQuasi2D::EwaldHandlerQuasi2D().

30 { return new EwaldHandlerQuasi2D(*this); }
EwaldHandlerQuasi2D(ParticleSet &ref, mRealType kc_in=-1.0)

◆ resetTargetParticleSet()

void resetTargetParticleSet ( ParticleSet ref)
inlineoverridevirtual

Implements LRHandlerBase.

Definition at line 64 of file EwaldHandlerQuasi2D.h.

64 {}

◆ slab_vsr_k0()

EwaldHandlerQuasi2D::mRealType slab_vsr_k0 ( mRealType  z) const
private

Definition at line 90 of file EwaldHandlerQuasi2D.cpp.

References EwaldHandlerQuasi2D::alpha, qmcplusplus::exp(), and qmcplusplus::sqrt().

Referenced by EwaldHandlerQuasi2D::evaluate_slab(), and EwaldHandlerQuasi2D::evaluateSR_k0().

91 {
92  mRealType z1 = alpha*z;
93  mRealType term1 = std::exp(-z1*z1) * 2*std::sqrt(M_PI)/alpha;
94  mRealType term2 = 2*M_PI*z*erfc(z1);
95  return term1-term2;
96 }
EwaldHandler3D::mRealType mRealType
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t exp(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

◆ slabFunc()

EwaldHandlerQuasi2D::mRealType slabFunc ( mRealType  z,
mRealType  k 
) const
private

Definition at line 74 of file EwaldHandlerQuasi2D.cpp.

References qmcplusplus::exp(), and EwaldHandlerQuasi2D::slabLogf().

Referenced by EwaldHandlerQuasi2D::evaluate_slab().

75 {
76  mRealType term1, term2;
77  term1 = std::exp(slabLogf( z, k));
78  term2 = std::exp(slabLogf(-z, k));
79  return term1+term2;
80 }
EwaldHandler3D::mRealType mRealType
mRealType slabLogf(mRealType z, mRealType k) const
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t exp(const Vector< T1, C1 > &l)

◆ slabLogf()

EwaldHandlerQuasi2D::mRealType slabLogf ( mRealType  z,
mRealType  k 
) const
private

Definition at line 82 of file EwaldHandlerQuasi2D.cpp.

References EwaldHandlerQuasi2D::alpha, and qmcplusplus::log().

Referenced by EwaldHandlerQuasi2D::slabFunc().

83 {
84  mRealType z1 = alpha*z;
85  mRealType k1 = k/(2*alpha);
86  mRealType log_term = k*z + std::log(erfc(z1+k1));
87  return log_term;
88 }
EwaldHandler3D::mRealType mRealType
MakeReturn< UnaryNode< FnLog, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t log(const Vector< T1, C1 > &l)

◆ srDf()

mRealType srDf ( mRealType  r,
mRealType  rinv 
) const
inlineoverridevirtual

Implements LRHandlerBase.

Definition at line 50 of file EwaldHandlerQuasi2D.h.

51  {
52  throw std::runtime_error("Quasi2D Ewald sr derivative not implemented");
53  }

Member Data Documentation

◆ alpha

◆ area

◆ kmags

std::vector<mRealType> kmags
private

store |k|

Definition at line 70 of file EwaldHandlerQuasi2D.h.

Referenced by EwaldHandlerQuasi2D::evaluate_slab(), and EwaldHandlerQuasi2D::fillFk().


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