Custom optimization routine


I am a new user of psi4.

I want to create a customized simple optimization cycle using the energy(), gradient(), and optking() routines. I am attaching a file with water optimization as example (the steps are copied from the optimize() routine of psi4 obviously). Although I am able to optimize the water molecule, the condition at line 32 seems never satisfy and thus the while loop continues until the end (the function optking() returns number not logical value hence, the condition never satisfy).

So, my question is: is it possible to check the geometry optimization convergence this way?

Thank you in advance. (1.0 KB)

You can either follow the optimize routine (something like if optimization_status == psi4.core.PsiReturnType.EndLoop:) or use the numbers directly. The number should correspond to these:
enum PsiReturnType { Success, Failure, Balk, EndLoop }; (see psi4-dec.h)

You can of course also test convergence yourself using the energy and gradient you compute.

Thank you very much.

That solved the problem.

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