# Computing analytic derivatives of molecular Hamiltonians obtained from solving Hartree-Fock equations

I'm currently working on a quantum chemistry project, I am dealing with a second-quantized electronic Hamiltonian (corresponding to some molecule), written in terms of fermionic creation and annihilation operators of the form:

$$H(R) = \displaystyle\sum_{p, q} h_{pq}(R) c_p^{\dagger} c_q + \frac{1}{2} \displaystyle\sum_{p, q, r, s} h_{pqrs}(R) c^{\dagger}_p c^{\dagger}_q c_r c_s\tag{1}$$

where $$R$$ is the nuclear coordinates of the molecule, and:

$$h_{pq} = \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)\tag{2}$$

$$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|}\tag{3}$$

where each $$\phi$$ is a molecular orbital, obtained from performing Hartree-Fock for the molecular Hamiltonian of interest (which depends implicitly on $$R$$). Computing these orbitals, and therefore the integrals, is straightforward through use of most electronic structure program suites.

I am interested in calculating the first and second derivatives of $$H(R)$$, with respect to $$R$$, so in effect, I need to compute the first and second derivatives of the integral outlined above. Is it possible to use PySCF or Psi4 for this task as well? I've looked around, and it seems like this problem of computing derivatives has to do with solving the coupled-perturbed Hartree-Fock equations, although I am unsure.

Addendum: I did some more looking around, and it seems like GAMESS might be able to find the derivatives I'm looking for, as it can do analytical calculations of the Hessian, but I'm still unsure how to access these derivatives in the output file.

• Technically your Eq. 1 is the just the second-quantized version of my Eq. 1 here: mattermodeling.stackexchange.com/a/6162/5. You could actually just do the integrals on my Eq. 2 there instead of on Eq. 1 (i.e. work with the 2nd quantized version of my Eq. 2). What is your goal with this? You want to do geometry optimization, or DBOC? Jun 15 at 20:14
• If you're interested in doing DBOC, I believe the first paper to do it at HF level with analytic derivatives was this one by Handy et al.. In 2006 Gauss et al. went beyond HF while still using analytic derivatives. Jun 15 at 20:21
• The goal is to compute the Hessian of the ground state energy function $E(R)$, for which one needs the second derivative of the Hamiltonian given above. Jun 16 at 0:42
• The geometrical Hessian is available in most electronic structure software packages, especially because of it's use in geometry optimization. OpenMOLCAS can do it. There's a PyMOLCAS that comes with it, and we had extensive discussions last year about transitioning to a more Python-friendly software, but the consensus was not to do it (for various reasons, and you should probably also consider being open to more languages). I've never explicitly asked a program to print me the Hessian, but it's used all the time for geometry opt. Jun 16 at 16:03
• Are you able to elaborate on why you want to calculate the Hessian, rather than just doing the geometry optimization (or whatever you need the Hessian for)? Jun 21 at 23:12

• +1. Pretty much every major electronic structure software will have the Hessian for geometry optimization (OpenMOLCAS and GAMESS were mentioned in the comments), but I suppose the OP would have to go through the code and add print statements to output the elements of the Hessian matrix, since this is not typically printed? Jun 28 at 22:55
• Excellent, I suppose the OP has the answer to their question then! Does PySCF not print out the Hessian without the user having to add more print statements? Jun 29 at 23:23