Search papers, labs, and topics across Lattice.
This paper introduces libxckernel, a novel library that automates the generation of exchange-correlation response kernels through symbolic differentiation, addressing the long-standing issue of manually coding the contraction layer for various functional families and properties. By expressing the xc functional's components as sesquilinear forms in the density matrix, the library efficiently computes any xc matrix element, including Fock matrices and orbital Hessians, while optimizing for performance by collapsing similar terms. The implementation of libxckernel in electronic structure programs like Psi4 and GPAW showcases its capability to enhance functionality in orbital stability analysis and time-dependent density-functional theory.
Automating the generation of exchange-correlation response kernels could eliminate tedious manual coding and significantly accelerate advancements in electronic structure calculations.
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.