A Python code is provided below for calculating the HF energy of a Hydrogen molecule using the 3-21G basis set. This code block calculates the integrals (kinetic, electron-electron repulsion, electron-nuclear, nuclear-nuclear, and overlap) required for computing the HF energy of the hydrogen molecule. Additionally, it performs a geometry optimization using the Newton-Raphson method.
However, please note that there is a minor bug in the code that leads to deviations in computed parameter, ie harmonic vibrational frequency, when compared to values reported in the literature.