FermionicHilbertSpaces.jl

FermionicHilbertSpaces.jl turns symbolic fermion, boson and spin operators into matrices on Hilbert spaces. The goal of this package is that you should be able to define your own physics and never have to think about indexing of vectors and matrices.

Install the package from the Julia package manager with Pkg.add("FermionicHilbertSpaces").

The cheat sheet lists common tasks and the functions that do them.

Functionality

  • Symbolic operators: fermions, bosons and spins are combined algebraically, e.g. f[1]'f[2] + hc, and simplified with their commutation relations. representation turns them into matrices on any Hilbert space.
  • Hilbert spaces: spaces keep track of their basis states and ordering, so you never index by hand. They can be restricted by particle number, parity or any rule on the basis states.
  • Tensor products and partial traces: spaces combine and split, as in partial_trace(ρ, H => Hsub), with fermionic signs handled automatically.
  • Extensible: custom operators and spaces can be added, see Extending.

It is not a solver: combine it with LinearAlgebra, KrylovKit or ODE solvers for eigenstates and time evolution.

Getting started

We find the ground state of a half-filled chain of interacting spinless fermions and how entangled its two halves are. The Hamiltonian conserves particle number, so we diagonalize only in the half-filled sector and then trace out the right half:

using FermionicHilbertSpaces, LinearAlgebra@fermions cN, V = 6, 2.0ham = sum(c[n+1]'c[n] + hc + V * c[n]'c[n] * c[n+1]'c[n+1] for n in 1:N-1)H = hilbert_space(c, 1:N, NumberConservation(N ÷ 2))E, vecs = eigen(Hermitian(representation(ham, H, :dense)))ρ = partial_trace(vecs[:, 1], H => hilbert_space(c, 1:N÷2))S = -sum(λ * log(λ) for λ in eigvals(Hermitian(ρ)) if λ > 0)E[1], S
(-2.672479361373294, 0.7055211210460454)

Where to go next

Tutorials:

Guides:

FermionicHilbertSpaces.jl grew out of QuantumDots.jl. Its symbolic operator algebra is built on NonCommutativeProducts.jl.