qc2.ansatz.qiskit ================= .. py:module:: qc2.ansatz.qiskit Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/qc2/ansatz/qiskit/gate_fabric/index /autoapi/qc2/ansatz/qiskit/lucj/index Classes ------- .. autoapisummary:: qc2.ansatz.qiskit.LUCJ qc2.ansatz.qiskit.GateFabric Package Contents ---------------- .. py:class:: LUCJ(mol: pyscf.gto.Mole, active_space: Iterable | None = None, n_reps: int = 2, initial_state: Optional[qiskit.circuit.QuantumCircuit] = None, name: str | None = 'LUCJ') Bases: :py:obj:`qiskit.circuit.library.blueprintcircuit.BlueprintCircuit` LUCJ ansatz using Unitary Coupled-Cluster with Jastrow factor. .. py:attribute:: mol .. py:attribute:: active_space :value: None .. py:attribute:: _num_spatial_orbitals .. py:attribute:: _num_particles .. py:attribute:: _num_qubits .. py:attribute:: n_reps :value: 2 .. py:attribute:: ccsd :value: None .. py:property:: num_qubits :type: int The number of qubits. .. py:property:: num_spatial_orbitals :type: int The number of spatial orbitals. .. py:property:: num_particles :type: tuple[int, int] The number of particles. .. py:method:: _run_scf() Runs a self-consistent field calculation. .. py:method:: _set_initial_state(initial_state: qiskit.circuit.QuantumCircuit | None) -> None Sets the initial state circuit for the LUCJ ansatz. :param initial_state: Initial state circuit (Hartree-Fock if None) .. py:method:: _check_configuration(raise_on_failure: bool = True) -> bool Check if the configuration of the NLocal class is valid. :param raise_on_failure: Whether to raise on failure. :returns: True, if the configuration is valid and the circuit can be constructed. Otherwise an ValueError is raised. :raises ValueError: If the numbr fo qubit is not set. :raises ValueError: If the number of spatial orbitals is lower than the number of particles .. py:method:: _build() .. py:method:: get_operator() -> ffsim.UCJOpSpinBalanced " Returns the LUCJ operator. .. py:method:: get_state(initial_state: numpy.ndarray | None = None) -> numpy.ndarray Constructs and returns the LUCJ ansatz state. .. py:class:: GateFabric(num_spatial_orbitals: int, num_particles: tuple, qubit_mapper: qiskit_nature.second_q.mappers.QubitMapper, initial_state: Optional[qiskit.circuit.QuantumCircuit] = None, num_layers: int = 1, include_pi: bool = False, name: str | None = 'GateFabric') Bases: :py:obj:`qiskit.circuit.library.blueprintcircuit.BlueprintCircuit` Gate Fabric ansatz implementation for Qiskit. .. py:attribute:: _num_qubits .. py:attribute:: _num_spatial_orbitals .. py:attribute:: _num_particles .. py:attribute:: _qubit_mapper .. py:attribute:: _num_layers :value: 1 .. py:attribute:: _include_pi :value: False .. py:attribute:: _initial_state .. py:property:: qubit_mapper :type: qiskit_nature.second_q.mappers.QubitMapper | None The qubit operator mapper. .. py:property:: num_qubits :type: int The number of qubits. .. py:property:: num_spatial_orbitals :type: int The number of spatial orbitals. .. py:property:: num_particles :type: tuple[int, int] The number of particles. .. py:method:: _check_configuration(raise_on_failure: bool = True) -> bool Check if the configuration of the NLocal class is valid. :param raise_on_failure: Whether to raise on failure. :returns: True, if the configuration is valid and the circuit can be constructed. Otherwise an ValueError is raised. :raises ValueError: If the numbr fo qubit is not set. :raises ValueError: If the number of spatial orbitals is lower than the number of particles .. py:method:: _build() -> None Builds the Gate Fabric circuit .. py:method:: _gate_fabric_layer(circuit: qiskit.circuit.QuantumCircuit, parameters: list, wires: list) -> None Implements a single layer of Gate Fabric .. py:method:: _orbital_rotation(circuit: qiskit.circuit.QuantumCircuit, theta: qiskit.circuit.Parameter, qubits: list) -> None Implements the orbital rotation gate .. py:method:: _double_excitation(circuit: qiskit.circuit.QuantumCircuit, phi: qiskit.circuit.Parameter, qubits: list) -> None Implements the double excitation gate