Skip to main content

Quantum simulation library based on PyTorch

Project description

TorchQC: Quantum Dynamics and Machine Learning

Description

TorchQC is a Python library that is based on the PyTorch deep learning library. Quantum operations and dynamics are entirely implemented using the PyTorch tensor mechanism. This makes all generated data ready for use in Deep Learning models.

Contributors

Dimitris Koutromanos Dionisis Stefanatos Emmanuel Paspalakis

Repository structure

  • examples: a folder containing jupyter notebooks demonstrating how the library can be used

    • composite_system_dynamics.ipynb
    • correlation_functions.ipynb
    • coupled_qubits_plus_resonator.ipynb
    • coupled_qubits_resonator_BBNN_extra_costs.ipynb
    • coupled_qubits_resonator_BBNN.ipynb
    • coupled_spins_3lvl_system.ipynb
    • demonstrations.ipynb
    • Dynamical_blockade_coupled_bosonic_modes.ipynb
    • Dynamical_blockade_single_mode_bosonic_system.ipynb
    • Dynamical_blockade_single_mode_gaussian_pulses.ipynb
    • emission_spectum.ipynb
    • Jaynes_Cummings_model_cat_state.ipynb
    • Jaynes_Cummings_model_coherent_state.ipynb
    • Jaynes_Cummings_model.ipynb
    • Jaynes_Cummings_model_photon_number_parity_oscillations.ipynb
    • lambda_3lvl_system_BBNN.ipynb
    • lambda_3lvl_system_STIRAP.ipynb
    • Lossy_Jaynes_Cummings_model_coherent_state.ipynb
    • Lossy_Jaynes_Cummings_model.ipynb
    • optomechanical_system.ipynb
    • Quantum_Rabi_model.ipynb
    • qubit_rabi_oscillations.ipynb
    • single_bosonic_mode.ipynb
    • single_qubit_dynamics.ipynb
    • single_qubit_markovian_master_equation_fock_liouville.ipynb
    • single_qubit_markovian_master_equation_num_methods.ipynb
    • steadystate.ipynb
    • Two_operator_two_time_correlation_function.ipynb
  • LICENSE: license file

  • README.md: Readme Markdown file

  • requirements.txt: file with Python package requirements for running the library

  • torchqc: main library directory with the core source code

    • adams_bashforth_methods.py: Adams numerical methods for solving ordinary differential equations
    • common_functions.py: contains common useful functions
    • common_matrices.py: matrix representations of common quantum operators
    • correlation.py: methods to calculate correlation functions
    • dynamics.py: methods to solve quantum dynamics (i.e. Schrodinger equation, Lindblad master equation)
    • fock_liouville.py: methods to calculate operators useful for quantum dynamics in Fock-Liouville space
    • mappings.py: Lie algebra operations (commutator, anticommutator)
    • markovian.py: method to apply Lindblad dissipative operator
    • operators.py: Operator / DynamicOperator Python classes that represent arbitrary quantum operators (density matrix, Hamiltonian)
    • runge_kutta_methods.py: Runge-Kutta numerical methods for solving ordinary differential equations
    • states.py: QuamtumState class representing quantum state vector
    • tensor_product.py: methods that calculate tensor products (Kronecker products) of states or operators

Installation instructions

Alternative 1 (From PyPI)

  • Install package directly from PyPI
pip install torchqc

Alternative 2 (From source code)

  • Clone GitHub repository
git clone https://github.com/qoptics-qtech/torchqc.git
  • Setup Python virtual environment (Python 3 required)
python -m venv my_env
  • Activate venv
source my_env/bin/activate
  • Install required packages
pip install -r requirements.txt
  • Install package using src code
pip install .

Examples execution

The examples folder contains several examples that can be added into three main categories

  • Closed and Open Quantum system simulations
  • Quantum optimal control with machine learning
  • Quantum optics

All examples are implemented in jupyter notebooks and can be executed by any program that can execute a jupyter notebook, such as Visual Code Studio

Usage instructions

To use the library, after it is successfully installed, it is required to be added to the program scope using commands such as:

import torchqc

Or directly including the submodules of interest:

from torchqc.states import QuantumState

After the needed object is in scope, one can use it to perform quantum operations. The following code defines the ground state of a qubit system:

qubit_state = QuantumState.basis(2)[0]

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

torchqc-1.1.0.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

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

torchqc-1.1.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file torchqc-1.1.0.tar.gz.

File metadata

  • Download URL: torchqc-1.1.0.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for torchqc-1.1.0.tar.gz
Algorithm Hash digest
SHA256 aa2ba9c707e8109fdbcf217a3196726fdec21d3eed698f259da6b938f53f0f65
MD5 09d7072e1dfe834cfd4a8aeea44a3e14
BLAKE2b-256 88e5b235e657e63ccff5f54411e940b2e0ea744371d676a6610688eebc2396cb

See more details on using hashes here.

File details

Details for the file torchqc-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: torchqc-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for torchqc-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e6bf1146dce83c143e96886b9393d8b6929e2abfd4365ef8ebcb5363e017c05
MD5 0e20020fe74c30bc7897ad657a71bdf5
BLAKE2b-256 31a0d44df607edf1af77271e24255099d02aaa1a587298db9c9af929468b18eb

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