5
$\begingroup$

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?

$\endgroup$
5
  • $\begingroup$ 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. $\endgroup$
    – Tyberius
    Commented Aug 12, 2022 at 18:05
  • $\begingroup$ 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 $\endgroup$
    – lela2011
    Commented Aug 12, 2022 at 18:18
  • 1
    $\begingroup$ @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. $\endgroup$ Commented Aug 12, 2022 at 20:06
  • $\begingroup$ 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. $\endgroup$
    – lela2011
    Commented Aug 12, 2022 at 20:12
  • 1
    $\begingroup$ 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. $\endgroup$
    – Tyberius
    Commented Aug 12, 2022 at 20:29

1 Answer 1

5
$\begingroup$

I will consider both your question and the comments to your question in this answer.

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.

I think you should talk with your teacher about this point. The integral calculation is technically challenging, but you learn essentially very little about quantum chemistry by doing it on your own.

If the more general concepts of quantum chemistry such as SCF, eigenvalues, etc. are of interest I would recommend using a library that exposes integrals to Python, an example could be Dalton Project, an example script that uses integrals is; geo_diff_integrals.py.

If you do want to implement the integrals on your own, there is two ways you can go. The "easy" (less hard) but very slow evaluation as described in Handbook of Computational Quantum Chemistry. Going this route an example of a Python implementation as a reference for the electron-eletron integral and the electron-nuclear integral can be found here.

The other way to go about implementing integrals would be a little more sophisticated using recurrence relations, a very good guide for this is A (hopefully) gentle guide to the computer implementation of molecular integrals over Gaussian basis functions.

As a very general note about the integral implementation. Do NOT worry about the speed before you have a working implementation.

$\endgroup$
3
  • $\begingroup$ Can I just suggest a simpler route that I think would be plenty good enough for a high school project - just use s type functions. These have a easy expressed analytic form, you can sort of model higher angular momenta by putting them off site, and you can still write a full HF driver which to my mind would still be a very impressive high school project without getting bogged down in something that is very technical and tricky to do at all, let alone well. $\endgroup$
    – Ian Bush
    Commented Aug 16, 2022 at 13:43
  • $\begingroup$ I've thought about just using s-type orbitals but I feel like it just wouldn't live up to what I want to achieve. I would basically limit myself to Hydrogen and Helium and that wouldn't be enough for me and my teacher. Maybe I have to expand on the project a bit. I am working on my so called matura thesis. It's a low-spec bachelor thesis. That's why I can't make too many compromises. The resources you provided are very helpful though. Especially giving a non optimized algorithm a chance first. Would that in other words mean to just do a double sum over all the primitive functions? $\endgroup$
    – lela2011
    Commented Aug 16, 2022 at 17:20
  • $\begingroup$ @lela2011 It doesn't limit you to H and He - as I said you can model higher angular momenta by having the s type orbitals centred at positions which do not coincide with the atom - consider a p function, and then two s functions, one to the left of the atom, one to the right. I'm not claiming this is the best solution, but it avoids writing some extremely tricky code from which I feel you will learn little. Even using canned packages is often not trivial. $\endgroup$
    – Ian Bush
    Commented Aug 17, 2022 at 10:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .