Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 30, 2024
1 parent f51d5ae commit 690011f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions doc/source/tutorials/ansatz.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ An example of how to build a UCC doubles circuit ansatz for the :math:`H_2` mole
.. code-block:: python
from qibochem.driver.molecule import Molecule
from qibochem.ansatz.hf_reference import hf_circuit
from qibochem.ansatz.hf_reference import hf_circuit
from qibochem.ansatz.ucc import ucc_circuit
mol = Molecule([("H", (0.0, 0.0, 0.0)), ("H", (0.0, 0.0, 0.74804))])
Expand Down Expand Up @@ -139,7 +139,7 @@ An example of how to build a UCC doubles circuit ansatz for the :math:`H_2` mole
q3: ... ─────o─RX─RX─o────────────o─RX─
UCC with Qubit-Excitation-Based n-tuple Excitation
UCC with Qubit-Excitation-Based n-tuple Excitation
--------------------------------------------------

A CNOT depth-efficient quantum circuit for employing the UCC ansatz, dubbed the Qubit-Excitation-Based (QEB) n-tuple excitations for UCC, was constructed by Yordanov et al. [#f7]_ and Magoulas et al. [#f8]_, avoiding the exponential number of CNOT cascades in those developed before. [#f5]_ The quantum circuits generated have a reduction of CNOTs from :math:`(2n-1)2^{2n}` to :math:`2^{2n-1}+4n-2`.
Expand Down Expand Up @@ -272,4 +272,4 @@ The orthonormal molecular orbitals :math:`\phi` are optimized by a direct minimi
.. [#f8] Yordanov Y. S. et al., 'Efficient Quantum Circuits for Quantum Computational Chemistry', Phys Rev A 102 (2020) 062612.
.. [#f9] Magoulas, I. and Evangelista, F. A., 'CNOT-Efficient Circuits for Arbitrary Rank Many-Body Fermionic and Qubit Excitations', J. Chem. Theory Comput. 19 (2023) 822.
.. [#f9] Magoulas, I. and Evangelista, F. A., 'CNOT-Efficient Circuits for Arbitrary Rank Many-Body Fermionic and Qubit Excitations', J. Chem. Theory Comput. 19 (2023) 822.
2 changes: 1 addition & 1 deletion src/qibochem/ansatz/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from qibochem.ansatz.basis_rotation import basis_rotation_gates
from qibochem.ansatz.hardware_efficient import he_circuit
from qibochem.ansatz.hf_reference import hf_circuit
from qibochem.ansatz.qeb import qeb_circuit
from qibochem.ansatz.ucc import (
generate_excitations,
mp2_amplitude,
sort_excitations,
ucc_ansatz,
ucc_circuit,
)
from qibochem.ansatz.qeb import qeb_circuit

# TODO: Probably can move some of the functions, e.g. generate_excitations/sort_excitations to a new 'util.py'
6 changes: 3 additions & 3 deletions tests/test_ucc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from qibo.hamiltonians import SymbolicHamiltonian

from qibochem.ansatz import hf_circuit
from qibochem.ansatz.qeb import qeb_circuit
from qibochem.ansatz.ucc import (
expi_pauli,
generate_excitations,
Expand All @@ -18,7 +19,6 @@
ucc_ansatz,
ucc_circuit,
)
from qibochem.ansatz.qeb import qeb_circuit
from qibochem.driver import Molecule


Expand Down Expand Up @@ -145,6 +145,7 @@ def test_ucc_circuit(excitation, mapping, basis_rotations, coeffs):
# Check that number of parametrised gates matches
assert len(test_circuit.get_parameters()) == len(basis_rotations)


@pytest.mark.parametrize(
"excitation,mapping,basis_rotations,coeffs",
[
Expand Down Expand Up @@ -183,7 +184,7 @@ def test_qeb_circuit(excitation, mapping, basis_rotations, coeffs):
control_circuit += pauli_term.circuit(-coeff * theta)
control_result = control_circuit(nshots=1)
control_state = control_result.state(True)

test_circuit = qeb_circuit(n_qubits, excitation, theta=theta, trotter_steps=1)
test_result = test_circuit(nshots=1)
test_state = test_result.state(True)
Expand Down Expand Up @@ -231,7 +232,6 @@ def test_ucc_ansatz_h2():
assert np.allclose(mp2_guess_amplitudes, test_parameters)



def test_ucc_ansatz_embedding():
"""Test the default arguments of ucc_ansatz using LiH with HF embedding applied, but without the HF circuit"""
mol = Molecule([("Li", (0.0, 0.0, 0.0)), ("H", (0.0, 0.0, 1.4))])
Expand Down

0 comments on commit 690011f

Please sign in to comment.