Recommended resources
The freely available resources this lesson will direct you to.
Hello! Welcome back.
In our last lesson, we dissected the Hartree-Fock (HF) equations and developed a physical intuition for the direct (Hartree) and exchange (Fock) terms. A crucial point we established was that the Fock operator, which defines the effective single-particle Hamiltonian, depends on the very orbitals we are trying to solve for. This creates a non-linear, "chicken-and-egg" problem. We can't simply solve for the orbitals in a single step.
Today's lesson directly addresses this challenge. Our learning outcome is to outline the self-consistent field (SCF) procedure for solving the Hartree-Fock equations. This procedure is the cornerstone of computational quantum chemistry and forms the basis for many calculations in condensed matter physics. We will break down the abstract HF equations into a concrete, iterative algorithm that is perfectly suited for computer implementation.
1. From Operators to Matrices: The Roothaan-Hall Equations
The Hartree-Fock equation for a single spin-orbital, , is an integro-differential equation, which is notoriously difficult to solve directly. The standard approach, developed independently by Clemens Roothaan and George Hall, is to convert it into a more tractable matrix algebra problem.
The key idea is to expand the unknown molecular orbitals as a linear combination of a known set of basis functions . These basis functions are typically atom-centered functions that resemble hydrogenic atomic orbitals (e.g., Slater-type or Gaussian-type orbitals). For a basis set of size :
Here, the are the expansion coefficients we need to find. Substituting this expansion into the Hartree-Fock equation and performing some algebraic manipulation leads to the Roothaan-Hall equations:
Let's quickly define these matrices:
- is the Fock matrix. Its elements are . It represents the Fock operator in the chosen basis.
- is the coefficient matrix. Each column contains the coefficients for a specific molecular orbital . This is the matrix we are trying to find.
- is the overlap matrix. Its elements are . Because basis functions centered on different atoms are generally not orthogonal, is not the identity matrix.
- is a diagonal matrix containing the orbital energies .
The presence of the overlap matrix makes this a generalized eigenvalue problem. More importantly, the chicken-and-egg problem persists: the Fock matrix depends on the electron density, which is built from the coefficients .
Computational Chemistry 4.23 - Hartree-Fock-Roothaan Equations
The following video from the channel TMP Chem clearly explains the motivation for introducing a basis set and how it leads to the Roothaan-Hall matrix equation. Pay close attention to the conclusion where the speaker identifies the core challenge: the Fock matrix depends on the coefficients we want to solve for.
Please watch from the beginning to the end (09:31). This will set the stage for why an iterative procedure is not just useful, but necessary.
2. The Self-Consistent Field (SCF) Algorithm
To solve this non-linear problem, we use an iterative approach called the Self-Consistent Field (SCF) procedure. We start with a guess for the orbitals, calculate the field they produce, solve for new orbitals in that field, and repeat the process until the orbitals and the field are consistent with each other.
The following flowchart provides a high-level overview of the entire process.

Let's break this down into a more detailed, step-by-step algorithm.
The SCF Algorithm Steps
-
Initialization:
- Specify the molecular geometry (nuclear coordinates) and the total number of electrons.
- Choose a basis set .
- Calculate all the integrals that do not change during the iterations:
- Overlap integrals:
- One-electron integrals (kinetic energy and nuclear attraction ). These are combined to form the core Hamiltonian matrix: .
- Two-electron integrals: . These are the most numerous and computationally expensive integrals.
-
Orthogonalization:
- The generalized eigenvalue problem is inconvenient. We transform it into a standard eigenvalue problem by finding a transformation matrix that makes the basis orthonormal. A common method is symmetric orthogonalization, where .
- This allows us to work with a transformed Fock matrix and solve the standard eigenvalue equation .
-
Initial Guess:
- Make an initial guess for the coefficient matrix (and thus the density matrix ). A very simple guess is to assume the electrons feel no repulsion from each other initially. This is equivalent to setting , which makes the initial Fock matrix equal to the core Hamiltonian: .
-
SCF Iteration Loop:
- (a) Build Fock Matrix: Using the current density matrix , construct the two-electron part of the Fock matrix, . The full Fock matrix for the current iteration is .
- (b) Solve Roothaan-Hall Equations:
- Transform to the orthogonal basis: .
- Diagonalize to find the new orbital energies and transformed coefficients .
- Back-transform the coefficients to the original basis: .
- (c) Form New Density Matrix: Construct a new density matrix using the coefficients of the occupied molecular orbitals (determined by filling the orbitals from the lowest energy up, following the Aufbau principle). For a closed-shell system with electrons:
- (d) Check for Convergence: Compare the new density matrix with the previous one , or compare the total energy from the current step with the previous one. If the difference is below a predefined threshold, the field is "self-consistent." The calculation is complete. If not, return to step (a) with the new density matrix .
The following video provides an excellent and detailed walkthrough of this entire algorithmic procedure.
This comprehensive video by David Sherrill, a leading computational chemist, covers the entire Hartree-Fock algorithm. It details the transformation to a matrix problem, the iterative steps, the crucial orthogonalization procedure, and convergence checks.
This video is dense but highly informative. I suggest you watch it in parts: Setup (00:00 - 09:50): This section reviews the HF equations and shows how they are converted into the Roothaan-Hall matrix equation FC=SCE. This reinforces the previous video. Algorithm Overview (16:13 - 18:04): A quick, high-level summary of the iterative steps. Solving the Eigenvalue Problem (21:15 - 36:08): This is a critical section. It explains in detail how the generalized eigenvalue problem is transformed into a standard one using symmetric and canonical orthogonalization. Pay close attention to the role of the S⁻¹/² matrix. Updating and Convergence (36:08 - 47:56): This part explains how to use the new coefficients to build the next density matrix and Fock matrix, and how to check if the iterations have converged.
Test your understanding!
In the SCF procedure, why do we need to calculate the two-electron integrals only once at the beginning, but we must recalculate the Fock matrix in every iteration?
Show answer
The two-electron integrals depend only on the chosen basis functions , which are fixed throughout the calculation. Therefore, they can be computed once and stored.
The Fock matrix , however, depends on both the fixed one-electron integrals () and the two-electron term , which is constructed using the density matrix . The density matrix is built from the orbital coefficients , which change in every iteration as we refine our solution. Since changes, must be recalculated in each SCF cycle until (and thus and ) stops changing, achieving self-consistency.
3. From Algorithm to Code
Your background in physics and programming makes it valuable to see how this algorithm translates directly into code. You don't need to write a program from scratch, but understanding the structure of a simple HF code can solidify these concepts immensely.
The following resource provides a step-by-step guide to building a minimal Hartree-Fock program in Python using numpy. It's a perfect illustration of the SCF procedure in action.
T>T: Hartree Fock Theory in 100 Lines
The article 'Hartree Fock Theory in 100 Lines' by Adam Baskerville walks through a complete, minimal implementation of the RHF-SCF algorithm. It provides explanations and Python code snippets for each step we've discussed.
Please read the section 'The Hartree Fock Procedure' for a concise 12-step list of the algorithm. Then, read through the detailed explanations from subsection '3) Diagonalise Overlap Matrix' to '12) Repeat or End'. Pay attention to how the theoretical steps (like forming S⁻¹/², building F from P, and checking for convergence) are implemented as matrix operations in Python. You don't need to analyze the code line-by-line, but rather see the one-to-one mapping between the algorithm and the code's structure.
This hands-on perspective demystifies the process, showing that at its core, the SCF procedure is a series of well-defined matrix manipulations, ideally suited for a computational approach.
Conclusion
In this lesson, we have mapped out the Self-Consistent Field (SCF) procedure, the workhorse algorithm for solving the Hartree-Fock equations.
Key Takeaways:
- The integro-differential HF equations are converted into the matrix-based Roothaan-Hall equations () by introducing a basis set.
- The fact that the Fock matrix depends on its own solutions () necessitates an iterative solution.
- The SCF procedure follows a clear loop:
- Start with a guess for the electron density ().
- Build the Fock matrix .
- Solve the Roothaan-Hall equations (often after an orthogonalization step) to get new coefficients .
- Update the density matrix using the new coefficients.
- Check for convergence. If not converged, repeat from step 2.
- This entire algorithm is fundamentally a sequence of matrix operations, making it highly suitable for computer implementation.
Preview of the Next Lesson:
The Hartree-Fock method, for all its power, is still an approximation. It treats each electron as moving in the average field of all others, but it neglects the instantaneous correlations in their motion, especially between electrons of opposite spin. The energy that the Hartree-Fock method fails to capture is known as the correlation energy. In our next lesson, we will formally define this crucial concept and discuss its physical significance, which will serve as our entry point into more advanced and accurate many-body theories.