That error message could be a lot clearer, and in 1.3, it will be. (For devs, the error message change is included in Py-Findif.) I’m assuming that @dgasmith changed how Psi interfaces with NumPy between 1.1 and 1.2, and that’s what caused the change.
When you call epsilon_a_subset
, it doesn’t return a NumPy array directly. It returns a Vector object, from Psi’s internals. This can be useful in some more advanced cases, but if you just want a list of the energies for orbitals with alpha spin, here’s what you can do:
HOMO = scf_wfn.epsilon_a_subset("AO", "ALL").np[scf_wfn.nalpha() - 1]
LUMO = scf_wfn.epsilon_a_subset("AO", "ALL").np[scf_wfn.nalpha()]
.np
will let you access the elements of scf_wfn.epsilon_a_subset("AO", "ALL")
just like it was a NumPy array!
EDIT: July 2022
A older version of this post contained an indexing error, present in the original post. It’s now fixed.