Installation
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.6 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
Pkg.add("DFTK")
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")
DFTK is continuously tested on Debian, Ubuntu, mac OS and Windows and should work on these operating systems out of the box.
That's it. With this you are all set to run the code in the Tutorial or the examples
directory.
We follow the usual semantic versioning conventions of Julia. Therefore all DFTK versions with the same minor (e.g. all 0.6.x
) should be API compatible, while different minors (e.g. 0.7.y
) might have breaking changes. These will also be announced in the release notes.
Recommended optional packages
While not strictly speaking required to use DFTK it is usually convenient to install a couple of standard packages from the AtomsBase ecosystem to make working with DFT more convenient. Examples are
- AtomsIO and AtomsIOPython, which allow you to read (and write) a large range of standard file formats for atomistic structures. In particular AtomsIO is lightweight and highly recommended.
- ASEconvert, which integrates DFTK with a number of convenience features of the ASE, the atomistic simulation environment. See Creating and modelling metallic supercells for an example where ASE is used within a DFTK workflow.
You can install these packages using
import Pkg
Pkg.add(["AtomsIO", "AtomsIOPython", "ASEconvert"])
There are two main packages to use Python dependencies from Julia, namely PythonCall and PyCall. These packages can be used side by side, but some care is needed. By installing AtomsIOPython and ASEconvert you indirectly install PythonCall which these two packages use to manage their third-party Python dependencies. This might cause complications if you plan on using PyCall-based packages (such as PyPlot) In contrast AtomsIO is free of any Python dependencies and can be safely installed in any case.
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:
Add a development version of DFTK to the global Julia environment:
import Pkg Pkg.develop("DFTK")
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.Clone DFTK into a location of your choice
$ git clone https://github.com/JuliaMolSim/DFTK.jl /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 Pkg.develop("/some/path/")
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.
We use PrecompileTools.jl to reduce the time to first SCF. For development spending the additional time for precompiling DFTK is usually not worth it and it might be a good idea to disable precompilation in a development setup. See the PrecompileTools documentation for instructions how to do this.