Installation#

This project is currently in a highly experimental stage, however we can already offer binary distributions via some channels.

Installing from conda#

This project is packaged for the conda package manager and available on the conda-forge channel. To install the conda package manager we recommend the miniforge installer. If the conda-forge channel is not yet enabled, add it to your channels with

conda config --add channels conda-forge

Once the conda-forge channel has been enabled, this project can be installed with:

conda install tblite

It is possible to list all of the versions available on your platform with:

conda search tblite --channel conda-forge

Now you are ready to use the tblite executable, find the tblite.h header and link against the tblite library.

FreeBSD Port#

A port for FreeBSD is available

pkg install science/tblite

In case no package is available build the port using

cd /usr/ports/science/tblite
make install clean

For more information see the tblite port details.

Building from source#

This library depends on several Fortran modules to provide the desired functionality

  • mctc-lib: Modular computation tool chain library

  • dftd4: Reference implementation of the generally applicable charge-dependent London-dispersion correction, DFT-D4

  • s-dftd3: Reimplementation of the DFT-D3 dispersion correction

  • mstore: Molecular structure store (testing only)

  • toml-f: Library for processing and emitting TOML data

Meson based build#

The primary build system of this project is meson. For the full feature-complete build it is highly recommended to perform the build and development with meson. To setup a build the following software is required

  • A Fortran 2008 compliant compiler, like GCC Fortran and Intel Fortran classic

  • meson, version 0.57.2 or newer

  • ninja, version 1.10 or newer

  • a linear algebra backend, like MKL or OpenBLAS

Optional dependencies are

  • asciidoctor, to build the manual pages

  • A C compiler to test the C API and compile the Python extension module

  • Python 3.6 or newer with the CFFI package installed to build the Python API

To setup a new build run

meson setup _build --prefix=$HOME/.local

The Fortran and C compiler can be selected with the FC and CC environment variable, respectively. The installation location is selected using the --prefix option. The required Fortran modules will be fetched automatically from the upstream repositories and checked out in the subprojects directory.

Note

For Intel Fortran oneAPI (2021 or newer) builds with MKL backend the -Dfortran_link_args=-qopenmp option has to be added.

Tip

To produce statically linked binaries set --default-library=static and add -Dfortran_link_args=-static as well.

To compile the project run

meson compile -C _build

Verify that the resulting projects is working correctly by running the testsuite with

meson test -C _build --print-errorlogs

In case meson is spawning too many concurrent test jobs limit the number of processes with the --num-processes option when running the test command. By default the whole library and its subprojects are tested, to limit the testing to the project itself add --suite tblite as option.

To verify the included parametrizations are working correctly run the extra testsuite by passing the --benchmark argument

meson test -C _build --print-errorlogs --benchmark

Finally, you can make the project available by installation with

meson install -C _build

CMake based build#

This project also provides support for CMake to give projects using it as build system an easier way to interface. The CMake build files usually do not provide a feature-complete build, but contributions are more than welcome. To setup a build the following software is required

  • A Fortran 2008 compliant compiler, like GCC Fortran and Intel Fortran classic

  • cmake, version 3.14 or newer

  • ninja, version 1.10 or newer

  • a linear algebra backend, like MKL or OpenBLAS

Configure a new build with

cmake -B _build -G Ninja -DCMAKE_INSTALL_PREFIX=$HOME/.local

You can set the Fortran compiler in the FC environment variable. The installation location can be selected with the CMAKE_INSTALL_PREFIX, GNU install directories are supported by default. CMake will automatically fetch the required Fortran modules, you can provide specific version in the subprojects directory which will be used instead.

To run a build use

cmake --build _build

After a successful build make sure the testsuite passes

pushd _build && ctest --output-on-failure && popd

To make the project available install it with

cmake --install _build

Fpm based build#

This projects supports building with the Fortran package manager (fpm). Create a new build by running

fpm build

You can adjust the Fortran compiler with the --compiler option and select the compilation profile with --profile release. To test the resulting build run the testsuite with

fpm test

The command line driver can be directly used from fpm wih

fpm run --profile release -- --help

To make the installation accessible install the project with

fpm install --profile release --prefix $HOME/.local

Python extension module#

The Python API is available as Python extension module. The easiest way to setup is to add -Dpython=true to a meson tree build and follow the meson installation instructions. The extension module will become available once the project is installed.

Important

When building with Intel compilers make sure to use the real-time version of the MKL. Add -Dlapack=mkl-rt when configuring the build. Otherwise, when using the normal MKL libraries dynamically loading the tblite library from Python will fail.

This section describes alternative ways to build the Python API

Using pip#

This project support installation with pip as an easy way to build the Python API.

  • C compiler to build the C-API and compile the extension module (the compiler name should be exported in the CC environment variable)

  • Python 3.6 or newer

  • The following Python packages are required additionally

Make sure to have your C compiler set to the CC environment variable

export CC=gcc

Install the project with pip

pip install .

To install extra dependencies as well use

pip install '.[ase]'

Using meson#

The Python extension module can be built on-top of an existing installation, either provided by meson or CMake.

Building requires against an existing tblite installation requires

  • C compiler to build the C-API and compile the extension module

  • meson version 0.55 or newer

  • a build-system backend, i.e. ninja version 1.7 or newer

  • Python 3.6 or newer with the CFFI package installed

Setup a build with

meson setup _build_python python -Dpython_version=$(which python3)

The Python version can be used to select a different Python version, it defaults to 'python3'. Python 2 is not supported with this project, the Python version key is meant to select between several local Python 3 versions.

Compile the project with

meson compile -C _build

The extension module is now available in _build_python/tblite/_libtblite.*.so. You can install as usual with

meson configure _build --prefix=/path/to/install
meson install -C _build

Supported Compilers#

This is a non-comprehensive list of tested compilers for tblite. Compilers with the label latest are tested with continuous integration for each commit.

Compiler

Version

Platform

Architecture

tblite

GCC

11.1, 10.3

Ubuntu 20.04

x86_64

0.2.0, 0.2.1, 0.3.0, latest

GCC

10.3, 9.4

MacOS 11.6.5

x86_64

0.2.0, 0.2.1, 0.3.0, latest

GCC

9.4

MacOS 10.15.7

x86_64

0.2.0, 0.2.1

GCC

11.0

MacOS 11.0

arm64

0.2.0, 0.2.1

GCC

10.3

CentOS 7

aarch64, ppc64le

0.2.0, 0.2.1

GCC/MinGW

11.2

Windows 2022

x86_64

0.2.1 0.3.0, latest

Intel

2021.2

Ubuntu 20.04

x86_64

0.2.0, 0.2.1, 0.3.0, latest

NAG

7.1

AlmaLinux 8.5

x86_64

0.2.0, 0.2.1

Compiler known to fail are documented here, together with the last commit where this behaviour was encountered. If available an issue in on the projects issue tracker or the issue tracker of the dependencies is linked. Usually, it safe to assume that older versions of the same compiler will fail to compile as well and this failure is consistent over platforms and/or architectures.

Compiler

Version

Platform

Architecture

Reference

GCC

6.4.0

MacOS 10.15.7

x86_64

abb17c3

Intel

19.0.5

AlmaLinux 8.5

x86_64

0542ce7, tblite#45

Intel

17.0.1

OpenSuse 42.1

x86_64

abb17c3, tblite#2

Intel

16.0.3

CentOS 7.3

x86_64

abb17c3, dftd4#112

Flang

20190329

Ubuntu 20.04

x86_64

abb17c3, toml-f#28

NVHPC

20.9

Manjaro Linux

x86_64

abb17c3, toml-f#27