A solver for perturbative expansions in quantum systems
Project description
SymPT: Symbolic Perturbation Theory Toolbox
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. Detailed documentation can be found here.
Table of Contents
- Overview
- Key Features
- Installation
- Usage
- Core Classes
- Algorithms
- Advanced Tools
- Contributing
- License
Overview
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.
Key Features
- 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.
Installation
From PyPI
Make sure to install SymPT on a new python environment. To do so, you can use the Anaconda distribution platform
conda create -n sympt python
SymPT is available on PyPI for easy installation:
conda activate sympt
pip install sympt
From Source
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
conda activate 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.
Usage
Basic Workflow
- Define Symbols and Basis: Use
RDSymbolandRDBasisto 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.
Examples
Here we include two example cases of how to use SymPT. Find more within the Examples folder of this project.
Example 1: Schrieffer-Wolff Transformation (SWT)
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")
display(H_eff)
Example 2: Arbitrary Coupling Elimination (ACE)
from sympt import *
from sympy import Rational
# Define symbols
omega = RDSymbol('omega', order=0, real=True)
omega_z = RDSymbol('omega_z', order=0, real=True)
g = RDSymbol('g', order=1, real=True)
# Define basis and operators
spin = RDBasis(name='sigma', dim=2)
s0, sx, sy, sz = spin.basis
a = BosonOp('a')
ad = Dagger(a)
# Define Hamiltonian
H = omega * ad * a + Rational(1,2) * omega_z * sz + g * sx * (a + ad)
mask = Block(fin = sx, inf = a, subspaces=[spin]) # this mask is equivalent to "SW" up to second order
# Solve ACE transformation
eff_frame = EffectiveFrame(H, subspaces=[spin])
eff_frame.solve(max_order=2, method="ACE", mask=mask)
H_eff = eff_frame.get_H(return_form="operator")
display(H_eff)
Core Classes
RDSymbol
- Represents scalar, commutative quantities with perturbative orders.
- Example:
omega = RDSymbol('omega', order=0, real=True)
RDBasis
- Encodes finite-dimensional subspaces and generates basis operators (e.g., Pauli or Gell-Mann matrices).
- Example:
spin = RDBasis(name='sigma', dim=2)
EffectiveFrame
- 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.
Block
- Used in ACE transformations to specify couplings to eliminate.
- Example:
mask = Block(fin=a)
Algorithms
Schrieffer-Wolff Transformation (SWT)
Systematically block-diagonalizes the Hamiltonian, focusing on separating diagonal and off-diagonal terms.
Full-Diagonalization (FD)
Fully diagonalizes the Hamiltonian, eliminating all off-diagonal elements.
Arbitrary Coupling Elimination (ACE)
Targets specific off-diagonal couplings for elimination, allowing flexible transformations.
Advanced Tools
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.
Contributing
We welcome contributions! Please:
- Fork the repository.
- Create a feature branch.
- Submit a pull request with detailed descriptions.
License
SymPT is licensed under the MIT License. See LICENSE for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sympt-1.2.1.tar.gz.
File metadata
- Download URL: sympt-1.2.1.tar.gz
- Upload date:
- Size: 37.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f10256d46070f301c03bf14a0bb23de4240ef6dfa4cef9d38a097ba3a87189cc
|
|
| MD5 |
ec701a8ae51038cf121453ad5e008419
|
|
| BLAKE2b-256 |
a0c6d0a13622fd9980b263cf3e66c07e90b55fdaa8ee6285ff71149ef4e2b697
|
Provenance
The following attestation bundles were made for sympt-1.2.1.tar.gz:
Publisher:
publish.yml on qcode-uni-a/sympt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sympt-1.2.1.tar.gz -
Subject digest:
f10256d46070f301c03bf14a0bb23de4240ef6dfa4cef9d38a097ba3a87189cc - Sigstore transparency entry: 176362688
- Sigstore integration time:
-
Permalink:
qcode-uni-a/sympt@3d9c4ed39465dfb0a45513ee4c082757ec300f4d -
Branch / Tag:
refs/tags/v1.2.1 - Owner: https://github.com/qcode-uni-a
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3d9c4ed39465dfb0a45513ee4c082757ec300f4d -
Trigger Event:
release
-
Statement type:
File details
Details for the file sympt-1.2.1-py3-none-any.whl.
File metadata
- Download URL: sympt-1.2.1-py3-none-any.whl
- Upload date:
- Size: 35.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f02b5e81a75726ccd8f94f82ec1e60f463bf47dd1a43a4df31bf70c9479037f7
|
|
| MD5 |
514624681d69fffc8ba4ca8bdd88648d
|
|
| BLAKE2b-256 |
8e29b46bb008a1302502bcf97887ac735e3ed83e019e20844e0f2c324ee31ecf
|
Provenance
The following attestation bundles were made for sympt-1.2.1-py3-none-any.whl:
Publisher:
publish.yml on qcode-uni-a/sympt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sympt-1.2.1-py3-none-any.whl -
Subject digest:
f02b5e81a75726ccd8f94f82ec1e60f463bf47dd1a43a4df31bf70c9479037f7 - Sigstore transparency entry: 176362692
- Sigstore integration time:
-
Permalink:
qcode-uni-a/sympt@3d9c4ed39465dfb0a45513ee4c082757ec300f4d -
Branch / Tag:
refs/tags/v1.2.1 - Owner: https://github.com/qcode-uni-a
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3d9c4ed39465dfb0a45513ee4c082757ec300f4d -
Trigger Event:
release
-
Statement type: