53RealSphericalHarmonic::RealSphericalHarmonic() {}
55RealType RealSphericalHarmonic::getValueAt(RealType costheta, RealType phi) {
59 p = LegendreP(L, M, costheta);
61 if (functionType == RSH_SIN) {
62 phase = sin((RealType)M * phi);
64 phase = cos((RealType)M * phi);
67 return coefficient * p * phase;
85RealType RealSphericalHarmonic::LegendreP(
int l,
int m, RealType x) {
87 if (m < 0 || m > l || fabs(x) > 1.0) {
88 printf(
"LegendreP got a bad argument: l = %d\tm = %d\tx = %lf\n", l, m, x);
90 return std::numeric_limits<RealType>::quiet_NaN();
95 RealType h = sqrt((1.0 - x) * (1.0 + x)), f = 1.0;
96 for (
int i = 1; i <= m; i++) {
104 RealType pmmp1 = x * (2 * m + 1) * pmm;
109 for (
int ll = m + 2; ll <= l; ll++) {
110 pll = (x * (2 * ll - 1) * pmmp1 - (ll + m - 1) * pmm) / (ll - m);
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.