QMCPACK
LRRPABFeeHandlerTemp< Func, BreakupBasis > Struct Template Reference
+ Inheritance diagram for LRRPABFeeHandlerTemp< Func, BreakupBasis >:
+ Collaboration diagram for LRRPABFeeHandlerTemp< Func, BreakupBasis >:

Public Types

using ParticleLayout = ParticleSet::ParticleLayout
 
using BreakupBasisType = BreakupBasis
 

Public Member Functions

 LRRPABFeeHandlerTemp (ParticleSet &ref, mRealType kc_in=-1.0)
 
 LRRPABFeeHandlerTemp (const LRRPABFeeHandlerTemp &aLR, ParticleSet &ref)
 "copy" constructor More...
 
LRHandlerBasemakeClone (ParticleSet &ref) const override
 make clone More...
 
void initBreakup (ParticleSet &ref) override
 
void Breakup (ParticleSet &ref, mRealType rs_ext) override
 
void resetTargetParticleSet (ParticleSet &ref) override
 
void resetTargetParticleSet (ParticleSet &ref, mRealType rs)
 
mRealType evaluate (mRealType r, mRealType rinv) const override
 
mRealType srDf (mRealType r, mRealType rinv) const override
 evaluate the first derivative of the short range part at r More...
 
mRealType evaluateLR (mRealType r) const override
 evaluate the contribution from the long-range part for for spline More...
 
mRealType evaluate_vlr_k (mRealType k) const 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 mRealType evaluateSR_k0 () const
 evaluate $ v_{s}(k=0) = \frac{4\pi}{V}\int_0^{r_c} r^2 v_s(r) dr $ More...
 
virtual mRealType evaluateLR_r0 () const
 evaluate $ v_s(r=0) $ for the self-interaction term 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
 
virtual mRealType lrDf (mRealType r) const
 

Public Attributes

bool FirstTime
 
mRealType rs
 
mRealType kc
 
BreakupBasisType Basis
 
Func myFunc
 
- 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...
 

Private Member Functions

mRealType evalFk (mRealType k) const
 
mRealType evalXk (mRealType k) const
 
void InitBreakup (const ParticleLayout &ref, int NumFunctions)
 Initialise the basis and coefficients for the long-range beakup. More...
 
void fillXk (std::vector< TinyVector< mRealType, 2 >> &KList)
 
void fillFk (const KContainer &KList)
 

Additional Inherited Members

- Protected Attributes inherited from LRHandlerBase
std::string ClassName
 

Detailed Description

template<class Func, class BreakupBasis = LPQHIBasis>
struct qmcplusplus::LRRPABFeeHandlerTemp< Func, BreakupBasis >

Definition at line 36 of file LRRPABFeeHandlerTemp.h.

Member Typedef Documentation

◆ BreakupBasisType

using BreakupBasisType = BreakupBasis

Definition at line 42 of file LRRPABFeeHandlerTemp.h.

◆ ParticleLayout

Constructor & Destructor Documentation

◆ LRRPABFeeHandlerTemp() [1/2]

LRRPABFeeHandlerTemp ( ParticleSet ref,
mRealType  kc_in = -1.0 
)
inline

Definition at line 51 of file LRRPABFeeHandlerTemp.h.

References LRHandlerBase::ClassName, and LRRPABFeeHandlerTemp< Func, BreakupBasis >::myFunc.

52  : LRHandlerBase(kc_in), FirstTime(true), Basis(ref.getLattice())
53  {
54  LRHandlerBase::ClassName = "LRRPAFeeHandlerTemp";
55  myFunc.reset(ref);
56  }

◆ LRRPABFeeHandlerTemp() [2/2]

LRRPABFeeHandlerTemp ( const LRRPABFeeHandlerTemp< Func, BreakupBasis > &  aLR,
ParticleSet ref 
)
inline

"copy" constructor

Parameters
aLRLRHandlerTemp
refParticleset

Copy the content of aLR References to ParticleSet or ParticleLayoutout_t are not copied.

Definition at line 70 of file LRRPABFeeHandlerTemp.h.

References LRRPABFeeHandlerTemp< Func, BreakupBasis >::fillFk(), ParticleSet::getSimulationCell(), and LRRPABFeeHandlerTemp< Func, BreakupBasis >::myFunc.

71  : LRHandlerBase(aLR), FirstTime(true), Basis(aLR.Basis, ref.getLattice())
72  {
73  myFunc.reset(ref);
74  fillFk(ref.getSimulationCell().getKLists());
75  }
void fillFk(const KContainer &KList)

Member Function Documentation

◆ Breakup()

void Breakup ( ParticleSet ref,
mRealType  rs_ext 
)
inlineoverridevirtual

Implements LRHandlerBase.

Definition at line 89 of file LRRPABFeeHandlerTemp.h.

References LRRPABFeeHandlerTemp< Func, BreakupBasis >::Basis, LRRPABFeeHandlerTemp< Func, BreakupBasis >::fillFk(), ParticleSet::getLattice(), ParticleSet::getSimulationCell(), LRRPABFeeHandlerTemp< Func, BreakupBasis >::InitBreakup(), LRHandlerBase::LR_rc, LRRPABFeeHandlerTemp< Func, BreakupBasis >::myFunc, and LRRPABFeeHandlerTemp< Func, BreakupBasis >::rs.

90  {
91  //ref.getLattice().Volume=ref.getTotalNum()*4.0*M_PI/3.0*rs*rs*rs;
92  rs = rs_ext;
93  myFunc.reset(ref, rs);
94  InitBreakup(ref.getLattice(), 1);
95  fillFk(ref.getSimulationCell().getKLists());
96  LR_rc = Basis.get_rc();
97  }
void fillFk(const KContainer &KList)
mRealType LR_rc
Maximum r cutoff.
Definition: LRHandlerBase.h:39
void InitBreakup(const ParticleLayout &ref, int NumFunctions)
Initialise the basis and coefficients for the long-range beakup.

◆ evalFk()

mRealType evalFk ( mRealType  k) const
inlineprivate

Definition at line 138 of file LRRPABFeeHandlerTemp.h.

References LRRPABFeeHandlerTemp< Func, BreakupBasis >::Basis, LRHandlerBase::coefs, LRRPABFeeHandlerTemp< Func, BreakupBasis >::myFunc, and qmcplusplus::n.

Referenced by LRRPABFeeHandlerTemp< Func, BreakupBasis >::evaluate_vlr_k(), and LRRPABFeeHandlerTemp< Func, BreakupBasis >::fillFk().

139  {
140  //FatK = 4.0*M_PI/(Basis.get_CellVolume()*k*k)* std::cos(k*Basis.get_rc());
141  mRealType FatK = myFunc.Fk(k, Basis.get_rc());
142  for (int n = 0; n < Basis.NumBasisElem(); n++)
143  FatK += coefs[n] * Basis.c(n, k);
144  return FatK;
145  }
EwaldHandler3D::mRealType mRealType
std::vector< mRealType > coefs
Fourier component for each k-shell Coefficient.
Definition: LRHandlerBase.h:53

◆ evaluate()

mRealType evaluate ( mRealType  r,
mRealType  rinv 
) const
inlineoverridevirtual

Implements LRHandlerBase.

Definition at line 103 of file LRRPABFeeHandlerTemp.h.

References LRRPABFeeHandlerTemp< Func, BreakupBasis >::Basis, LRHandlerBase::coefs, and qmcplusplus::n.

104  {
105  mRealType v = 0.0;
106  for (int n = 0; n < coefs.size(); n++)
107  v += coefs[n] * Basis.h(n, r);
108  return v;
109  }
EwaldHandler3D::mRealType mRealType
std::vector< mRealType > coefs
Fourier component for each k-shell Coefficient.
Definition: LRHandlerBase.h:53

◆ evaluate_vlr_k()

mRealType evaluate_vlr_k ( mRealType  k) const
inlineoverridevirtual

Implements LRHandlerBase.

Definition at line 135 of file LRRPABFeeHandlerTemp.h.

References LRRPABFeeHandlerTemp< Func, BreakupBasis >::evalFk().

135 { return evalFk(k); }
mRealType evalFk(mRealType k) const

◆ evaluateLR()

mRealType evaluateLR ( mRealType  r) const
inlineoverridevirtual

evaluate the contribution from the long-range part for for spline

Implements LRHandlerBase.

Definition at line 128 of file LRRPABFeeHandlerTemp.h.

129  {
130  mRealType vk = 0.0;
131  return vk;
132  // for(int n=0; n<coefs.size(); n++) v -= coefs[n]*Basis.h(n,r);
133  }
EwaldHandler3D::mRealType mRealType

◆ evalXk()

mRealType evalXk ( mRealType  k) const
inlineprivate

Definition at line 147 of file LRRPABFeeHandlerTemp.h.

References LRRPABFeeHandlerTemp< Func, BreakupBasis >::Basis, and LRRPABFeeHandlerTemp< Func, BreakupBasis >::myFunc.

Referenced by LRRPABFeeHandlerTemp< Func, BreakupBasis >::fillXk().

148  {
149  //mRealType FatK;
150  //FatK = -4.0*M_PI/(Basis.get_CellVolume()*k*k)* std::cos(k*Basis.get_rc());
151  //return (FatK);
152  return myFunc.Xk(k, Basis.get_rc());
153  }

◆ fillFk()

void fillFk ( const KContainer KList)
inlineprivate

Definition at line 215 of file LRRPABFeeHandlerTemp.h.

References LRRPABFeeHandlerTemp< Func, BreakupBasis >::evalFk(), LRHandlerBase::Fk, LRHandlerBase::Fk_symm, KContainer::kpts_cart, KContainer::kshell, KContainer::ksq, LRHandlerBase::MaxKshell, qmcplusplus::pow(), Vector< T, Alloc >::resize(), and Vector< T, Alloc >::size().

Referenced by LRRPABFeeHandlerTemp< Func, BreakupBasis >::Breakup(), LRRPABFeeHandlerTemp< Func, BreakupBasis >::initBreakup(), and LRRPABFeeHandlerTemp< Func, BreakupBasis >::LRRPABFeeHandlerTemp().

216  {
217  Fk.resize(KList.kpts_cart.size());
218  const std::vector<int>& kshell(KList.kshell);
219  if (MaxKshell >= kshell.size())
220  MaxKshell = kshell.size() - 1;
222  // std::cout<<"Filling FK :"<<std::endl;
223  for (int ks = 0, ki = 0; ks < Fk_symm.size(); ks++)
224  {
225  mRealType k = std::pow(KList.ksq[ki], 0.5);
226  mRealType uk = evalFk(k);
227  Fk_symm[ks] = uk;
228  // std::cout<<uk<<std::endl;
229  while (ki < KList.kshell[ks + 1] && ki < Fk.size())
230  Fk[ki++] = uk;
231  }
232  //for(int ki=0; ki<KList.kpts_cart.size(); ki++){
233  // mRealType k=dot(KList.kpts_cart[ki],KList.kpts_cart[ki]);
234  // k=std::sqrt(k);
235  // Fk[ki] = evalFk(k); //Call derived fn.
236  //}
237  }
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
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)
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
mRealType evalFk(mRealType k) const
Vector< mRealType > Fk_symm
Fourier component for each k-shell.
Definition: LRHandlerBase.h:49

◆ fillXk()

void fillXk ( std::vector< TinyVector< mRealType, 2 >> &  KList)
inlineprivate

Definition at line 205 of file LRRPABFeeHandlerTemp.h.

References LRRPABFeeHandlerTemp< Func, BreakupBasis >::evalXk(), LRHandlerBase::Fk, and Vector< T, Alloc >::resize().

Referenced by LRRPABFeeHandlerTemp< Func, BreakupBasis >::InitBreakup().

206  {
207  Fk.resize(KList.size());
208  for (int ki = 0; ki < KList.size(); ki++)
209  {
210  mRealType k = KList[ki][0];
211  Fk[ki] = evalXk(k); //Call derived fn.
212  }
213  }
void resize(size_type n, Type_t val=Type_t())
Resize the container.
Definition: OhmmsVector.h:166
EwaldHandler3D::mRealType mRealType
mRealType evalXk(mRealType k) const
Vector< mRealType > Fk
Fourier component for all the k-point.
Definition: LRHandlerBase.h:41

◆ initBreakup()

void initBreakup ( ParticleSet ref)
inlineoverridevirtual

Implements LRHandlerBase.

Definition at line 82 of file LRRPABFeeHandlerTemp.h.

References LRRPABFeeHandlerTemp< Func, BreakupBasis >::Basis, LRRPABFeeHandlerTemp< Func, BreakupBasis >::fillFk(), ParticleSet::getLattice(), ParticleSet::getSimulationCell(), LRRPABFeeHandlerTemp< Func, BreakupBasis >::InitBreakup(), and LRHandlerBase::LR_rc.

83  {
84  InitBreakup(ref.getLattice(), 1);
85  fillFk(ref.getSimulationCell().getKLists());
86  LR_rc = Basis.get_rc();
87  }
void fillFk(const KContainer &KList)
mRealType LR_rc
Maximum r cutoff.
Definition: LRHandlerBase.h:39
void InitBreakup(const ParticleLayout &ref, int NumFunctions)
Initialise the basis and coefficients for the long-range beakup.

◆ InitBreakup()

void InitBreakup ( const ParticleLayout ref,
int  NumFunctions 
)
inlineprivate

Initialise the basis and coefficients for the long-range beakup.

We loocally create a breakup handler and pass in the basis that has been initialised here. We then discard the handler, leaving basis and coefs in a usable state. This method can be re-called later if lattice changes shape.

Definition at line 162 of file LRRPABFeeHandlerTemp.h.

References qmcplusplus::app_log(), LRRPABFeeHandlerTemp< Func, BreakupBasis >::Basis, LRHandlerBase::coefs, Vector< T, Alloc >::data(), LRBreakup< BreakupBasis >::DoBreakup(), LRRPABFeeHandlerTemp< Func, BreakupBasis >::fillXk(), LRRPABFeeHandlerTemp< Func, BreakupBasis >::FirstTime, LRHandlerBase::Fk, LRRPABFeeHandlerTemp< Func, BreakupBasis >::kc, LRBreakup< BreakupBasis >::KList, LRHandlerBase::LR_kc, LRHandlerBase::MaxKshell, qmcplusplus::pow(), and LRBreakup< BreakupBasis >::SetupKVecs().

Referenced by LRRPABFeeHandlerTemp< Func, BreakupBasis >::Breakup(), and LRRPABFeeHandlerTemp< Func, BreakupBasis >::initBreakup().

163  {
164  //First we send the new Lattice to the Basis, in case it has been updated.
165  Basis.set_Lattice(ref);
166  //Compute RC from box-size - in constructor?
167  //No here...need update if box changes
168  int NumKnots(15);
169  Basis.set_NumKnots(NumKnots);
170  Basis.set_rc(ref.LR_rc);
171  //Initialise the breakup - pass in basis.
172  LRBreakup<BreakupBasis> breakuphandler(Basis);
173  // std::cout<<" finding kc: "<<ref.LR_kc<<" , "<<LR_kc<< std::endl;
174  //Find size of basis from cutoffs
175  kc = (LR_kc < 0) ? ref.LR_kc : LR_kc;
176  //mRealType kc(ref.LR_kc); //User cutoff parameter...
177  //kcut is the cutoff for switching to approximate k-point degeneracies for
178  //better performance in making the breakup. A good bet is 30*K-spacing so that
179  //there are 30 "boxes" in each direction that are treated with exact degeneracies.
180  //Assume orthorhombic cell just for deriving this cutoff - should be insensitive.
181  //K-Spacing = (kpt_vol)**1/3 = 2*pi/(cellvol**1/3)
182  mRealType kcut = (30.0) * 2 * M_PI * std::pow(Basis.get_CellVolume(), -1.0 / 3.0);
183  //Use 3000/LMax here...==6000/rc for non-ortho cells
184  mRealType kmax(6000.0 / ref.LR_rc);
185  // std::cout<<"K_STATS !!! "<<kcut<<" "<<kmax<<std::endl;
186  MaxKshell = static_cast<int>(breakuphandler.SetupKVecs(kc, kcut, kmax));
187  if (FirstTime)
188  {
189  app_log() << " finding kc: " << ref.LR_kc << " , " << LR_kc << std::endl;
190  app_log() << " LRBreakp parameter Kc =" << kc << std::endl;
191  app_log() << " Continuum approximation in k = [" << kcut << "," << kmax << ")" << std::endl;
192  FirstTime = false;
193  }
194  //Set up x_k
195  //This is the FT of -V(r) from r_c to infinity.
196  //This is the only data that the breakup handler needs to do the breakup.
197  //We temporarily store it in Fk, which is replaced with the full FT (0->inf)
198  //of V_l(r) after the breakup has been done.
199  fillXk(breakuphandler.KList);
200  //Allocate the space for the coefficients.
201  coefs.resize(Basis.NumBasisElem()); //This must be after SetupKVecs.
202  breakuphandler.DoBreakup(Fk.data(), coefs.data()); //Fill array of coefficients.
203  }
mRealType LR_kc
Maximum k cutoff.
Definition: LRHandlerBase.h:37
std::ostream & app_log()
Definition: OutputManager.h:65
DECLARE_COULOMB_TYPES int MaxKshell
Maxkimum Kshell for the given Kc.
Definition: LRHandlerBase.h:35
EwaldHandler3D::mRealType mRealType
std::vector< mRealType > coefs
Fourier component for each k-shell Coefficient.
Definition: LRHandlerBase.h:53
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)
Vector< mRealType > Fk
Fourier component for all the k-point.
Definition: LRHandlerBase.h:41
void fillXk(std::vector< TinyVector< mRealType, 2 >> &KList)

◆ makeClone()

LRHandlerBase* makeClone ( ParticleSet ref) const
inlineoverridevirtual

make clone

Implements LRHandlerBase.

Definition at line 77 of file LRRPABFeeHandlerTemp.h.

78  {
79  return new LRRPABFeeHandlerTemp<Func, BreakupBasis>(*this, ref);
80  }

◆ resetTargetParticleSet() [1/2]

void resetTargetParticleSet ( ParticleSet ref)
inlineoverridevirtual

◆ resetTargetParticleSet() [2/2]

◆ srDf()

mRealType srDf ( mRealType  r,
mRealType  rinv 
) const
inlineoverridevirtual

evaluate the first derivative of the short range part at r

Parameters
rradius
rinv1/r

Implements LRHandlerBase.

Definition at line 116 of file LRRPABFeeHandlerTemp.h.

References LRRPABFeeHandlerTemp< Func, BreakupBasis >::Basis, LRHandlerBase::coefs, and qmcplusplus::n.

117  {
118  mRealType df = 0.0;
119  //mRealType df = myFunc.df(r, rinv);
120  for (int n = 0; n < coefs.size(); n++)
121  df += coefs[n] * Basis.df(n, r);
122  return df;
123  }
EwaldHandler3D::mRealType mRealType
std::vector< mRealType > coefs
Fourier component for each k-shell Coefficient.
Definition: LRHandlerBase.h:53

Member Data Documentation

◆ Basis

◆ FirstTime

bool FirstTime

◆ kc

◆ myFunc

◆ rs


The documentation for this struct was generated from the following file: