wfn.form_H() errors

Dear Developers,

I was running two simple calculations of He and H2 and got two wave functions (wfn & wfn1). After that, I used wfn.form_H() and wfn1.form_H(). But this will change the wfn1.H().np which does make sense to me. Is there any thing I accidentally ignored? Thank you.

import psi4

mol1 = psi4.geometry("""
He
symmetry c1
“”")

mol2 = psi4.geometry("""
H
H 1 0.7
symmetry c1
“”")

base_wfn1 = psi4.core.Wavefunction.build(mol2, “cc-pVDZ”)
wfn1 = psi4.driver.proc.scf_wavefunction_factory(“SVWN”, base_wfn1, “UKS”)
wfn1.initialize()
wfn1.iterations()
base_wfn = psi4.core.Wavefunction.build(mol1, “cc-pVDZ”)
wfn = psi4.driver.proc.scf_wavefunction_factory(“SVWN”, base_wfn, “UKS”)
wfn.initialize()
wfn.iterations()

print(“wfn_H\n”, wfn.H().np[:])
wfn.form_H()
print(“wfn_H\n”,wfn.H().np[:])
print(“wfn1_H\n”,wfn1.H().np[:])
wfn1.form_H()
print(“wfn1_H\n”,wfn1.H().np[:])

And if you switch the order of mol1 and mol2 in the psi4.core.Wavefunction.build, it will give an error.
PSIO_ERROR: Attempt to write into next entry: 35, SO-basis Overlap Ints
PSIO_ERROR: unit = 35, errval = 18
PSIO_ERROR: 18 (Incorrect block end address)

RuntimeError:
Fatal Error: PSIO Error
Error occurred in file: /scratch/psilocaluser/conda-builds/psi4-multiout_1551855686116/work/psi4/src/psi4/libpsio/error.cc on line: 128
The most recent 5 function calls were:
psi::PSIO::write(unsigned long, char const*, char*, unsigned long, psi::psio_address, psi::psio_address*)
psi::PSIO::write_entry(unsigned long, char const*, char*, unsigned long)

The wfns shared the same namespace for some intermediates, e.g. overlap integrals, and one needs to run psi4.core.clean() to remove those. This causes the IO error you see. I assume since the overlap is lying around your command to form a new core Matrix reads the wrong overlap.

I am far from being an expert, but I assume you will need to do the form_H() calculations separately. Or change the namespace of at least the .35 file.