28 CHECK(v == Approx(1.0));
31 for (
int i = 0; i < 10; i++)
34 CHECK(vp1 == Approx(1.0));
48 std::complex<double> out =
Ylm(0, 0, v);
49 CHECK(out.real() == Approx(0.28209479177387814));
77 {{0, 0, 1}, 1, -1, 0, 0},
78 {{0.587785, 0, 0.809017}, 1, -1, 0.203076, 0},
79 {{0.587785, 0, 0.809017}, 1, 0, 0.395288, 0},
80 {{0.951057, 0, 0.309017}, 1, 1, -0.328584, 0},
81 {{0.587785, 0, 0.809017}, 2, -2, 0.133454, 0},
82 {{0.293893, 0.904508, 0.309017}, 2, -1, 0.0701612, -0.215934},
83 {{0.587785, 0, -0.809017}, 2, 0, 0.303888, 0},
84 {{0.293893, 0.904508, -0.309017}, 2, 1, 0.0701612, 0.215934},
85 {{0.293893, 0.904508, 0.309017}, 2, 2, -0.282661, 0.205365},
86 {{-0.475528, -0.345492, -0.809017}, 3, -3, 0.0261823, 0.0805808},
87 {{-0.475528, -0.345492, 0.809017}, 4, 4, -0.0427344, 0.0310484},
92 for (
int i = 0; i <
N; i++)
94 YlmValue& v = Vals[i];
100 std::complex<double> out =
Ylm(v.l, v.m, w);
102 CHECK(v.y_re == Approx(out.real()));
103 CHECK(v.y_im == Approx(out.imag()));
107 TEST_CASE(
"Derivatives of Spherical Harmonics",
"[numerics]")
130 YlmDerivValue Vals[
N] = {
131 {{0.587785, 0, 0.809017}, 1, -1, 0.27951007, 0.0, 0.0, -0.2030763},
132 {{0.587785, 0, 0.809017}, 1, 0, -0.2871933, 0.0, 0.0, 0.0},
133 {{0.951057, 0, 0.309017}, 1, 1, -0.1067635, 0.0, 0.0, -0.3285845},
134 {{0.587785, 0, 0.809017}, 2, -2, 0.3673685, 0.0, 0.0, -0.2669088},
135 {{0.293893, 0.904508, 0.309017}, 2, -1, -0.1931373, 0.5944147, -0.2159338, -0.0701613},
136 {{0.587785, 0, -0.809017}, 2, 0, 0.8998655, 0.0, 0.0, 0.0},
137 {{0.293893, 0.904508, -0.309017}, 2, 1, 0.1931373, 0.5944146, -0.2159339, 0.0701613},
138 {{0.293893, 0.904508, 0.309017}, 2, 2, -0.1836842, 0.1334547, -0.4107311, -0.5653217},
139 {{-0.475528, -0.345492, -0.809017}, 3, -3, -0.1081114, -0.3327295, 0.2417422, -0.0785476},
140 {{-0.475528, -0.345492, 0.809017}, 4, 4, -0.2352762, 0.1709368, -0.1241928, -0.1709382},
144 for (
int i = 0; i <
N; i++)
146 YlmDerivValue& v = Vals[i];
152 std::complex<double> theta, phi;
183 {{0, 0, 5}, 1, -1, 0, 0},
184 {{2.938925, 0, 4.045085}, 1, -1, 0.203076, 0},
185 {{2.938925, 0, 4.045085}, 1, 0, 0.395288, 0},
186 {{0.951057, 0, 0.309017}, 1, 1, -0.328584, 0},
187 {{0.587785, 0, 0.809017}, 2, -2, 0.133454, 0},
188 {{1.469465, 4.52254, 1.545085}, 2, -1, 0.0701612, -0.215934},
189 {{0.587785, 0, -0.809017}, 2, 0, 0.303888, 0},
190 {{0.293893, 0.904508, -0.309017}, 2, 1, 0.0701612, 0.215934},
191 {{1.469465, 4.52254, 1.545085}, 2, 2, -0.282661, 0.205365},
192 {{-0.475528, -0.345492, -0.809017}, 3, -3, 0.0261823, 0.0805808},
193 {{-2.37764, -1.72746, 4.045085}, 4, 4, -0.0427344, 0.0310484},
197 for (
int i = 0; i <
N; i++)
199 YlmValue& v = Vals[i];
207 CHECK(v.y_re == Approx(out.real()));
208 CHECK(v.y_im == Approx(out.imag()));
212 TEST_CASE(
"Cartesian derivatives of Spherical Harmonics",
"[numerics]")
237 YlmDerivValue Vals[
N] =
238 {{{0.587785, 0, 0.809017}, 1, -1, 0.2261289, 0.0, 0.0, -0.3454942, -0.1642922, 0.0},
239 {{2.938925, 0, 4.045085}, 1, 0, -0.0464689, 0.0, 0.0, 0.0, 0.0337616, 0.0},
240 {{4.755285, 0, 1.545085}, 1, 1, -0.0065983, 0.0, 0.0, -0.0690987, 0.020307, 0.0},
241 {{0.587785, 0, 0.809017}, 2, -2, 0.2972075, 0.0, 0.0, -0.4540925, -0.2159337, 0.0},
242 {{1.469465, 4.52254, 1.545085}, 2, -1, 0.0394982, 0.0253845, -0.0253846, 0.0303795, 0.0367369, -0.1130644},
243 {{0.587785, 0, -0.809017}, 2, 0, -0.7280067, 0.0, 0.0, 0.0, -0.5289276, 0.0},
244 {{0.293893, 0.904508, -0.309017}, 2, 1, 0.1974909, -0.1269229, -0.1269229, -0.1518973, -0.183685, -0.5653221},
245 {{1.469465, 4.52254, 1.545085}, 2, 2, 0.0786382, 0.1156131, -0.0374877, -0.0288926, 0.0349388, -0.0253846},
246 {{-0.475528, -0.345492, -0.809017}, 3, -3, 0.1709827, -0.2963218, -0.3841394, -0.0501111, 0.0635463, 0.1955735},
247 {{-2.37764, -1.72746, 4.045085}, 4, 4, 0.0059594, -0.0565636, 0.0565635, 0.0307981, 0.0276584, -0.0200945}};
250 for (
int i = 0; i <
N; i++)
252 YlmDerivValue& v = Vals[i];
helper functions for EinsplineSetBuilder
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)
TEST_CASE("complex_helper", "[type_traits]")
void sphericalHarmonicGrad(const int l, const int m, const TinyVector< T, 3 > &r, TinyVector< std::complex< T >, 3 > &grad)
get cartesian derivatives of spherical Harmonics.
float imag(const float &c)
imaginary part of a scalar. Cannot be replaced by std::imag due to AFQMC specific needs...
void derivYlmSpherical(const int l, const int m, const TinyVector< T, 3 > &r, std::complex< T > &theta_deriv, std::complex< T > &phi_deriv, const bool conj)
calculate the derivative of a Ylm with respect to theta and phi param[in] l: angular momentum param[i...
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
T LegendrePll(int l, T x)
std::complex< T > sphericalHarmonic(const int l, const int m, const TinyVector< T, 3 > &r)
wrapper for Ylm, which can take any normal position vector as an argument param[in] l angular momentu...