Using existing JK object in psi4numpy

Hi all,

I’ve got a python code that first runs a self-consistent DFT energy calculation with a density fitted range-separated hybrid, and then reoptimizes the excited state orbitals. The reoptimization uses a JK object based on the basis set from the original calculation.

I would like to use the JK object from the initial calculation for the later calculations to avoid doubling a large memory object. Despite looking everwhere, and despite being fairly confident it must be available, I could not seem to find out how to do this.

Please help!

tl;dr - I have a DFT wfn and would like to access its existing JK object via python.

All the best,

Tim

Hi,

You should be able to access the JK object from the wavefunction if the save_jk keyword is set to true:

psi4.set_options({'save_jk': True})
e, wfn = psi4.energy('b3lyp/6-31g', return_wfn=True)
jk = wfn.jk()

Thank you! But, unfortunately when I first go to use the jk object I get a “forrtl: severe (174): SIGSEGV, segmentation fault occurred” error. Any idea what is going wrong?

molecule X {
0 1
Be
}

psi4.set_options({'save_jk': True})
e, wfn = psi4.energy('hse06/6-31g', return_wfn=True)
jk = wfn.jk()

C = wfn.Ca_subset("MO", "OCC")
jk.C_left_add(C)
jk.C_right_add(C)
jk.compute() # This seems to be the line that fails
print(jk.J()[0])