How can I change max iteration in energy method?


Hi, I’m a newbie in Psi4, and I’m having trouble writing a psi4-python code.

My script said “Fatal Error: Iterations did not converge.”, so I wanted to change max iteration and add maxiter option in the energy method.

scf_energy, wfn ="scf/6-31g**", return_wfn=return_wfn, maxiter=500)

But it doesn’t work well.

Please tell me if you have any advice.

Thank you,


Instead of supplying maxiter as an argument to the energy function, treat it as an option. Just include one of the following lines before your energy call:

set maxiter 500 to apply to all methods, or
set scf maxiter 500 to apply to just scf.

Might I ask for the coordinates of this troublesome molecule? Improving our SCF code is high on the developer to-do list, and we’d appreciate any examples of molecules we can use to test the SCF changes.


Thank you for your advice, and as you mentioned the coordinates of the molecule cause trouble. I want to calculate torsion energy of the molecule gaining dihedral angle in 10 degrees from 0 to 360.

I use my own library psikit(, and this is my whole code

from rdkit import Chem
from rdkit.Chem import rdMolTransforms
from psikit import Psikit

pk = Psikit()

conformer = pk.mol.GetConformer(0)

for dihedral_degree in range(0, 360, 10):
    rdMolTransforms.SetDihedralDeg(conformer, 0, 1, 2, 3, dihedral_degree) # C-N-S-O dihedral angle
    print(dihedral_degree,"scf/sto-3g", maxiter=500))

and this is the coordinates of the molecule.

C 4.1849348070947405 -1.7924348429601273 -1.3799272940965122
N 2.84385380774969 0.6704251410262807 -1.2943204629125742
S 0.04279646300828439 0.6222406801042148 0.4580332088292887
O -1.3526430954985227 3.7220850053069308 -0.13212277347509963
O 0.84730520881222 -1.064849617058772 3.346549936962613
C -1.9808929419126597 -1.5621970383882722 -1.317891473501073
C -4.69892399334976 -1.4094671557700051 -0.30289755933589646
H 3.239892498121687 -3.207206103234504 -2.5491088281086873
H 6.0695509123425 -1.463660901576179 -2.139476640284267
H 4.349485483910852 -2.50938090852209 0.5426187252955574
H 2.417734051237826 1.2940252363261038 -3.096551475837313
H -1.225227863560315 -3.4615053542407934 -1.1053693679927319
H -1.910129694750547 -1.0224499650561665 -3.3013290044687893
H -4.7670500895862675 -1.996162869540755 1.6629212744325275
H -5.912865977583351 -2.648060642810516 -1.4006534937099253
H -5.406344934503997 0.5124787385120418 -0.4461539329691137
units angstrom

Thank you,


Are you sure that your units are correct? Your coordinates seem to be in bohr, not angstroms.


Thank you for your correction, that is my mistake.


Since your question seems answered, I marked one of my previous posts as solving the issue. Let me know if you’re still having problems, and I should be able to unmark it.


Thank you for your suggestion, now my code works well.
This is my jupyter notebook,


closed #8

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.