Newbie - trying to do MOs and getting errors

I’m trying to run psi4 using WebMO server on a WSL/Windows10. Most calcs work, but not the MOs.

Any help troubleshooting?

*** Psi4 encountered an error. Buy a developer more coffee!
*** Resources and help at github.com/psi4/psi4.
Traceback (most recent call last):
File “/home/crfhradilvp/psi4conda/bin/psi4”, line 287, in
exec(content)
File “”, line 71, in

IndexError: list index out of range

Printing out the relevant lines from the Psithon --> Python processed input file:
end = (i+1)*6
lin = “%12s” % (’ ')
for j in range(start,end): lin+= “%10d” % (j+1)
print_out(lin+newline)
lin = " "
–> for num in range(start,end): lin+= “%10.3f” % (float(evals[num]))
print_out("Eigenvalues: “+lin+newline)
for j in range(len(coeffs)):
lin = “%3d %5s” % (j+1,ao_labels[j].split()[0])
lin += “%5s” % (” ".join(ao_labels[j].split()[1:]))
for num in range(start,end): lin+= “%10.5f” % (float(coeffs[j][num]))

Can you post a copy of the input file? Based on the error message, it looks like in the line for num in range(start,end): lin+= “%10.3f” % (float(evals[num])), you’re trying to access a non-existent element of a list. evals[num] probably doesn’t exist for some value of num, but I need to know where these variables come from to be more specific. Hence the input file.

memory 1024 mb
import numpy as np
import psi4
import math
molecule mol {
0 1
O 0.00000000 0.00000000 0.00000000
H 0.00000000 -0.75808100 -0.63582100
H 0.00000000 0.75808100 -0.63582100
}
set scf_type df
set basis STO-3G
set reference rhf
set MOLDEN_WRITE true
set WRITER_FILE_LABEL output
set print_mos true
e, wfn = energy('scf', return_wfn=True)
newline = """
"""
print_out("Molecular Orbitals with AO's Listed"+newline)
# Use Andy's handy little AO name helper function
ao_labels = []
for s in range(wfn.basisset().nshell()):
shell = wfn.basisset().shell(s)
center = str(shell.ncenter+1)
am = [shell.am](http://shell.am)
    amchar = shell.amchar
basename = '{'+wfn.molecule().symbol(shell.ncenter)+center+'} '+amchar
if amchar == 'd' and wfn.basisset().has_puream() == True:
for i in range(1,6): ao_labels.append(basename+' '+str(i))
continue
for j in range(0,am+1):
lx = am - j
for lz in range(0, j + 1):
ly = j - lz
ao_labels.append(basename+'x'*lx+'y'*ly+'z'*lz)
evals = list(np.array(wfn.epsilon_a_subset("AO", "OCC")).astype(str))
coeffs = list(np.array(wfn.Ca_subset("AO", "OCC")).astype(str))
length = int(math.ceil(len(evals)/6))
rem = len(evals)%6
start = 0
end = 0
for i in range(length+1):
if rem == 0 and i == length: break
if rem != 0 and i == length:
start = end
end = start + rem
else:
start = i*6
end = (i+1)*6
lin = "%12s" % (' ')
for j in range(start,end): lin+= "%10d" % (j+1)
print_out(lin+newline)
lin = " "
for num in range(start,end): lin+= "%10.3f" % (float(evals[num]))
print_out("Eigenvalues: "+lin+newline)
for j in range(len(coeffs)):
lin = "%3d %5s" % (j+1,ao_labels[j].split()[0])
lin += "%5s" % (" ".join(ao_labels[j].split()[1:]))
for num in range(start,end): lin+= "%10.5f" % (float(coeffs[j][num]))
print_out(lin+newline)
print_out(newline)
oeprop(wfn, "MULLIKEN_CHARGES")
mol.print_out()
print_variables()

I need the version of the input file with the whitespace intact. When you’re working with Python code, whitespace is important. Also, it’s helpful to enclose code in triple backticks (looks like ```). Then the forum won’t interfere with the formatting.

Looking at the input file, I suspect you got this input file from somewhere else. If you don’t mind me asking, where? In addition to whatever is necessary to fix this bug, I’m probably going to recommend some other changes, and those should go to the source.

Thanks. I thought I mentioned that I’m using WebMO Pro as my front end. v18.1 (build 002)

So WebMO is generating this file? I’m definitely confused about the weblink in the input file. @ashley, have you run MOs of late? Otherwise we’ll have to send to Prof. Schmidt.

What version of WebMO and what version of Psi4 are you using? If you just upgraded to the HTML5 version of WebMO (version 18+) with the newest version of Psi4 (version 1.2+), there was a known problem with the MO parsing there. We have a new version of the parsing script that just came out (as of April 26, 2019) that should fix the problems. If you replace your webmo/public_html/cgi-bin/parse_psi.cgi file with this new one, it should fix all the known parsing problems. (I can’t post the .cgi file here because the forum doesn’t allow it, but if you e-mail me I can send it to you.)

Go to https://github.com/psi4/psi4webmo/tree/master/cgi-bin and download the parse_psi.cgi script. Replace the file in ~webmo/public_html/cgi-bin/parse_psi.cgi with this new one and hopefully that should fix your problems.

Nope - that didn’t do it. Looks the same.

Be sure to restart the server or daemon or whatever controls WebMO. This caught us a couple weeks ago.

Update - I reinstalled everything from scratch to make sure that I didn’t muck anything up. I also install gamess on my WSL to make sure that this was peculiar to running WebMO on a WSL. Gamess works fine making MOs.

Another thing I noticed, but I’m not sure if it matters, when I ran PSI4 to get vibrational frequencies all of the intensities are reported as 1. Is this a parsing error or does PSI4 not estimate intensities?

input.inp

memory 1024 mb

molecule mol {
0 1
O 0.00000000 0.00000000 0.00000000
H -0.91097400 -0.23977800 -0.00000000
H 0.01211098 0.94192380 -0.00000000

}

set scf_type df
set basis STO-3G
set reference rhf


mol.update_geometry()
mol.symmetrize(1e-3)

e, wfn = optimize('scf', return_wfn=True)
e, wfn = frequencies('scf', return_wfn=True)
oeprop(wfn, "MULLIKEN_CHARGES")
mol.print_out()
print_variables()

Psi does do IR intensities but only for restricted Hartree–Fock. It’s pretty new, and I don’t know if WebMO does that optional parsing.

If you get a chance, could you post the MO input file with spacing intact? I can at least see if it runs ok command-line. If that’s ok and it’s not the problem that Ashley knew of, we’ll have to send to the WebMO folks.

Another update:

Thank you Ashley for pointing to the psi4webmo git repo. I actually downloaded and installed all the latest from there and I’m not getting any errors!

However, I’m also not getting any MO visualization. The MO’s are reported correctly in WebMO, but they aren’t painted when I click on the magnifying glass.

Here’s the input.inp:

memory 1024 mb

molecule mol {
0 1
O 0.00000000 0.00000000 0.00000000
H -0.75808100 -0.00000000 0.63582100
H 0.75808100 0.00000000 0.63582100

}

set scf_type df
set basis STO-3G
set reference rhf
set MOLDEN_WRITE true
set WRITER_FILE_LABEL output
set print_mos true

e, wfn = energy('scf', return_wfn=True)

molden(wfn, 'output.molden')
oeprop(wfn, "MULLIKEN_CHARGES")
mol.print_out()
print_variables()

Here’s an input.inp file for vibrational analysis

memory 1024 mb

molecule mol {
0 1
O 0.00000000 0.00000000 0.00000000
H -0.75808100 -0.00000000 0.63582100
H 0.75808100 0.00000000 0.63582100

}

set scf_type df
set basis STO-3G
set reference rhf


mol.update_geometry()
mol.symmetrize(1e-3)

e, wfn = optimize('scf', return_wfn=True)
e, wfn = frequencies('scf', dertype = 1, return_wfn=True)
oeprop(wfn, "MULLIKEN_CHARGES")
mol.print_out()
print_variables()

The output block looks like this

==> Harmonic Vibrational Analysis <==

  non-mass-weighted Hessian:       Symmetric? True   Hermitian? True   Lin Dep Dim?  6 (0)
  projection of translations (True) and rotations (True) removed 6 degrees of freedom (6)
  total projector:                 Symmetric? True   Hermitian? True   Lin Dep Dim?  6 (6)
  mass-weighted Hessian:           Symmetric? True   Hermitian? True   Lin Dep Dim?  6 (0)
  pre-proj  low-frequency mode:    0.0000i [cm^-1]
  pre-proj  low-frequency mode:    0.0000i [cm^-1]
  pre-proj  low-frequency mode:    0.0000  [cm^-1]
  pre-proj  low-frequency mode:    0.0000  [cm^-1]
  pre-proj  low-frequency mode:    0.0000  [cm^-1]
  pre-proj  low-frequency mode:    0.0000  [cm^-1]
  pre-proj  all modes:['0.0000i' '0.0000i' '0.0000' '0.0000' '0.0000' '0.0000' '2170.2659'
 '4139.8013' '4390.8571']
  projected mass-weighted Hessian: Symmetric? True   Hermitian? True   Lin Dep Dim?  6 (6)
  post-proj low-frequency mode:    0.0001i [cm^-1] (TR)
  post-proj low-frequency mode:    0.0000i [cm^-1] (TR)
  post-proj low-frequency mode:    0.0000i [cm^-1] (TR)
  post-proj low-frequency mode:    0.0000  [cm^-1] (TR)
  post-proj low-frequency mode:    0.0000  [cm^-1] (TR)
  post-proj low-frequency mode:    0.0000  [cm^-1] (TR)
  post-proj  all modes:['0.0001i' '0.0000i' '0.0000i' '0.0000' '0.0000' '0.0000' '2170.2659'
 '4139.8013' '4390.8571']

  Vibration                       7                   8                   9           
  Freq [cm^-1]                2170.2659           4139.8013           4390.8571       
  Irrep                           A1                  A1                  B1          
  Reduced mass [u]              1.0785              1.0491              1.0774        
  Force const [mDyne/A]         2.9929             10.5931             12.2380        
  Turning point v=0 [a0]        0.2268              0.1665              0.1595        
  RMS dev v=0 [a0 u^1/2]        0.1665              0.1206              0.1171        
  Char temp [K]               3122.5294           5956.2524           6317.4657       
  ----------------------------------------------------------------------------------
      1   O               -0.00  0.00 -0.07   -0.00  0.00  0.05   -0.07  0.00 -0.00   
      2   H                0.45  0.00  0.54    0.57  0.00 -0.42    0.54  0.00 -0.45   
      3   H               -0.45 -0.00  0.54   -0.57 -0.00 -0.42    0.54 -0.00  0.45   
  • On the IR topic, WebMO inserts the dertype=1 into the input that forces finite difference (to be fair, analytic Hessians are the exception, not the rule, in psi). If you remove that arg in the input, you get intensities:

  Vibration                       7                   8                   9
  Freq [cm^-1]                2170.2904           4139.7924           4390.8193
  Irrep                           A1                  A1                  B1
  Reduced mass [u]              1.0785              1.0491              1.0774
  Force const [mDyne/A]         2.9930             10.5931             12.2378
  Turning point v=0 [a0]        0.2268              0.1665              0.1595
  RMS dev v=0 [a0 u^1/2]        0.1665              0.1206              0.1171
  IR activ [km/mol]             7.2271             44.3434             30.0552
  Char temp [K]               3122.5646           5956.2395           6317.4114
  ----------------------------------------------------------------------------------
      1   O               -0.00  0.00 -0.07    0.00  0.00  0.05   -0.07 -0.00  0.00
      2   H                0.45  0.00  0.54    0.57  0.00 -0.42    0.54  0.00 -0.45
      3   H               -0.45 -0.00  0.54   -0.57 -0.00 -0.42    0.54 -0.00  0.45

  • I’m glad the cgi from psi4webmo worked, but I’m suspicious of the word “update”. That psi4/psi4webmo repo is only a means of exchanging code between psi4 devs and the webmo folks. The definitive webmo code is under a different location under a different version control system, and they only get synced up when someone has an interest, so some of those files are many years old. You may want to get a fresh installation and replace only the file Ashley mentioned.

  • MO coeffs are showing up (a) in the output file, (b) in some table WebMO parses from the output, © on the screen? I gather at least (a) is yes and © is no. Knowing (b) would be a good clue as to whether viz or parsing is amiss. Since at least (a) works and the job finishes correctly, may need to post a link to this thread in webmo forum for Prof. Schmidt to see.

Thank you for the response

  • The IR fix worked, but WebMO is not parsing the information correctly.
  • At first I downloaded the lastest WebMO Pro version that I have a license for (18.1.002p). Perhaps those script changes aren’t in the download? I see what you mean about the dates - most are 2,3 or 5 years
  • WebMO shows orbitals, occupancy, energies - but not visualization.
    (from the Li atomic radius lab at psi4education) I get:
  ==> Alpha-Spin Molecular Orbitals <==

                            1            2            3            4            5

 1    LI1 s0        0.9925300    0.2768048    0.0000000    0.0000000    0.0000000
 2    LI1 s0        0.0293013   -1.0299894    0.0000000    0.0000000    0.0000000
 3    LI1 p0        0.0000000    0.0000000    0.0000000    1.0000000    0.0000000
 4    LI1 p+1       0.0000000    0.0000000    0.0000000    0.0000000    1.0000000
 5    LI1 p-1       0.0000000    0.0000000    1.0000000    0.0000000    0.0000000

            Ene    -2.3692423   -0.1801264    0.1301306    0.1301306    0.1301306
            Sym            Ag           Ag          B2u          B1u          B3u
            Occ             1            1            0            0            0



  ==> Beta-Spin Molecular Orbitals <==

                            1            2            3            4            5

 1    LI1 s0        0.9912203    0.2814589    0.0000000    0.0000000    0.0000000
 2    LI1 s0        0.0341338   -1.0298406    0.0000000    0.0000000    0.0000000
 3    LI1 p0        0.0000000    0.0000000    0.0000000    1.0000000    0.0000000
 4    LI1 p+1       0.0000000    0.0000000    0.0000000    0.0000000    1.0000000
 5    LI1 p-1       0.0000000    0.0000000    1.0000000    0.0000000    0.0000000

            Ene    -2.3379370    0.1022490    0.1909202    0.1909202    0.1909202
            Sym            Ag           Ag          B2u          B1u          B3u
            Occ             1            0            0            0            0

You’re right, I’m convinced now that these all seem to be WebMO parsing issues, so I will take your advice and post in the webmo forum.

Thank you so much for your help!

You’re welcome. Thanks for trying out Psi4!

I don’t know how the MOs are communicated between Psi and WebMO, be it printing, or Molden, NBO, or fchk files. We have had changes in our code of late to make the files more regulation. This comes to mind for Molden files and there are others. If you’ll post the link to the webmo thread here, I’ll try to follow along and chip in.

Here’s a link to the webmo forum thread that I just created:
https://www.webmo.net/discus/support/messages/5/1007.html?1557942296
Thanks.