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
    • spin.py: methods to implement dicke states of spin-1/2 systems

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.3.0.tar.gz (18.8 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.3.0-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for torchqc-1.3.0.tar.gz
Algorithm Hash digest
SHA256 272f8325593595318a597db68b085d4efbe604f94096c7d7915a8709d39796de
MD5 85a77b02936127a511486eda28389b6a
BLAKE2b-256 6d4068a2a51e4c6aef397ecf1c3c3f650def300c4eae54169a5d671b0ab76fcc

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for torchqc-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ceee07e2831c3648c2cfe5459d6c2bb503102730f4cf95952e8e3e429c529ef0
MD5 01677f27c3cc8a36208519e4f9385b53
BLAKE2b-256 3f08b08fbbc237a11513409715a29876928d17a3924f17bf20fd43a4bc4ff13f

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