I keep my eyes open for checking psi4 community! ]]>

You have a great blog – keep up the good work!

]]>I will revive my code ASAP. ]]>

Looking at the section of your logfile that deals with orbitals we see the following (some lines removed for clarity):

```
Doubly Occupied:
19A -0.344262 20A -0.252907 21A -0.252901
Virtual:
22A -0.006508 23A -0.006507 24A 0.059658
```

In other words, the HOMO is 21A, and the LUMO is 22A.

If we ask Psi4 for the value of scf_wfn.nalpha() and scf_wfn.nalpha() + 1:

scf_wfn.nalpha()

21L

scf_wfn.nalpha() + 1

22L

So this is correct.

However, if we now ask for the energy with the commands you used:

HOMO = scf_wfn.epsilon_a_subset(‘AO’, ‘ALL’).np[scf_wfn.nalpha()]

LUMO = scf_wfn.epsilon_a_subset(‘AO’, ‘ALL’).np[scf_wfn.nalpha() + 1]

print(HOMO)

-0.006507359007532365

print(LUMO)

-0.006505885540737663

This is incorrect, since this is the value for 22A (LUMO) and 23A.

Running a short python loop to check the values of each:

for x in range(scf_wfn.nalpha() – 5, scf_wfn.nalpha() + 5):

… print (x,scf_wfn.epsilon_a_subset(‘AO’, ‘ALL’).np[x])

…

(16, ‘-0.36536139997427’)

(17, ‘-0.3442637226030818’)

(18, ‘-0.3442627202770589’)

(19, ‘-0.2529058168266043’)

(20, ‘-0.25290025580303666’)

(21, ‘-0.006507359007532365’)

(22, ‘-0.006505885540737663’)

(23, ‘0.059658198769279545’)

(24, ‘0.09945063457011293’)

(25, ‘0.09945379639349274’)

Note that the correct energy for 21 should be -0.252901 (according to the log file) but here it’s 20.

Based upon this, I think there is a bug in the way that Psi4 interfaces with numpy. I note that the numpy/Psi4 interface was changed between versions 1.1 and 1.2.

Converting the Psi4 core.Vector into a numpy array and indexing this:

b = scf_wfn.epsilon_a_subset(‘AO’, ‘ALL’)

np.asarray(b)[21]

‘-0.006507359007532365’

We see that this is what is causing the issue, and I think it’s due to numpy numbering from zero whereas the electrons number from one. In other words the first (zero) element of the array shouldn’t have a value but does:

]]>np.asarray(b)[0]

‘-10.190569457449559’

Thank you for your comments.

Sure, I agree that my calculation is based on roughly optimized geometry and it has still room for improve.

Benzene is very simple structure for organic and medicinal chemist however there are many HOMO – LUMO values are reported… It’s interesting for me.

I would like to ask you why you use following command for HOMO/LUMO calculation.

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() ]

By my understanding, scf_wfn.nalpha() returns number of Returns the number alpha electrons, so highest occupied molecule orbital should be “scf_wfn.epsilon_a_subset(‘AO’, ‘ALL’).np[scf_wfn.nalpha()]”. Or do I need to convert number of electrons to python index?

Any comments and/or advices are appreciated.

Thanks