The Hartree-Fock Quantum Chemistry Solver is a computational quantum chemistry program that implements the self-consistent field (SCF) method for solving the electronic Schrödinger equation. This implementation includes both Restricted Hartree-Fock (RHF) and Unrestricted Hartree-Fock (UHF) algorithms, capable of handling closed-shell and open-shell molecular systems.
The solver is designed with a modular architecture that separates core quantum chemical algorithms from input/output processing, making it extensible for future enhancements and additional quantum chemistry methods.
The Hartree-Fock solver is built with a modular library structure that separates different aspects of quantum chemistry calculations into distinct components:
<Number of atoms> <charge> <multiplicity> <Z1> <x1> <y1> <z1> <Z2> <x2> <y2> <z2> ... <Basis Set Name>
Example for water molecule (H₂O):
3 0 1 8 0.0000000000 0.0000000000 0.21981483259 1 0.0000000000 1.4194772274 -0.87926122007 1 0.0000000000 -1.4194772274 -0.87926122007 STO-3G
Central driver program and command-line interface
Self-consistent field implementations:
Molecular structure handling:
Gaussian functions:
Mathematical utilities:
Integral evaluations:
main/sample_inputs/ - Molecule definition files
main/sample_outputs/ - Calculation results
The Hartree-Fock method is a fundamental quantum mechanical approach to approximately solve the electronic Schrödinger equation for molecular systems. It forms the foundation of more advanced computational chemistry methods and provides essential insights into electronic structure.
The Hartree-Fock equation in operator form:
F̂ψᵢ = εᵢψᵢ
Where:
The Fock operator includes:
The Self-Consistent Field procedure can be challenging to converge for some systems. This implementation includes two key acceleration techniques:
The fundamental quantum chemistry algorithms that include:
Gaussian basis set implementation with:
User interface and I/O components:
The iterative procedure for solving the Hartree-Fock equations:
Efficient computation of molecular integrals:
// Main SCF iteration loop for RHF method bool scf_rhf(const BasisSet& basis, Molecule& mol, double convergence_threshold) { int maxiter = 100; int iter = 0; double energy = 0.0; double energy_prev = 0.0; double delta_e = 0.0; // Initialize density matrix from core Hamiltonian Matrix D = Matrix::Zero(basis.nbf(), basis.nbf()); // Compute and store one-electron integrals Matrix S = overlap(basis); Matrix T = kinetic(basis); Matrix V = nuclear(basis, mol); Matrix H = T + V; // Compute orthogonalization matrix X Matrix X = compute_orthogonalization_matrix(S); // Start SCF iterations while (iter < maxiter) { // Form Fock matrix Matrix F = H; for (int mu = 0; mu < basis.nbf(); ++mu) { for (int nu = 0; nu < basis.nbf(); ++nu) { for (int lambda = 0; lambda < basis.nbf(); ++lambda) { for (int sigma = 0; sigma < basis.nbf(); ++sigma) { double eri = two_electron_integral(basis, mu, nu, lambda, sigma); F(mu, nu) += D(lambda, sigma) * (2.0 * eri - eri_exchange(basis, mu, lambda, nu, sigma)); } } } } // Transform Fock matrix to orthogonal basis Matrix F_prime = X.transpose() * F * X; // Solve eigenvalue problem Eigen::SelfAdjointEigenSolversolver(F_prime); Matrix C_prime = solver.eigenvectors(); Matrix C = X * C_prime; // Form new density matrix Matrix D_new = Matrix::Zero(basis.nbf(), basis.nbf()); int n_occ = mol.n_electrons() / 2; for (int mu = 0; mu < basis.nbf(); ++mu) { for (int nu = 0; nu < basis.nbf(); ++nu) { for (int i = 0; i < n_occ; ++i) { D_new(mu, nu) += 2.0 * C(mu, i) * C(nu, i); } } } // Calculate electronic energy energy = 0.0; for (int mu = 0; mu < basis.nbf(); ++mu) { for (int nu = 0; nu < basis.nbf(); ++nu) { energy += 0.5 * D_new(mu, nu) * (H(mu, nu) + F(mu, nu)); } } // Add nuclear repulsion energy energy += nuclear_repulsion_energy(mol); // Check convergence delta_e = std::abs(energy - energy_prev); if (delta_e < convergence_threshold) { return true; // Converged } // Update for next iteration D = D_new; energy_prev = energy; iter++; } return false; // Not converged within max iterations }
Calculation parameters:
Results:
Calculation parameters:
Results:
Calculation parameters:
Results:
Calculation parameters:
Results:
Calculation parameters:
Results:
Calculation parameters:
Results:
Note: This project is officially registered as part of my academic coursework at BITS Pilani. It reflects significant original effort, research, and development, and is protected under institutional intellectual property policies. Unauthorized copying, reproduction, or derivative use—whether in part or in full—is strictly discouraged and may lead to academic or legal consequences. If you find this work inspiring or would like to collaborate or learn more, feel free to reach out!!