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
- 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.
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.
MolSim to your installed registries. For this use
] registry add https://github.com/JuliaMolSim/MolSim.git
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
Check out which version of python is used by the
You can do this for example with the Julia commands
using PyCall PyCall.python
Then use the corresponding package manager (usually
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
Feel free to contact us (@mfherbst and @antoine-levitt) directly, open issues or submit pull requests. Any contribution or discussion is welcome!