Haskell-abinitio

contains a package in Haskell to calculate the electronic structure properties of molecules using the Hartree-Fock method

View project on GitHub

Ab initio simulation

Ab initio molecular modeling is a branch of computational chemistry that, for a set of given atoms, solves the Schrödinger equation (the analogous of Newton’s equation in quantum mechanics), with no inclusion of parameters derived from experimental data. In such systems it is quite easy to calculate forces between nuclei but things get tricky when we calculate the potential energy contribution of forces related to electrons. In this case we can adopt a first approximation, the so called Hartree-Fock, that considers the electron-electron repulsion as an average between each electron and the mean field of all the others. This theory is right now the cornerstone of more sophisticated methods, such (Multiconfigurational Methods), [Møller-Plesset Perturbation Theory] (https://en.wikipedia.org/wiki/M%C3%B8ller%E2%80%93Plesset_perturbation_theory) or [Coupled Cluster] (https://en.wikipedia.org/wiki/Coupled_cluster), and the mathematical models behind its implementation are vastly used throughout the world of computational chemistry.

Joining two worlds

The set of problems inherent in computational chemistry are mainly due to the theoretical models complexity and the need of educing as much as possible the computational time, leading to a demand of extremely solid and efficient software. What is happening in the actual context is the result of a poor interface between the two adjoining worlds of chemist and computer science and the necessity of publishing papers and scientific material to raise funds. This usually leads to software hastily developed by a few chemists with only a side-interest in programming and therefore a limited skill set.

The very few software that can be deemed remarkable are usually the result of massive funding, and even those packages are now facing huge problems in terms of parallelization, concurrency and stability of the code.Most of the efforts are spent trying to fix these issues instead of being addressed at developing better code (improve modularity and intelligibility) or new features and new algorithms. We witness the proliferation of projects that serve no other purpose than to provide a bridge between different software, while the main core of molecular modeling codes, in most cases written in Fortran 77, remains untouched since the eighties.

The Hartree-Fock Method

This package can calculate the Hartree Fock energy of a given molecule geometry and a basis set solving the Roothaan Hall equations through a self consistent field procedure. It uses the Harris Functional as an initial density guess and the DIIS method to greatly improve the convergence. The entire code is written using the Repa library and focusing our efforts on efficiency, parallelism and code readability. Using Haskell’s higher order abstraction we are trying to develop an EDSL appropriate for quantum mechanics problems, creating code operators able to fairly mimic the physical ones. The original idea of the project can be found at Haskell ab initio