FermiQC / Fermi.jl

Fermi quantum chemistry program
MIT License
134 stars 24 forks source link

One- and two-body integrals from Hartree-Fock #116

Closed mtfishman closed 2 years ago

mtfishman commented 2 years ago

Hi @gustavojra,

Thanks for the nice package!

Is there a simple way to obtain the coefficients of the second quantized Hamiltonian (the one- and two-body integrals) from a Hartree-Fock solution?

Thanks, Matt

gustavojra commented 2 years ago

Hi @mtfishman,

The computation returns the orbital coefficients C. There should be a simple formula relating these coefficients to the elements of this matrix. I just don't remember off the top of my head. My guess is that you are simply looking for the density matrix:

Dμν = Cμi Ciν

If your second quantized Hamiltonian looks like

H = hμν + gμνρσ

then contracting D in there should return the HF energy

Ehf = Dμν*hμν + Dμν*Dρσ*gμνρσ

Just watch out for changes due to spin integration.

If that's so, all you need is to slice the occupied orbitals (Co) and multiply by the transpose of itself (Co')

wfn = @energy rhf
C = wfn.orbitals.C
ndocc = wfn.molecule.Nα
Co = C[:, 1:ndocc]
D = Co * Co'