Hello, I try to make automated script for geometry optimization.
And I found that if some calculation is not converged and reach the geom_maxiter, then following calculation is ‘continued’ from failed calculation.
And ‘continued’ calculation is also fail to optimize structure.
Here is the sample code of my problem.
import psi4
import sys
with open(sys.argv[1]) as fil:
xyz = fil.read()
for i in range(3):
psi4.set_memory('4 GB')
psi4.core.set_num_threads(16)
psi4.set_options({
'basis': '6-31gs',
'geom_maxiter': 2,
})
mymol = psi4.core.Molecule.from_string(xyz, dtype='xyz')
psi4.core.set_output_file(f'res_{i+1}.dat', False)
try:
psi4.optimize('b3lyp', molecule=mymol)
except:
pass
mymol.save_xyz_file(f'res_{i+1}.xyz', False)
psi4.core.clean()
psi4.core.clean_variables()
psi4.core.clean_options()
psi4.core.clean_timers()
psi4.core.opt_clean()
Then, the result of res_2.dat and res_3.dat is like below
# res_2.dat
# $ grep 'Convergence Criteria' res_2.dat -A 2 --no-group-separator | awk 'NR % 3 ==0'
3 -1560.20297072 3.21e-02 4.03e-02 6.96e-03 o 1.65e-01 2.97e-02 o ~
4 -1560.23588741 -3.29e-02 1.09e-02 2.14e-03 o 2.06e-01 3.70e-02 o ~
# res_3.dat
# $ grep 'Convergence Criteria' res_3.dat -A 2 --no-group-separator | awk 'NR % 3 ==0'
5 -1560.20297072 3.29e-02 4.03e-02 6.96e-03 o 1.64e-01 2.97e-02 o ~
6 -1560.23600632 -3.30e-02 1.08e-02 2.11e-03 o 1.96e-01 3.66e-02 o ~
I’'ve tested clean functions like the sample code above but nothing is work.
Since the optimize function in psi4 sometimes fail to find optimized structure, this problem is critical for automated script.
Does anyone have a solution for this problem?