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.2.0.tar.gz (18.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.2.0-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for torchqc-1.2.0.tar.gz
Algorithm Hash digest
SHA256 a6a225adfc29c9df7946bbefc4616d1ef14ec82831f3a17e251a9defad171d18
MD5 0b4c171ed9d79ba778a698673213a147
BLAKE2b-256 44086aa8b89d4a9d8859b3a05a291eb5921c2d208c32debfd6904d9be805d151

See more details on using hashes here.

File details

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

File metadata

  • Download URL: torchqc-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 20.6 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 30ebda926e476f06157fa42dac45fbae7076ff71770c231910e879341591044f
MD5 e18ac2e9abf60eb6a30be00512fe63f9
BLAKE2b-256 3e412f0ca8c19090825f2fa1d8d417706a3a96046f711bbcfad58eec7e62f458

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