Trouble running OpenFermion-Psi4 script

I’m trying to run this notebook. I have the development versions of OpenFermion and OpenFermion-Psi4 installed, along with the release version of Psi4. When I run it I get the following error:

Traceback (most recent call last):
  File "/home/al/opt/anaconda3/envs/ece590/bin/psi4", line 287, in <module>
    exec(content)
  File "<string>", line 80, in <module>

NameError: name 'hf_energy' is not defined

Printing out the relevant lines from the Psithon --> Python processed input file:
                print('WARNING: SCF calculation failed.')
            else:
                raise
        finally:
           
-->         molecule.hf_energy = hf_energy
            molecule.nuclear_repulsion = mol.nuclear_repulsion_energy()
            molecule.canonical_orbitals = numpy.asarray(hf_wavefunction.Ca())
            molecule.overlap_integrals = numpy.asarray(hf_wavefunction.S())
            molecule.n_orbitals = molecule.canonical_orbitals.shape[0]
            molecule.n_qubits = 2 * molecule.n_orbitals

/home/al/opt/OpenFermion-Psi4/openfermionpsi4/_run_psi4.py:226: Warning: No calculation saved. Psi4 segmentation fault possible.
  Warning)

Is there any further output suggesting why (or if) the psi4 calculation failed?

The output looks like openfermion code I am not familiar with.

After quickly looking at the OpenFermion code, hokru is right. There isn’t enough information here to say whether this is a Psi4 error or an OpenFermion-Psi4 error. Give us the .out file. If you suspect a Psi4 error, always give us a Psi4 output file.

Until then, all I can say is that the molecule object never has an hf_energy attribute set, which may be due to molecule.load() in _run_psi4.py::run_psi4 failing for reasons unknown, or maybe some other reason.

This is the totality of the output from the script: https://pastebin.com/jC2FLhN1
There are no output files created in the directory where I run the script. Could someone try to see if they are able to run the script by installing OpenFermion and OpenFermion-Psi4? If not I think I’ll create a github issue in OpenFermion-Psi4. (Sorry I can’t post a link to OpenFermion’s github, the forum rules only allow me 2 links since I’m a new user.)

I found the problem, I modified the script in an attempt to do different elements and didn’t modify the multiplicity correctly.

I’m glad the issue was solved.

That said, always check your custom modifications before reporting an error.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.