Specifying UHF is ignored in PsiAPI

I tried running the following geometry optimization of an open-shell system:

with open('Benzyl radical MMFF.xyz') as f:
    mol = f.read()

molecule = psi4.geometry(mol)

# Set computation options
psi4.set_options({'basis': '6-31g*',
                  'reference': 'uhf'})

# Optimize Geometry
psi4.optimize('b3lyp', molecule=molecule)

# Save optimized geometry
optimized_geometry = molecule.save_string_xyz_file()

with open('Benzyl radical B3LYP 6-31G(d,p).xyz', 'w') as f:
    f.write(optimized_geometry)

However, somehow it didn’t pick up on using UHF and produced the following error:

Out:

RuntimeError: Fatal Error: RHF: RHF reference is only for singlets. Error occurred in file: [D:\bld\psi4_1689343434894\work\psi4\src\psi4\libscf_solver\rhf.cc](file:///D:/bld/psi4_1689343434894/work/psi4/src/psi4/libscf_solver/rhf.cc) on line: 92

I also tried specifying UHF in the globals like so:

psi4.core.set_global_option('REFERENCE', 'UHF')

But without any luck. Does anyone know where I’m going wrong?

I can’t reproduce this issue.

I tried running the following simplified input file, and it ran successfully:

molecule = psi4.geometry(
"""
1 2
O
H 1 1.0
H 1 1.0 2 104.5""")

psi4.set_options({'basis': '6-31g*',
                  'reference': 'uhf'})

psi4.energy('b3lyp', molecule=molecule)

Try the input file that I just posted. Does it work for you? If so, give me the entire input file, so I can reproduce exactly what you did. This includes any XYZ files. I encourage you to simplify the example before you send it to me, if at all possible. That means using smaller molecules, removing as many lines of code as possible, etc. If not, give me your Psi4 version number. This may be a problem that existed in an older version of Psi, in which case, all you can do is update.