H₂ Molecule Jordan-Wigner Circuit Construction
Overview¶
The quantum circuit for simulating the H molecule using the Jordan-Wigner (JW) transformation involves mapping fermionic operators to qubit operators and implementing various excitation operators. This document provides a detailed explanation of each circuit section and its physical significance.
1. Initial State Preparation¶
Physical Basis¶
We use the STO-3G minimal basis set for H, which provides:
2 spatial orbitals (one for each H atom)
4 spin orbitals (2 spatial × 2 spins)
Requires 4 qubits for encoding
Initial State¶
The Hartree-Fock (HF) state serves as our reference state:
State:
Physical meaning: Two electrons occupying the bonding orbital (lower energy)
Implementation: X gates on qubits 0 and 1
2. Jordan-Wigner Transformation Overview¶
The Jordan-Wigner transformation maps fermionic creation and annihilation operators to qubit operators by representing them as strings of Pauli matrices. This transformation ensures that the fermionic anticommutation relations are preserved in the qubit representation.
Mapping Operators¶
For a system with spin orbitals, the mapping is:
Creation operator:
Annihilation operator:
The term, known as the Jordan-Wigner string, accounts for the anticommutation relations of fermionic operators. This string ensures that operators on different sites anticommute, as required by the Pauli exclusion principle.
3. Single Excitations¶
Physical Significance¶
Single excitations represent the promotion of an electron from an occupied molecular orbital (MO) to a virtual (unoccupied) MO. Physically, this accounts for electron correlation by allowing electrons to occupy higher energy states, leading to a more accurate description of the electronic structure.
3.1 Single Excitation ( ↑ Spin)¶
Operator Form¶
The single excitation operator in second quantization:
where:
is the annihilation operator for orbital
is the creation operator for orbital
are the excitation amplitudes
Jordan-Wigner Transformation¶
For the excitation (↑ spin), the JW transformed operators become:
Annihilation operator :
(Since the product from to -1 is empty, the JW string is identity.)
Creation operator :
Implementation in Circuit¶
Implementation consists of:
Initial rotation: on target qubit (qubit 2)
Forward JW string: CNOT ladder implementing -string from qubit 0 to qubit 2
Phase rotation: on qubit 2, with basis change using gates if necessary
Reverse JW string: Inverse CNOT ladder to undo the JW string
Final rotation: on target qubit (qubit 2)
Implementing JW Strings Using CNOT Gates¶
The JW strings are implemented using CNOT gates to propagate the required operators:
Forward JW String:
Apply CNOT gates from qubit to qubit for to 1
Reverse JW String:
Apply CNOT gates from qubit to qubit for down to 1
This sequence effectively creates the required operators between the qubits involved in the excitation.
3.2 Single Excitation (↓ Spin)¶
Similar to the (↑ spin excitation but for the transition:
Operates on different qubits (1 and 3)
Maintains spin symmetry
Uses the same mathematical structure as ( ↑ spin excitation)
Operator Form¶
For the excitation (↓ spin):
Annihilation operator :
Creation operator :
Implementation in Circuit¶
Implementation steps are analogous to the (↑ spin excitation, applied to qubits 1 and 3.
4. Double Excitation¶
Physical Significance¶
Double excitations involve the simultaneous excitation of two electrons from occupied to virtual MOs. They capture the correlated motion of electron pairs, which is essential for accurately modeling systems with significant electron correlation effects.
Operator Form¶
The double excitation operator in second quantization:
Implementation Details¶
For the 01→23 double excitation:
Initial preparation: Simultaneous on qubits 2 and 3
JW string implementation: Extended CNOT ladder for multiple qubits
Phase rotation: Single application
Reverse operations: Maintaining unitarity
5. Physical Significance¶
The complete circuit implements the Unitary Coupled Cluster (UCC) ansatz:
where:
represents single excitations
represents double excitations
The UCC ansatz allows for the incorporation of electron correlation effects by considering excitations from the reference state to excited states, weighted by parameters .
6. Circuit Parameters¶
The three parameters (, , ) control:
: Amplitude of (\uparrow) spin single excitation
: Amplitude of (\downarrow) spin single excitation
: Amplitude of double excitation
These parameters are typically optimized variationally to find the ground state energy.
Optimization of Parameters¶
In the Variational Quantum Eigensolver (VQE) framework, these parameters are adjusted to minimize the expectation value of the Hamiltonian:
The optimization is performed using classical algorithms, such as gradient descent or the Nelder-Mead method. The objective is to find the parameter set that yields the lowest possible energy, corresponding to the ground state of the molecule.
7. Implementation Considerations¶
Spin Symmetry and Antisymmetry¶
Spin Symmetry: Maintained by treating spin-up and spin-down orbitals separately and performing excitations within the same spin manifold.
Antisymmetry: The JW transformation preserves the antisymmetric nature of the fermionic wavefunction under particle exchange through the use of JW strings.
Computational Complexity¶
Gate Depth: The JW transformation can result in long strings of operators, leading to circuits with many CNOT gates.
Scalability: The number of gates increases with the number of orbitals, making it challenging to simulate larger molecules.
Alternative Transformations: Methods like the Bravyi-Kitaev transformation can reduce the number of required gates by balancing locality and parity encoding.
Error Mitigation Techniques¶
In practical quantum computations, errors due to decoherence and gate imperfections can significantly affect results. Common error mitigation techniques include:
Zero-Noise Extrapolation: Running the circuit at different noise levels and extrapolating to zero noise.
Symmetry Verification: Using conserved quantities, like particle number or spin, to detect and correct errors.
Subspace Expansion: Expanding the variational ansatz to include error states and projecting back onto the physical subspace.
8. Circuit Diagrams¶
Note: Visual diagrams cannot be included in this text format. In practice, you should include circuit diagrams illustrating the following sections:
Initial State Preparation: Show the application of gates on qubits 0 and 1.
Single Excitation Circuits: Depict the sequence of gates for the and excitations, including the CNOT ladders and rotation gates.
Double Excitation Circuit: Illustrate the circuit involving multiple qubits and controlled operations.
9. Conlusion¶
By incorporating detailed explanations of the Jordan-Wigner transformation, implementation of JW strings using CNOT gates, and the physical significance of excitations, we gain a deeper understanding of simulating the H₂ molecule on a quantum computer. Additionally, considering computational complexities and error mitigation techniques provides insight into practical challenges and solutions in quantum simulations.
References¶
: Helgaker, T., Jorgensen, P., & Olsen, J. (2014). Molecular Electronic-Structure Theory. John Wiley & Sons.
: Szabo, A., & Ostlund, N. S. (2012). Modern Quantum Chemistry: Introduction to Advanced Electronic Structure Theory. Dover Publications.
: Jordan, P., & Wigner, E. (1928). Über das Paulische Äquivalenzverbot. Zeitschrift für Physik, 47(9-10), 631-651.
: Romero, J., et al. (2019). Strategies for quantum computing molecular energies using the unitary coupled cluster ansatz. Quantum Science and Technology, 4(1), 014008.
Additional References:
McArdle, S., Endo, S., Aspuru-Guzik, A., Benjamin, S. C., & Yuan, X. (2020). Quantum computational chemistry. Reviews of Modern Physics, 92(1), 015003.
Kandala, A., et al. (2017). Hardware-efficient variational quantum eigensolver for small molecules and quantum magnets. Nature, 549(7671), 242-246.
Bravyi, S., & Kitaev, A. (2002). Fermionic quantum computation. Annals of Physics, 298(1), 210-226.
from qiskit import QuantumCircuit
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit_ibm_runtime import QiskitRuntimeService, SamplerV2 as Sampler
service = QiskitRuntimeService()
# 1. A quantum circuit for preparing the quantum state (|00> + |11>)/rt{2}
bell = QuantumCircuit(2)
bell.h(0)
bell.cx(0, 1)
bell.measure_all()
# 2: Optimize problem for quantum execution.
backend = service.least_busy(operational=True, simulator=False)
pm = generate_preset_pass_manager(backend=backend, optimization_level=1)
isa_circuit = pm.run(bell)
# 3. Execute using the Sampler primitive
sampler = Sampler(mode=backend)
sampler.options.default_shots = 1024 # Options can be set using auto-complete.
job = sampler.run([isa_circuit])
print(f"Job ID is {job.job_id()}")
pub_result = job.result()[0]
print(f"Counts for the meas output register: {pub_result.data.meas.get_counts()}")Job ID is cw3k0e1vka8g008bgbeg
Counts for the meas output register: {'00': 407, '11': 517, '01': 53, '10': 47}
from qiskit import QuantumCircuit, QuantumRegister
import numpy as np
def create_h2_jordan_wigner_circuit(parameters):
"""
Creates a quantum circuit for H2 molecule using Jordan-Wigner transformation
with clear visual breaks between different sections
Args:
parameters (list): List of parameters for the ansatz [theta1, theta2, theta3]
Returns:
QuantumCircuit: The prepared circuit
"""
# Initialize quantum registers
qr = QuantumRegister(4, 'q')
circuit = QuantumCircuit(qr)
# Section 1: Initial state preparation (Hartree-Fock state |1100⟩)
circuit.x(qr[0])
circuit.x(qr[1])
circuit.barrier(label='Initial HF State |1100⟩')
# Section 2: Single excitation 0->2 (↑ spin)
circuit.ry(parameters[0]/2, qr[2])
# Forward CNOT ladder
circuit.cx(qr[2], qr[1])
circuit.cx(qr[1], qr[0])
circuit.barrier(label='↑ Forward JW string')
# Phase rotation
circuit.x(qr[0])
circuit.rz(parameters[0], qr[0])
circuit.x(qr[0])
circuit.barrier(label='↑ Phase rotation')
# Reverse CNOT ladder
circuit.cx(qr[1], qr[0])
circuit.cx(qr[2], qr[1])
circuit.ry(-parameters[0]/2, qr[2])
circuit.barrier(label='↑ Reverse JW string')
# Section 3: Single excitation 1->3 (↓ spin)
circuit.ry(parameters[1]/2, qr[3])
# Forward CNOT ladder
circuit.cx(qr[3], qr[2])
circuit.cx(qr[2], qr[1])
circuit.barrier(label='↓ Forward JW string')
# Phase rotation
circuit.x(qr[1])
circuit.rz(parameters[1], qr[1])
circuit.x(qr[1])
circuit.barrier(label='↓ Phase rotation')
# Reverse CNOT ladder
circuit.cx(qr[2], qr[1])
circuit.cx(qr[3], qr[2])
circuit.ry(-parameters[1]/2, qr[3])
circuit.barrier(label='↓ Reverse JW string')
# Section 4: Double excitation 01->23
circuit.ry(parameters[2]/2, qr[2])
circuit.ry(parameters[2]/2, qr[3])
circuit.barrier(label='Double excitation preparation')
# Forward CNOT ladder
circuit.cx(qr[3], qr[2])
circuit.cx(qr[2], qr[1])
circuit.cx(qr[1], qr[0])
circuit.barrier(label='Double Forward JW string')
# Phase rotation
circuit.rz(parameters[2], qr[0])
circuit.barrier(label='Double Phase rotation')
# Reverse CNOT ladder
circuit.cx(qr[1], qr[0])
circuit.cx(qr[2], qr[1])
circuit.cx(qr[3], qr[2])
circuit.barrier(label='Double Reverse JW string')
# Final rotations
circuit.ry(-parameters[2]/2, qr[2])
circuit.ry(-parameters[2]/2, qr[3])
circuit.barrier(label='Final state')
return circuit
# Example usage with visual output
parameters = [0.1, 0.2, 0.3]
circuit = create_h2_jordan_wigner_circuit(parameters)
circuit.draw('latex')
print(circuit) ┌───┐ Initial HF State |1100⟩ ┌───┐ ↑ Forward JW string »
q_0: ┤ X ├────────────░─────────────────────────────┤ X ├──────────░──────────»
├───┤ ░ ┌───┐└─┬─┘ ░ »
q_1: ┤ X ├────────────░────────────────────────┤ X ├──■────────────░──────────»
└───┘ ░ ┌──────────┐└─┬─┘ ░ »
q_2: ─────────────────░────────────┤ Ry(0.05) ├──■─────────────────░──────────»
░ └──────────┘ ░ »
q_3: ─────────────────░────────────────────────────────────────────░──────────»
░ ░ »
« ┌───┐┌─────────┐┌───┐ ↑ Phase rotation ┌───┐ »
«q_0: ┤ X ├┤ Rz(0.1) ├┤ X ├────────░─────────┤ X ├──────────────────»
« └───┘└─────────┘└───┘ ░ └─┬─┘┌───┐ »
«q_1: ─────────────────────────────░───────────■──┤ X ├─────────────»
« ░ └─┬─┘┌───────────┐»
«q_2: ─────────────────────────────░────────────────■──┤ Ry(-0.05) ├»
« ░ └───────────┘»
«q_3: ─────────────────────────────░────────────────────────────────»
« ░ »
« ↑ Reverse JW string ↓ Forward JW string »
«q_0: ──────────░─────────────────────────────────────────░───────────────»
« ░ ┌───┐ ░ ┌───┐»
«q_1: ──────────░──────────────────────────┤ X ├──────────░──────────┤ X ├»
« ░ ┌───┐└─┬─┘ ░ └───┘»
«q_2: ──────────░─────────────────────┤ X ├──■────────────░───────────────»
« ░ ┌─────────┐└─┬─┘ ░ »
«q_3: ──────────░──────────┤ Ry(0.1) ├──■─────────────────░───────────────»
« ░ └─────────┘ ░ »
« ↓ Phase rotation »
«q_0: ────────────────────────░───────────────────────────────»
« ┌─────────┐┌───┐ ░ ┌───┐ »
«q_1: ┤ Rz(0.2) ├┤ X ├────────░─────────┤ X ├─────────────────»
« └─────────┘└───┘ ░ └─┬─┘┌───┐ »
«q_2: ────────────────────────░───────────■──┤ X ├────────────»
« ░ └─┬─┘┌──────────┐»
«q_3: ────────────────────────░────────────────■──┤ Ry(-0.1) ├»
« ░ └──────────┘»
« ↓ Reverse JW string Double excitation preparation »
«q_0: ──────────░─────────────────────────────────────░────────────────────»
« ░ ░ »
«q_1: ──────────░─────────────────────────────────────░────────────────────»
« ░ ┌──────────┐ ░ ┌───┐»
«q_2: ──────────░──────────┤ Ry(0.15) ├───────────────░───────────────┤ X ├»
« ░ ├──────────┤ ░ └─┬─┘»
«q_3: ──────────░──────────┤ Ry(0.15) ├───────────────░─────────────────■──»
« ░ └──────────┘ ░ »
« ┌───┐ Double Forward JW string ┌─────────┐ Double Phase rotation »
«q_0: ─────┤ X ├────────────░─────────────┤ Rz(0.3) ├───────────░───────────»
« ┌───┐└─┬─┘ ░ └─────────┘ ░ »
«q_1: ┤ X ├──■──────────────░───────────────────────────────────░───────────»
« └─┬─┘ ░ ░ »
«q_2: ──■───────────────────░───────────────────────────────────░───────────»
« ░ ░ »
«q_3: ──────────────────────░───────────────────────────────────░───────────»
« ░ ░ »
« ┌───┐ Double Reverse JW string Final state
«q_0: ┤ X ├──────────────────────░────────────────────────────────░──────
« └─┬─┘┌───┐ ░ ░
«q_1: ──■──┤ X ├─────────────────░────────────────────────────────░──────
« └─┬─┘┌───┐ ░ ┌───────────┐ ░
«q_2: ───────■──┤ X ├────────────░─────────────┤ Ry(-0.15) ├──────░──────
« └─┬─┘ ░ ├───────────┤ ░
«q_3: ────────────■──────────────░─────────────┤ Ry(-0.15) ├──────░──────
« ░ └───────────┘ ░