Abstract
Accurate and efficient gradients of molecular energy with respect to nuclear degrees of freedom are essential for geometry optimization and molecular dynamics, including simulations 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 GPU and 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 run times, while semi-numerical is slower on GPU but remains competitive on CPU. For excited states, analytical and a custom AD approach using implicit differentation show similar performance and low memory requirements, whereas gradients with full-AD are memory-limited. Accuracy of AD gradients is excellent 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 alter- native for analytic gradients in semiempirical quantum chemistry, offering high accuracy with modest memory overhead. Our results provide actionable guidance for selecting optimal gradient strategies in large-scale ground- and excited-state molecular dynamics simulations.
Supplementary materials
Title
Supporting Information
Description
Supporting information that shows data verifying the implementation of analytical gradients against finite-difference gradients, and wall time and peak memory benchmarking for higher excited states
Actions



![Author ORCID: We display the ORCID iD icon alongside authors names on our website to acknowledge that the ORCiD has been authenticated when entered by the user. To view the users ORCiD record click the icon. [opens in a new tab]](https://www.cambridge.org/engage/assets/public/coe/logo/orcid.png)