Tutorials
qcr:2606.56493.1

Fermion-to-Qubit Mappers in Qiskit Nature

This Qiskit Nature tutorial covers the qubit mappers, the transformations that convert the fermionic operators of a chemistry problem into the qubit (Pauli) operators a quantum computer can actually execute, a foundational and consequential step in any quantum chemistry calculation. Electrons obey fermionic anticommutation rules that qubits do not, so a mapping is required, and the choice of mapping affects the number of qubits, the locality (Pauli weight) of the operators, and ultimately the circuit cost and hardware feasibility. The tutorial introduces the main mappers Qiskit Nature provides: the Jordan-Wigner transformation (simple but with non-local operator strings), the parity mapping (which enables a two-qubit reduction by exploiting symmetries), and the Bravyi-Kitaev transformation (which balances locality logarithmically). It shows how to apply each mapper to a fermionic Hamiltonian, compare the resulting qubit operators and their weights, and use symmetry-based qubit reductions. By making the fermion-to-qubit mapping explicit and comparable, the tutorial helps users understand and control a key driver of circuit cost in quantum chemistry on Qiskit Nature.
Chemistry
Qubit
Circuit-based
Uploaded 2 days ago
33
Views
GitHub390
Citing this entry? Use this QCR ID
Uploaded by
QL
QCR Librarian

Overview

qiskit-community/qiskit-nature
390233
In [ ]:
# --- Setup cell added by QCR (not part of the original tutorial) ---
# Source: qiskit-community/qiskit-nature @ 0.8, Apache License 2.0.
# Installs the example's dependencies. If a later cell still reports a missing
# package, restart the runtime/kernel and run again from the top.
%pip install -q qiskit-nature==0.8.0 pyscf

Mapping to the Qubit Space

The problems and operators with which you interact in Qiskit Nature (usually) need to be mapped into the qubit space before they can be solved with our quantum algorithms. This task is handled by the various QubitMapper classes.

In this tutorial, you will learn about the various options available to you.

Fermionic Mappers

This section deals with fermionic mappers, which transform fermionic operators into the qubit space. This is mostly used by the electronic structure stack but also finds application for the FermiHubbardModel.

There exist different mapping types with different properties. Qiskit Nature already supports the following fermionic mappings:

  • Jordan-Wigner (Zeitschrift für Physik, 47, 631-651 (1928))
  • Parity (The Journal of chemical physics, 137(22), 224109 (2012))
  • Bravyi-Kitaev (Annals of Physics, 298(1), 210-226 (2002))

We will discuss some of these in the following sections. You should learn all the information necessary, to comfortable work with any of the available mappers.

In order to discuss the various mappings, we will be using the electronic structure Hamiltonian of the H2 molecule. For more information on how to obtain this, please refer to the electronic structure tutorial.

In [1]:
from qiskit_nature.second_q.drivers import PySCFDriver

driver = PySCFDriver()
problem = driver.run()
fermionic_op = problem.hamiltonian.second_q_op()

The Jordan-Wigner Mapping

The Jordan-Wigner mapping is the most straight-forward mapping with the simplest physical interpretation, because it maps the occupation of one spin-orbital to the occupation of one qubit.

You can construct use it like so:

In [2]:
from qiskit_nature.second_q.mappers import JordanWignerMapper

mapper = JordanWignerMapper()
In [3]:
qubit_jw_op = mapper.map(fermionic_op)
print(qubit_jw_op)
-0.8105479805373283 * IIII
+ 0.17218393261915543 * IIIZ
- 0.2257534922240237 * IIZI
+ 0.12091263261776633 * IIZZ
+ 0.17218393261915543 * IZII
+ 0.16892753870087907 * IZIZ
+ 0.045232799946057826 * YYYY
+ 0.045232799946057826 * XXYY
+ 0.045232799946057826 * YYXX
+ 0.045232799946057826 * XXXX
- 0.22575349222402363 * ZIII
+ 0.1661454325638241 * ZIIZ
+ 0.16614543256382408 * IZZI
+ 0.1746434306830045 * ZIZI
+ 0.12091263261776633 * ZZII
True

The Parity Mapping

The Parity mapping is the dual mapping to the Jordan-Wigner one, in the sense that it encodes the parity information locally on one qubit, whereas the occupation information is delocalized over all qubits.

In [4]:
from qiskit_nature.second_q.mappers import ParityMapper

mapper = ParityMapper()
In [5]:
qubit_p_op = mapper.map(fermionic_op)
print(qubit_p_op)
-0.8105479805373283 * IIII
+ 0.17218393261915543 * IIIZ
- 0.2257534922240237 * IIZZ
+ 0.12091263261776633 * IIZI
+ 0.17218393261915543 * IZZI
+ 0.16892753870087907 * IZZZ
+ 0.045232799946057826 * ZXIX
- 0.045232799946057826 * IXZX
- 0.045232799946057826 * ZXZX
+ 0.045232799946057826 * IXIX
- 0.22575349222402363 * ZZII
+ 0.1661454325638241 * ZZIZ
+ 0.16614543256382408 * IZIZ
+ 0.1746434306830045 * ZZZZ
+ 0.12091263261776633 * ZIZI

This has one major benefit for the case of problems in which we want to preserve the number of particles of each spin species; it allows us to remove 2 qubits, because the information in them becomes redundant. Since Qiskit Nature arranges the qubits in block-order, such that the first half encodes the alpha-spin, and the second half the beta-spin information, this means we can remove the N/2-th and N-th qubit.

To do this, you need to specify the number of particles in your system, like so:

In [6]:
mapper = ParityMapper(num_particles=problem.num_particles)
In [7]:
qubit_op = mapper.map(fermionic_op)
print(qubit_op)
-1.0523732457728605 * II
+ 0.39793742484317896 * IZ
- 0.39793742484317896 * ZI
- 0.01128010425623538 * ZZ
+ 0.18093119978423122 * XX

More advanced qubit reductions

It is also possible to perform more advanced qubit reductions, which are based on finding Z2 symmetries in the Hilbert space of the qubit. A requirement for this to be useful, is that you know in which symmetry-subspace you need to look for your actual solution of interest. This can be a bit tricky, but luckily the problem classes of Qiskit Nature provide you with a utility to automatically determine that correct subspace.

Here is how you can use this to your advantage:

In [8]:
tapered_mapper = problem.get_tapered_mapper(mapper)
print(type(tapered_mapper))
<class 'qiskit_nature.second_q.mappers.tapered_qubit_mapper.TaperedQubitMapper'>
In [9]:
qubit_op = tapered_mapper.map(fermionic_op)
print(qubit_op)
-1.041093141516625 * I
- 0.7958748496863577 * Z
- 0.1809311997842312 * X

As you can see here, the H2 molecule is such a simple system that we can simulate it entirely on a single qubit!

Interleaved ordering

As mentioned previously, Qiskit Nature arranges the fermionic spin-up and spin-down parts of the qubit register in block-order. However, sometimes one may want to interleave the registers instead. This can be achieved by means of the InterleavedQubitMapper. This can be shown best upon inspection of the HarteeFock initial state circuit:

In [10]:
from qiskit_nature.second_q.circuit.library import HartreeFock
In [11]:
hf_state = HartreeFock(2, (1, 1), JordanWignerMapper())
hf_state.draw()
     ┌───┐
q_0: ┤ X ├
     └───┘
q_1: ─────
     ┌───┐
q_2: ┤ X ├
     └───┘
q_3: ─────
          
In [12]:
from qiskit_nature.second_q.mappers import InterleavedQubitMapper
In [13]:
interleaved_mapper = InterleavedQubitMapper(JordanWignerMapper())
In [14]:
hf_state = HartreeFock(2, (1, 1), interleaved_mapper)
hf_state.draw()
     ┌───┐
q_0: ┤ X ├
     ├───┤
q_1: ┤ X ├
     └───┘
q_2: ─────
          
q_3: ─────
          
In [15]:
import tutorial_magics

%qiskit_version_table
%qiskit_copyright

Version Information

Qiskit SoftwareVersion
qiskit-terra0.24.0.dev0+2b3686f
qiskit-aer0.11.2
qiskit-ibmq-provider0.19.2
qiskit-nature0.6.0
System information
Python version3.9.16
Python compilerGCC 12.2.1 20221121 (Red Hat 12.2.1-4)
Python buildmain, Dec 7 2022 00:00:00
OSLinux
CPUs8
Memory (Gb)62.50002670288086
Thu Apr 06 09:11:44 2023 CEST

This code is a part of Qiskit

© Copyright IBM 2017, 2023.

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.

Join the Discussion

Comments (0)

No comments yet. Be the first to share your thoughts!

Indexed by QCR Librarian

This entry was created automatically from publicly available records. QCR links to public sources and only stores repository content where the license permits redistribution.

Versions

v1 Latest
Jun 17, 2026
qcr:2606.56493.1

Cite all versions? Use the base QCR ID to always reference the latest version of this entry.

Tools used

Qiskit

Keywords

qubit-mappers
jordan-wigner
bravyi-kitaev
quantum-chemistry
qiskit

You may also like5