# problem with loops over basis sets in psi4 using python

I've recently started using the psi4 quantum chemistry software. I wanted to compare a couple of different basis sets (mainly pople style) on an amino acid. So I've written a python code inside the input file to iterate over the different sets.But only the first loop runs and the second fails miserably giving an error code:

PSIO_ERROR: Attempt to write into next entry: 35, SO-basis Overlap Ints
PSIO_ERROR: unit = 35, errval = 18
PSIO_ERROR: 18 (Incorrect block end address)
Traceback (most recent call last):
File "<string>", line 42, in <module>
File "/usr/share/psi/python/driver.py", line 617, in energy
procedures['energy'][lowername](lowername, **kwargs)
File "/usr/share/psi/python/proc.py", line 1231, in run_scf
scf_helper(name, **kwargs)
File "/usr/share/psi/python/proc.py", line 1457, in scf_helper
e_scf = psi4.scf(precallback, postcallback)
RuntimeError: PSIO Error


here is my code:

basis_sets = ["6-31G", "6-31G*", "6-31G**"]
for basis_set in basis_sets:
set basis =  $basis_set energy('scf')  I've tried to run it without the code and there was no problem. I copied the code from the psi4 tutorial page for python scripting Thanks for the help. • I guess this may be borderline off-topic here. However, please provide the complete input file which failed with along with the version and other parameters necessary to reproduce the problem. Have you tried using the original example with Dunning's basis sets? This error looks quite cryptic and I have no experience. Have you tried substituting the alias 6-31G* with the equivalent 6-31G(d)? I can't be sure, but maybe the asterisk is causing some kind of trouble. You can edit in more information, alternatively you might want to consider asking this on a more computational site. – Martin - マーチン Feb 10 '17 at 11:45 • I tried running these basis sets individually without the loop and they worked fine. The other part is just an .xyz file with my molecule nothing special. – Avishai Barnoy Feb 10 '17 at 12:00 • Well, apparently there is something wrong with the loop then. Please provide the information I have asked for. This is already borderline off-topic and as it is not reproducible it basically is of no further use in the future. (Be aware that the community might decide to close this question.) It would also be helpful if you could try what I suggested, as I have a gut feeling that the python bit does not recognise the alias what the global program probably does. – Martin - マーチン Feb 10 '17 at 12:08 • I tried to run the different basis sets under different aliases and it recognizes them. I'll couldn't find the source of the problem, and I guess that for now I'll have to run them manually. – Avishai Barnoy Feb 12 '17 at 9:41 • If it solves your problem, feel free to add an answer. – Martin - マーチン Feb 12 '17 at 9:43 ## 1 Answer Here is an input file that will reproduce this error: molecule { b 0.0000 0.0000 0.0000 h 0.0000 0.0000 1.0000 } basis_sets = ["6-31G", "6-31G*", "6-31G**"] for basis_set in basis_sets: set basis =$basis_set
energy('scf')


The problem is that Psi4 sees there are files remaining in scratch that it can use, starting with the spin orbital-basis overlap integrals, but because the basis set has changed, the file is the wrong size. You'll need to clean these up after the energy call by adding clean() within the loop.

• So just by adding clean() after the energy ('scf') the problem will be solved? – Avishai Barnoy Aug 7 '17 at 16:20
• Yes, try it for yourself – pentavalentcarbon Aug 7 '17 at 16:21