# What is the best algorithm for ERIs of contracted gaussian atomic orbitals

I am currently working on python script that does Hartree-Fock-Calculations. I try to avoid packages as good as possible. I've figured out how to calculate the one electron integrals when it comes to the Roothaan-Hall-Equations through this paper. I am now stuck however at calculating the two electron integrals. I've gathered that there are several recursive methods one can use since the analytical methods are quite inefficient for the vast amount of integrals that are needed to be calculated. I am however struggling with figuring out which algorithm is best for my problem and where to find literature on that. I am using a STO-3G basis set and maybe a 6-31G one. There are no shells that surpass an angular-momentum quantum number of 2.

Therefore my question is: What algorithm is the best for a closed shell molecule when I'm using a STO-3G / 6-31G basis set? Can you provide me with literature that is at least somewhat easy to understand?

• Welcome to the site! I'm not an expert in this, but I imagine if you are just planning to use this for a select fairly small basis sets, you won't see a huge difference in performance between the various algorithms. The differences start to come in when you get to larger basis sets with higher angular momentum functions and different amounts of primitive contraction.
– Tyberius
Aug 12, 2022 at 18:05
• Thanks for the info. Is there any "easy" theory I can work with. I'm a high school student and have been working on this project for over a year already. I am really looking for a script that also includes the basic concepts of the algorithms Aug 12, 2022 at 18:18
• @lela2011 Welcome to our community! Thank you for contributing your question, and I hope we see much more of you in the future!!! However, I wonder why you are doing this? I personally use packages for this, just like you use a calculator when you want to know something like log(52). I assume you don't write a python package from scratch every time you want to calculate something like log(x), and likewise integrals in quantum chemistry are so ubiquitous that for most people the best thing to do is to use a package. Aug 12, 2022 at 20:06
• I would use a package but since it's a graded paper I feel like using packages for the calculations would take a way too much work. During meetings with my teacher the idea of using packages never even came up. That's why for this project everything except matrix routines are going to be self-coded. Aug 12, 2022 at 20:12
• It's an impressive project for a high schooler. Nike has a point that it would be worth asking your advisor and consider for yourself how important it is for you to learn these lower level implementation details vs higher level concepts about elec structure theory. If you are pursing this further, there are some existing simple implementations you can use as a reference, e.g. github.com/TyBalduf/EZElec, github.com/jjgoings/McMurchie-Davidson (disclaimer: first link is mine). It's not particularly "easy", but the reference I used is Ch 12 Modern Electronic Structure Theory.
– Tyberius
Aug 12, 2022 at 20:29

I understand your motivation is related to making a high school project, you say

I would use a package but since it's a graded paper I feel like using packages for the calculations would take a way too much work.