QMCPACK
J2KECorrection< RT, FT > Class Template Reference
+ Inheritance diagram for J2KECorrection< RT, FT >:
+ Collaboration diagram for J2KECorrection< RT, FT >:

Public Member Functions

 J2KECorrection (const ParticleSet &targetPtcl, const std::vector< FT *> &F)
 
RT computeKEcorr ()
 

Private Attributes

size_t num_groups_
 
std::vector< size_t > num_elec_in_groups_
 
RT num_elecs_
 
RT vol
 
RT G0mag
 
const std::vector< FT * > & F_
 
bool SK_enabled
 

Detailed Description

template<typename RT, class FT>
class qmcplusplus::J2KECorrection< RT, FT >

Definition at line 25 of file J2KECorrection.h.

Constructor & Destructor Documentation

◆ J2KECorrection()

J2KECorrection ( const ParticleSet targetPtcl,
const std::vector< FT *> &  F 
)
inline

Definition at line 36 of file J2KECorrection.h.

37  : num_groups_(targetPtcl.groups()),
38  num_elecs_(targetPtcl.getTotalNum()),
39  vol(targetPtcl.getLattice().Volume),
40  F_(F),
41  SK_enabled(targetPtcl.hasSK())
42  {
43  // compute num_elec_in_groups_
44  num_elec_in_groups_.reserve(3);
45  for (int i = 0; i < num_groups_; i++)
46  num_elec_in_groups_.push_back(targetPtcl.last(i) - targetPtcl.first(i));
47 
48  if (SK_enabled)
49  G0mag = std::sqrt(targetPtcl.getSimulationCell().getKLists().ksq[0]);
50  }
const std::vector< FT * > & F_
std::vector< size_t > num_elec_in_groups_
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

Member Function Documentation

◆ computeKEcorr()

RT computeKEcorr ( )
inline

Definition at line 52 of file J2KECorrection.h.

Referenced by TwoBodyJastrow< FT >::ChiesaKEcorrection(), and TwoBodyJastrow< FT >::finalizeOptimization().

53  {
54  if (!SK_enabled)
55  return 0;
56 
57  const int numPoints = 1000;
58  RT uk = 0.0;
59  RT a = 1.0;
60 
61  for (int i = 0; i < num_groups_; i++)
62  {
63  int Ni = num_elec_in_groups_[i];
64  for (int j = 0; j < num_groups_; j++)
65  {
66  int Nj = num_elec_in_groups_[j];
67  if (F_[i * num_groups_ + j])
68  {
69  FT& ufunc = *(F_[i * num_groups_ + j]);
70  RT radius = ufunc.cutoff_radius;
71  RT k = G0mag;
72  RT dr = radius / (RT)(numPoints - 1);
73  for (int ir = 0; ir < numPoints; ir++)
74  {
75  RT r = dr * (RT)ir;
76  RT u = ufunc.evaluate(r);
77  uk += 0.5 * 4.0 * M_PI * r * std::sin(k * r) / k * u * dr * (RT)Nj / (RT)(Ni + Nj);
78  }
79  }
80  }
81  }
82  for (int iter = 0; iter < 20; iter++)
83  a = uk / (4.0 * M_PI * (1.0 / (G0mag * G0mag) - 1.0 / (G0mag * G0mag + 1.0 / a)));
84  return 4.0 * M_PI * a / (4.0 * vol) * num_elecs_;
85  }
MakeReturn< UnaryNode< FnSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sin(const Vector< T1, C1 > &l)
const std::vector< FT * > & F_
std::vector< size_t > num_elec_in_groups_

Member Data Documentation

◆ F_

const std::vector<FT*>& F_
private

Definition at line 32 of file J2KECorrection.h.

Referenced by J2KECorrection< RealType, FT >::computeKEcorr().

◆ G0mag

◆ num_elec_in_groups_

std::vector<size_t> num_elec_in_groups_
private

◆ num_elecs_

RT num_elecs_
private

Definition at line 29 of file J2KECorrection.h.

Referenced by J2KECorrection< RealType, FT >::computeKEcorr().

◆ num_groups_

size_t num_groups_
private

◆ SK_enabled

bool SK_enabled
private

◆ vol

RT vol
private

Definition at line 30 of file J2KECorrection.h.

Referenced by J2KECorrection< RealType, FT >::computeKEcorr().


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