forked from QMCPACK/qmcpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEwaldHandler.h
More file actions
132 lines (113 loc) · 4.39 KB
/
Copy pathEwaldHandler.h
File metadata and controls
132 lines (113 loc) · 4.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
//////////////////////////////////////////////////////////////////////////////////////
// This file is distributed under the University of Illinois/NCSA Open Source License.
// See LICENSE file in top directory for details.
//
// Copyright (c) 2020 QMCPACK developers.
//
// File developed by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
// Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
// Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
//
// File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
//////////////////////////////////////////////////////////////////////////////////////
/** @file LRHandlerTemp.h
* @brief Define a LRHandler with two template parameters
*/
#ifndef QMCPLUSPLUS_EWALD_HANDLER_H
#define QMCPLUSPLUS_EWALD_HANDLER_H
#include "LongRange/LRHandlerBase.h"
namespace qmcplusplus
{
/* LR breakup for the standard Ewald method
*
* Quasi-2D Ewald method : J. Phys.: Condens. Matter 16, 891 (2004)
* http://iopscience.iop.org/0953-8984/16/6/017/
* Note that \f$ \simga \rightarrow 1/\sigma\f$
* It is possible to use 3D Ewald but for the bulk system, the optimal breakup method
* is used.
*/
class EwaldHandler : public LRHandlerBase
{
public:
///type of supercell
int SuperCellEnum;
/// Related to the Gaussian width: \f$ v_l = v(r)erf(\sigma r)\f$
mRealType Sigma;
///Volume of the supercell
mRealType Volume;
///Area of the supercell: always z is the slab direction
mRealType Area;
/** Define prefactors for the mixed boundary conditions
*
* For quasi-2D (see Appendix A of JPC)
* PreFactors[0] = \f$ \frac{2\pi}{A}\f$
* PreFactors[1] = \f$ \frac{2\pi}{A}\frac{1}{\sigma\pi}\f$
* PreFactors[2] = \f$ \frac{2\pi}{A}\frac{1}{\sigma\pi}\f$
* PreFactors[3] = \f$ 2\frac{\sqrt{\pi}}{A*\sigma}-\frac{2\pi}{k*A} erfc(\frac{k}{2\sigma}\f$
*/
TinyVector<mRealType, 4> PreFactors;
///store |k|
std::vector<mRealType> kMag;
/// Constructor
EwaldHandler(ParticleSet& ref, mRealType kc_in = -1.0) : LRHandlerBase(kc_in)
{
LRHandlerBase::ClassName = "EwaldHandler";
Sigma = LR_kc = ref.Lattice.LR_kc;
}
/** "copy" constructor
* @param aLR LRHandlerTemp
* @param ref Particleset
*
* Copy the content of aLR
* References to ParticleSet or ParticleLayoutout_t are not copied.
*/
EwaldHandler(const EwaldHandler& aLR, ParticleSet& ref);
LRHandlerBase* makeClone(ParticleSet& ref) { return new EwaldHandler(*this, ref); }
void initBreakup(ParticleSet& ref);
void Breakup(ParticleSet& ref, mRealType rs_in) { initBreakup(ref); }
void resetTargetParticleSet(ParticleSet& ref) {}
inline mRealType evaluate(mRealType r, mRealType rinv) { return erfc(r * Sigma) * rinv; }
/** evaluate the contribution from the long-range part for for spline
*/
inline mRealType evaluateLR(mRealType r) { return -erf(r * Sigma) / r; }
inline mRealType evaluateSR_k0() { return 0.0; }
inline mRealType evaluateLR_r0() { return 2.0 * Sigma / std::sqrt(M_PI) + PreFactors[3]; }
/** evaluate the first derivative of the short range part at r
*
* @param r radius
* @param rinv 1/r
*/
inline mRealType srDf(mRealType r, mRealType rinv) { return 0.0; }
inline mRealType evaluate_vlr_k(mRealType k) override;
void fillFk(KContainer& KList);
/** evaluate k-dependent
*/
mRealType evaluate_slab(mRealType z,
const std::vector<int>& kshell,
const pComplexType* restrict rk1,
const pComplexType* restrict rk2);
/** evaluate k=0 term at z
* @param z distance in the slab direction
* @param zp z*Sigma
* @return \f$X*z*erf(z*Sgima) + Y*exp^{-z^2*Simga^2}]\f$
*
* Here \f$ X=\frac{2\pi}{A}\f$ and \f$ Y=\frac{2\sqrt{\pi}}{A*Simga}\f$
*/
inline mRealType SlabFunc0(mRealType z, mRealType zp)
{
return PreFactors[0] * z * erf(zp) + PreFactors[1] * std::exp(-zp * zp);
}
/** evaluate k!=0 term at z
* @param ks index of this kshell
* @param z distance in the slab direction
* @param zp z*Sigma
*/
inline mRealType SlabFuncK(int ks, mRealType z, mRealType zp)
{
mRealType expkz = std::exp(kMag[ks] * z);
mRealType kz0 = PreFactors[2] * kMag[ks]; //could save this
return erfc(kz0 - zp) / expkz + erfc(kz0 + zp) * expkz;
}
};
} // namespace qmcplusplus
#endif