Skip to content
Density-functional toolkit
Julia Shell
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows Add CompatHelper (#157) Mar 19, 2020
codegen/xc_fallback Doc and cleanup Aug 7, 2019
data/psp/hgh Fixes for PSP parser (#83) Dec 8, 2019
deps Version check for spglib Feb 13, 2020
docs Definitions, normalizations, etc. (#152) Mar 17, 2020
examples Improve load_psp and list_psp Mar 29, 2020
src Fix oops Mar 30, 2020
test Fix some typos in local part Mar 29, 2020
.bumpversion.cfg Bump version: 0.0.4 → 0.0.5 Mar 10, 2020
.gitignore Add relevant files from FourierTransforms.jl as a copy Nov 18, 2019
.travis.yml Fixing compat versions (#181) Mar 20, 2020
LICENSE Initial commit May 2, 2019
Project.toml Keep only major Apr 6, 2020 Fixing compat versions (#181) Mar 20, 2020
environment.yml [noci] Add environment.yml of python dependencies Mar 6, 2020

dftk logo

Density-functional toolkit

gitter license Build Status on Linux Coverage Status DOI

The density-functional toolkit, DFTK for short, is a library of Julia routines for experimentation with plane-wave-based density-functional theory (DFT), as implemented in much larger production codes such as Abinit, Quantum Espresso and VASP. The main aim at the moment is to provide a platform to facilitate numerical analysis of algorithms and techniques related to DFT. For this we want to leverage as much of the existing developments in plane-wave DFT and the related ecosystems of Julia python or C codes as possible.


The library is at an early stage but we do already support a sizeable set of features. An overview:

  • Methods and models:
    • Kohn-Sham-like models, with an emphasis on flexibility: compose your own model, from Cohen-Bergstresser linear eigenvalue equations to Gross-Pitaevskii equations and sophisticated LDA/GGA functionals (any functional from the libxc library)
    • Analytic potentials or Godecker norm-conserving pseudopotentials (GTH, HGH)
    • Brillouin zone symmetry for k-Point sampling using spglib
    • Smearing functions for metals
    • Self-consistent field approaches: Damping, Kerker mixing, Anderson/Pulay/DIIS mixing, interface to NLsolve.jl
    • Direct minimization using Optim.jl
    • Multi-level threading (kpoints, eigenvectors, FFTs, linear algebra)
    • 1D / 2D / 3D systems
    • Magnetic fields
  • Ground-state properties and post-processing:
    • Total energy
    • Forces
    • Density of states (DOS), local density of states (LDOS)
    • Band structures
    • Easy access to all intermediate quantities (e.g. density, Bloch waves)
  • Support for arbitrary floating point types, including Float32 (single precision) or Double64 (from DoubleFloats.jl). For DFT this is currently restricted to LDA (with Slater exchange and VWN correlation).

All this in about 5k lines of pure Julia code. The code emphasizes simplicity and flexibility, with the goal of facilitating methodological development and interdisciplinary collaboration. It has not been properly optimized and fine-tuned yet, but the performance is of the same order of magnitude as established packages.

Note: DFTK has only been compared against standard packages for a small number of test cases and might still contain bugs.

Getting started

The package is not yet registered in the General registry of Julia. Instead you can obtain it from the MolSim registry, which contains a bunch of packages related to performing molecular simulations in Julia. Note that at least Julia 1.3 is required.

First add MolSim to your installed registries. For this use

] registry add

for a Julia command line. Afterwards you can install DFTK like any other package in Julia:

] add DFTK

or if you like the bleeding edge:

] add DFTK#master

Some parts of the code require a working Python installation with the libraries pymatgen and spglib. Check out which version of python is used by the PyCall.jl package. You can do this for example with the Julia commands

using PyCall

Then use the corresponding package manager (usually apt, pip, pip3 or conda) to install aforementioned libraries, for example

pip install spglib pymatgen


conda install -c conda-forge spglib pymatgen

You can then run the code in the examples/ directory.




Feel free to contact us (@mfherbst and @antoine-levitt) directly, open issues or submit pull requests. Any contribution or discussion is welcome!

You can’t perform that action at this time.