Skip to main content

Add your description here

Project description

RWA-Tools

A Python package for working with quantum Hamiltonians in the Rotating Wave Approximation (RWA) frame.

Overview

RWA-Tools provides a set of utilities for symbolic manipulation of quantum Hamiltonians, particularly focusing on applying the Rotating Wave Approximation to simplify time-dependent quantum systems. This package leverages SymPy for symbolic mathematics to represent and transform Hamiltonians.

Installation

pip install rwa-tools

For development installation:

git clone https://github.com/ograsdijk/rwa-tools.git
cd rwa-tools
pip install -e .

Features

  • Symbolic representation of quantum Hamiltonians
  • Application of the Rotating Wave Approximation (RWA)
  • Unitary transformations to rotating frames
  • Handling of multi-level quantum systems
  • Simplification of time-dependent Hamiltonians

Usage Examples

Creating a Symbolic Hamiltonian

import matplotlib.pyplot as plt
import networkx as nx
import sympy as smp

from rwa_tools import (
    create_coupling_graph,
    create_hamiltonian_symbolic,
    create_hamiltonian_rwa,
)
from rwa_tools.graph_transform import create_transform_matrix

# Define your quantum system
nstates = 5
couplings = [[(0, 4), (1, 4)], [(2, 4), (3, 4)], [(1, 3)], [(0, 4), (1, 4)]]

# Create the Hamiltonian and coupling graph
hamiltonian = create_hamiltonian_symbolic(couplings, nstates)
coupling_graph = create_coupling_graph(couplings, nstates=nstates)

# Visualize the coupling graph
fig, ax = plt.subplots()
nx.draw(coupling_graph)

Applying RWA Transformation

from rwa_tools import (
    create_coupling_graph,
    create_hamiltonian_symbolic,
    create_hamiltonian_rwa,
)
from rwa_tools.graph_transform import create_transform_matrix

# Define your quantum system
nstates = 5
couplings = [[(0, 4), (1, 4)], [(2, 4), (3, 4)], [(1, 3)], [(0, 4), (1, 4)]]
hamiltonian = create_hamiltonian_symbolic(couplings, nstates)
coupling_graph = create_coupling_graph(couplings, nstates=nstates)

# Create transformation matrix from coupling graph
T = create_transform_matrix(coupling_graph, hamiltonian.coupling_symbol_paths)

# Apply RWA transformation
hamiltonian_rwa = create_hamiltonian_rwa(hamiltonian, T)

# Print the resulting RWA Hamiltonian
print(hamiltonian_rwa.hamiltonian)

Working with Independent Subsystems

from rwa_tools import (
    create_coupling_graph,
    split_into_independent_components,
    create_hamiltonian_symbolic,
    split_hamiltonian_by_components,
)

# Define a system with independent components
nstates = 7
couplings = [[(0, 2), (1, 2)], [(3, 5), (4, 5)]]
hamiltonian = create_hamiltonian_symbolic(couplings, nstates)
coupling_graph = create_coupling_graph(couplings, nstates=nstates)

# Split into independent components
independent_graphs = split_into_independent_components(coupling_graph)

# Split the Hamiltonian by components
independent_hamiltonians = split_hamiltonian_by_components(
    hamiltonian, independent_graphs
)

# Access individual subsystem Hamiltonians
print(independent_hamiltonians[0].total)
print(independent_hamiltonians[1].total)

API Documentation

Core Classes

  • HamiltonianSymbolic: Represents a symbolic quantum Hamiltonian in the lab frame
  • HamiltonianRWA: Represents a quantum Hamiltonian in the rotating wave approximation frame

Key Functions

  • create_hamiltonian_symbolic: Create a symbolic representation of a quantum Hamiltonian
  • create_coupling_graph: Create a graph representing couplings between quantum states
  • create_hamiltonian_rwa: Generate a Hamiltonian in the RWA frame from a lab-frame Hamiltonian and unitary transformation
  • create_transform_matrix: Create a transformation matrix based on the coupling graph
  • split_into_independent_components: Split a graph into independent connected components
  • split_hamiltonian_by_components: Split a Hamiltonian into independent subsystems

Mathematical Background

The Rotating Wave Approximation is a technique used in quantum optics and quantum mechanics to simplify the treatment of time-dependent systems. The transformed Hamiltonian is calculated using:

$H_{RWA} = U^{\dagger}HU - i\hbar U^{\dagger}(\partial U/\partial t)$

Where $U$ is the unitary transformation matrix and $H$ is the original Hamiltonian.

License

This project is licensed under the MIT License - see the LICENSE file 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

rwa_tools-0.1.0.tar.gz (29.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rwa_tools-0.1.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file rwa_tools-0.1.0.tar.gz.

File metadata

  • Download URL: rwa_tools-0.1.0.tar.gz
  • Upload date:
  • Size: 29.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for rwa_tools-0.1.0.tar.gz
Algorithm Hash digest
SHA256 80707fce572bf91a95c4ccb0f9eba3b3cf39bbb0abcfe0a992cd749b5059df27
MD5 6c1eddb723b385d623a0181b6710faa1
BLAKE2b-256 4f8b1f349321ee7c22a42e31b19ff702523b364c59e630fbbe702658c09908e1

See more details on using hashes here.

File details

Details for the file rwa_tools-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rwa_tools-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for rwa_tools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e3dd71c2f102c237ba07ff54d5ab867c6f6c8b4cfb384aa52cf496af4b40a5b1
MD5 d636acc2c609ce67e7c84f3866f7e89c
BLAKE2b-256 65542d475ff149a458a48de565f84ec716b824d7b3de2e44f0e1a79496a27035

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page