ffsim.optimize_orbitals¶
- ffsim.optimize_orbitals(rdm, hamiltonian, *, initial_orbital_rotation=None, real=None, method='L-BFGS-B', callback=None, options=None, return_optimize_result=False)[source]¶
Find orbitals that minimize the energy of a pair of one- and two-RDMs.
Uses scipy.optimize.minimize to find an orbital rotation that minimizes the energy of a pair of one- and two-RDMs with respect to a molecualar Hamiltonian.
The minimized energy can be computed from the returned orbital rotation as
rdm.rotated(orbital_rotation).expectation(mol_hamiltonian)
or
rdm.expectation(mol_hamiltonian.rotated(orbital_rotation.T.conj()))
- Parameters:
rdm (
ReducedDensityMatrix) – The reduced density matrices.hamiltonian (
MolecularHamiltonian) – The Hamiltonian.initial_orbital_rotation (
ndarray|None) – An initial guess for the orbital rotation. If not provided, the identity matrix will be used.real (
bool|None) – Whether to restrict the optimization to real-valued orbital rotations. The default behavior is to restrict to real-valued orbital rotations if the reduced density matrices, Hamiltonian, and initial orbital rotation (if one was given) are all real-valued, and to allow complex orbital rotations if any of these are complex-valued.method (
str) – The optimization method. See the documentation of scipy.optimize.minimize for possible values.callback – Callback function for the optimization. See the documentation of scipy.optimize.minimize for usage.
options (
dict|None) – Options for the optimization. See the documentation of scipy.optimize.minimize for usage.return_optimize_result (
bool) – Whether to also return the OptimizeResult returned by scipy.optimize.minimize.
- Return type:
- Returns:
The orbital rotation, which, when applied to the reduced density matrix (or conjugated and applied to the Hamiltonian), minimizes its energy. If
return_optimize_resultis set toTrue, the OptimizeResult returned by scipy.optimize.minimize is also returned.