From c3200ec0fc1f43a3aceca81e7ed7fab041f2df4f Mon Sep 17 00:00:00 2001 From: Caleb Johnson Date: Mon, 7 Oct 2024 15:02:52 -0500 Subject: [PATCH] Fix bugs in orbital optimization affecting open-shell --- qiskit_addon_sqd/fermion.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qiskit_addon_sqd/fermion.py b/qiskit_addon_sqd/fermion.py index 70d2d96..7d48098 100644 --- a/qiskit_addon_sqd/fermion.py +++ b/qiskit_addon_sqd/fermion.py @@ -233,7 +233,7 @@ def optimize_orbitals( # Generate the one and two-body reduced density matrices from latest wavefunction amplitudes dm1, dm2_chem = myci.make_rdm12(amplitudes, num_orbitals, (num_up, num_dn)) dm2 = np.asarray(dm2_chem.transpose(0, 2, 3, 1), order="C") - dm11, dm22 = myci.make_rdm1s(amplitudes, num_orbitals, (num_up, num_dn)) + dm1a, dm2b = myci.make_rdm1s(amplitudes, num_orbitals, (num_up, num_dn)) # TODO: Expose the momentum parameter as an input option # Optimize the basis rotations @@ -241,7 +241,7 @@ def optimize_orbitals( k_flat, learning_rate, 0.9, num_steps_grad, dm1, dm2, hcore, eri_phys ) - return e_qsci, k_flat, [np.diagonal(dm11), np.diagonal(dm22)] + return e_qsci, k_flat, [np.diagonal(dm1a), np.diagonal(dm2b)] def rotate_integrals(