{ "cells": [ { "cell_type": "markdown", "id": "f7cdf3ab", "metadata": {}, "source": [ "# Hartree-Fock Method\n", "\n", "The Hartree-Fock (HF) method is the foundation of modern electronic structure theory. It provides a mean-field approximation to the many-electron Schrödinger equation by approximating the wavefunction as a Slater determinant of one-electron orbitals.\n", "\n", "This notebook covers:\n", "\n", "1. **Basic Theory** - The Hartree-Fock approximation\n", "2. **Initial Guess** - Methods for starting the SCF procedure\n", "3. **Restricted Hartree-Fock (RHF)** - For closed-shell systems\n", "4. **Unrestricted Hartree-Fock (UHF)** - For open-shell systems\n", "5. **Restricted Open-shell Hartree-Fock (ROHF)** - For open-shell systems with spatial symmetry\n", "6. **Practical Examples** - Using MiniHF's HFSolver" ] }, { "cell_type": "markdown", "id": "basic-theory", "metadata": {}, "source": [ "## 1. Hartree-Fock Theory\n", "\n", "### The Many-Electron Problem\n", "\n", "The time-independent Schrödinger equation for a molecule with $N$ electrons is:\n", "\n", "$$\n", "\\hat{H} \\Psi = E \\Psi\n", "$$\n", "\n", "where the Hamiltonian operator is:\n", "\n", "$$\n", "\\hat{H} = -\\frac{1}{2} \\sum_{i=1}^N \\nabla_i^2 - \\sum_{i=1}^N \\sum_{\\alpha=1}^M \\frac{Z_{\\alpha}}{r_{i\\alpha}} + \\sum_{i=1}^N \\sum_{j>i}^N \\frac{1}{r_{ij}}\n", "$$\n", "\n", "### The Hartree-Fock Approximation\n", "\n", "The HF method approximates the many-electron wavefunction as a Slater determinant of spin-orbitals:\n", "\n", "$$\n", "\\Psi_{HF} = \\frac{1}{\\sqrt{N!}} \\begin{vmatrix}\n", "\\phi_1(\\mathbf{r}_1, \\sigma_1) & \\phi_2(\\mathbf{r}_1, \\sigma_1) & \\cdots & \\phi_N(\\mathbf{r}_1, \\sigma_1) \\\\\n", "\\phi_1(\\mathbf{r}_2, \\sigma_2) & \\phi_2(\\mathbf{r}_2, \\sigma_2) & \\cdots & \\phi_N(\\mathbf{r}_2, \\sigma_2) \\\\\n", "\\vdots & \\vdots & \\ddots & \\vdots \\\\\n", "\\phi_1(\\mathbf{r}_N, \\sigma_N) & \\phi_2(\\mathbf{r}_N, \\sigma_N) & \\cdots & \\phi_N(\\mathbf{r}_N, \\sigma_N)\n", "\\end{vmatrix}\n", "$$\n", "\n", "### The Fock Matrix\n", "\n", "Minimizing the energy leads to the **Hartree-Fock equations**:\n", "\n", "$$\n", "\\hat{F} \\phi_i = \\epsilon_i \\phi_i\n", "$$\n", "\n", "where $\\hat{F}$ is the Fock operator:\n", "\n", "$$\n", "\\hat{F}(\\mathbf{r}) = \\hat{h}(\\mathbf{r}) + \\sum_{j=1}^N \\left[ \\hat{J}_j(\\mathbf{r}) - \\hat{K}_j(\\mathbf{r}) \\right]\n", "$$\n", "\n", "with:\n", "- $\\hat{h}(\\mathbf{r})$: One-electron Hamiltonian (kinetic + nuclear attraction)\n", "- $\\hat{J}_j(\\mathbf{r})$: Coulomb operator (classical electron repulsion)\n", "- $\\hat{K}_j(\\mathbf{r})$: Exchange operator (quantum mechanical exchange)\n", "\n", "### Matrix Formulation\n", "\n", "In a basis set $\\{\\chi_{\\mu}\\}$, the HF equations become:\n", "\n", "$$\n", "\\sum_{\\nu} F_{\\mu\\nu} C_{\\nu i} = \\epsilon_i \\sum_{\\nu} S_{\\mu\\nu} C_{\\nu i}\n", "$$\n", "\n", "where:\n", "- $F_{\\mu\\nu}$: Fock matrix element\n", "- $S_{\\mu\\nu}$: Overlap matrix element\n", "- $C_{\\nu i}$: Molecular orbital coefficient\n", "- $\\epsilon_i$: Orbital energy" ] }, { "cell_type": "markdown", "id": "dbdde824", "metadata": {}, "source": [ "## 2. Initial Guess\n", "\n", "The Hartree-Fock equations are solved iteratively through the Self-Consistent Field (SCF) procedure, which requires an initial guess for the molecular orbital coefficients. The quality of this initial guess matters significantly for three reasons: \n", "\n", "- **Convergence**: A good guess reduces the number of SCF iterations\n", "- **Stability**: A poor guess may lead to convergence to a local minimum\n", "- **Performance**: Some guesses work better for specific systems (e.g., transition metals)\n", "\n", "### Naive Initial Guess Methods\n", "\n", "These methods are computationally inexpensive and easy to implement, but often yield poor convergence or converge to local minima. **Thus, this project implements only the naive initial guess approaches** (Core Hamiltonian, Hückel, and Extended Hückel) as described below. \n", "\n", "#### 2.1 Core Hamiltonian Guess\n", "\n", "The simplest *ab initio* guess. It neglects all electron–electron repulsion and uses only one‑electron terms.\n", "\n", "**Procedure**:\n", "1. Compute the core Hamiltonian matrix \n", " $\\mathbf{H}_{\\text{core}} = \\mathbf{T} + \\mathbf{V}_{\\text{ne}}$, where \n", " $\\mathbf{T}$ = kinetic energy, $\\mathbf{V}_{\\text{ne}}$ = nuclear attraction.\n", "2. Solve the generalized eigenvalue problem \n", " $\\mathbf{H}_{\\text{core}} \\mathbf{C} = \\mathbf{S} \\mathbf{C} \\epsilon$.\n", "3. Use the resulting coefficients $\\mathbf{C}$ as the initial MO guess.\n", "\n", "> **Note**: This guess is very crude. It contains no electron‑electron repulsion, so it often fails for metals, small gap systems, or when SCF is near instabilities.\n", "\n", "#### 2.2 Simple Hückel Guess (Non‑iterative)\n", "\n", "A semi‑empirical π‑electron method. Not commonly used as a standalone HF initial guess today, but historically relevant.\n", "\n", "**Form** (for planar π systems): \n", "- Set $\\mathbf{H}_{ii} = \\alpha$, $\\mathbf{H}_{ij} = \\beta$ (if bonded) \n", "- Solve $\\mathbf{H}^{\\text{Hückel}} \\mathbf{C} = \\mathbf{S}^{\\text{Hückel}} \\mathbf{C} \\epsilon$ \n", " (often $\\mathbf{S} = \\mathbf{I}$ is assumed)\n", "\n", "> **Limitation**: Only π electrons, empirical parameters, not suitable for general HF initial guesses.\n", "\n", "#### 2.3 Extended Hückel Guess (EHT)\n", "\n", "Uses empirical atom‑specific parameters ($H_{ii}$ = valence orbital ionization energy) and a distance‑dependent off‑diagonal term (e.g., Wolfsberg–Helmholz formula).\n", "\n", "**Features**:\n", "- Includes all valence electrons.\n", "- Constructs a modified $\\mathbf{H}^{\\text{EHT}}$, then solves $\\mathbf{H}^{\\text{EHT}} \\mathbf{C} = \\mathbf{S} \\mathbf{C} \\epsilon$.\n", "- Provides a much better initial guess than the core Hamiltonian, especially for **organic molecules** and transition metal complexes.\n", "\n", "> **Advantage over core guess**: It mimics some effective potential via empirical data, reducing SCF oscillations. Many modern codes (e.g., ORCA, XTB) use variants of EHT‑like guesses as default.\n", "\n", "\n", "\n", "