Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Log inSign up
Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Blog
Job Board
Q3AS

© 2026 Aqora Quantum S.A.S.

TermsPrivacyLegal Notice

arXiv:1711.08127 · ACS Central Science

Automatic Differentiation in Quantum Chemistry with Applications to Fully Variational Hartree–Fock

Teresa Tamayo-Mendoza, Christoph Kreisbeck, Roland H. Lindh, Alán Aspuru‐Guzik

Published May 9, 2018• 95 citations
arXivHTMLPDF

Abstract

Abstract Automatic differentiation (AD) is a powerful tool that allows calculating derivatives of implemented algorithms with respect to all of their parameters up to machine precision, without the need to explicitly add any additional functions. Thus, AD has great potential in quantum chemistry, where gradients are omnipresent but also difficult to obtain, and researchers typically spend a considerable amount of time finding suitable analytical forms when implementing derivatives. Here, we demonstrate that AD can be used to compute gradients with respect to any parameter throughout a complete quantum chemistry method. We present DiffiQult, a Hartree–Fock implementation, entirely differentiated with the use of AD tools. DiffiQult is a software package written in plain Python with minimal deviation from standard code which illustrates the capability of AD to save human effort and time in implementations of exact gradients in quantum chemistry. We leverage the obtained gradients to optimize the parameters of one-particle basis sets in the context of the floating Gaussian framework.

DOI
10.1021/acscentsci.7b00586

Related papers

Automatic differentiation in quantum chemistry

Tamayo Mendoza, Teresa

Automatic differentiation (AD) is a well-established tool that allows us to compute exact derivatives of implemented functions with respect to all their parameters. It does so without requiring any extra coding or knowledge of the analytical derivatives. Derivatives of quantum chemistry algorithms are generally very hard to obtain and often cumbersome to implement. AD shows great potential to solve this problem and to facilitate the implementation of gradients in the context of electronic structure methods. In this dissertation, we have applied AD in a broader context and demonstrate that AD tools can compute arbitrary gradients of quantum chemistry methods with respect to any input parameter and any intermediate function. To this end, we have developed the open-source code DiffiQult, a fully differentiable Hartree-Fock (HF) software package. DiffiQult is a python package that uses AD tools using the external libraries JAX and Algopy. As a proof of concept, DiffiQult is an example of an end-to-end differentiable software package of a quantum chemistry algorithm based solely on AD tools. This application has helped us understand the challenges of AD in quantum chemistry. We outline the details, benefits, and caveats of AD for the HF algorithm in this work. We have chosen HF as a starting point since it contains all the functions included in correlated electronic structure methods. In this way, it opens the door for the development of AD for more accurate algorithms. As an application, we describe DiffiQult within the framework of the fully variational HF method, where we use a gradient-based optimization method to compute system-specific basis functions. As a result, the wavefunction can capture more molecular features, and we obtain a set of basis functions for correlated methods in quantum and classical algorithms. This proves that these functions improve variationally energy while keeping a compact representation in correlated methods by interfacing with the quantum chemistry library PySCF, and with Tequila, a platform for rapid development of quantum algorithms. First, we present optimization results of minimal basis sets with respect to all parameters of the molecules H2O, CH4, NH3, HF. Later we include optimization of the potential energy surface of two isomerization mechanisms of diazene and hydrogens chains. Here, we use a minimal optimized basis set to compute FCI when possible with PySCF and VQE energies of hydrogen chains with Tequila. We obtain similar results compared to a bigger basis set with considerably fewer configurations. Also, we show how this approach improves the estimation of the thermodynamic limit in the hydrogen chain at the HF level. Finally, we apply this approach to the optimization of all atomic orbitals of benzene and compute electronic correlations restricting the active space to the 6 π orbitals of benzene using the UpCCGSD ansatz implemented in Tequila.

•Jan 1, 2021•0 citations

Ground and excited state gradients with end-to-end differentiable semiempirical quantum chemistry

Vishikh Athavale, Maksim Kulichenko, Nikita S. Fedik +3 more

Accurate and efficient gradients of molecular energy with respect to nuclear degrees of freedom are essential for geometry optimization and molecular dynamics, including simulations that go beyond the Born-Oppenheimer regime. A common approach involves deriving analytical formulas for new electronic structure methods, which is often conceptually difficult and requires tedious coding. Here, we implement analytical, semi-numerical, and automatic differentiation (AD)-based gradient pathways for semiempirical Hamiltonian models in the PYSEQM software package, leveraging both graphics processing unit (GPU) and central processing unit (CPU) architectures. We further extend these capabilities to excited states calculated using the configuration interaction singles and time-dependent Hartree-Fock ansätze. We benchmark wall time, peak memory usage, and accuracy across three molecular families of varying chemical complexity, including systems of up to a thousand atoms. For ground-state simulations, analytical and AD gradients achieve near-identical GPU runtimes, while semi-numerical gradients are slower on GPU but remain competitive on CPU. For excited states, both analytical and custom AD approaches using implicit differentiation show similar performance and low memory requirements, whereas gradients with full AD are memory-limited. AD gradients match analytical ones in accuracy across all tested systems, aided by a quaternion-based diatomic frame rotation for two-center quantities that ensures smooth energy surfaces. Overall, automatic differentiation emerges as a practical alternative to analytical gradients in semiempirical quantum chemistry, offering high accuracy while allowing seamless integration in AI-driven workflows and popular packages, such as PyTorch and JAX. Our results provide actionable guidance for selecting optimal gradient strategies in large-scale ground- and excited-state molecular dynamics simulations.

The Journal of Chemical Physics•Jan 27, 2026•3 citations

DQC: A Python program package for differentiable quantum chemistry

Muhammad Kasim, Susi Lehtola, Sam M. Vinko

Automatic differentiation represents a paradigm shift in scientific programming, where evaluating both functions and their derivatives is required for most applications. By removing the need to explicitly derive expressions for gradients, development times can be shortened and calculations can be simplified. For these reasons, automatic differentiation has fueled the rapid growth of a variety of sophisticated machine learning techniques over the past decade, but is now also increasingly showing its value to support ab initio simulations of quantum systems and enhance computational quantum chemistry. Here, we present an open-source differentiable quantum chemistry simulation code and explore applications facilitated by automatic differentiation: (1) calculating molecular perturbation properties, (2) reoptimizing a basis set for hydrocarbons, (3) checking the stability of self-consistent field wave functions, and (4) predicting molecular properties via alchemical perturbations.

arXiv:2110.11678•The Journal of Chemical Physics•Feb 22, 2022•52 citations

Automatic differentiation for coupled cluster methods

Fabijan Pavošević, Sharon Hammes‐Schiffer

Automatic differentiation is a tool for numerically calculating derivatives of a given function up to machine precision. This tool is useful for quantum chemistry methods, which require the calculation of gradients either for the minimization of the energy with respect to wave function parameters or for the calculation of molecular responses to external perturbations. Herein, we apply automatic differentiation to the coupled cluster with doubles method, in which the wave function parameters are obtained by minimizing the energy Lagrangian. The benefit of this approach is that the l amplitudes can be obtained without implementation of the usual L-equations, thereby reducing the coding effort by approximately a factor of two. We also show that the excitation energies at the coupled cluster level can be ontained with only a few lines of the code using automatic differentiation. We further apply automatic differentiation to the multicomponent coupled cluster with doubles method, which treats more than one type of particle, such as electrons and protons, quantum mechanically. This approach will be especially useful for prototyping, debugging, and testing multicomponent quantum chemistry methods because reference and benchmark data are limited in this emerging field.

arXiv:2011.11690•Nov 23, 2020•5 citations

Differentiable quantum computational chemistry with PennyLane

Juan Miguel Arrazola, Soran Jahangiri, Alain Delgado +15 more

This work describes the theoretical foundation for all quantum chemistry functionality in PennyLane, a quantum computing software library specializing in quantum differentiable programming. We provide an overview of fundamental concepts in quantum chemistry, including the basic principles of the Hartree-Fock method. A flagship feature in PennyLane is the differentiable Hartree-Fock solver, allowing users to compute exact gradients of molecular Hamiltonians with respect to nuclear coordinates and basis set parameters. PennyLane provides specialized operations for quantum chemistry, including excitation gates as Givens rotations and templates for quantum chemistry circuits. Moreover, built-in simulators exploit sparse matrix techniques for representing molecular Hamiltonians that lead to fast simulation for quantum chemistry applications. In combination with PennyLane's existing methods for constructing, optimizing, and executing circuits, these methods allow users to implement a wide range of quantum algorithms for quantum chemistry. We discuss how PennyLane can be used to implement variational algorithms for calculating ground-state energies, excited-state energies, and energy derivatives, all of which can be differentiated with respect to both circuit and Hamiltonian parameters. We provide an example workflow describing how to jointly optimize circuit parameters, nuclear coordinates, and basis set parameters for quantum chemistry algorithms. We discuss a functionality for reducing the number of qubits by using symmetries and explain how PennyLane can be used to estimate quantum resources needed to implement several quantum algorithms. By combining insights from quantum computing, computational chemistry, and machine learning, PennyLane is the first library for differentiable quantum computational chemistry.

arXiv:2111.09967•Nov 18, 2021•9 citations

Semiempirical Quantum Chemistry in the Age of ab initio Data and Differentiable Programming: I. Differentiable Molecular Orbital Theory

Martin Stöhr, Todd J. Martı́nez

Semiempirical quantum chemistry (SQC) methods offer fast quantum chemical insights by constructing and solving a parametric effective minimal basis Fock matrix. Establishing suitable parameterizations has long been a challenging and time-consuming task involving tedious grid searches or costly finite-difference gradients of carefully crafted loss functions based on select experimental data. The growing availability of differentiable programming environments that leverage algorithmic differentiation to obtain complex derivatives together with access to a wealth of reliable reference data from ab initio calculations offers a new and more efficient approach. In this work, we extend a previous, basic implementation of SQC methods in PyTorch [J. Chem. Theory Comput. 16, 4951-4962 (2020)] by including global algorithmic considerations into the code design. This allows for improved general applicability and establishes a robust back-end for rapid SQC parameterizations. In particular, we address the general differentiability of the eigensolver and the iterative SCF procedure. The new implementation offers drastic improvements in computing costs as well as memory footprint and provides increased stability in gradient evaluation. We highlight the importance of these advances and their improvements over existing formulations and illustrate their role in the context of SQC parameterization.

Journal of Chemical Theory and Computation•Jan 8, 2026•1 citation
Abstract Automatic differentiation (AD) is a powerful tool that allows calculating derivatives of implemented algorithms with respect to all of their parameters up to machine precision, without the need to explicitly add any additional functions. Thus, AD has great potential in quantum chemistry, where gradients are omnipresent but also difficult to obtain, and researchers typically spend a considerable amount of time finding suitable analytical forms when implementing derivatives. Here, we demonstrate that AD can be used to compute gradients with respect to any parameter throughout a complete quantum chemistry method. We present DiffiQult, a Hartree–Fock implementation, entirely differentiated with the use of AD tools. DiffiQult is a software package written in plain Python with minimal deviation from standard code which illustrates the capability of AD to save human effort and time in implementations of exact gradients in quantum chemistry. We leverage the obtained gradients to optimize the parameters of one-particle basis sets in the context of the floating Gaussian framework.
Automatic differentiation (AD) is a well-established tool that allows us to compute exact derivatives of implemented functions with respect to all their parameters. It does so without requiring any extra coding or knowledge of the analytical derivatives. Derivatives of quantum chemistry algorithms are generally very hard to obtain and often cumbersome to implement. AD shows great potential to solve this problem and to facilitate the implementation of gradients in the context of electronic structure methods. In this dissertation, we have applied AD in a broader context and demonstrate that AD tools can compute arbitrary gradients of quantum chemistry methods with respect to any input parameter and any intermediate function. To this end, we have developed the open-source code DiffiQult, a fully differentiable Hartree-Fock (HF) software package. DiffiQult is a python package that uses AD tools using the external libraries JAX and Algopy. As a proof of concept, DiffiQult is an example of an end-to-end differentiable software package of a quantum chemistry algorithm based solely on AD tools. This application has helped us understand the challenges of AD in quantum chemistry. We outline the details, benefits, and caveats of AD for the HF algorithm in this work. We have chosen HF as a starting point since it contains all the functions included in correlated electronic structure methods. In this way, it opens the door for the development of AD for more accurate algorithms. As an application, we describe DiffiQult within the framework of the fully variational HF method, where we use a gradient-based optimization method to compute system-specific basis functions. As a result, the wavefunction can capture more molecular features, and we obtain a set of basis functions for correlated methods in quantum and classical algorithms. This proves that these functions improve variationally energy while keeping a compact representation in correlated methods by interfacing with the quantum chemistry library PySCF, and with Tequila, a platform for rapid development of quantum algorithms. First, we present optimization results of minimal basis sets with respect to all parameters of the molecules H2O, CH4, NH3, HF. Later we include optimization of the potential energy surface of two isomerization mechanisms of diazene and hydrogens chains. Here, we use a minimal optimized basis set to compute FCI when possible with PySCF and VQE energies of hydrogen chains with Tequila. We obtain similar results compared to a bigger basis set with considerably fewer configurations. Also, we show how this approach improves the estimation of the thermodynamic limit in the hydrogen chain at the HF level. Finally, we apply this approach to the optimization of all atomic orbitals of benzene and compute electronic correlations restricting the active space to the 6 π orbitals of benzene using the UpCCGSD ansatz implemented in Tequila.
Accurate and efficient gradients of molecular energy with respect to nuclear degrees of freedom are essential for geometry optimization and molecular dynamics, including simulations that go beyond the Born-Oppenheimer regime. A common approach involves deriving analytical formulas for new electronic structure methods, which is often conceptually difficult and requires tedious coding. Here, we implement analytical, semi-numerical, and automatic differentiation (AD)-based gradient pathways for semiempirical Hamiltonian models in the PYSEQM software package, leveraging both graphics processing unit (GPU) and central processing unit (CPU) architectures. We further extend these capabilities to excited states calculated using the configuration interaction singles and time-dependent Hartree-Fock ansätze. We benchmark wall time, peak memory usage, and accuracy across three molecular families of varying chemical complexity, including systems of up to a thousand atoms. For ground-state simulations, analytical and AD gradients achieve near-identical GPU runtimes, while semi-numerical gradients are slower on GPU but remain competitive on CPU. For excited states, both analytical and custom AD approaches using implicit differentiation show similar performance and low memory requirements, whereas gradients with full AD are memory-limited. AD gradients match analytical ones in accuracy across all tested systems, aided by a quaternion-based diatomic frame rotation for two-center quantities that ensures smooth energy surfaces. Overall, automatic differentiation emerges as a practical alternative to analytical gradients in semiempirical quantum chemistry, offering high accuracy while allowing seamless integration in AI-driven workflows and popular packages, such as PyTorch and JAX. Our results provide actionable guidance for selecting optimal gradient strategies in large-scale ground- and excited-state molecular dynamics simulations.
Automatic differentiation represents a paradigm shift in scientific programming, where evaluating both functions and their derivatives is required for most applications. By removing the need to explicitly derive expressions for gradients, development times can be shortened and calculations can be simplified. For these reasons, automatic differentiation has fueled the rapid growth of a variety of sophisticated machine learning techniques over the past decade, but is now also increasingly showing its value to support ab initio simulations of quantum systems and enhance computational quantum chemistry. Here, we present an open-source differentiable quantum chemistry simulation code and explore applications facilitated by automatic differentiation: (1) calculating molecular perturbation properties, (2) reoptimizing a basis set for hydrocarbons, (3) checking the stability of self-consistent field wave functions, and (4) predicting molecular properties via alchemical perturbations.
Automatic differentiation is a tool for numerically calculating derivatives of a given function up to machine precision. This tool is useful for quantum chemistry methods, which require the calculation of gradients either for the minimization of the energy with respect to wave function parameters or for the calculation of molecular responses to external perturbations. Herein, we apply automatic differentiation to the coupled cluster with doubles method, in which the wave function parameters are obtained by minimizing the energy Lagrangian. The benefit of this approach is that the l amplitudes can be obtained without implementation of the usual L-equations, thereby reducing the coding effort by approximately a factor of two. We also show that the excitation energies at the coupled cluster level can be ontained with only a few lines of the code using automatic differentiation. We further apply automatic differentiation to the multicomponent coupled cluster with doubles method, which treats more than one type of particle, such as electrons and protons, quantum mechanically. This approach will be especially useful for prototyping, debugging, and testing multicomponent quantum chemistry methods because reference and benchmark data are limited in this emerging field.
This work describes the theoretical foundation for all quantum chemistry functionality in PennyLane, a quantum computing software library specializing in quantum differentiable programming. We provide an overview of fundamental concepts in quantum chemistry, including the basic principles of the Hartree-Fock method. A flagship feature in PennyLane is the differentiable Hartree-Fock solver, allowing users to compute exact gradients of molecular Hamiltonians with respect to nuclear coordinates and basis set parameters. PennyLane provides specialized operations for quantum chemistry, including excitation gates as Givens rotations and templates for quantum chemistry circuits. Moreover, built-in simulators exploit sparse matrix techniques for representing molecular Hamiltonians that lead to fast simulation for quantum chemistry applications. In combination with PennyLane's existing methods for constructing, optimizing, and executing circuits, these methods allow users to implement a wide range of quantum algorithms for quantum chemistry. We discuss how PennyLane can be used to implement variational algorithms for calculating ground-state energies, excited-state energies, and energy derivatives, all of which can be differentiated with respect to both circuit and Hamiltonian parameters. We provide an example workflow describing how to jointly optimize circuit parameters, nuclear coordinates, and basis set parameters for quantum chemistry algorithms. We discuss a functionality for reducing the number of qubits by using symmetries and explain how PennyLane can be used to estimate quantum resources needed to implement several quantum algorithms. By combining insights from quantum computing, computational chemistry, and machine learning, PennyLane is the first library for differentiable quantum computational chemistry.
Semiempirical quantum chemistry (SQC) methods offer fast quantum chemical insights by constructing and solving a parametric effective minimal basis Fock matrix. Establishing suitable parameterizations has long been a challenging and time-consuming task involving tedious grid searches or costly finite-difference gradients of carefully crafted loss functions based on select experimental data. The growing availability of differentiable programming environments that leverage algorithmic differentiation to obtain complex derivatives together with access to a wealth of reliable reference data from ab initio calculations offers a new and more efficient approach. In this work, we extend a previous, basic implementation of SQC methods in PyTorch [J. Chem. Theory Comput. 16, 4951-4962 (2020)] by including global algorithmic considerations into the code design. This allows for improved general applicability and establishes a robust back-end for rapid SQC parameterizations. In particular, we address the general differentiability of the eigensolver and the iterative SCF procedure. The new implementation offers drastic improvements in computing costs as well as memory footprint and provides increased stability in gradient evaluation. We highlight the importance of these advances and their improvements over existing formulations and illustrate their role in the context of SQC parameterization.