Complexity in computing the integrals involving higher angular momentum

I am quite familiar with Hartree Fock theory. However, writing it into program is an entirely different task, and that is where I have a couple of questions.

I wrote a Hartree-Fock routine in Python a couple of years ago. It involved a ultra-minimal basis: only one gaussian for two hydrogen atoms each. Kinetic energy term was pretty simple, so were the one-electron terms. Coulomb and exchange integrals were tricky, which involved evaluation of an erf. Now, my question is, if I included higher angular momentum basis functions (p,d,f,g type functions), what happens? Is it difficult to evaluate the J (Coulomb) and K (exchange) integrals because of the mathematical complexity? Or something else? Can someone give the math behind this and explain why it is difficult to evaluate?

• FYI: the question might be more appropriate at CompScience.SE as noted in our Help Center. See specifically the note concerning Computational questions. – Wildcat Jul 2 '15 at 8:26
• If it appears to be that you don't get any good answers to your question, you might want to actually consider migrating it the CompSci.SE as wildcat suggested. If you decide to do so, either flag the question with a custom flag or notify me here in the comments. – Martin - マーチン Jul 2 '15 at 16:14
• I think this is too specialized for Comp Sci, to be honest. Adding to that, the actual question is too broad to get a concise answer. You are certainly welcome to reask it there, but I will refrain from moving it at this time. – jonsca Jul 7 '15 at 0:43

It appears that the integrals that are difficult are the two-electron repulsion integrals. There exists a recursive relationship that can turn integrals with high-angular momentum functions into integrals with only s-type functions. Refer to this lecture for details.

See the following articles for details concerning these recurrence relations:

M. Head Gordon and J. Pople, J. Chem. Phys. 89, 5777 (1988)

S. Obara and A. Saika, J. Chem. Phys. 84, 3963 (1986)

• Could you summarize the link in your answer in case it becomes unavailable in the future. See the help centre for how to write a good answer. – bon Jul 2 '15 at 10:33

Computing overlap, kinetic, electron-nucleus attraction and electron-electron repulsion integrals is possible even for Cartesian gaussians of higher angular momentum. There are analytical formulas which gives you the solution of these integrals. In particular you can find them in Cook's book  (pay attention to the fact that the electron-electron formula is wrong! See this discussion for details.).

If you don't have access to Cook's book , you can find a detailed derivation of analytical formulas for overlap, kinetic energy and nuclear-electron attraction integrals in Refs. [3, 4, 5].

These formulas are quite straightforward to implement (apart from the computation of Boys function, see this discussion) but they are highly inefficient. This is the main problem!

This is why alternative methods have been developed. In Helgaker's book  you can find a good description of these alternative methods:

• Obara-Saika scheme
• McMurchie-Davidson scheme

If you just want to write a working Hartree-Fock program you can just use the analytical solution at first. However, if you need efficiency you will need to look at these methods.

A side note: personally I love Python but it is really, really unappropriate for computationally demanding calculations! My Hartree-Fock program in Python takes at least 2 minutes to compute two-electron integrals in the STO-3G basis set (a minimal one!) for $\ce{H_2O}$, while a Fortran version of the same program takes a bunch of seconds.

 D. Cook, Handbook of Computational Chemistry, Oxford University Press, 1998.

 T. Helgaker, P. Jørgensen and J. Olsen, Molecular Electronic-Structure Theory, Wiley, 2000.

 M. Hô, J. M. Hernández-Pérez, Evaluation of Gaussian Molecular Integrals: Overlap Integrals, The Mathematica Journal, Vol. 14, 2012.

 M. Hô, J. M. Hernández-Pérez, Evaluation of Gaussian Molecular Integrals: Kinetic-Energy Integrals, The Mathematica Journal, Vol. 15, 2013.

 M. Hô, J. M. Hernández-Pérez, Evaluation of Gaussian Molecular Integrals: Nuclear-Electron Attraction Integrals, The Mathematica Journal, Vol. 16, 2014.