Qubit mapping

The QubitMapper algorithm in QDK/Chemistry transforms electronic-structure Hamiltonians into qubit Hamiltonians suitable for quantum computation. Following QDK/Chemistry’s algorithm design principles, it takes a Hamiltonian instance as input and produces a QubitHamiltonian instance as output. This transformation is essential for executing quantum chemistry algorithms on quantum hardware.

Overview

The QubitMapper algorithm converts fermionic Hamiltonians into qubit-operator representations composed of Pauli strings. This transformation preserves the operator algebra, particle-number constraints, and antisymmetry required by fermionic statistics. The resulting qubit Hamiltonian is mathematically equivalent to the original fermionic Hamiltonian but is now in a form that can be executed on quantum hardware or simulated by quantum algorithms.

Using the QubitMapper

Note

This algorithm is currently available only in the Python API.

This section demonstrates how to create, configure, and run a qubit mapping. The run method returns a QubitHamiltonian object containing the Pauli-string representation.

Input requirements

The QubitMapper requires the following input:

Hamiltonian

A Hamiltonian instance containing the fermionic one- and two-electron integrals. This is typically constructed using the HamiltonianConstructor algorithm.

The Hamiltonian defines the fermionic operators that will be transformed into qubit (Pauli) operators using the selected encoding strategy.

Note

Different encoding strategies (Jordan-Wigner, Bravyi-Kitaev, parity) produce mathematically equivalent qubit Hamiltonians but with different Pauli-string structures. The choice of encoding can affect circuit depth and measurement requirements on quantum hardware.

Creating a mapper

from qdk_chemistry.algorithms import create

# Create a QubitMapper instance
qubit_mapper = create("qubit_mapper", "qiskit")

Configuring settings

Settings can be modified using the settings() object. See Available implementations below for implementation-specific options.

# Configure the encoding strategy
qubit_mapper.settings().set("encoding", "jordan-wigner")

Running the calculation

from pathlib import Path  # noqa: E402

from qdk_chemistry.data import Structure  # noqa: E402

# Read a molecular structure from XYZ file
structure = Structure.from_xyz_file(Path(".") / "../data/water.structure.xyz")

# Perform an SCF calculation to generate initial orbitals
scf_solver = create("scf_solver")
_, wfn_hf = scf_solver.run(
    structure, charge=0, spin_multiplicity=1, basis_or_guess="cc-pvdz"
)

# Select an active space
active_space_selector = create(
    "active_space_selector",
    algorithm_name="qdk_valence",
    num_active_electrons=4,
    num_active_orbitals=6,
)
active_wfn = active_space_selector.run(wfn_hf)
active_orbitals = active_wfn.get_orbitals()

# Construct Hamiltonian in the active space
hamiltonian_constructor = create("hamiltonian_constructor")
hamiltonian = hamiltonian_constructor.run(active_orbitals)

# Map the fermionic Hamiltonian to a qubit Hamiltonian
qubit_hamiltonian = qubit_mapper.run(hamiltonian)
print(f"Qubit Hamiltonian has {qubit_hamiltonian.num_qubits} qubits")

Available implementations

QDK/Chemistry’s QubitMapper provides a unified interface for qubit mapping methods. You can discover available implementations programmatically:

from qdk_chemistry.algorithms import registry  # noqa: E402

print(registry.available("qubit_mapper"))
# ['qiskit']

Qiskit

Factory name: "qiskit"

Qubit mapping implementation integrated through the Qiskit plugin. This module supports multiple encoding strategies:

Jordan-Wigner mapping** [JW28]

Encodes each fermionic mode in a single qubit whose state directly represents the orbital occupation.

Parity mapping** [SRL12]

Encodes qubits with cumulative electron-number parities of the orbitals.

Bravyi-Kitaev mapping** [BK02]

Distributes both occupation and parity information across qubits using a binary-tree (Fenwick tree) structure, reducing the average Pauli-string length to logarithmic scaling.

Settings

Setting

Type

Description

encoding

string

Qubit mapping strategy (jordan-wigner, bravyi-kitaev, parity)

Further reading