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.

Classes ket.fermion

Fermion

Fermionic operator product.

FermionSentence

Linear combination of fermionic operator products.

class Fermion(operators: dict)

Fermionic operator product.

Represents an ordered product of fermionic creation and annihilation operators.

show(spin=False)

Return a string representation of the operator.

Parameters:

spin – Whether to include spin labels.

Returns:

Human-readable fermionic operator string.

get_spin()

Return the spin associated with each operator.

adjoint()

Return the Hermitian adjoint of the fermionic operator.

class FermionSentence

Linear combination of fermionic operator products.

adjoint()

Return the Hermitian adjoint of the fermionic sentence.

simplify(tol=1e-08) None

Remove terms with small coefficients in place.

conserves_particle_number() bool

Check whether the operator conserves particle number.

conserves_spin_z() bool

Check whether the operator conserves the z component of spin.

is_two_body_number_conserving() bool

Check whether the operator is at most two-body and conserves particle number.

Functions ket.fermion

AnnihilateFermion(orbital[, spin])

Create a fermionic annihilation operator.

CreateFermion(orbital[, spin])

Create a fermionic creation operator.

number_operator(n_orbitals[, orbital])

Construct a fermionic number operator.

AnnihilateFermion(orbital: int, spin: str | None = None)

Create a fermionic annihilation operator.

Parameters:
  • orbital – Orbital index.

  • spin – Optional spin label (“a” or “b”).

Returns:

Fermionic annihilation operator.

CreateFermion(orbital: int, spin: str | None = None)

Create a fermionic creation operator.

Parameters:
  • orbital – Orbital index.

  • spin – Optional spin label (“a” or “b”).

Returns:

Fermionic creation operator.

number_operator(n_orbitals: int, orbital: int | None = None)

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.