Spherical harmonics provide a smooth, orthogonal, and symmetry-adapted basis to expand functions on a sphere, and they are used routinely in physical and theoretical chemistry as well as in different fields of science and technology, from geology and atmospheric sciences to signal processing and computer graphics. More recently, they have become a key component of rotationally equivariant models in geometric machine learning, including applications to atomic-scale modeling of molecules and materials. We present an elegant and efficient algorithm for the evaluation of the real-valued spherical harmonics. Our construction features many of the desirable properties of existing schemes and allows to compute Cartesian derivatives in a numerically stable and computationally efficient manner. To facilitate usage, we implement this algorithm in sphericart, a fast C++ library which also provides C bindings, a Python API, and a PyTorch implementation that includes a GPU kernel.
翻译:球谐函数提供了光滑、正交且具有对称适应性的基函数,可用于展开球面上的函数,并广泛应用于物理化学和理论化学领域,以及从地质学、大气科学到信号处理和计算机图形学等不同科学与技术领域。近年来,它们已成为几何机器学习中旋转等变模型的关键组成部分,包括在分子与材料的原子尺度建模中的应用。我们提出了一种优雅且高效的算法来评估实值球谐函数。该构建方法兼具现有方案的诸多理想特性,并能够以数值稳定且计算高效的方式计算笛卡尔导数。为便于使用,我们将该算法实现为快速C++库sphericart,同时提供C语言绑定、Python API以及包含GPU内核的PyTorch实现。