Repeat energy() with changed core integrals

I would like to

  1. Do a standard SCF.
  2. Get the core Hamiltonian from the wfn object and modify it.
  3. Do a SCF with the modified core Hamiltonian.

Just as an example, I was hoping the following would return a different energy, but it doesn’t. Still, you see where I’m going:

h2 = psi4.geometry("""
0 1
H
H 1 0.78
symmetry c1
“”")
e, wf = psi4.energy(‘scf’, return_wfn=True)
m=np.asarray(wf.H())
m[:,:]*=0.5
psi4.energy(‘scf’)

It seems psi4.energy() computes its integrals anew. Is there any way around that?

Hcore gets re-computed everytime.

Is this like an external potential you’d like to add or a more fundamental change of H?

Yes, an external potential.

Seems external potential solutions exist.

  • Holger has a solution that was discussed before.
  • there is a build-in EXTERN option that seems to be able to read a potential from a grid (ONEPOT_GRID_READ)

Yet, the documentation on ONEPOT_GRID_READ is sparse- it even has a question mark- and I wasn’t able to find an example.

I’d greatly appreciate if anyone could share an example.

  • Establishing the grid (not dense at the nuclei, but away from the nuclei- it’s an external potential).
  • Formatting the “.dx” file.

Maybe the easiest way is to modify the python psi4 driver running the scf:

You would need to convert your numpy matrix to a psi4.Matrix (see example here: Interface to NumPy) and the you can add it like in the linked-line above.
At the start I would avoid symmetry.

You can also do self.H().add(MyPotential).


It may be useful to expose an interface that does not require modifying the python code. At least I don’t think we have one yet.