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

Public Types

using ParticleLayout = ParticleSet::ParticleLayout
 
using BreakupBasisType = BreakupBasis
 

Public Member Functions

 LRRPAHandlerTemp (ParticleSet &ref, mRealType kc_in=-1.0)
 
 LRRPAHandlerTemp (const LRRPAHandlerTemp &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::LRRPAHandlerTemp< Func, BreakupBasis >

Definition at line 36 of file LRRPAHandlerTemp.h.

Member Typedef Documentation

◆ BreakupBasisType

using BreakupBasisType = BreakupBasis

Definition at line 42 of file LRRPAHandlerTemp.h.

◆ ParticleLayout

Definition at line 41 of file LRRPAHandlerTemp.h.

Constructor & Destructor Documentation

◆ LRRPAHandlerTemp() [1/2]

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

Definition at line 51 of file LRRPAHandlerTemp.h.

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

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

◆ LRRPAHandlerTemp() [2/2]

LRRPAHandlerTemp ( const LRRPAHandlerTemp< 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 LRRPAHandlerTemp.h.

References LRRPAHandlerTemp< Func, BreakupBasis >::fillFk(), ParticleSet::getSimulationCell(), and LRRPAHandlerTemp< 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 LRRPAHandlerTemp.h.

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

Referenced by RadialJastrowBuilder::initTwoBodyFunctor().

90  {
91  //ref.getLattice().Volume=ref.getTotalNum()*4.0*M_PI/3.0*rs*rs*rs;
92  if (rs_ext > 0)
93  rs = rs_ext;
94  else
95  rs = std::pow(3.0 / 4.0 / M_PI * ref.getLattice().Volume / static_cast<mRealType>(ref.getTotalNum()), 1.0 / 3.0);
96  myFunc.reset(ref, rs);
97  InitBreakup(ref.getLattice(), 1);
98  fillFk(ref.getSimulationCell().getKLists());
99  LR_rc = Basis.get_rc();
100  }
EwaldHandler3D::mRealType mRealType
void fillFk(const KContainer &KList)
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 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 141 of file LRRPAHandlerTemp.h.

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

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

142  {
143  //FatK = 4.0*M_PI/(Basis.get_CellVolume()*k*k)* std::cos(k*Basis.get_rc());
144  mRealType FatK = myFunc.Fk(k, Basis.get_rc());
145  for (int n = 0; n < Basis.NumBasisElem(); n++)
146  FatK += coefs[n] * Basis.c(n, k);
147  return FatK;
148  }
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 106 of file LRRPAHandlerTemp.h.

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

Referenced by RadialJastrowBuilder::initTwoBodyFunctor().

107  {
108  mRealType v = 0.0;
109  for (int n = 0; n < coefs.size(); n++)
110  v += coefs[n] * Basis.h(n, r);
111  return v;
112  }
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 138 of file LRRPAHandlerTemp.h.

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

138 { return -1.0 * 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 130 of file LRRPAHandlerTemp.h.

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

◆ evalXk()

mRealType evalXk ( mRealType  k) const
inlineprivate

Definition at line 150 of file LRRPAHandlerTemp.h.

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

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

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

◆ fillFk()

void fillFk ( const KContainer KList)
inlineprivate

Definition at line 218 of file LRRPAHandlerTemp.h.

References LRRPAHandlerTemp< 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 LRRPAHandlerTemp< Func, BreakupBasis >::Breakup(), LRRPAHandlerTemp< Func, BreakupBasis >::initBreakup(), and LRRPAHandlerTemp< Func, BreakupBasis >::LRRPAHandlerTemp().

219  {
220  Fk.resize(KList.kpts_cart.size());
221  const std::vector<int>& kshell(KList.kshell);
222  if (MaxKshell >= kshell.size())
223  MaxKshell = kshell.size() - 1;
225  // std::cout<<"Filling FK :"<<std::endl;
226  for (int ks = 0, ki = 0; ks < Fk_symm.size(); ks++)
227  {
228  mRealType k = std::pow(KList.ksq[ki], 0.5);
229  mRealType uk = -1.0 * evalFk(k);
230  Fk_symm[ks] = uk;
231  // std::cout<<uk<<std::endl;
232  while (ki < KList.kshell[ks + 1] && ki < Fk.size())
233  Fk[ki++] = uk;
234  }
235  //for(int ki=0; ki<KList.kpts_cart.size(); ki++){
236  // mRealType k=dot(KList.kpts_cart[ki],KList.kpts_cart[ki]);
237  // k=std::sqrt(k);
238  // Fk[ki] = evalFk(k); //Call derived fn.
239  //}
240  }
void resize(size_type n, Type_t val=Type_t())
Resize the container.
Definition: OhmmsVector.h:166
mRealType evalFk(mRealType k) const
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
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 208 of file LRRPAHandlerTemp.h.

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

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

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

◆ initBreakup()

void initBreakup ( ParticleSet ref)
inlineoverridevirtual

Implements LRHandlerBase.

Definition at line 82 of file LRRPAHandlerTemp.h.

References LRRPAHandlerTemp< Func, BreakupBasis >::Basis, LRRPAHandlerTemp< Func, BreakupBasis >::fillFk(), ParticleSet::getLattice(), ParticleSet::getSimulationCell(), LRRPAHandlerTemp< 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 165 of file LRRPAHandlerTemp.h.

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

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

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

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

◆ resetTargetParticleSet() [1/2]

void resetTargetParticleSet ( ParticleSet ref)
inlineoverridevirtual

Implements LRHandlerBase.

Definition at line 102 of file LRRPAHandlerTemp.h.

References LRRPAHandlerTemp< Func, BreakupBasis >::myFunc.

102 { myFunc.reset(ref); }

◆ resetTargetParticleSet() [2/2]

void resetTargetParticleSet ( ParticleSet ref,
mRealType  rs 
)
inline

◆ 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 119 of file LRRPAHandlerTemp.h.

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

120  {
121  mRealType df = 0.0;
122  //mRealType df = myFunc.df(r, rinv);
123  for (int n = 0; n < coefs.size(); n++)
124  df += coefs[n] * Basis.dh_dr(n, r);
125  return df;
126  }
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: