JDFTx  1.7.0
SphericalHarmonics.h File Reference
#include <core/vector3.h>

Classes

struct  YlmProdTerm
 Term in real spherical harmonic expansion of a product of two real spherical harmonics. More...
 

Namespaces

 YlmInternal
 

Macros

#define X2   double x2 = x*x;
 
#define Y2   double y2 = y*y;
 
#define Z2   double z2 = z*z;
 
#define X2Y2   double x2y2 = x*x + y*y;
 
#define X2Y2i   X2 Y2 double x2y2 = x2 + y2;
 
#define DECLARE_Ylm(lm, code)    template<> __hostanddev__ double Ylm<lm>(double x, double y, double z) { code; }
 
#define SwitchTemplate_lm(l, m, fTemplate, argList)
 Switch a function templated over l,m for all supported l,m with parenthesis enclosed argument list argList.
 
#define ADD(l, m, coeff)   result.push_back(YlmProdTerm(l,m,coeff))
 
#define DECLARE_YlmPrime(l, m)   template<> __hostanddev__ vector3<> YlmPrime<l*(l+1)+m>(const vector3<>& qHat) { return YlmPrime<l,m>(qHat); }
 

Functions

double bessel_jl (int l, double x)
 Spherical bessel function.
 
template<int lm>
__hostanddev__ double YlmInternal::Ylm (double x, double y, double z)
 
 YlmInternal::DECLARE_Ylm (-2, return 0.) DECLARE_Ylm(-1
 
return YlmInternal::DECLARE_Ylm (0, return 0.28209479177387814) DECLARE_Ylm(1
 
return return *y YlmInternal::DECLARE_Ylm (2, return 0.4886025119029199 *z) DECLARE_Ylm(3
 
return return *y return *x YlmInternal::DECLARE_Ylm (4, return 1.0925484305920792 *x *y) DECLARE_Ylm(5
 
return return *y return *x return *y *z YlmInternal::DECLARE_Ylm (6, return -0.31539156525252005 *(x *x+y *y - 2.*z *z)) DECLARE_Ylm(7
 
return return *y return *x return *y *z return *x *z YlmInternal::DECLARE_Ylm (8, return 0.5462742152960396 *(x-y) *(x+y)) DECLARE_Ylm(9
 
return return *y return *x return *y *z return *x *z return *y *y *y *x *x YlmInternal::DECLARE_Ylm (10, return 2.890611442640554 *x *y *z) DECLARE_Ylm(11
 
return return *y return *x return *y *z return *x *z return *y *y *y *x *x return *y *x *x y *y *z *z YlmInternal::DECLARE_Ylm (12, return 0.3731763325901154 *z *(2.*z *z -3.*(x *x+y *y))) DECLARE_Ylm(13
 
return return *y return *x return *y *z return *x *z return *y *y *y *x *x return *y *x *x y *y *z *z return *x *x *x y *y *z *z YlmInternal::DECLARE_Ylm (14, return 1.445305721320277 *(x-y) *(x+y) *z) DECLARE_Ylm(15
 
return return *y return *x return *y *z return *x *z return *y *y *y *x *x return *y *x *x y *y *z *z return *x *x *x y *y *z *z return *x *x *x *y *y YlmInternal::DECLARE_Ylm (16, return 2.5033429417967046 *x *y *(x-y) *(x+y)) DECLARE_Ylm(17
 
return return *y return *x return *y *z return *x *z return *y *y *y *x *x return *y *x *x y *y *z *z return *x *x *x y *y *z *z return *x *x *x *y *y return *y *z *y *y *x *x YlmInternal::DECLARE_Ylm (18, return -0.9461746957575601 *x *y *(x *x+y *y - 6.*z *z)) DECLARE_Ylm(19
 
return return *y return *x return *y *z return *x *z return *y *y *y *x *x return *y *x *x y *y *z *z return *x *x *x y *y *z *z return *x *x *x *y *y return *y *z *y *y *x *x return *y *z **x *x y *y *z *z YlmInternal::DECLARE_Ylm (20, X2Y2 Z2 return 0.03526184897173477 *(9.*x2y2 *(x2y2 - 8 *z2)+24.*z2 *z2)) DECLARE_Ylm(21
 
return return *y return *x return *y *z return *x *z return *y *y *y *x *x return *y *x *x y *y *z *z return *x *x *x y *y *z *z return *x *x *x *y *y return *y *z *y *y *x *x return *y *z **x *x y *y *z *z return *x *z **x *x y *y *z *z YlmInternal::DECLARE_Ylm (22, X2 Y2 return -0.47308734787878004 *(x2 - y2) *(x2+y2 - 6.*z *z)) DECLARE_Ylm(23
 
return return *y return *x return *y *z return *x *z return *y *y *y *x *x return *y *x *x y *y *z *z return *x *x *x y *y *z *z return *x *x *x *y *y return *y *z *y *y *x *x return *y *z **x *x y *y *z *z return *x *z **x *x y *y *z *z return *x *z *x *x *y *y YlmInternal::DECLARE_Ylm (24, X2 Y2 return 0.6258357354491761 *(x2 *(x2 - 6.*y2)+y2 *y2)) DECLARE_Ylm(25
 
return return *y return *x return *y *z return *x *z return *y *y *y *x *x return *y *x *x y *y *z *z return *x *x *x y *y *z *z return *x *x *x *y *y return *y *z *y *y *x *x return *y *z **x *x y *y *z *z return *x *z **x *x y *y *z *z return *x *z *x *x *y *y X2 Y2 return *y **x2 *x2 *y2 y2 *y2 YlmInternal::DECLARE_Ylm (26, return 8.302649259524166 *x *y *z *(x-y) *(x+y)) DECLARE_Ylm(27
 
return return *y return *x return *y *z return *x *z return *y *y *y *x *x return *y *x *x y *y *z *z return *x *x *x y *y *z *z return *x *x *x *y *y return *y *z *y *y *x *x return *y *z **x *x y *y *z *z return *x *z **x *x y *y *z *z return *x *z *x *x *y *y X2 Y2 return *y **x2 *x2 *y2 y2 *y2 X2 Y2 return *y *y2 *x2 *x2 y2 *z *z YlmInternal::DECLARE_Ylm (28, return -4.793536784973324 *x *y *z *(x *x+y *y - 2.*z *z)) DECLARE_Ylm(29
 
return return *y return *x return *y *z return *x *z return *y *y *y *x *x return *y *x *x y *y *z *z return *x *x *x y *y *z *z return *x *x *x *y *y return *y *z *y *y *x *x return *y *z **x *x y *y *z *z return *x *z **x *x y *y *z *z return *x *z *x *x *y *y X2 Y2 return *y **x2 *x2 *y2 y2 *y2 X2 Y2 return *y *y2 *x2 *x2 y2 *z *z X2Y2 Z2 return *y *x2y2 *x2y2 *z2 *z2 *z2 YlmInternal::DECLARE_Ylm (30, X2Y2 Z2 return 0.1169503224534236 *z *(15.*x2y2 *x2y2 - 8.*z2 *(5.*x2y2 - z2))) DECLARE_Ylm(31
 
return return *y return *x return *y *z return *x *z return *y *y *y *x *x return *y *x *x y *y *z *z return *x *x *x y *y *z *z return *x *x *x *y *y return *y *z *y *y *x *x return *y *z **x *x y *y *z *z return *x *z **x *x y *y *z *z return *x *z *x *x *y *y X2 Y2 return *y **x2 *x2 *y2 y2 *y2 X2 Y2 return *y *y2 *x2 *x2 y2 *z *z X2Y2 Z2 return *y *x2y2 *x2y2 *z2 *z2 *z2 X2Y2 Z2 return *x *x2y2 *x2y2 *z2 *z2 *z2 YlmInternal::DECLARE_Ylm (32, X2 Y2 return -2.396768392486662 *(x2-y2) *z *(x2+y2 - 2.*z *z)) DECLARE_Ylm(33
 
return return *y return *x return *y *z return *x *z return *y *y *y *x *x return *y *x *x y *y *z *z return *x *x *x y *y *z *z return *x *x *x *y *y return *y *z *y *y *x *x return *y *z **x *x y *y *z *z return *x *z **x *x y *y *z *z return *x *z *x *x *y *y X2 Y2 return *y **x2 *x2 *y2 y2 *y2 X2 Y2 return *y *y2 *x2 *x2 y2 *z *z X2Y2 Z2 return *y *x2y2 *x2y2 *z2 *z2 *z2 X2Y2 Z2 return *x *x2y2 *x2y2 *z2 *z2 *z2 X2 Y2 return *x *x2 *y2 *x2 y2 *z *z YlmInternal::DECLARE_Ylm (34, X2 Y2 return 2.0756623148810416 *z *(x2 *(x2 - 6.*y2)+y2 *y2)) DECLARE_Ylm(35
 
return return *y return *x return *y *z return *x *z return *y *y *y *x *x return *y *x *x y *y *z *z return *x *x *x y *y *z *z return *x *x *x *y *y return *y *z *y *y *x *x return *y *z **x *x y *y *z *z return *x *z **x *x y *y *z *z return *x *z *x *x *y *y X2 Y2 return *y **x2 *x2 *y2 y2 *y2 X2 Y2 return *y *y2 *x2 *x2 y2 *z *z X2Y2 Z2 return *y *x2y2 *x2y2 *z2 *z2 *z2 X2Y2 Z2 return *x *x2y2 *x2y2 *z2 *z2 *z2 X2 Y2 return *x *x2 *y2 *x2 y2 *z *z X2 Y2 return *x *x2 *x2 *y2 *y2 *y2 YlmInternal::DECLARE_Ylm (36, X2 Y2 return 1.3663682103838286 *x *y *(x2 *(3.*x2 - 10.*y2)+3.*y2 *y2)) DECLARE_Ylm(37
 
return return *y return *x return *y *z return *x *z return *y *y *y *x *x return *y *x *x y *y *z *z return *x *x *x y *y *z *z return *x *x *x *y *y return *y *z *y *y *x *x return *y *z **x *x y *y *z *z return *x *z **x *x y *y *z *z return *x *z *x *x *y *y X2 Y2 return *y **x2 *x2 *y2 y2 *y2 X2 Y2 return *y *y2 *x2 *x2 y2 *z *z X2Y2 Z2 return *y *x2y2 *x2y2 *z2 *z2 *z2 X2Y2 Z2 return *x *x2y2 *x2y2 *z2 *z2 *z2 X2 Y2 return *x *x2 *y2 *x2 y2 *z *z X2 Y2 return *x *x2 *x2 *y2 *y2 *y2 X2 Y2 return *y *z **x2 *x2 *y2 y2 *y2 YlmInternal::DECLARE_Ylm (38, X2 Y2 return -2.0182596029148967 *x *y *(x2 - y2) *(x2+y2 - 10.*z *z)) DECLARE_Ylm(39
 
return return *y return *x return *y *z return *x *z return *y *y *y *x *x return *y *x *x y *y *z *z return *x *x *x y *y *z *z return *x *x *x *y *y return *y *z *y *y *x *x return *y *z **x *x y *y *z *z return *x *z **x *x y *y *z *z return *x *z *x *x *y *y X2 Y2 return *y **x2 *x2 *y2 y2 *y2 X2 Y2 return *y *y2 *x2 *x2 y2 *z *z X2Y2 Z2 return *y *x2y2 *x2y2 *z2 *z2 *z2 X2Y2 Z2 return *x *x2y2 *x2y2 *z2 *z2 *z2 X2 Y2 return *x *x2 *y2 *x2 y2 *z *z X2 Y2 return *x *x2 *x2 *y2 *y2 *y2 X2 Y2 return *y *z **x2 *x2 *y2 y2 *y2 X2 Y2 return *y *z *y2 *x2 **x2 y2 *z *z YlmInternal::DECLARE_Ylm (40, X2Y2 Z2 return 0.9212052595149236 *x *y *(x2y2 *(x2y2 - 16.*z2)+16.*z2 *z2)) DECLARE_Ylm(41
 
return return *y return *x return *y *z return *x *z return *y *y *y *x *x return *y *x *x y *y *z *z return *x *x *x y *y *z *z return *x *x *x *y *y return *y *z *y *y *x *x return *y *z **x *x y *y *z *z return *x *z **x *x y *y *z *z return *x *z *x *x *y *y X2 Y2 return *y **x2 *x2 *y2 y2 *y2 X2 Y2 return *y *y2 *x2 *x2 y2 *z *z X2Y2 Z2 return *y *x2y2 *x2y2 *z2 *z2 *z2 X2Y2 Z2 return *x *x2y2 *x2y2 *z2 *z2 *z2 X2 Y2 return *x *x2 *y2 *x2 y2 *z *z X2 Y2 return *x *x2 *x2 *y2 *y2 *y2 X2 Y2 return *y *z **x2 *x2 *y2 y2 *y2 X2 Y2 return *y *z *y2 *x2 **x2 y2 *z *z X2Y2 Z2 return *y *z **x2y2 *x2y2 *z2 *z2 *z2 YlmInternal::DECLARE_Ylm (42, X2Y2 Z2 return 0.06356920226762842 *(5.*x2y2 *x2y2 *(18.*z2 - x2y2)+8.*z2 *z2 *(2.*z2 - 15.*x2y2))) DECLARE_Ylm(43
 
return return *y return *x return *y *z return *x *z return *y *y *y *x *x return *y *x *x y *y *z *z return *x *x *x y *y *z *z return *x *x *x *y *y return *y *z *y *y *x *x return *y *z **x *x y *y *z *z return *x *z **x *x y *y *z *z return *x *z *x *x *y *y X2 Y2 return *y **x2 *x2 *y2 y2 *y2 X2 Y2 return *y *y2 *x2 *x2 y2 *z *z X2Y2 Z2 return *y *x2y2 *x2y2 *z2 *z2 *z2 X2Y2 Z2 return *x *x2y2 *x2y2 *z2 *z2 *z2 X2 Y2 return *x *x2 *y2 *x2 y2 *z *z X2 Y2 return *x *x2 *x2 *y2 *y2 *y2 X2 Y2 return *y *z **x2 *x2 *y2 y2 *y2 X2 Y2 return *y *z *y2 *x2 **x2 y2 *z *z X2Y2 Z2 return *y *z **x2y2 *x2y2 *z2 *z2 *z2 X2Y2 Z2 return *x *z **x2y2 *x2y2 *z2 *z2 *z2 YlmInternal::DECLARE_Ylm (44, X2Y2i Z2 return 0.4606026297574618 *(x2-y2) *(x2y2 *(x2y2 - 16.*z2)+16.*z2 *z2)) DECLARE_Ylm(45
 
return return *y return *x return *y *z return *x *z return *y *y *y *x *x return *y *x *x y *y *z *z return *x *x *x y *y *z *z return *x *x *x *y *y return *y *z *y *y *x *x return *y *z **x *x y *y *z *z return *x *z **x *x y *y *z *z return *x *z *x *x *y *y X2 Y2 return *y **x2 *x2 *y2 y2 *y2 X2 Y2 return *y *y2 *x2 *x2 y2 *z *z X2Y2 Z2 return *y *x2y2 *x2y2 *z2 *z2 *z2 X2Y2 Z2 return *x *x2y2 *x2y2 *z2 *z2 *z2 X2 Y2 return *x *x2 *y2 *x2 y2 *z *z X2 Y2 return *x *x2 *x2 *y2 *y2 *y2 X2 Y2 return *y *z **x2 *x2 *y2 y2 *y2 X2 Y2 return *y *z *y2 *x2 **x2 y2 *z *z X2Y2 Z2 return *y *z **x2y2 *x2y2 *z2 *z2 *z2 X2Y2 Z2 return *x *z **x2y2 *x2y2 *z2 *z2 *z2 X2 Y2 return *x *z *x2 *y2 **x2 y2 *z *z YlmInternal::DECLARE_Ylm (46, X2 Y2 return -0.5045649007287242 *(x2 *(x2 - 6.*y2)+y2 *y2) *(x2+y2 - 10.*z *z)) DECLARE_Ylm(47
 
template<int lm>
__hostanddev__ double Ylm (const vector3<> &qhat)
 Index by combined lm := l*(l+1)+m index (useful when static-looping over all l,m)
 
template<int l, int m>
__hostanddev__ double Ylm (const vector3<> &qhat)
 Index by l and m separately.
 
template<int l, int m>
void set_Ylm (const vector3<> qHat, double &result)
 Use above macro to provide a non-templated version of the function.
 
double Ylm (int l, int m, const vector3<> &qHat)
 
std::vector< YlmProdTermexpandYlmProd (int lm1, int lm2)
 
std::vector< YlmProdTermexpandYlmProd (int l1, int m1, int l2, int m2)
 Wrapper function expandYlmProd with individual indices.
 
template<int l, int m>
__hostanddev__ vector3 YlmPrime (const vector3<> &qHat)
 Derivative of spherical Harmonic with repect to iDir'th component of qHat with separate l,m indices. More...
 
template<int lm>
__hostanddev__ vector3 YlmPrime (const vector3<> &qHat)
 Derivative of spherical Harmonic with repect to iDir'th component of qHat with combined lm index. More...
 
 DECLARE_YlmPrime (0, 0) DECLARE_YlmPrime(1
 
 DECLARE_YlmPrime (1, 0) DECLARE_YlmPrime(1
 
 DECLARE_YlmPrime (2,-2) DECLARE_YlmPrime(2
 
 DECLARE_YlmPrime (2, 0) DECLARE_YlmPrime(2
 
 DECLARE_YlmPrime (2, 2) DECLARE_YlmPrime(3
 
 DECLARE_YlmPrime (3,-2) DECLARE_YlmPrime(3
 
 DECLARE_YlmPrime (3, 0) DECLARE_YlmPrime(3
 
 DECLARE_YlmPrime (3, 2) DECLARE_YlmPrime(3
 
 DECLARE_YlmPrime (4,-4) DECLARE_YlmPrime(4
 
 DECLARE_YlmPrime (4, 0) DECLARE_YlmPrime(4
 
 DECLARE_YlmPrime (4, 2) DECLARE_YlmPrime(4
 
 DECLARE_YlmPrime (4, 4) DECLARE_YlmPrime(5
 
 DECLARE_YlmPrime (5,-4) DECLARE_YlmPrime(5
 
 DECLARE_YlmPrime (5, 0) DECLARE_YlmPrime(5
 
 DECLARE_YlmPrime (5, 2) DECLARE_YlmPrime(5
 
 DECLARE_YlmPrime (5, 4) DECLARE_YlmPrime(5
 
 DECLARE_YlmPrime (6,-6) DECLARE_YlmPrime(6
 
 DECLARE_YlmPrime (6, 0) DECLARE_YlmPrime(6
 
 DECLARE_YlmPrime (6, 2) DECLARE_YlmPrime(6
 
 DECLARE_YlmPrime (6, 4) DECLARE_YlmPrime(6
 
 DECLARE_YlmPrime (6, 6) template< int l
 Non-templated version of YlmPrime (for debugging)
 
int m void set_YlmPrime (const vector3<> qHat, vector3<> &result)
 
vector3 YlmPrime (int l, int m, const vector3<> &qHat)
 

Detailed Description

Real spherical Harmonics and spherical bessel functions