Skip to main content
QUICK REVIEW

[Paper Review] Associated Legendre Polynomials and Spherical Harmonics Computation for Chemistry Applications

Taweetham Limpanuparb, Josh Milthorpe|arXiv (Cornell University)|Oct 7, 2014
Scientific Research and DiscoveriesPhysics and Astronomy2 references8 citations
TL;DR

This paper presents a highly accurate and efficient C++ algorithm for computing associated Legendre polynomials (ALPs) and spherical harmonics (SHs) in quantum chemistry applications. By normalizing ALPs, using stable one-term recurrence relations for trigonometric functions, and precomputing coefficients, the method achieves absolute or relative errors below $10^{-10}$ for degrees and orders up to 1000, with an average computation time of less than 4 cycles per ALP.

ABSTRACT

Associated Legendre polynomials and spherical harmonics are central to calculations in many fields of science and mathematics - not only chemistry but computer graphics, magnetic, seismology and geodesy. There are a number of algorithms for these functions published since 1960 but none of them satisfy our requirements. In this paper, we present a comprehensive review of algorithms in the literature and, based on them, propose an efficient and accurate code for quantum chemistry. Our requirements are to efficiently calculate these functions for all non-negative integer degrees and orders up to a given number (<=1000) and the absolute or the relative error of each calculated value should not exceed 10E-10. We achieve this by normalizing the polynomials, employing efficient and stable recurrence relations, and precomputing coefficients. The algorithm presented here is straightforward and may be used in other areas of science.

Motivation & Objective

  • To develop a numerically stable and efficient algorithm for computing associated Legendre polynomials (ALPs) and spherical harmonics (SHs) in quantum chemistry.
  • To ensure absolute or relative errors for ALP and SH values remain below $10^{-10}$ for degrees and orders up to 1000.
  • To optimize performance by using one-term recurrence relations for trigonometric functions and precomputing coefficients.
  • To provide a straightforward, reusable implementation suitable for broader scientific applications beyond quantum chemistry.

Proposed method

  • Normalization of ALPs to improve numerical stability during recurrence computations.
  • Use of one-term recurrence relations for $\cos(m\phi)$ and $\sin(m\phi)$, which are shown to be numerically stable and accurate to below $10^{-13}$ in relative error.
  • Precomputation of coefficients to avoid repeated calculations and improve performance.
  • Computation of $P_{\ell}^{m}$ values via a recurrence in the direction of increasing $\ell$, starting from normalized $P_{\ell}^{\ell}$.
  • Application of the reflection formula to relate $P_{\ell}^{-m}$ to $P_{\ell}^{m}$ for negative orders.
  • Final computation of spherical harmonics using the normalized $P_{\ell}^{m}$ and the trigonometric functions with precomputed phases.

Experimental results

Research questions

  • RQ1Can a recurrence-based algorithm for ALPs and SHs achieve sub-$10^{-10}$ absolute or relative error for degrees and orders up to 1000?
  • RQ2Is the use of one-term recurrence relations for trigonometric functions more stable and accurate than two-term alternatives in this context?
  • RQ3Can precomputed coefficients and normalization significantly improve both accuracy and performance in ALP and SH evaluation?
  • RQ4Does the algorithm remain efficient and accurate beyond $\ell = 1000$, particularly when vectorization and pipelining are leveraged?

Key findings

  • The algorithm achieves absolute or relative errors below $10^{-10}$ for all ALP and SH values computed for $\ell \leq 1000$ and $|m| \leq \ell$.
  • One-term recurrence relations for $\cos(m\phi)$ and $\sin(m\phi)$ yield relative errors below $10^{-13}$, ensuring high accuracy in SH computation.
  • The average time to compute a single ALP is less than 4 cycles on modern processors, with performance improving for larger $\ell$ due to effective loop vectorization and pipelining.
  • Initialization time is negligible (~100 μs for $L=100$) when amortized over multiple calls, making the method practical for repeated use.
  • The error in spherical harmonics $Y_{\ell}^{m}$ is bounded by the sum of errors in $P_{\ell}^{m}$ and the trigonometric functions, with the product term $\Delta_P \Delta_c$ being negligible.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.