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

  • 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 (until it is officially released in Python Package Index PyPI)
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.0.0.tar.gz (17.1 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.0.0-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for torchqc-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e991d8af51be92f2f5b73ac865c2dfa334d2b03fe5564fc9a84acf0cd1d06428
MD5 7f46d4ee469b634ef4e4fc3dfc3679b4
BLAKE2b-256 df6de26f320dbbbf06dd36a18c6685fd175204a0f75af7b167f6f96eb417c7e9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for torchqc-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0850db99d36dd1af6b50e0b12b092a5a7d603982e66d5f58d0d9c64ed4429c00
MD5 17f123bd0c48f41d3dc7335d2e4e8ef4
BLAKE2b-256 b991bb5129731aeddac65757b2b7828bef24e8fdc1e558c86d90b293bab786fd

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