ket.fermion
Fermionic operators and utilities.
This module provides fermionic creation and annihilation operators,
fermionic operator sentences, and utilities for particle number
and spin conservation checks.
Summary
Classes
Functions
Classes
-
class Fermion(operators: dict)[source]
Bases: dict
Fermionic operator product.
Represents an ordered product of fermionic creation and
annihilation operators.
-
show(spin=False)[source]
Return a string representation of the operator.
- Parameters:
spin – Whether to include spin labels.
- Returns:
Human-readable fermionic operator string.
-
get_spin()[source]
Return the spin associated with each operator.
-
adjoint()[source]
Return the Hermitian adjoint of the fermionic operator.
-
__add__(other)[source]
Promote Fermion + Fermion/FermionSentence → FermionSentence.
-
class FermionSentence[source]
Bases: dict
Linear combination of fermionic operator products.
-
adjoint()[source]
Return the Hermitian adjoint of the fermionic sentence.
-
simplify(tol=1e-8) → None[source]
Remove terms with small coefficients in place.
-
conserves_particle_number() → bool[source]
Check whether the operator conserves particle number.
-
conserves_spin_z() → bool[source]
Check whether the operator conserves the z component of spin.
-
is_two_body_number_conserving() → bool[source]
Check whether the operator is at most two-body and
conserves particle number.
Functions
-
CreateFermion(orbital: int, spin: str | None = None)[source]
Create a fermionic creation operator.
- Parameters:
-
- Returns:
Fermionic creation operator.
-
AnnihilateFermion(orbital: int, spin: str | None = None)[source]
Create a fermionic annihilation operator.
- Parameters:
-
- Returns:
Fermionic annihilation operator.
-
number_operator(n_orbitals: int, orbital: int | None = None)[source]
Construct a fermionic number operator.
- Parameters:
n_orbitals – Total number of orbitals.
orbital – Orbital index. If None, returns the total
number operator.
- Returns:
Fermionic number operator as a FermionSentence.