Symmetries
The Symmetries class in QDK/Chemistry is a general container for symmetry information that quantum algorithms can exploit to reduce resource requirements.
As a core data class, it follows QDK/Chemistry’s immutable data pattern.
Overview
Many quantum algorithms can reduce circuit depth, qubit count, or classical post-processing cost when the symmetries of the target quantum state are known in advance.
The Symmetries class encapsulates this symmetry information so that it can be passed to any algorithm that exploits it, such as the symmetry-conserving Bravyi-Kitaev qubit mapping.
Conserved quantum numbers
From the alpha and beta electron counts, several derived quantities are available as read-only properties.
Properties
- n_alpha
Number of alpha (spin-up) electrons in the active space.
- n_beta
Number of beta (spin-down) electrons in the active space.
- n_particles
Total number of active electrons, \(n_\alpha + n_\beta\).
- sz
Spin projection quantum number, \(S_z = (n_\alpha - n_\beta) / 2\).
- spin_multiplicity
Spin multiplicity, \(2S + 1 = |n_\alpha - n_\beta| + 1\).
Creating a Symmetries object
A Symmetries object can be created by specifying electron counts directly, or by using a factory method to extract them from an existing Wavefunction or Ansatz.
Direct construction
Provide the alpha and beta electron counts explicitly:
from qdk_chemistry.data import Symmetries
# Closed-shell singlet with 4 active electrons
sym = Symmetries(n_alpha=2, n_beta=2)
print(sym.n_particles) # 4
print(sym.sz) # 0.0
print(sym.spin_multiplicity) # 1
# Open-shell doublet
sym = Symmetries(n_alpha=3, n_beta=2)
print(sym.sz) # 0.5
print(sym.spin_multiplicity) # 2
From a wavefunction
If a Wavefunction is available, for example from an ScfSolver or MCCalculator calculation, the factory method from_wavefunction() extracts the active-space electron counts automatically:
from qdk_chemistry.data import Symmetries
symmetries = Symmetries.from_wavefunction(wavefunction)
From an ansatz
When an Ansatz is available, for example after a multi-configuration calculation, the electron counts can be derived from the ansatz’s wavefunction:
from qdk_chemistry.data import Symmetries
symmetries = Symmetries.from_ansatz(ansatz)
Note
Symmetries.from_ansatz(ansatz) is equivalent to
Symmetries.from_wavefunction(ansatz.get_wavefunction()).
Further reading
QubitMapper: Fermion-to-qubit mapping algorithms that consume
SymmetriesDesign principles: Data class design principles in QDK/Chemistry