# DFTK.jl: The density-functional toolkit.

The density-functional toolkit, **DFTK** for short, is a library of Julia routines for playing with plane-wave density-functional theory (DFT) algorithms. In its basic formulation it solves periodic Kohn-Sham equations. The unique feature of the code is its **emphasis on simplicity and flexibility** with the goal of facilitating methodological development and interdisciplinary collaboration. In about 5k lines of pure Julia code we already support a sizeable set of features, after just a good year of development. Our performance is of the same order of magnitude as much larger production codes such as Abinit, Quantum Espresso and VASP.

## Package features

- 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
- Direct minimization
- 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). - Third-party integrations:
- Use structures prepared in pymatgen, ASE or abipy.
- asedftk: DFTK-based calculator implementation for ASE.
- Read data in ETSF Nanoquanta format.

Missing a feature? Look for an open issue or create a new one.

## Example index

First, new users should take a look at the Installation and Tutorial sections. More details about DFTK are explained in the examples as we go along:

- Temperature and metallic systems
- Creating supercells with pymatgen
- Creating slabs with ASE
- Gross-Pitaevskii equation in one dimension
- Gross-Pitaevskii equation with magnetism
- Cohen-Bergstresser model
- Arbitrary floating-point types
- Monitoring self-consistent field calculations
- Custom solvers
- Custom potential

These and more examples can be found in the `examples`

directory of the main code.

If you have a great example you think would fit here, please open a pull request!