sympt

Symbolic Perturbation Theory (SymPT) is a Python package for symbolic perturbative transformations on quantum systems. SymPT helps compute effective Hamiltonians for both time-independent and time-dependent systems at both operator and matrix level.

https://github.com/qcode-uni-a/sympt

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.3%) to scientific vocabulary

Keywords

block-diagonalization diagonalization effective hamiltonian perturbation perturbation-theory quantum schrieffer-wolff unitary
Last synced: 6 months ago · JSON representation ·

Repository

Symbolic Perturbation Theory (SymPT) is a Python package for symbolic perturbative transformations on quantum systems. SymPT helps compute effective Hamiltonians for both time-independent and time-dependent systems at both operator and matrix level.

Basic Info
Statistics
  • Stars: 19
  • Watchers: 4
  • Forks: 3
  • Open Issues: 5
  • Releases: 8
Topics
block-diagonalization diagonalization effective hamiltonian perturbation perturbation-theory quantum schrieffer-wolff unitary
Created over 1 year ago · Last pushed 8 months ago
Metadata Files
Readme License Citation

README.md

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

  1. Overview
  2. Key Features
  3. Installation
  4. Usage
  5. Core Classes
  6. Algorithms
  7. Advanced Tools
  8. Contributing
  9. 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 bash conda create -n sympt python

SymPT is available on PyPI for easy installation:

bash conda activate sympt pip install sympt

From Source

To install SymPT from the source code, clone the repository and install dependencies:

bash 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

  1. Define Symbols and Basis: Use RDSymbol and RDBasis to construct system components.
  2. Set Up EffectiveFrame: Initialize the transformation frame with the Hamiltonian.
  3. Solve the Transformation: Specify the perturbation order and method (SWT, FD, or ACE).
  4. 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)

```python 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

effframe = EffectiveFrame(H, V, subspaces=[spin]) effframe.solve(maxorder=2, method="SW") Heff = effframe.getH(returnform="operator") display(Heff) ```

Example 2: Arbitrary Coupling Elimination (ACE)

```python from sympt import * from sympy import Rational

Define symbols

omega = RDSymbol('omega', order=0, real=True) omegaz = RDSymbol('omegaz', 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

effframe = EffectiveFrame(H, subspaces=[spin]) effframe.solve(maxorder=2, method="ACE", mask=mask) Heff = effframe.getH(returnform="operator") display(Heff) ```


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: 1. Fork the repository. 2. Create a feature branch. 3. Submit a pull request with detailed descriptions.


License

SymPT is licensed under the MIT License. See LICENSE for details.

Owner

  • Name: QCode
  • Login: qcode-uni-a
  • Kind: organization
  • Location: Germany

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: Diotallevi
    given-names: Giovanni Francesco
  - family-names: Reascos
    given-names: Leander
  - family-names: Benito
    given-names: Mónica
title: "SymPT: a comprehensive tool for automating effective Hamiltonian derivations"
version: 1.2.1
identifiers:
  - type: arXiv
    value: 2412.10240
    url: "https://arxiv.org/abs/2412.10240"
date-released: 2024
repository-code: "https://github.com/your-repo/sympt"
license: "MIT"

GitHub Events

Total
  • Create event: 5
  • Issues event: 2
  • Release event: 2
  • Watch event: 14
  • Delete event: 1
  • Issue comment event: 2
  • Push event: 23
  • Public event: 1
  • Fork event: 2
Last Year
  • Create event: 5
  • Issues event: 2
  • Release event: 2
  • Watch event: 14
  • Delete event: 1
  • Issue comment event: 2
  • Push event: 23
  • Public event: 1
  • Fork event: 2

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 89 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 8
  • Total maintainers: 1
pypi.org: sympt

A solver for perturbative expansions in quantum systems

  • Documentation: https://sympt.readthedocs.io/
  • License: MIT License Copyright (c) 2024 QCode Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 1.2.1
    published 12 months ago
  • Versions: 8
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 89 Last month
Rankings
Dependent packages count: 9.9%
Average: 32.8%
Dependent repos count: 55.7%
Maintainers (1)
Last synced: 6 months ago