Skip to content

Commit

Permalink
Clean up unused var
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb-johnson committed Jan 29, 2025
1 parent b32de36 commit fa07fec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions docs/how_tos/use_oo_to_optimize_hamiltonian_basis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Subspace dimension: 34969\n",
"Energy of that batch from SQD: -109.10920963467966\n"
"Subspace dimension: 31329\n",
"Energy of that batch from SQD: -109.11240232327665\n"
]
}
],
Expand Down Expand Up @@ -341,7 +341,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"improved_energy in the new basis: -109.11071813054073\n"
"improved_energy in the new basis: -109.11784464303457\n"
]
}
],
Expand Down
6 changes: 2 additions & 4 deletions qiskit_addon_sqd/fermion.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,8 @@ def _optimize_orbitals_sci(
This procedure is described in `Sec. II A 4 <https://arxiv.org/pdf/2405.05068>`_.
"""
prev_update = np.zeros(len(k_flat))
num_orbitals = dm1.shape[0]
for _ in range(num_steps):
grad = _SCISCF_Energy_contract_grad(dm1, dm2, hcore, eri, num_orbitals, k_flat)
grad = _SCISCF_Energy_contract_grad(dm1, dm2, hcore, eri, k_flat)
prev_update = learning_rate * grad + momentum * prev_update
k_flat -= prev_update

Expand All @@ -533,7 +532,6 @@ def _SCISCF_Energy_contract(
dm2: np.ndarray,
hcore: np.ndarray,
eri: np.ndarray,
num_orbitals: int,
k_flat: np.ndarray,
) -> Array:
"""Calculate gradient.
Expand All @@ -551,7 +549,7 @@ def _SCISCF_Energy_contract(
return grad


_SCISCF_Energy_contract_grad = jit(grad(_SCISCF_Energy_contract, argnums=5), static_argnums=4)
_SCISCF_Energy_contract_grad = jit(grad(_SCISCF_Energy_contract, argnums=4))


def _apply_excitation_single(
Expand Down

0 comments on commit fa07fec

Please sign in to comment.