Fennek

This is Fennek, Quantum Chemistry as a Service.
You can post calculations from here, get info about them, or generate a token to use the API!

API documentation: Open Swagger UI

About Fennek and Fintl

Methods:

  • Hartree-Fock:
    • RI-JK (dSCF is WIP)
    • Fermi smearing
    • DIIS
    • Density Damping

The tech stack

Fennek is a decentralized system consisting of a Java Spring Boot API service
and a Java worker using BLAS and the fintl library.

Stack

  • Fennek: Java 25, Spring Boot 3, OpenBLAS
  • FintL: Fortran
  • Database: PostgreSQL

Architecture

Architecture graph

Fintl Architecture

Layered design with strict bottom-up dependencies:

C Interface (iso_c_binding)
│
Drivers (OpenMP shell-pair/quartet loops)
│
Integral Kernels (Obara-Saika VRR/HRR)
│
Basis / Boys Fn / Utilities
│
Precision (kinds, constants, thresholds)

Source layout

Directory Modules Role
core/ precision, util Numeric constants, Cartesian indexing tables
special/ boys Boys function F_m(x) via erf + upward recurrence
ints/ overlap_kinetic, nuclear, eri_{4c,3c,2c}2e Shell-level integral kernels (OS recurrence)
driver/ one_electron_driver, two_electron_driver Full-matrix assembly with symmetry, parallelization and Schwartz screening
interface/ integrals, integrals_shells C-binding API (driver-level and block-level)

Theoretical background

ELI5 Hartree Fock Theory

The wave function

Wave function \(\Psi(\vec{r}_1, \vec{r}_2, ..., \vec{r}_N)\), abbreviated \(\Psi(\vec{r})\) from now on, describes the quantum state of a molecular system.

  • It contains information about electrons and their distribution in space.
  • \(|\Psi(\vec{r})|^2\) describes the probability density of a complete electron configuration.
  • One electron density for probability of finding an electron at a certain point:
    \(\rho(\vec{r}) = N \int | \Psi(\vec{r}, \vec{r_2}, ..., \vec{r_N}) d\vec{r_2}, ..., d\vec{r_N}\)

The Hamilton Operator

Hamilton Operator \(\hat{H}\) describes energy contributions on molecular system.

  • Kinetic energy of electrons (kinetic energy of nuclei ignored in Born-Oppenheimer approximation).
  • Electron-electron repulsion.
  • Electron-nuclear attraction.

Nuclear-nuclear repulsion for fixed nuclei is a constant in the BO approximation and not included in the (electronic) Hamiltonian.

The Hartree Fock energy

Energy of the molecular system is calculated by evaluating the wave function with the Hamilton Operator \(\hat{H}\Psi = E\Psi\).
For a general trial wave function, the expected energy is calculated by \(E[\Psi] = \frac{\langle \Psi \mid \hat{H} \mid \Psi \rangle}{\langle \Psi \mid \Psi\rangle}\).
Energy minimization \(E_0 = \min_{\Psi} E[\Psi]\) is done using the variational principle:

The variational principle (SO Ch. 2)

It states that the energy calculated by a trial wave function is always greater or equal to the true ground-state energy \(E[\Psi] \geq E_0\).
The goal is to find the wave function to minimize the energy:

\[ E_0 = \underset{min}{\Psi}\frac{\langle \Psi \mid \hat{H} \mid \Psi \rangle}{\langle \Psi \mid \Psi \rangle} \]

In simple terms, we are trying to find the lowest point in a landscape that's defined by the wave function parameters.

The Hartree-Fock approximation

HF approximates the molecular wave function as a single Slater determinant that is constructed from molecular orbitals.
This approximates the influence of all other electrons on one electron (the electron-electron correlation) with an average field, Hartree-Fock is therefore a mean-field theory.
The procedure is then to find optimal molecular orbital coefficients that minimize the energy.

  1. Initial guess for molecular orbital coefficients and density.
  2. Construct Fock matrix from current density and mo coefficients.
  3. Calculate energy (Contraction of Fock Matrix with density -> electronic energy).
  4. Improve orbital coefficients to lower energy (Diagonalization of Fock Matrix using Roothaan-Hall equations -> new coefficients).
  5. repeat until convergence criteria are met (often difference in energy and density per iteration).
  6. Calculation of properties (dipole moments, ...).

Mathematical foundation

Atomic orbitals

Molecular orbitals

Fock operator

Roothaan-Hall equations

Density matrix

One- and two-electron integrals

Evaluating atomic orbital integrals

Gaussian-type orbitals

Gaussian product theorem

Overlap integrals

Kinetic energy integrals

Electron-nuclear attraction integrals

Electron-electron repulsion integrals

Obara–Saika recurrence scheme (OS paper)

Implementation

Fintl - Fortran molecular Integral Library

A molecular integral kernel using contracted GTO written in Fortran with a C interface and an included python API wrapper.

Source code under fintl repository

Basis set representation

Fintl and the SCF worker use a shell-based basis format. A shell is a contracted GTO.

In Fennek, a Shell is defined as:
ContractedGTO(Integer L, List<PrimitiveGTO> primitives)
where
PrimitiveGTO(double exponent, double coefficient)

In Fintl a shell is defined as:
type :: shell_t
real(dp) :: center(3)
integer :: L !(S: 0, P: 1, D: 2, ...)
integer :: n_prim !number primitives
integer :: n_cart !number cartesians
real(dp),allocatable :: expo(:), coeff(:), norm_coeff(:,:)
end type shell_t


The compatibility layer uses AOShell from the worker as
AOShell(Integer L, Integer nPrim, Integer nCart, Coordinate center, List<Double> coefficients, List<Double> exponent)
and a parser into the fintl shell lists. Since all primitives in one shell have the same L, all have the same number of cartesians.

SCF worker

Matrix operations and diagonalization

Single atom density guess

Convergence acceleration (DIIS, damping)

Fermi smearing

Testing and validation

Correlated methods

Limitations of Hartree-Fock

Electron correlation

Configuaration Interaction

Møller-Plesset perturbation theory

Coupled Cluster (CCSD/CC2)

Next steps

Methods:

  • SCF:
    • dSCF
    • Properties (dipole moments etc)
    • DFT (grid in FintL)
    • seminum-K
  • MP2
  • Geometry optimizations with MP2
  • CI
  • CASSCF

Code:

  • Cleanup domain model API
  • Rework scf package in Worker
  • general cleanup
  • Optimizations

SCF Calculation Results

UUID Basis Name Auxbasis Name E_SCF E_Elec E_Nuc n_iter properties configuration
5df84753-b3a8-4267-9684-eab3f996c1c5 def2-QZVP def2-universal-JKFIT -76.0673994555878 -85.36815854030233 9.300759084714525 40 {} {diis=true, rijk=true, fermi=false, enConv=1.0E-6, dampFac=0.5, maxIter=100, scfMethod=HF}