Automatic generation of exchange-correlation response kernels
Abstract
Computing density-functional response properties requires contracting derivatives of the exchange--correlation (xc) energy with perturbed densities on a grid. While the xc functional's derivatives have long been available to high orders from libraries such as Libxc, the surrounding contraction layer - the chain rule that combines them with the grid-based basis-function and density data into the total xc contribution - has instead been hand-derived and hand-coded in every program, for every functional family, spin case, and property. We present libxckernel, a library that automatically generates this layer by symbolic differentiation. The xc functional's ingredients are expressed as sesquilinear forms in the density matrix, so the xc energy can be differentiated to any order while the functional derivatives remain opaque. The basis functions and the orbital coefficients may both be complex. The chain rule then produces any xc matrix element: Fock matrices, orbital Hessians, and response terms of any order. Terms sharing a pattern are collapsed for efficiency. Extensible plugins emit the expressions as NumPy Einstein sums, compiled C kernels with C++/Fortran interfaces, or host-program specific source code. libxckernel is free and open-source software under the BSD-3-Clause license, enabling rapid implementation of functionality missing from many electronic structure programs. We demonstrate it by extending Psi4 with meta-generalized gradient approximation (mGGA) response kernels for orbital stability analysis and time-dependent density-functional theory (TD-DFT), GGA and mGGA analytic nuclear Hessians, and exact quadrature grid response, and by extending GPAW with mGGA and triplet TD-DFT kernels and gradient-corrected kernels for periodic dielectric response.
Versions
Related
- Stationarity Constraints Improve Both Energies and Densities of Machine-Learned Exchange-Correlation Functionals
- ROSE: Deep Learning exchange-correlation functional from reduced density-matrix representations
- Machine-learned Laplacian-level density functional from exact exchange-correlation potentials and energies
- Machine-learned exchange-correlation functionals for molecules, solids, and reactive surfaces
- XC100: A Wavefunction-Derived Exchange-Correlation Energy Dataset for Atomic and Molecular Species
BibTeX
@misc{lehtola2026automatic,
title = {{Automatic generation of exchange-correlation response kernels}},
author = {Susi Lehtola},
howpublished = {arXiv},
year = {2026},
month = aug,
doi = {10.48550/arxiv.2608.26440},
eprint = {2608.26440},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2608.26440},
}
RIS
TY - UNPB
TI - Automatic generation of exchange-correlation response kernels
AU - Susi Lehtola
PY - 2026
DA - 2026/08/26
PB - arXiv
DO - 10.48550/arxiv.2608.26440
UR - https://arxiv.org/abs/2608.26440
AB - Computing density-functional response properties requires contracting derivatives of the exchange--correlation (xc) energy with perturbed densities on a grid. While the xc functional's derivatives have long been available to high orders from libraries such as Libxc, the surrounding contraction layer - the chain rule that combines them with the grid-based basis-function and density data into the total xc contribution - has instead been hand-derived and hand-coded in every program, for every functional family, spin case, and property. We present libxckernel, a library that automatically generates this layer by symbolic differentiation. The xc functional's ingredients are expressed as sesquilinear forms in the density matrix, so the xc energy can be differentiated to any order while the functional derivatives remain opaque. The basis functions and the orbital coefficients may both be complex. The chain rule then produces any xc matrix element: Fock matrices, orbital Hessians, and response terms of any order. Terms sharing a pattern are collapsed for efficiency. Extensible plugins emit the expressions as NumPy Einstein sums, compiled C kernels with C++/Fortran interfaces, or host-program specific source code. libxckernel is free and open-source software under the BSD-3-Clause license, enabling rapid implementation of functionality missing from many electronic structure programs. We demonstrate it by extending Psi4 with meta-generalized gradient approximation (mGGA) response kernels for orbital stability analysis and time-dependent density-functional theory (TD-DFT), GGA and mGGA analytic nuclear Hessians, and exact quadrature grid response, and by extending GPAW with mGGA and triplet TD-DFT kernels and gradient-corrected kernels for periodic dielectric response.
ER -