Skip to content

Commit

Permalink
Fix test failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
fdmalone committed Jun 26, 2024
1 parent 1aad9b4 commit 0f297fb
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions recirq/qcqmc/optimize_wf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,16 @@
import scipy.optimize
import scipy.sparse

from recirq.qcqmc import (afqmc_circuits, afqmc_generators, converters, data,
fermion_mode, hamiltonian, layer_spec, trial_wf)
from recirq.qcqmc import (
afqmc_circuits,
afqmc_generators,
converters,
data,
fermion_mode,
hamiltonian,
layer_spec,
trial_wf,
)


def get_and_check_energy(
Expand Down Expand Up @@ -499,6 +507,7 @@ def evaluate_energy_and_gradient(

return cost_val, np.concatenate((two_body_grad, one_body_grad))


def compute_finite_difference_grad(
n_orb: int,
n_elec: int,
Expand All @@ -520,7 +529,7 @@ def compute_finite_difference_grad(
initial_wf: The initial wavefunction (typically Hartree--Fock)
restricted: Whether we're using a restricted ansatz or not.
"""
generators = get_pp_plus_gate_generators(
generators = afqmc_generators.get_pp_plus_gate_generators(
n_elec=n_elec, heuristic_layers=tuple(), do_pp=True
)
one_body_gradient = np.zeros_like(one_body_params)
Expand Down Expand Up @@ -574,7 +583,6 @@ def compute_finite_difference_grad(
return one_body_gradient, two_body_gradient



def objective(
params: np.ndarray,
n_one_body_params: int,
Expand Down

0 comments on commit 0f297fb

Please sign in to comment.