Energy and Gradient From Gradient Call?

Hi guys,

I’m using the python API for psi4 and interested in both the energy and forces at the same time. I’m using psi4.driver.gradient to obtain the gradient, but this does not return the energy as well. Currently I am just calling energy directly after my gradient call, which causes psi4 to calculate the electronic structure a second time to get the energy (pretty inefficient.) Is there a call in the python API that allows me to get the energy and forces at the same time?

Once you’ve done a gradient computation, you should be able to get the energy from the CURRENT ENERGY variable in either the global space or the wavefunction returned by the gradient call when you pass return_wfn=True to gradient. Let us know if either of those fail.

This worked! thanks so much!

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