The question I’m going to ask is a bit similar to a previous one of mine : Restarting a SCF with another reference SCF wavefunction
But I think it is still different enough for me to make a new post.
What I would like is to be able to store a wavefunction object from psi4, that could be used anytime for other purposes. For instance, I would like to do a SCF calculation which can take hours, store the scf_wfn object into a file, and then use this file in another script to rebuild the scf_wfn object for post-HF purposes, or to change the MO coefficient of this scf_wfn object only.
For now, I did something like this:
scf_e, scf_wfn = psi4.energy('scf', return_wfn=True) my_file=scf_wfn.get_scratch_filename(180) + '.npy' subprocess.check_call("cp " + my_file + " scf_wfn.npy", shell = True)
And I indeed get a scf_wfn.npy which I tried to extract in another script as:
scf_wfn = numpy.load("scf_wfn.npy",allow_pickle=True)
But it doesn’t seem to work properly as the object is not really the same. For instance, I get such kind of error when playing with MO coefficients:
'numpy.ndarray' object has no attribute 'Ca'
Any idea of what is going wrong and how I can really extract this scf_wfn from a file ?