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 "&lt;string&gt;", line 42, in &lt;module&gt;
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.
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.