Installing DFT-D4#

This guide will walk you through installing the latest version of DFT-D4.

Installing from conda-forge#

Conda 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
conda config --set channel_priority strict

Once the conda-forge channel has been enabled, DFT-D4 can be installed with conda:

conda install dftd4

or with mamba:

mamba install dftd4

It is possible to list all of the versions of DFT-D4 available on your platform with conda:

conda search dftd4 --channel conda-forge

or with mamba:

mamba search dftd4 --channel conda-forge

Alternatively, mamba repoquery may provide more information:

# Search all versions available on your platform:
mamba repoquery search dftd4 --channel conda-forge

# List packages depending on `dftd4`:
mamba repoquery whoneeds dftd4 --channel conda-forge

# List dependencies of `dftd4`:
mamba repoquery depends dftd4 --channel conda-forge

FreeBSD ports#

FreeBSD

A port for FreeBSD is available

pkg install science/dftd4

In case no package is available build the port using

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

For more information see the dftd4 port details.

Building from source#

To build this project from the source code in this repository you need to have

  • a Fortran compiler supporting Fortran 2008

  • One of the supported build systems

    • meson version 0.55 or newer

    • CMake version 3.9 or newer

First, get the source by cloning the repository

git clone https://github.com/dftd4/dftd4
cd dftd4

Using Meson#

To build this project with meson a build-system backend is required, i.e. ninja version 1.7 or newer. Setup a build with

meson setup _build --prefix=/path/to/installation

You can select the Fortran compiler by the FC environment variable. To compile the project run

meson compile -C _build

DFT-D4 comes with a comprehensive test suite. Run the tests with

meson test -C _build --print-errorlogs

Finally, you can install DFT-D4 with

meson install -C _build

Using CMake#

While meson is the preferred way to build this project it also offers CMake support. Configure the CMake build with

cmake -B_build -GNinja -DCMAKE_INSTALL_PREFIX=/path/to/installation

Similar to meson the compiler can be selected with the FC environment variable. You can build the project using

cmake --build _build

DFT-D4 comes with a comprehensive test suite. Run the tests with

ctest --test-dir _build --output-on-failure

Finally, you can install DFT-D4 with

cmake --install _build