In case you don't have a working Julia installation yet, first download the Julia binaries and follow the Julia installation instructions. At least Julia 1.4 is required for DFTK.

Afterwards you can install DFTK like any other package in Julia. For example run in your Julia REPL terminal:

import Pkg

which will install the latest DFTK release. Alternatively (if you like to be fully up to date) install the master branch:

import Pkg
Pkg.add(name="DFTK", rev="master")

Python dependencies

Some parts of the code require a working Python installation with the pymatgen module. 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 pymatgen


conda install -c conda-forge pymatgen

Afterwards you're all set and should be able to run the code in the examples directory.

Developer setup

If you want to start developing DFTK Julia has the option to automatically keep track of the changes of the sources during development. This means, for example, that Revise will automatically be aware of the changes you make to the DFTK sources and automatically reload your changes inside an active Julia session. To achieve such a setup you have two recommended options:

  1. Add a development version of DFTK to the global Julia environment:

    import Pkg

    This clones DFTK to the path ~/.julia/dev/DFTK" (on Linux). Note that with this method you cannot install both the stable and the development version of DFTK into your global environment.

  2. Clone DFTK into a location of your choice

    $ git clone /some/path/

    Whenever you want to use exactly this development version of DFTK in a Julia environment (e.g. the global one) add it as a develop package:

    import Pkg

    To run a script or start a Julia REPL using exactly this source tree as the DFTK version, use the --project flag of Julia, see this documentation for details. For example to start a Julia REPL with this version of DFTK use

    $ julia --project=/some/path/

    The advantage of this method is that you can easily have multiple clones of DFTK with potentially different modifications made.