Loading [MathJax]/extensions/tex2jax.js
DFT-EFE
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Loading...
Searching...
No Matches
SphericalHarmonicFunctions.h
Go to the documentation of this file.
1#ifndef dftefeSphericalHarmonicFunctions_h
2#define dftefeSphericalHarmonicFunctions_h
3
4#include <vector>
5#include <iostream>
6#include <fstream>
7#include <memory>
8#include <utils/Point.h>
9#include <sstream>
10#include <utils/Spline.h>
11
12namespace dftefe
13{
14 namespace atoms
15 {
17 {
18 public:
19 SphericalHarmonicFunctions(const bool isAssocLegendreSplineEval = true);
20
22
27
28 //
29 // We use the real form of spherical harmonics without the Condon-Shortley
30 // phase (i.e., the (-1)^m prefactor) (see
31 // https://en.wikipedia.org/wiki/Spherical_harmonics) NOTE: 1) The
32 // wikipedia definition has the Condon-Shortley phase.
33 // 2) The definition of the associated Legendre polynomial (P_lm) in
34 // Boost library also contains a Condon-Shortley phase.
35 // Thus, if you're using Boost library, multiply the P_lm
36 // evaluation with (-1)^m to remove the Condon-Shortley phase.
37 // Most Quantum Chemistry codes (e.g., QChem) do not include the
38 // Condon-Shortley phase. So to make it consistent, it is
39 // prefered to remove the Condon-Shortley phase, if there are any
40 // to begin with.
41 // 3) From C++17 onwards, the <cmath> has the associated Legendre
42 // polynomial (see
43 // https://en.cppreference.com/w/cpp/numeric/special_functions/assoc_legendre)
44 // Thus, if you're using C++17 or beyond, you can use the C++
45 // standard's definition of associated Legendre polynomial
46 // instead of Boost. Note that, the C++ standard does not have
47 // the Condon-Shortley phase while Boost has it. So, we do not
48 // have to do anything special to remove it while using the C++
49 // standard.
50 //
51
52 //
53 // Y_lm(theta, phi) = Clm(l,m) * Dm(m) * P_lm(l,m,cos(theta)) * Qm(m,phi),
54 // where theta = polar angle,
55 // phi = azimuthal angle
56 // P_lm is the associated Legendre polynomial of degree l and order m,
57 // Qm is the real form of exp(i*m*phi),
58 // C_lm is the normalization constant for P_lm,
59 // D_m is the normalization constant for Q_m
60 //
61
62 //
63 // For the definition of the associated Legendre polynomials i.e. P_lm and
64 // their derivatives (as used for evaluating the real form of spherical
65 // harmonics and their derivatives) refer:
66 // @article{bosch2000computation,
67 // title={On the computation of derivatives of Legendre functions},
68 // author={Bosch, W},
69 // journal={Physics and Chemistry of the Earth, Part A: Solid Earth
70 // and Geodesy}, volume={25}, number={9-11}, pages={655--659},
71 // year={2000},
72 // publisher={Elsevier}
73 // }
74 // We use the derivative definitions from the above reference because
75 // finding the derivatives on the pole (i.e., theta = 0) is tricky. This
76 // is because the azimuthal angles (phi) is undefined for a point on the
77 // pole. However, the derivative is still well defined on the pole via the
78 // L'Hospital's rule. However, one can avoid implementing tedious
79 // L'Hospital's rule on pole and use much simpler expressions given in the
80 // above reference.
81 //
82
83 double
84 Plm(const int l, const int m, const double theta) const;
85
86 double
87 dPlmDTheta(const int l, const int m, const double theta) const;
88
89 double
90 d2PlmDTheta2(const int l, const int m, const double theta) const;
94
95 private:
96 std::vector<std::vector<std::shared_ptr<const utils::Spline>>>
99 };
100
101 // Analytical Functions
102 void
104 double & r,
105 double & theta,
106 double & phi,
107 double polarAngleTolerance);
108
109 void
110 convertCartesianToSpherical(const std::vector<utils::Point> &x,
111 std::vector<double> & r,
112 std::vector<double> & theta,
113 std::vector<double> & phi,
114 double polarAngleTolerance);
115 double
116 Dm(const int m);
117
118 double
119 Clm(const int l, const int m);
120
121 double
122 Qm(const int m, const double phi);
123
124 double
125 dQmDPhi(const int m, const double phi);
126
127 } // namespace atoms
128} // namespace dftefe
129#endif // SphericalHarmonicFunctions
Definition: SphericalHarmonicFunctions.h:17
double d2PlmDTheta2(const int l, const int m, const double theta) const
Definition: SphericalHarmonicFunctions.cpp:503
bool d_isAssocLegendreSplineEval
Definition: SphericalHarmonicFunctions.h:98
double dPlmDTheta(const int l, const int m, const double theta) const
Definition: SphericalHarmonicFunctions.cpp:472
std::vector< std::vector< std::shared_ptr< const utils::Spline > > > d_assocLegendreSpline
Definition: SphericalHarmonicFunctions.h:97
double Plm(const int l, const int m, const double theta) const
Definition: SphericalHarmonicFunctions.cpp:443
Definition: PointImpl.h:13
void convertCartesianToSpherical(const utils::Point &x, double &r, double &theta, double &phi, double polarAngleTolerance)
Definition: SphericalHarmonicFunctions.cpp:251
double Dm(const int m)
Definition: SphericalHarmonicFunctions.cpp:379
double dQmDPhi(const int m, const double phi)
Definition: SphericalHarmonicFunctions.cpp:432
double Qm(const int m, const double phi)
Definition: SphericalHarmonicFunctions.cpp:418
double Clm(const int l, const int m)
Definition: SphericalHarmonicFunctions.cpp:410
dealii includes
Definition: AtomFieldDataSpherical.cpp:31