# Calculating first and second derivatives of a molecular Hamiltonian?

I'm interested in computing first and second derivatives of molecular Hamiltonians with respect to nuclear coordinates. I've been using Psi4 and PySCF to perform Hartree-Fock calculations, and I was wondering if there is any way to use these packages (or similar Python packages) to compute first and second derivatives analytically, by solving the coupled-perturbed Hartree-Fock equations?

• +1 and welcome to our new community! Thank you for contributing your question here and we hope to see much more of you in the future! Commented Jun 15, 2021 at 19:23
• Thank you @NikeDattani! Commented Jun 15, 2021 at 19:24

\begin{align} H &= -\sum_{i}\frac{1}{2}\nabla_{i}^{2}-\sum_{i,A}\frac{Z_{A}}{\left|r_{i}-R_{A}\right|}+\sum_{A>B}\frac{Z_{A}Z_{B}}{\left|R_{A}-R_{B}\right|}+\sum_{i>j}\frac{1}{r_{ij}},\tag{1}\\ \frac{\partial H}{\partial R} &= \sum_{i,A}\frac{Z_{A}}{\left|r_{i}-R_{A}\right|^{2}}-\sum_{A>B}\frac{Z_{A}Z_{B}}{R^{2}}. \tag{2} \end{align}