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

Public Member Functions

 EwaldHandler2D (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 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...
 
virtual 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
 Evaluate the long-range potential with the open BC for the D-1 direction. 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 Attributes

mRealType alpha
 
mRealType area
 

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 EwaldHandler2D.h.

Constructor & Destructor Documentation

◆ EwaldHandler2D()

EwaldHandler2D ( ParticleSet ref,
mRealType  kc_in = -1.0 
)

Definition at line 17 of file EwaldHandler2D.cpp.

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

Referenced by EwaldHandler2D::makeClone().

18  : LRHandlerBase(kc_in)
19 {
20  if (ref.getLattice().ndim != 2)
21  throw std::runtime_error("2D Ewald requires 2D Lattice");
22  LR_rc = ref.getLattice().LR_rc; // CoulombPBC needs get_rc() to createSpline4RbyVs
23  LR_kc = ref.getLattice().LR_kc; // get_kc() is used in QMCFiniteSize
24  alpha = std::sqrt(LR_kc/2.0/LR_rc);
25  area = ref.getLattice().Volume/ref.getLattice().R(2,2);
26  // report
27  app_log() << " alpha = " << alpha << " area = " << area << std::endl;
28  fillFk(ref.getSimulationCell().getKLists());
29 }
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 55 of file EwaldHandler2D.h.

References EwaldHandler2D::initBreakup().

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

◆ evaluate()

mRealType evaluate ( mRealType  r,
mRealType  rinv 
) const
inlineoverridevirtual

Implements LRHandlerBase.

Definition at line 33 of file EwaldHandler2D.h.

References EwaldHandler2D::alpha.

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

◆ evaluate_vlr_k()

virtual mRealType evaluate_vlr_k ( mRealType  k) const
inlineoverridevirtual

Implements LRHandlerBase.

Definition at line 50 of file EwaldHandler2D.h.

51  {
52  throw std::runtime_error("2D Ewald vlr_k not implemented");
53  }

◆ evaluateLR()

mRealType evaluateLR ( mRealType  r) const
inlineoverridevirtual

Implements LRHandlerBase.

Definition at line 37 of file EwaldHandler2D.h.

References EwaldHandler2D::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 EwaldHandler2D.h.

References EwaldHandler2D::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 EwaldHandler2D.h.

References EwaldHandler2D::alpha, EwaldHandler2D::area, and qmcplusplus::sqrt().

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

◆ fillFk()

void fillFk ( const KContainer KList)

Definition at line 31 of file EwaldHandler2D.cpp.

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

Referenced by EwaldHandler2D::EwaldHandler2D().

32 {
33  const mRealType knorm = 2.0*M_PI / area;
34  const mRealType kalpha = 1.0 / (2.0*alpha);
35  mRealType kmag, uk;
36 
37  Fk.resize(KList.kpts_cart.size());
38  MaxKshell = KList.kshell.size() - 1;
40 
41  for (int ks = 0, ki = 0; ks < Fk_symm.size(); ks++)
42  {
43  kmag = std::sqrt(KList.ksq[ki]);
44  uk = knorm * erfc(kalpha*kmag)/kmag;
45  Fk_symm[ks] = uk;
46  while (ki < KList.kshell[ks + 1] && ki < Fk.size())
47  Fk[ki++] = uk;
48  }
49 }
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)
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 54 of file EwaldHandler2D.h.

Referenced by EwaldHandler2D::Breakup().

54 {}

◆ lrDf()

mRealType lrDf ( mRealType  r) const
inlineoverridevirtual

Reimplemented from LRHandlerBase.

Definition at line 46 of file EwaldHandler2D.h.

47  {
48  throw std::runtime_error("2D Ewald lr derivative not implemented");
49  }

◆ makeClone()

LRHandlerBase* makeClone ( ParticleSet ref) const
inlineoverridevirtual

make clone

Implements LRHandlerBase.

Definition at line 30 of file EwaldHandler2D.h.

References EwaldHandler2D::EwaldHandler2D().

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

◆ resetTargetParticleSet()

void resetTargetParticleSet ( ParticleSet ref)
inlineoverridevirtual

Implements LRHandlerBase.

Definition at line 56 of file EwaldHandler2D.h.

56 {}

◆ srDf()

mRealType srDf ( mRealType  r,
mRealType  rinv 
) const
inlineoverridevirtual

Implements LRHandlerBase.

Definition at line 42 of file EwaldHandler2D.h.

43  {
44  throw std::runtime_error("2D Ewald sr derivative not implemented");
45  }

Member Data Documentation

◆ alpha

◆ area


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