1 Introduction

Atomic and molecular collisions at subkelvin temperatures are a very sensitive probe of the interaction potential. The group of Narevicius conducted a few years ago the first merged-beam experiments for low-energy collisions of atoms with diatomic molecules [1,2,3]. These experiments were cutting-edge attainments in cold controlled chemistry [4,5,6]. Recently, Narevicius with collaborators directly probed the anisotropy in the atom–diatom collisions through orbiting resonances, revealing its strong role in the interaction energy [7]. Therefore, a high level of theory is needed to inspect and elucidate the measurements in the subkelvin regime, where quantum effects dominate.

The potential describing the interaction between an atom in an S state and a closed-shell diatomic molecule in the Jacobi coordinate system is a function of three coordinates \((R, r, \vartheta )\). The orientation of the molecule and the entire complex is characterized by the vectors \(\mathbf {r}\) and \(\mathbf {R}\), respectively. Consequently, r is the interatomic separation in the molecule, whereas R is the distance from the atom to the center of mass (COM) of the molecule. The third coordinate \(\vartheta\) is the angle between \(\mathbf {r}\) and \(\mathbf {R}\). The potential may be conveniently expanded in Legendre polynomials as follows [8,9,10]

$$\begin{aligned} V(R,r,\vartheta )= & {} \sum _\eta V_\eta (R,r)P_\eta (\cos \vartheta ) \nonumber \\= & {} V_0(R,r)+V_1(R,r)\cos \vartheta + V_2(R,r)\frac{1}{2}(3\cos ^2\vartheta -1) \nonumber \\&+ V_3(R,r)\frac{1}{2}(5\cos ^3\vartheta -3\cos \vartheta ) \nonumber \\&+ V_4(R,r)\frac{1}{8}(35\cos ^4\vartheta -30\cos ^2\vartheta +3 ) + ... , \end{aligned}$$
(1)

where \(V_\eta (R,r)\) are radial functions. Note that the terms with \(\eta =1,3,\ldots\) vanish for homonuclear molecules because \(V(R,r,\vartheta )=V(R,r,\pi -\vartheta )\). When we consider the atom–diatom complex in the laboratory coordinate frame, the angle \(\vartheta\) can be expressed in terms of four angles \(\theta _1\), \(\phi _1\), \(\theta _2\), \(\phi _2\) [11]:

$$\begin{aligned} \cos [\vartheta (\theta _1,\phi _1,\theta _2,\phi _2)] = \frac{\mathbf {R}\cdot \mathbf {r}}{Rr}= & {} \sin \theta _1\cos \phi _1 \sin \theta _2\cos \phi _2 \nonumber \\&+\sin \theta _1\sin \phi _1 \sin \theta _2\sin \phi _2 +\cos \theta _1\cos \theta _2. \end{aligned}$$
(2)

The angles \(\theta _1\) and \(\phi _1\) specify the direction of the atom–COM axis, whereas \(\theta _2\) and \(\phi _2\) indicate the orientation of the diatomic bond.

The adiabatic approach in molecular collisions has a long record, going back to Levine [12]. Klemperer and coworkers [8] introduced the Born–Oppenheimer separation of angular and radial motion for calculating the properties of ground-state van der Waals complexes. A similar concept has been adopted by many other authors, e.g., for spectroscopic studies of weakly bound molecular systems [13,14,15,16,17,18] or molecular scattering calculations [19,20,21]. In our investigations, we have employed the newly developed adiabatic variational theory (AVT) for cold anisotropic collision experiments [11, 22, 23] that allows solving the Schrödinger equation, reducing the multidimensional problem to simpler subproblems without losing physical information, and then calculating reaction rate coefficients. It has been successfully applied for excited metastable helium atoms (He(\(2^3\)S)) colliding with rovibrational ground-state hydrogen molecules, achieving a good, or very good, agreement with the experimental data of the Narevicius group [22,23,24,25]. The latest work with AVT confirms the observed strong quantum kinetic isotope effect in low-energy collisions between He(\(2^3\)S) and hydrogen isotopologues (H\(_2\), HD, D\(_2\)) and exhibits that the change of the rovibrational state of the molecule can significantly enhance or suppress the reaction process like a quantum switch [26].

According to AVT, we represent the interaction potential, Eq. (1), in a matrix form in a basis set consisting of products of two spherical harmonics, \(\{Y_{l_1,m_1}(\theta _1,\phi _1)Y_{l_2,m_2}(\theta _2,\phi _2)\}\), where \(l_1,m_1,l_2,m_2\) are referred to as quantum numbers. Such a basis set describes the rotations of the entire complex and the molecule. Up to date, AVT has been only used with \(\eta \le 2\) [11, 22,23,24,25,26,27], where the matrix elements were calculated directly without using sophisticated methods. For \(\eta >2\), the matrix elements become much more complicated and difficult to resolve. Therefore, in the present work, we derive general analytical angular solutions for the following matrix elements (in the Dirac notation)

$$\begin{aligned} V_{l_1,m_1,l_2,m_2}^{{l_1^\prime ,m_1^\prime ,l_2^\prime ,m_2^\prime }} = \left\langle \prod _{j=1}^2 Y_{l_j^\prime ,m_j^\prime }(\theta _j,\phi _j) | V(R,r,\vartheta (\theta _1,\phi _1,\theta _2,\phi _2)) | \prod _{j=1}^2 Y_{l_j,m_j}(\theta _j,\phi _j) \right\rangle . \end{aligned}$$
(3)

This is a purely mathematical issue and it boils down to the evaluation of appropriate integrals, which can be further used to investigate thoroughly the effect of anisotropy on the resonant structure in reaction cross sections and rate coefficients of atoms colliding with diatoms. In general, the inclusion of higher terms \((\eta >2)\) of the Legendre polynomials expansion in AVT may lead to a better agreement of the theoretical predictions with the experimental findings and a deeper understanding of quantum phenomena in chemical reactions (as, for instance, Penning ionization, interatomic or intermolecular Coulombic decay, Auger effect), especially at very low temperatures (below 1 kelvin). Moreover, the first detection of He(2\(^3\)S) on an exoplanet in 2018 [28] significantly extended the role of theoretical chemistry in astrochemistry. The interaction and collisions of 2\(^3\)S helium with ubiquitous molecular hydrogen and other diatomic molecules are expected to be intensively studied in the next years.

The problem might seem to be similar to the one considered by Percival and Seaton in Ref. [29]. The authors found the matrix elements of \(P_\eta (\cos \vartheta )\) in the following basis set \(\{\sum _{m_1,m_2} \langle l_1,l_2,m_1,m_2|LM\rangle Y_{l_1,m_1}(\theta _1,\phi _1) Y_{l_2,m_2}(\theta _2,\phi _2)\}\), where \(\langle l_1,l_2,m_1,m_2|LM\rangle\) are the Clebsch–Gordan coefficients. However, they imposed constraints that \(|l_1-l_2|\le L\le l_1+l_2\) and \(M=m_1+m_2\). This action is physically well-motivated — the total angular momentum L is a rigorously good quantum number. Since then, the other authors have been widely using the solutions of Percival and Seaton. However, the solutions cannot be adopted to the above-mentioned AVT, which is a non-standard method, where \(m_1\) and \(m_2\) are input parameters, but not L and M. Nevertheless, the studies presented in this work are based on a methodology different from that in Ref. [29] and to our knowledge have not been conducted previously.

2 Evaluation of the integral involving arbitrary powers of trigonometric functions

First, we represent the Legendre polynomials in Eq. (1) as follows:

$$\begin{aligned} P_\eta (\cos \vartheta ) = 2^\eta \sum _{k=0}^\eta {\eta \atopwithdelims ()k} {\alpha \atopwithdelims ()\eta } \cos ^k\!\vartheta \,, \end{aligned}$$
(4)

where \(\alpha =\frac{\eta +k-1}{2}\). Note that \({\alpha \atopwithdelims ()\eta }\) is the generalized binomial coefficient defined as

$$\begin{aligned} {\alpha \atopwithdelims ()\eta } = \frac{\alpha (\alpha -1)\cdots (\alpha -\eta +1)}{\eta !}. \end{aligned}$$
(5)

In Appendix 1, we showed that the Eq. (4) is equivalent to the well-known expression [30, 31]

$$\begin{aligned} P_\eta (\cos \vartheta ) = \frac{1}{2^\eta } \sum _{k=0}^{\left[ \frac{\eta }{2} \right] } (-1)^k \frac{(2\eta -2k)!}{k!(\eta -k)!(\eta -2k)!} \cos ^{\eta -2k}\!\vartheta \,, \end{aligned}$$
(6)

where \(\left[ \frac{\eta }{2}\right]\) stands for the integer part of \(\frac{\eta }{2}\). After substituting Eq. (2) into Eq. (4) and utilizing the trinomial expansion, the matrix elements, Eq. (3), read

$$\begin{aligned} V_{l_1,m_1,l_2,m_2}^{{l_1^\prime ,m_1^\prime ,l_2^\prime ,m_2^\prime }}= & {} \sum \limits _\eta V_{\eta }(R,r) 2^\eta \sum _{k=0}^\eta {\eta \atopwithdelims ()k} {\frac{\eta +k-1}{2} \atopwithdelims ()\eta } \sum _{\begin{array}{c} k_1,k_2,k_3 \ge 0 \\ k_1+k_2+k_3=k \end{array}} {k \atopwithdelims ()k_1,k_2,k_3} \nonumber \\&\times \prod _{j=1}^2 I(k_3,k_1+k_2,k_1,k_2,l^\prime _j,m^\prime _j,l_j,m_j), \end{aligned}$$
(7)

where \({k \atopwithdelims ()k_1,k_2,k_3}=\frac{k!}{k_1!k_2!k_3!}\). This formula can be straight implemented in any quantum chemistry package or atomic and molecular physics program, provided that the analytical form of such a general integral is known

$$\begin{aligned} I(n_1,n_2,n_3,n_4,l^\prime _j,m^\prime _j,l_j,m_j)= & {} \int _0^{\pi } \int _0^{2\pi } Y_{l^\prime _j,m^\prime _j}^{*}(\theta _j,\phi _j) \cos ^{n_1}\!\theta _j\, \sin ^{n_2}\!\theta _j\, \nonumber \\&\times \cos ^{n_3}\!\phi _j\, \sin ^{n_4}\!\phi _j\, Y_{l_j,m_j}(\theta _j,\phi _j) \sin \theta _j d\phi _j d\theta _j \,\, \end{aligned}$$
(8)

with \(j=1,2\) and non-negative integers \(n_1,n_2,n_3,n_4\). For simplicity, we henceforth omit the index j. We use mostly recommended and broadly accepted notation of the spherical harmonics, where the factor of \((-1)^m\), i.e., the Condon–Shortley phase, is included in the associated Legendre polynomial \((P_l^m)\), see Chapter 15.4 in Ref. [30]. Thus,

$$\begin{aligned} Y_{l,m} = N_{l,m} P_l^m(\cos \theta ) e^{im\phi }, \end{aligned}$$
(9)

where \(l=0,1,2,\ldots\), \(-l\le m \le l\), and \(N_{l,m}\) is a normalization constant given by

$$\begin{aligned} N_{l,m} = \sqrt{\frac{1}{2\pi }} N_{l,m}^{\theta } = \sqrt{\frac{2l+1}{4\pi }\frac{(l-m)!}{(l+m)!}}. \end{aligned}$$
(10)

For negative m values, the associated Legendre polynomial reads

$$\begin{aligned} P_l^{-m} = (-1)^m \frac{(l-m)!}{(l+m)!} P_l^m. \end{aligned}$$
(11)

The integral \(I(n_1,n_2,n_3,n_4,l^\prime ,m^\prime ,l,m)\), Eq. (8), can be factorized into two independent integrals:

$$\begin{aligned} I^\theta (n_1,n_2,l^\prime ,m^\prime ,l,m)&=N_{l^\prime ,m^\prime }^{\theta }N_{l,m}^{\theta } \int _{0}^{\pi } \cos ^{n_1}\!\theta \, \sin ^{n_2}\!\theta \, P_{l^\prime }^{m^\prime }(\cos \theta ) P_l^m(\cos \theta ) \sin \theta d\theta , \end{aligned}$$
(12)
$$\begin{aligned} I^\phi (n_3,n_4,m^\prime ,m)&= \frac{1}{2\pi } \int _0^{2\pi } \cos ^{n_3}\!\phi \, \sin ^{n_4}\!\phi \, e^{i(m-m^\prime )\phi } d\phi . \end{aligned}$$
(13)

2.1 Integral over \(\theta\)

Substituting \(\cos \theta\) by x in Eq. (12) yields

$$\begin{aligned} I^\theta (n_1,n_2,l^\prime ,m^\prime ,l,m) = N_{l^\prime ,m^\prime }^{\theta } N_{l,m}^{\theta } \int _{-1}^{1} x^{n_1} \left( \sqrt{1-x^2} \right) ^{n_2} P_{l^\prime }^{m^\prime }(x) P_l^m(x) dx. \end{aligned}$$
(14)

Based on the Schmied expression [32],

$$\begin{aligned} x^n = \sum _{l=n,n-2,\ldots } \frac{n!(2l+1)}{2^{\frac{n-l}{2}} \left( \frac{n-l}{2} \right) ! (n+l+1)!!} P_l(x), \quad n=0,1,2,\ldots , \end{aligned}$$
(15)

we expand the first term inside the integral \(I^{\theta }\) by means of Legendre polynomials \(P_l\). Note that \(P_l(x)=P_l^0(x)\), therefore, further we use the form of the above equation with the associated Legendre polynomials. We also represent the second term in the integral \(I^{\theta }\) by the associated Legendre polynomials utilizing

$$\begin{aligned} P_l^l(x) = (-1)^l (2l-1)!! \left( \sqrt{1-x^2} \right) ^l. \end{aligned}$$
(16)

Consequently, the considered integral (14) becomes

$$\begin{aligned} I^{\theta }(n_1,n_2,l^\prime ,m^\prime ,l,m)=\, & {} N_{l^\prime ,m^\prime }^{\theta }N_{l,m}^{\theta } \frac{n_1!(-1)^{n_2}}{(2n_2-1)!!} \sum _{k_1=n_1,n_1-2,\ldots } \lambda (n_1,k_1) \nonumber \\&\times \int _{-1}^{1} {P}_{k_1}^0(x) P_{n_2}^{n_2}(x) P_{l^\prime }^{m^\prime }(x) P_{l}^{m}(x) dx, \end{aligned}$$
(17)

where

$$\begin{aligned} \lambda (n_1,k_1)= \frac{2k_1+1}{2^{\frac{n_1-k_1}{2}} \left( \frac{n_1-k_1}{2} \right) ! (n_1+k_1+1)!!}. \end{aligned}$$
(18)

Dong and Lemus showed in Ref. [33] a general expression for the overlap integral of an arbitrary number of associated Legendre polynomials. Here, we present the proper formula adjusted to our problem of four associated Legendre polynomials, namely

$$\begin{aligned} \int _{-1}^{1} {P}_{p_1}^{q_1}(x) P_{p_2}^{q_2}(x) P_{p_3}^{q_3}(x) P_{p_4}^{q_4}(x) dx= & {} \sqrt{\frac{(p_1+q_1)!(p_2+q_2)!(p_3+q_3)!(p_4+q_4)!}{(p_1-q_1)!(p_2-q_2)!(p_3-q_3)!(p_4-q_4)!}} \nonumber \\&\times \sum _{p_{12}}\sum _{p_{123}}\sum _{p_{1234}} G_{12}G_{123}G_{1234} \nonumber \\&\times \sqrt{\frac{(p_{1234}-q_{1234})!}{(p_{1234}+q_{1234})!}} \int _{-1}^{1} P^{q_{1234}}_{p_{1234}}(x) dx, \qquad \end{aligned}$$
(19)

where

$$\begin{aligned} G_{12}=\, & {} (-1)^{q_{12}} (2p_{12}+1) \left( \begin{array}{@{}ccc@{}} p_{1} &{} p_{2} &{} p_{12} \\ 0 &{} 0 &{} 0 \end{array} \right) \left( \begin{array}{@{}ccc@{}} p_{1} &{} p_{2} &{} p_{12} \\ q_{1} &{} q_{2} &{} -q_{12} \end{array} \right) , \nonumber \\ |p_1-p_2|\le & {} \, p_{12} \le p_1+p_2, \ q_{12} = q_1+q_2, \ p_{12} \ge q_{12}, \end{aligned}$$
(20)
$$\begin{aligned} G_{123}=\, & {} (-1)^{q_{123}} (2p_{123}+1) \left( \begin{array}{@{}ccc@{}} p_{12} &{} p_{3} &{} p_{123} \\ 0 &{} 0 &{} 0 \end{array} \right) \left( \begin{array}{@{}ccc@{}} p_{12} &{} p_{3} &{} p_{123} \\ q_{12} &{} q_{3} &{} -q_{123} \end{array} \right) , \nonumber \\ |p_{12}-p_3|\le & {} \,p_{123} \le p_{12}+p_3, \ q_{123} = q_1+q_2+q_3, \ p_{123} \ge q_{123}, \end{aligned}$$
(21)
$$\begin{aligned} G_{1234}\,=\, & {} (-1)^{q_{1234}} (2p_{1234}+1) \left( \begin{array}{@{}ccc@{}} p_{123} &{} p_{4} &{} p_{1234} \\ 0 &{} 0 &{} 0 \end{array} \right) \left( \begin{array}{@{}ccc@{}} p_{123} &{} p_{4} &{} p_{1234} \\ q_{123} &{} q_{4} &{} -q_{1234} \end{array} \right) , \nonumber \\ |p_{123}-p_4|\le & {} \,p_{1234} \le p_{123}+p_4, \ q_{1234} = q_1+q_2+q_3+q_4, \ p_{1234} \ge q_{1234}, \end{aligned}$$
(22)
$$\begin{aligned} \int _{-1}^{1} P^{q_{1234}}_{p_{1234}}(x) dx= & {} \left\{ \begin{array}{c@{\quad }c} 2 &{} \mathrm{if} \ p_{1234}=q_{1234}=0 \\ \mathcal{{I}}(p_{1234},q_{1234}) &{} \mathrm{otherwise} \end{array} \right. , \end{aligned}$$
(23)
$$\begin{aligned} \mathcal{{I}}(p_{1234},q_{1234})= & {} \frac{[(-1)^{p_{1234}}+(-1)^{q_{1234}}] 2^{q_{1234}-2} q_{1234} \varGamma \left( \frac{p_{1234}}{2} \right) \varGamma \left( \frac{p_{1234}+q_{1234}+1}{2} \right) }{\varGamma \left( \frac{p_{1234}-q_{1234}+2}{2} \right) \varGamma \left( \frac{p_{1234}+3}{2} \right) }. \end{aligned}$$
(24)

In Eqs. (20)–(22), ( :  :  : ) denotes a Wigner 3j symbol. It should be noted that the above formula for the overlap integral holds for all \(q_1, q_2, q_3, q_4 \ge 0\), while for negative values, one has to apply Eq. (11). Moreover, the integral is equal to zero when \(p_1+p_2+p_{12}\) or \(p_{12}+p_3+p_{123}\) or \(p_{123}+p_4+p_{1234}\) is odd.

2.2 Integral over \(\phi\)

Let us now focus on the integral with respect to \(\phi\), i.e., on Eq. (13). We represent the exponential function by means of the trigonometric ones using Euler’s formula and perform its binomial expansion. Then, we obtain

$$\begin{aligned} I^{\phi }(n_3,n_4,m^\prime ,m)=\, & {} \frac{1}{2\pi } \sum \limits _{k=0}^{|m-m^\prime |} \delta ^{k} i^{k} {|m-m^\prime | \atopwithdelims ()k} \nonumber \\&\times \int _0^{2\pi } \cos ^{|m-m^\prime |-k+n_3}\!\phi \, \sin ^{k+n_4}\!\phi \, d\phi , \end{aligned}$$
(25)

where

$$\begin{aligned} \delta = \left\{ \begin{array}{r@{\quad }c@{\quad }c} 1 &{} \mathrm{for} &{} m \ge m^\prime \\ -1 &{} \mathrm{for} &{} m < m^\prime \end{array} \right. \end{aligned}$$
(26)

and i is the imaginary unit (\(i^2=-1\)). As we showed in Appendix 2, the above internal integral may be written in the form of the beta function

$$\begin{aligned} \int _0^{2\pi } \cos ^{|m-m^\prime | -k+n_3}\!\phi \, \sin ^{k+n_4}\!\phi \, d\phi=\, & {} \frac{1}{2}B \left( \frac{|m-m^\prime |-k+n_3+1}{2},\frac{k+n_4+1}{2} \right) \nonumber \\&\times \left( 1+(-1)^{|m-m^\prime |-k+n_3} \right) \nonumber \\&\times \left( 1+(-1)^{|m-m^\prime | +n_3+n_4} \right) . \end{aligned}$$
(27)

Since there is a close relationship between the beta function and the gamma function, see Eq. (47) in Appendix 2, the integral over \(\phi\) reads

$$\begin{aligned} I^{\phi }(n_3,n_4,m^\prime ,m)=\, & {} \frac{ ( 1+(-1)^{|m-m^\prime | +n_3+n_4} )}{4\pi \left( \frac{|m-m^\prime | +n_3+n_4}{2}\right) !} \sum \limits _{k=0}^{|m-m^\prime |} \delta ^{k} i^{k} {|m-m^\prime | \atopwithdelims ()k} \nonumber \\&\times \varGamma \left( \frac{|m-m^\prime |-k+n_3+1}{2}\right) \varGamma \left( \frac{k+n_4+1}{2}\right) \nonumber \\&\times \left( 1+(-1)^{|m-m^\prime |-k+n_3} \right) . \end{aligned}$$
(28)

It is clear that this integral vanishes if \(|m-m^\prime |+n_3+n_4\) is odd.

3 Compact expression

The matrix elements, Eq. (3), can be also found based on the theorem of addition of spherical harmonics [31, 34]

$$\begin{aligned} P_\eta (\cos \vartheta )= \frac{4\pi }{2\eta +1} \sum \limits _{m_\eta =-\eta }^{\eta } Y_{\eta ,m_\eta }^*(\theta _1,\phi _1) Y_{\eta ,m_\eta } (\theta _2,\phi _2), \end{aligned}$$
(29)

where \(\vartheta\) is the angle between two directions described by \((\theta _1,\phi _1)\) and \((\theta _2,\phi _2)\), then

$$\begin{aligned} V_{l_1,m_1,l_2,m_2}^{{l_1^\prime ,m_1^\prime ,l_2^\prime ,m_2^\prime }}= \sum \limits _\eta V_\eta (R,r) \frac{4\pi }{2\eta +1}\sum \limits _{m_\eta =-\eta }^{\eta } \langle Y_{l_1^\prime ,m_1^\prime } Y_{l_2^\prime ,m_2^\prime } | Y_{\eta ,m_\eta }^*Y_{\eta ,m_\eta } | Y_{l_1,m_1}Y_{l_2,m_2} \rangle . \end{aligned}$$
(30)

The closed-form expression for the integral with three spherical harmonics is given by [31, 34]

$$\begin{aligned} \int _0^\pi \int _0^{2\pi } Y_{p_1,q_1}Y_{p_2,q_2}Y_{p_3,q_3} \sin \theta d\phi d\theta= & {} \sqrt{\frac{(2p_1+1)(2p_2+1)(2p_3+1)}{4\pi }} \nonumber \\&\times \left( \begin{array}{@{}ccc@{}} p_1 &{} p_2 &{} p_3 \\ 0 &{} 0 &{} 0 \end{array} \right) \left( \begin{array}{@{}ccc@{}} p_1 &{} p_2 &{} p_3 \\ q_1 &{} q_2 &{} q_3 \end{array} \right) . \end{aligned}$$
(31)

When we include \(Y_{p,q}^*=(-1)^{q}Y_{p,-q}\), the matrix elements are as follows

$$\begin{aligned} V_{l_1,m_1,l_2,m_2}^{{l_1^\prime ,m_1^\prime ,l_2^\prime ,m_2^\prime }}= \,& {} (-1)^{m_1^\prime + m_2^\prime } \sqrt{(2l^\prime _1+1)(2l_1+1)(2l_2^\prime +1)(2l_2+1)} \nonumber \\&\times \sum \limits _\eta V_{\eta }(R,r) \left( \begin{array}{@{}ccc@{}} l_1^\prime &{} \eta &{} l_1 \\ 0 &{} 0 &{} 0 \end{array} \right) \left( \begin{array}{@{}ccc@{}} l_2^\prime &{} \eta &{} l_2 \\ 0 &{} 0 &{} 0 \end{array} \right) \nonumber \\&\times \sum \limits _{m_\eta =-\eta }^{\eta } (-1)^{m_\eta } \left( \begin{array}{@{}ccc@{}} l_1^\prime &{} \eta &{} l_1 \\ -m_1^\prime &{} -m_\eta &{} m_1 \end{array} \right) \left( \begin{array}{@{}ccc@{}} l_2^\prime &{} \eta &{} l_2 \\ -m_2^\prime &{} m_\eta &{} m_2 \end{array} \right) . \end{aligned}$$
(32)

In order to validate our mathematical derivations, we implemented both approaches in MATLAB [35] and performed calculations for the same large set of various input parameters. We obtained identical results, confirming the correctness of the findings.

4 Concluding remarks

We have derived the exact analytical angular matrix elements of the potential for the interaction of an atom with a closed-shell diatomic molecule, expanded in Legendre polynomials, in a basis set of products of two spherical harmonics. We presented two approaches. The first concerns the calculation of the integral involving arbitrary powers of trigonometric functions. The obtained results within this approach are generic and may be useful not only in studies of anisotropic molecular collisions but also in other different fields of theoretical physics and chemistry. The second approach is much shorter; we demonstrated the expression in a compact form that can be of great interest to experimentalists due to its coding simplicity, especially when adiabatic variational theory is applied.