Practical Introduction to Hartree-Fock Algorithm using Python

Laksh
Analytics Vidhya
Published in
10 min readMay 7, 2019

--

We will write a Hartree-Fock algorithm completely from scratch in Python and use it to find the (almost) exact energy of simple diatomic molecules like H₂

Prerequisites

I will assume you have read the first three chapters of “Modern Quantum Chemistry” by Szabo and Ostlund, or any other similar book, or have taken an introductory course into computational quantum chemistry. I will be referring to said book throughout the post. The book is very cheap (£10 on Amazon) and is a good investment.

I’ll also assume you have had a bit of practice coding in python, and know the basics, like how for loops work, etc.

I will go through the important maths again here and there. This is to function as a reminder, and it will not make sense if you are reading about this for the first time. If this is the case, simply refer to the book.

In many lines of the code, I will put a page reference to Szabo & Ostlund (I will just refer to the page number mostly).

Advice for following this tutorial

I suggest you have a jupyter notebook open, and simply code along. If you don’t understand a line of code, test it in another line to pick apart its function.

If you get stuck/some code doesn’t work

--

--