Welcome to SymPT, a Python package designed for performing symbolic perturbative transformations on quantum systems. SymPT leverages the Schrieffer-Wolff Transformation (SWT) and other related techniques to compute effective Hamiltonians in a systematic and efficient manner. The library offers a suite of tools for block-diagonalization, full-diagonalization, and custom transformations, supporting both time-independent and time-dependent systems.
This document provides comprehensive guidance on using SymPT, detailing its key features, algorithms, and implementation. Let’s dive in!
- Overview
- Key Features
- Installation
- Usage
- Core Classes
- Algorithms
- Advanced Tools
- Contributing
- License
SymPT is a symbolic perturbative transformation tool built to help researchers and engineers study quantum systems experiencing perturbative interactions. It computes effective Hamiltonians and performs other transformations using techniques based on SWT, FD, and ACE. The package also supports multi-block diagonalizations, with special emphasis on least-action methods.
- Multiple Transformation Methods: Includes routines for SWT, FD, ACE.
- Symbolic Computation: Powered by
sympy
, enabling exact symbolic results for quantum systems. - Customizable Input: Define Hamiltonians and operators with ease using symbolic expressions.
- Flexible Output: Obtain results in operator, matrix, or dictionary forms.
- Efficient Algorithms: Leverages caching and optimized partitioning for nested commutator calculations.
SymPT is available on PyPI for easy installation:
pip install sympt
To install SymPT from the source code, clone the repository and install dependencies:
git clone https://github.com/qcode-uni-a/sympt.git
cd SymPT
pip install .
SymPT depends on Python 3.8+ and the following libraries:
sympy
: For symbolic computations.numpy
: For matrix operations.- (Optional)
matplotlib
: For visualizing results.
- Define Symbols and Basis: Use
RDSymbol
andRDBasis
to construct system components. - Set Up EffectiveFrame: Initialize the transformation frame with the Hamiltonian.
- Solve the Transformation: Specify the perturbation order and method (
SWT
,FD
, orACE
). - Extract Results: Retrieve the effective Hamiltonian or rotate operators into the new frame.
Here we include two example cases of how to use SymPT. Find more within the Examples folder of this project.
from sympt import RDSymbol, RDBasis, EffectiveFrame
# Define symbols
omega = RDSymbol('omega', real=True, positive=True)
g = RDSymbol('g', order=1, real=True)
# Define basis and Hamiltonian
spin = RDBasis(name='sigma', dim=2)
s0, sx, sy, sz = spin.basis
H = omega * sz
V = g * sx
# Setup EffectiveFrame
eff_frame = EffectiveFrame(H, V, subspaces=[spin])
eff_frame.solve(max_order=2, method="SW")
H_eff = eff_frame.get_H(return_form="operator")
print(H_eff)
from sympt import *
from sympy import Rational
# Define symbols
omega = RDSymbol('omega', order=0, real=True)
g = RDSymbol('g', order=1, real=True)
# Define basis and operators
spin = RDBasis(name='sigma', dim=2).basis[0]
s0, sx, sy, sz = spin.basis
a = BosonOp('a')
ad = Dagger(a)
# Define Hamiltonian
H = Rational(1,2) * omega * sz + g * sx * (a + ad)
mask = Block(fin = sx, inf = a) # this mask is equivalent to "SW" up to second order
# Solve ACE transformation
eff_frame = EffectiveFrame(H)
eff_frame.solve(max_order=2, method="ACE", mask=mask)
H_eff = eff_frame.get_H(return_form="operator")
print(H_eff)
- Represents scalar, commutative quantities with perturbative orders.
- Example:
omega = RDSymbol('omega', order=0, real=True)
- Encodes finite-dimensional subspaces and generates basis operators (e.g., Pauli or Gell-Mann matrices).
- Example:
spin = RDBasis(name='sigma', dim=2)
- Central class for setting up and solving perturbative transformations.
- Methods:
.solve()
: Perform the transformation..get_H()
: Retrieve the effective Hamiltonian..rotate()
: Rotate operators into the new frame.
- Used in ACE transformations to specify couplings to eliminate.
- Example:
mask = Block(fin=a)
Systematically block-diagonalizes the Hamiltonian, focusing on separating diagonal and off-diagonal terms.
Fully diagonalizes the Hamiltonian, eliminating all off-diagonal elements.
Targets specific off-diagonal couplings for elimination, allowing flexible transformations.
display_dict
: Enhanced dictionary printing for Hamiltonians.group_by_operators
: Groups terms by their operator components.get_block_mask
: Simplifies block-off diagonal mask creation.
We welcome contributions! Please:
- Fork the repository.
- Create a feature branch.
- Submit a pull request with detailed descriptions.
SymPT is licensed under the MIT License. See LICENSE
for details.