Skip to content

Commit

Permalink
add zip loop in lucj_circuit
Browse files Browse the repository at this point in the history
  • Loading branch information
bartandrews committed Nov 8, 2024
1 parent b8f35fb commit 205b3c4
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 11 deletions.
10 changes: 10 additions & 0 deletions python/ffsim/tenpy/circuits/gates.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# (C) Copyright IBM 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

import numpy as np
import scipy as sp
import tenpy.linalg.np_conserved as npc
Expand Down
25 changes: 14 additions & 11 deletions python/ffsim/tenpy/circuits/lucj_circuit.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# (C) Copyright IBM 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

from __future__ import annotations

import numpy as np
Expand Down Expand Up @@ -49,17 +59,10 @@ def lucj_circuit_as_mps(
eng = TEBDEngine(psi, None, options)

# construct the LUCJ MPS
n_reps = np.shape(ucj_op.orbital_rotations)[0]
for i in range(n_reps):
apply_orbital_rotation(
np.conj(ucj_op.orbital_rotations[i]).T, psi, eng, chi_list, norm_tol
)
apply_diag_coulomb_evolution(
ucj_op.diag_coulomb_mats[i], psi, eng, chi_list, norm_tol
)
apply_orbital_rotation(
ucj_op.orbital_rotations[i], psi, eng, chi_list, norm_tol
)
for orb_rot, diag_mats in zip(ucj_op.orbital_rotations, ucj_op.diag_coulomb_mats):
apply_orbital_rotation(np.conj(orb_rot).T, psi, eng, chi_list, norm_tol)
apply_diag_coulomb_evolution(diag_mats, psi, eng, chi_list, norm_tol)
apply_orbital_rotation(orb_rot, psi, eng, chi_list, norm_tol)
if ucj_op.final_orbital_rotation is not None:
apply_orbital_rotation(
ucj_op.final_orbital_rotation, psi, eng, chi_list, norm_tol
Expand Down
10 changes: 10 additions & 0 deletions python/ffsim/tenpy/hamiltonians/lattices.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# (C) Copyright IBM 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

import numpy as np
from tenpy.models.lattice import Lattice

Expand Down
10 changes: 10 additions & 0 deletions python/ffsim/tenpy/hamiltonians/molecular_hamiltonian.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# (C) Copyright IBM 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

from __future__ import annotations

import numpy as np
Expand Down
10 changes: 10 additions & 0 deletions python/ffsim/tenpy/util.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# (C) Copyright IBM 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

from __future__ import annotations

from tenpy.networks.mps import MPS
Expand Down

0 comments on commit 205b3c4

Please sign in to comment.