Fermi.jl: A modern design for quantum chemistry

Fermi.jl is a quantum chemistry package for computation of many-electron wave functions for molecules. Many traditional packages written in C or Fortran exists, but the difficulty of inserting new implementations hinders the development of new methods. Fermi.jl is written completely in Julia and it is designed to be simple to read and maintain. Fermi.jl is aimed to serve as an efficient platform for methods development allowing the application of these on a wide variety of systems.


In 1929, the influential physicist Paul Dirac stated ``The underlying physical laws necessary for the mathematical theory of a large part of physics and the whole of chemistry are thus completely known, and the difficulty is only that the exact application of these laws leads to equations much too complicated to be soluble". Nearly a century later, theoretical and computational chemists have developed a multitude of sophisticated methods to model the electronic structure of atoms and molecules. Paired with the advances in computational power, approximate solutions to the electronic Schr\"{o}dinger equation for many electron systems ($\hat{H}\Psi = E\Psi$) are employed by scientists to solve important problems in chemistry, physics, biology and materials science. Implementation of these quantum chemistry methods are available in well known packages such as Psi4, Cfour, NWChem, and MRCC to name a few. Approximating molecular wave functions involves heavy numerical effort; therefore, codes are written completely or partially in efficient languages such as C, C++, and Fortran. While the contribution of these codes are invaluable to the field, the development of new methods is often hindered by the learning curve of the programming languages that they are built upon.

In order to accelerate the production of new implementations and ameliorate the maintenance of the code base, packages such as Psi4 and PySCF are written, as much as possible, in Python. This facilitates collaboration of computational chemists towards producing new programs and update existing ones. The emergence of Julia as a powerful tool in scientific computing motivated our development of the Fermi.jl package for quantum chemistry computations. Fermi.jl is written completely in Julia, with only external interfaces to resources written in other languages, such as libcint, a C library for molecular integrals evaluation. Currently, Fermi.jl can handle energy computations for a few important \textit{ab initio} methods: Restricted Hartree--Fock (RHF), M\o{}ller--Plesset perturbation theory (MP2) and Coupled Cluster theory up to perturbative triples [CCD, CCSD, and CCSD(T)]. The code design is based on readability, simplicity and extensibility, utilizing dynamic multiple dispatch for an elegant control flow. For example, MP2 computations can be done with single or double precision and with or without density fitting approximation for integrals. The main body of the code is the same for all combinations, with specific dispatches being called depending on the data type of the molecular integrals. The coupled cluster module leverages the capabilities of the TensorOperations.jl library, in particular allowing for automatic factorization of the tensor contractions. Each line of the code expresses a contraction that can be mapped to the corresponding mathematical term from the theory (often represented as diagrams). Unlike most electronic structure packages, Fermi.jl does not have an input file structure. It can be used interactively or one can write simple Julia scripts, both cases are facilitated by macros offering shortcuts for settings and routine calls. As Fermi.jl is improved and expanded, we hope to motivate computational chemists to consider Julia as modern alternative to traditional computing in electronic structure modeling.