# How to build cartesian representations of spherical Gaussian basis functions?

I'm trying to code an integral library for my own QC software from scratch. I need to use the spherical basis functions like in any other popular program. So, a D basis function is supposed to make five MOs, an F function is supposed to make seven, and so on.

But how do I find the representations for each D and higher AM basis function? Is there a general formula that can be conveniently applied to generate as many representations as necessary for angular momenta up to… I?

$$x^iy^jz^k\exp\left(-\alpha r^2\right) \quad \text{with} \quad i + j + k = n$$

Suppose, the total angular momentum is $$2,$$ the number of representations thus will be $$2n + 1 = 5,$$ thus it is five primitive basis functions with the same centers and same exponent values, but what exactly are these representations?

Following Helgaker et al. in "Molecular Electronic-Structure Theory" a real valued spherical harmonic GTO can be written as

$$\chi_{\alpha_{nl}lm}^{GTO}=N_{\alpha_{nl}lm}^{GTO}S_{lm}e^{-\alpha_{nl}r^2}$$

Where $$N_{\alpha_{nl}lm}^{GTO}$$ is a normalisation constant, and $$S_{lm}$$ is a real solid harmonic, which is the polynomial you want. The real solid harmonics obey the recurrence relations

$$S_{00}=1$$ $$S_{l+1,l+1}=\sqrt{2^{\delta_{l0}}{{2l+1}\over{2l+2}}}[xS_{l,l}-(1-\delta_{l0})yS_{l,-l}]$$ $$S_{l+1,-l-1}=\sqrt{2^{\delta_{l0}}{{2l+1}\over{2l+2}}}[yS_{l,l}+(1-\delta_{l0})xS_{l,-l}]$$ $$S_{l+1,m}={{(2l+1)zS_{lm}-\sqrt{(l+m)(l-m)}{r^2}S_{l-1,m}}\over{\sqrt{(l+m+1)(l-m+1)}}}$$

This is sufficient to evaluate the (form of the) polynomials.

Alternatively explicit formulae for the coefficients in the polynomials have been published in Schlegel, H.B. and Frisch, M.J. (1995), Transformation between Cartesian and pure spherical harmonic Gaussians. Int. J. Quantum Chem., 54: 83-87 . Again from Helgaker et al. these are given as follows: If $$G_{lm}({\bf r},a,{\bf A})$$ represents a spherical-harmonic GTO with exponent $$a$$ and centered at $${\bf R_A}$$, and $$G_{x,y,z}({\bf r},a,{\bf A})$$ similarly for a Cartesian GTO then

$$G_{lm}({\bf r},a,{\bf A})=N^{S}_{lm} \sum_{t=0}^{[(l-\left|m\right|)/2]} \sum_{u=0}^{t} \sum_{v=v_m}^{[\left|m\right|/2-v_m]+v_m} C_{tuv}^{lm}G_{2t+\left|m\right|-2(u+v),2(u+v),l-2t-\left|m\right|}({\bf r},a,{\bf A})$$

where

$$N^{S}_{lm}={1\over{2^{\left|m\right|}l!}}\sqrt{{2(l+\left|m\right|)!(l-\left|m\right|)!}\over{2^{}\delta_{0m}}}$$ $$C_{tuv}^{lm}=(-1)^{t+v-v_m}{1\over 4}^t \binom{l}{t} \binom{l-t}{\left|m\right|+t} \binom{t}{u} \binom{\left|m\right|}{2v}$$

and

$$v_m = 0 \space for \space m \ge 0, {1\over 2} \space for \space m<0$$

I strongly suggest you check the above formulae from the original sources for typos!