NameError: name 'wfn' is not defined

I am trying to optimize a geometry with CC3/aug-cc-pCVTZ. The following is my input and following that is the error I get:

memory 60 gb

molecule thio {
units bohr
C 0.000000000000 -1.350971354069 2.491402880805
C -0.000000000000 1.350971354069 2.491402880805
C -0.000000000000 2.343317037070 0.097001302258
C 0.000000000000 -2.343317037070 0.097001302258
S 0.000000000000 -0.000000000000 -2.177818675413
H 0.000000000000 -2.497725052804 4.183073862048
H -0.000000000000 2.497725052804 4.183073862048
H 0.000000000000 -4.305471346584 -0.458383225856
H -0.000000000000 4.305471346584 -0.458383225856
symmetry c2v

set {
scf_type df
cc_type df
basis aug-cc-pcVTZ
cholesky_tolerance 1e-9


(I tried removing the symmetry constraint and it still gives the same error)

Dipole Moment: (a.u.)
X: 0.0000 Y: 0.0000 Z: 0.2995 Total: 0.2995

Dipole Moment: (Debye)
X: 0.0000 Y: 0.0000 Z: 0.7612 Total: 0.7612

*** tstop() called on at Thu Jul 26 08:52:49 2018
Module time:
user time = 57.45 seconds = 0.96 minutes
system time = 0.72 seconds = 0.01 minutes
total time = 59 seconds = 0.98 minutes
Total time:
user time = 57.45 seconds = 0.96 minutes
system time = 0.72 seconds = 0.01 minutes
total time = 59 seconds = 0.98 minutes
=> Loading Basis Set <=

Keyword: DF_BASIS_CC
atoms 1-4 entry C          line   270 file /home/dash/psi4conda/share/psi4/basis/def2-qzvpp-ri.gbs
atoms 5   entry S          line  1030 file /home/dash/psi4conda/share/psi4/basis/def2-qzvpp-ri.gbs
atoms 6-9 entry H          line    24 file /home/dash/psi4conda/share/psi4/basis/def2-qzvpp-ri.gbs

Traceback (most recent call last):
File “/home/dash/psi4conda/bin/psi4”, line 260, in
File “”, line 40, in
File “/home/dash/psi4conda/lib//python3.6/site-packages/psi4/driver/”, line 1054, in optimize
G, wfn = gradient(lowername, return_wfn=True, molecule=moleculeclone, **kwargs)
File “/home/dash/psi4conda/lib//python3.6/site-packages/psi4/driver/”, line 697, in gradient
E, wfn = energy(lowername, return_wfn=True, molecule=moleculeclone, **kwargs)
File “/home/dash/psi4conda/lib//python3.6/site-packages/psi4/driver/”, line 460, in energy
wfn = procedures[‘energy’][lowername](lowername, molecule=molecule, **kwargs)
File “/home/dash/psi4conda/lib//python3.6/site-packages/psi4/driver/procrouting/”, line 2323, in run_ccenergy
wfn.set_basisset(“DF_BASIS_CC”, aux_basis)

NameError: name ‘wfn’ is not defined

*** Psi4 encountered an error. Buy a developer more coffee!
*** Resources and help at

What is the fix?

The good news is that dev-side, this looks like an easy bug to fix. On this line of code, change wfn to ref_wfn.

The bad news is that there are no workarounds in the meantime, as long as you set cc_type df.

I recommend waiting until the bug is fixed, then using a version of Psi where the bug is fixed. Depending on the opinion of the core devs, that means either a 1.2 backport or an alpha version of 1.3.

The module for cc3 has no density fitting, or did I miss something?

Remove the anyway not applicable cc_type df and this error is avoided.
Also cholesky_tolerance 1e-9 is never used, since it is only for CD not for DF/RI

Agreed, cc3 has no DF available.

Code fix will go into my next PR.

Feel free to just edit with little pencil and do a quick PR directly on GH, @jmisiewicz, when you see quick fixes like that.