Algorithmic differentiation for plane-wave DFT: materials design, error control and learning model parameters
Supporting information containing structures, raw data and computational scripts for the paper:
Niklas Frederik Schmitz, Bruno Ploumhans, Michael F. Herbst.
Algorithmic differentiation for plane-wave DFT: materials design, error control and learning model parameters. npj Computational Materials 12, 6 (2026). https://doi.org/10.1038/s41524-025-01880-3 arxiv: https://arxiv.org/abs/2509.07785
If you use this code, please cite:
@article{Schmitz2026addfpt,
author = {Schmitz, Niklas Frederik and Ploumhans, Bruno and Herbst, Michael F.},
doi = {10.1038/s41524-025-01880-3},
journal = {npj Computational Materials},
title = {Algorithmic differentiation for plane-wave DFT: materials design, error control and learning model parameters},
year = {2026},
volume = {12},
number = {1},
pages = {6},
}The code in this repository has been used to run all calculations and produce all plots of the above paper. It relies on DFTK version 0.7.16.
Running the code requires an installation of Julia 1.11.5. To install all further necessary dependencies, run the following command in this directory:
julia --project=@. -e "import Pkg; Pkg.instantiate()" # Install dependenciesFor each example, we provide the code to reproduce all results and plots. Raw computational data is also included, so you can regenerate all plots without re-running the DFT calculations. For full reproducibility, all computations can be run from scratch, with running times ranging from seconds to several hours on a modern workstation. For reference, we also include log files from our original runs. Note that performance could be further improved by tweaking threading settings.
The examples sections from the paper map as follows to this repository:
- Figure 1: Systematic DFT derivatives: See figure1_derivative_combinations/
- Elasticity: See elastic_constants/
- For the plot, see analysis.ipynb
- To regenerate the convergence study data, run
run.sh
- Inverse materials design: See inverse_design/
- For the plot, see analysis.ipynb.
- To rerun the optimization, run
bash run.jl
- Learning the exchange-correlation functional: See xc_finetuning/.
- For the final plot, see eval/pbe_Si_Al_V_NaCl_trained/analysis.ipynb
- For the data preprocessing, see sol58lc
- For the training, see train/pbe_Si_Al_V_NaCl/train.jl
- For the evaluation, see eval/
- Property-driven pseudopotential optimization: See pseudopotential_tuning/.
- For the final plot, see analysis.ipynb
- For the convergence study for GTH Li-q3 target results, see convergence_study_Li_q3
- For the training code of Li-q1, see lib.jl
- Propagating XC functional uncertainty: See forward_uncertainty/.
- For the final plot, see analysis.ipynb.
- For rerunning all computations, see run.sh
- Estimation of the plane-wave basis error: See pw_error_estimation.
- For the final plot, see 2_analysis.ipynb
- For rerunning all computations, see run_all.sh.
All code in this repository is licensed under the MIT license.
MIT License
Copyright (c) 2025 Niklas F. Schmitz and collaborators
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
All data in this repository, except where noted below, is licensed under the Creative Commons Attribution 4.0 (CC-BY 4.0) license.
Exceptions:
- The Sol58LC dataset in
xc_finetuning/sol58lc. See the corresponding README. - The all-electron data in
pseudopotential_tuning/all_electron_data. See the corresponding README.
This research was supported by the Swiss National Science Foundation (SNSF, Grant No. 221186) as well as the NCCR MARVEL, a National Centre of Competence in Research, funded by the SNSF (Grant No. 205602).