Skip to content

Latest commit

 

History

57 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UnitaryTransformations.jl

Build Status Documentation Code Style: Blue

A Julia package for symbolic unitary transformations on quantum Hamiltonians. Built on QuantumAlgebra.jl and Symbolics.jl.

Installation

using Pkg
Pkg.add(url="https://github.com/volkerkarle/UnitaryTransformations.jl")

Quick Example

Derive the dispersive shift for qubit readout in circuit QED:

using UnitaryTransformations, QuantumAlgebra, Symbolics

QuantumAlgebra.use_σpm(true)
@variables Δ g

# Jaynes-Cummings Hamiltonian
H = Δ/2 * σz() + g * (a'()*σm() + a()*σp())

# Schrieffer-Wolff transformation
P = Subspace(σz() => -1)  # qubit ground state
result = schrieffer_wolff(H, P; order=2)

println(result.H_P)  # -Δ/2 + (-g²/Δ) a†a  ← dispersive shift χ = -g²/Δ

Multi-Atom Systems with ∑ (Einstein Summation)

For systems with many identical particles, use the function for symbolic sums:

using UnitaryTransformations, QuantumAlgebra, Symbolics

QuantumAlgebra.use_σpm(true)
@variables ω_c Δ g

# Tavis-Cummings Hamiltonian: N atoms coupled to a cavity
H = ω_c * a'()*a() + (:i, Δ/2 * σz(:i) + g * (a'()*σm(:i) + a()*σp(:i)))

P = Subspace(a'()*a() => 0)  # Zero photon sector
result = schrieffer_wolff(H, P; order=2)

# The effective Hamiltonian includes exchange terms: χ Σᵢ≠ⱼ σ⁺ᵢσ⁻ⱼ

The function embeds sums directly into QuExpr, so everything works with existing functions (comm, normal_form, decompose, schrieffer_wolff).

Use multi-index sums for cross-site interactions:

((:i,:j), σx(:i) * σx(:j))  # Σᵢⱼ σˣᵢ σˣⱼ

Transformations

Transformation Purpose
Schrieffer-Wolff Block-diagonalize H, derive effective low-energy Hamiltonians
Magnus Expansion Effective Hamiltonians for periodically driven (Floquet) systems

Supported Systems

System Operators
Two-level systems σx(), σy(), σz(), σp(), σm()
Bosonic modes a(), a'()
N-level atoms nlevel_ops(N, :name)
SU(N) algebras su_generators(N, :name)
Multi-atom systems ∑(:i, expr) for Einstein summation
Hybrid systems Any combination

Features

  • Symbolic results: Get analytical expressions like -g²/Δ, not floating-point numbers
  • Arbitrary perturbation order: Compute to order 2, 4, 6+ with optional parallel acceleration
  • Automatic method selection: Eigenoperator method for TLS/bosons, matrix-element method for SU(N)
  • Symbolic sums: embeds sums into QuExpr for multi-particle commutators
# Higher-order with parallelization
result = schrieffer_wolff(H, P; order=4, parallel=true)

Magnus Expansion

For periodically driven systems H(t) = Σₙ Hₙ e^{inωt}:

@variables Δ Ω ω

modes = Dict(0 => Δ/2 * σz(), 1 => Ω/2 * σp(), -1 => Ω/2 * σm())
result = magnus_expansion(modes, ω; order=4)
# Computes Bloch-Siegert shift and higher-order corrections

Documentation

Requirements

License

MIT

Citation

@software{UnitaryTransformations.jl,
  author = {Karle, Volker},
  title = {UnitaryTransformations.jl: Symbolic Unitary Transformations for Quantum Hamiltonians},
  url = {https://github.com/volkerkarle/UnitaryTransformations.jl},
  year = {2025}
}

Contributing

Contributions welcome! See the documentation for details.

About

A repo for unitary transformations in quantum mechanics such as Schrieffer-Wolff or Lang–Firsov.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages