# Quantum chemistry Python package to solve the Coupled-Perturbed Hartree–Fock equations

Two of the most well-known Python quantum chemistry pakcages, PySCF and Psi4, can solve the Hartree–Fock equations. However, I am interested in finding analytic derivatives of the electron integrals:

$$h_{pq}(R) = \displaystyle\int dx \phi_p(x)^{*} \left( -\frac{\nabla_r^2}{2} - \displaystyle\sum_{I} \frac{Z_I}{|r - R_I|} \right) \phi_q(x)$$

$$h_{pqrs}(R) = \displaystyle\int dx_1 dx_2 \frac{\phi_p(x_1)^{*} \phi_q(x_2)^{*} \phi_r(x_2) \phi_s(x_1)}{|r_1 - r_2|}$$

with respect to the nuclear coordinates. To do this, one must solve the coupled-perturbed Hartree–Fock equations. It doesn't seem like Psi4 and PySCF have this functionality, so I was wondering if there was any other package I can use to do this?

• Hello, and welcome to Chemistry! I see you've already participated on Matter Modelling, so you'll be aware that this question would also fit there. That doesn't mean it's off-topic here, it's perfectly fine; but in the event that you ever want to move it there, feel free to let us know. (But please don't double-post on both sites.) Commented Jun 21, 2021 at 21:39
• Just checking the obvious: What order derivatives do you want? If it's only first order you don't need a CPHF solver. Commented Jun 21, 2021 at 21:52
• Related question on Matter Modeling. As mentioned there, any program that can do geometry optimizations probably has a way of generating the gradient/hessian (or at least relevant matrix-vector products that are needed for the optimization). So I suspect Psi4 and PySCF have these quantities, its just a matter of it they provide an interface to access them.
– Tyberius
Commented Jun 21, 2021 at 21:53
• @JackCeroni But I mean if these programs computing the geometric Hessian of energy analytically, they would need the 1st and 2nd derivatives of these integrals as part of that process.
– Tyberius
Commented Jun 21, 2021 at 21:58
• Yes, for second order or greater you need a CPHF solver of appropriate order. Commented Jun 21, 2021 at 22:24