Skip to content

Commit

Permalink
rename to op_periodic_edge
Browse files Browse the repository at this point in the history
  • Loading branch information
bartandrews committed Apr 24, 2024
1 parent ed5993c commit d3b66cf
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tests/python/operators/fermi_hubbard_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ def test_non_interacting_fermi_hubbard_1d_eigenvalue():
np.testing.assert_allclose(eigs_periodic[0], -4.000000000000)

# periodic boundary conditions (edge case)
op_periodic = fermi_hubbard_1d(norb=2, tunneling=1, interaction=0, periodic=True)
ham_periodic = ffsim.linear_operator(op_periodic, norb=2, nelec=(1, 1))
op_periodic_edge = fermi_hubbard_1d(
norb=2, tunneling=1, interaction=0, periodic=True
)
ham_periodic = ffsim.linear_operator(op_periodic_edge, norb=2, nelec=(1, 1))
eigs_periodic, _ = scipy.sparse.linalg.eigsh(ham_periodic, which="SA", k=1)
np.testing.assert_allclose(eigs_periodic[0], -4.000000000000)

Expand All @@ -206,8 +208,10 @@ def test_fermi_hubbard_1d_with_interaction_eigenvalue():
np.testing.assert_allclose(eigs_periodic[0], -2.828427124746)

# periodic boundary conditions (edge case)
op_periodic = fermi_hubbard_1d(norb=2, tunneling=1, interaction=2, periodic=True)
ham_periodic = ffsim.linear_operator(op_periodic, norb=2, nelec=(1, 1))
op_periodic_edge = fermi_hubbard_1d(
norb=2, tunneling=1, interaction=2, periodic=True
)
ham_periodic = ffsim.linear_operator(op_periodic_edge, norb=2, nelec=(1, 1))
eigs_periodic, _ = scipy.sparse.linalg.eigsh(ham_periodic, which="SA", k=1)
np.testing.assert_allclose(eigs_periodic[0], -3.123105625618)

Expand All @@ -231,10 +235,10 @@ def test_fermi_hubbard_1d_with_chemical_potential_eigenvalue():
np.testing.assert_allclose(eigs_periodic[0], -14.828427124746)

# periodic boundary conditions (edge case)
op_periodic = fermi_hubbard_1d(
op_periodic_edge = fermi_hubbard_1d(
norb=2, tunneling=1, interaction=2, chemical_potential=3, periodic=True
)
ham_periodic = ffsim.linear_operator(op_periodic, norb=2, nelec=(1, 1))
ham_periodic = ffsim.linear_operator(op_periodic_edge, norb=2, nelec=(1, 1))
eigs_periodic, _ = scipy.sparse.linalg.eigsh(ham_periodic, which="SA", k=1)
np.testing.assert_allclose(eigs_periodic[0], -9.123105625618)

Expand Down Expand Up @@ -270,15 +274,15 @@ def test_fermi_hubbard_1d_with_nearest_neighbor_interaction_eigenvalue():
np.testing.assert_allclose(eigs_periodic[0], -8.781962448006)

# periodic boundary conditions (edge case)
op_periodic = fermi_hubbard_1d(
op_periodic_edge = fermi_hubbard_1d(
norb=2,
tunneling=1,
interaction=2,
chemical_potential=3,
nearest_neighbor_interaction=4,
periodic=True,
)
ham_periodic = ffsim.linear_operator(op_periodic, norb=2, nelec=(1, 1))
ham_periodic = ffsim.linear_operator(op_periodic_edge, norb=2, nelec=(1, 1))
eigs_periodic, _ = scipy.sparse.linalg.eigsh(ham_periodic, which="SA", k=1)
np.testing.assert_allclose(eigs_periodic[0], -6.000000000000)

Expand Down

0 comments on commit d3b66cf

Please sign in to comment.