15 #ifndef QMCPLUSPLUS_QUADRATURE_H 16 #define QMCPLUSPLUS_QUADRATURE_H 108 D = 14641.0 / 725760.0;
111 ERRORMSG(
"Unrecognized spherical quadrature rule " << rule <<
".");
115 std::vector<PosType> a, b, c, d;
122 a.push_back(
PosType(1.0, 0.0, 0.0));
127 a.push_back(
PosType(q, -q, -q));
128 a.push_back(
PosType(-q, q, -q));
129 a.push_back(
PosType(-q, -q, q));
133 a.push_back(
PosType(1.0, 0.0, 0.0));
134 a.push_back(
PosType(-1.0, 0.0, 0.0));
135 a.push_back(
PosType(0.0, 1.0, 0.0));
136 a.push_back(
PosType(0.0, -1.0, 0.0));
137 a.push_back(
PosType(0.0, 0.0, 1.0));
138 a.push_back(
PosType(0.0, 0.0, -1.0));
139 b.push_back(
PosType(p, p, 0.0));
140 b.push_back(
PosType(p, -p, 0.0));
141 b.push_back(
PosType(-p, p, 0.0));
142 b.push_back(
PosType(-p, -p, 0.0));
143 b.push_back(
PosType(p, 0.0, p));
144 b.push_back(
PosType(p, 0.0, -p));
145 b.push_back(
PosType(-p, 0.0, p));
146 b.push_back(
PosType(-p, 0.0, -p));
147 b.push_back(
PosType(0.0, p, p));
148 b.push_back(
PosType(0.0, p, -p));
149 b.push_back(
PosType(0.0, -p, p));
150 b.push_back(
PosType(0.0, -p, -p));
152 c.push_back(
PosType(q, q, -q));
153 c.push_back(
PosType(q, -q, q));
154 c.push_back(
PosType(q, -q, -q));
155 c.push_back(
PosType(-q, q, q));
156 c.push_back(
PosType(-q, q, -q));
157 c.push_back(
PosType(-q, -q, q));
158 c.push_back(
PosType(-q, -q, -q));
195 for (
int k = 0; k < 5; k++)
207 for (
int k = 0; k < 5; k++)
225 for (
int i = 0; i < a.size(); i++)
227 xyz_m.push_back(a[i]);
231 for (
int i = 0; i < b.size(); i++)
233 xyz_m.push_back(b[i]);
237 for (
int i = 0; i < c.size(); i++)
239 xyz_m.push_back(c[i]);
243 for (
int i = 0; i < d.size(); i++)
245 xyz_m.push_back(d[i]);
253 for (
int k = 0; k <
nk; k++)
256 double nrm =
dot(r, r);
257 assert(
std::abs(nrm - 1.0) < 2 * std::numeric_limits<float>::epsilon());
261 assert(
std::abs(wSum - 1.0) < 2 * std::numeric_limits<float>::epsilon());
271 std::vector<PosType>& grid =
xyz_m;
272 std::vector<RealType>& w =
weight_m;
273 for (
int l1 = 0; l1 <=
lexact; l1++)
274 for (
int l2 = 0; l2 <= (
lexact - l1); l2++)
275 for (
int m1 = -l1; m1 <= l1; m1++)
276 for (
int m2 = -l2; m2 <= l2; m2++)
278 std::complex<mRealType> sum(0.0, 0.0);
279 for (
int k = 0; k < grid.size(); k++)
281 std::complex<mRealType> v1 =
Ylm(l1, m1, grid[k]);
282 std::complex<mRealType> v2 =
Ylm(l2, m2, grid[k]);
287 if ((l1 == l2) && (m1 == m2))
289 if ((
std::abs(im) > 7 * std::numeric_limits<float>::epsilon()) ||
290 (
std::abs(re) > 7 * std::numeric_limits<float>::epsilon()))
292 app_error() <<
"Broken spherical quadrature for " << grid.size() <<
"-point rule.\n" << std::endl;
293 app_error() <<
" Should be zero: Real part = " << re <<
" Imaginary part = " << im << std::endl;
305 std::vector<PosType>& grid =
xyz_m;
306 std::vector<RealType>& w =
weight_m;
308 for (
int l1 = 0; l1 <=
lexact; l1++)
309 for (
int l2 = 0; l2 <= (
lexact - l1); l2++)
310 for (
int m1 = -l1; m1 <= l1; m1++)
311 for (
int m2 = -l2; m2 <= l2; m2++)
314 for (
int k = 0; k < grid.size(); k++)
316 Ylm.evaluateV(grid[k][0], grid[k][1], grid[k][2]);
320 sum += 4.0 * M_PI * w[k] * v1 * v2;
322 if ((l1 == l2) && (m1 == m2))
324 if (
std::abs(sum) > 16 * std::numeric_limits<float>::epsilon())
326 app_error() <<
"Broken real spherical quadrature for " << grid.size() <<
"-point rule.\n" << std::endl;
327 app_error() <<
" Should be zero: " << sum << std::endl;
helper functions for EinsplineSetBuilder
void CheckQuadratureRuleReal(int lexact)
std::complex< T > Ylm(int l, int m, const TinyVector< T, 3 > &r)
calculates Ylm param[in] l angular momentum param[in] m magnetic quantum number param[in] r position ...
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sin(const Vector< T1, C1 > &l)
std::ostream & app_error()
float real(const float &c)
real part of a scalar. Cannot be replaced by std::real due to AFQMC specific needs.
SoaSphericalTensor that evaluates the Real Spherical Harmonics.
float imag(const float &c)
imaginary part of a scalar. Cannot be replaced by std::imag due to AFQMC specific needs...
MakeReturn< UnaryNode< FnCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t cos(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnArcCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t acos(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnArcTan, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t atan(const Vector< T1, C1 > &l)
OHMMS_PRECISION_FULL mRealType
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
void CheckQuadratureRule(int lexact)
std::vector< PosType > xyz_m
float conj(const float &c)
Workaround to allow conj on scalar to return real instead of complex.
TinyVector< T, 3 > PosType
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
std::vector< RealType > weight_m
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)
Quadrature3D(int rule, bool request_abort=true)