We will be merging the wavefunction passing update into the psi4private master today. This is a very large change that modified virtually every file in Psi4, details of the why and what can be found here. The purpose of this forum topic is take all of the “how does this affect me” and “this no longer works” comments.
A quick rundown on what we actually did:
- Energy, gradient, etc now actually return a energy (a number), gradient (a matrix), etc.
- All methods now take the ‘ref_wfn’ and ‘return_wfn’ kwargs. ‘ref_wfn’ means “use this as a reference for correlated methods” and “return_wfn” will return the method’s wavefunction that may contain additional information from the calculation.
- The global molecule is now only touched/modifed by the input file, the user parameter
activate
and by the optimize function. - Fixed numerous bugs/oddities and moved everything towards a more object oriented workflow.
A few notable issues that people may run into:
-
Process::environment.wavefunction no longer exists. This will break any input side
psi4.wavefunction
andpsi4.set_wavefunciton
calls. Please note that the vast majority of calls to methods now return wavefunctions and these object should be explicitly passed around. If an object does not return a wavefunction you will notice a warning pop up. We are still trying to figure what a wavefunction means in certain contexts (e.g., SAPT). -
A consequence of this is we broke all of the plugins! Don’t worry the fix is very simple please change your C++ signature from:
PsiReturnType skeleton(Options& options)
to:
SharedWavefunction skeleton(SharedWavefunction ref_wfn, Options& options)
Every method in Psi4 now takes a Wavefunction and Options objects, this is to make plugins consistent as well. The python-side signature is nowpsi4.plugin('skeleton.so', ref_wfn)
. Options passing has not yet been handled, but thats next up on the list.