Source-linked AI summary

QuTiP 5: The Quantum Toolbox in Python

Neill Lambert, Eric Giguère, Paul Menczel, Boxi Li, Patrick Hopf, Gerardo Suárez, Marc Gali, Jake Lishman, Rushiraj Gadhvi, Rochisha Agarwal, Asier Galicia, Nathan Shammah, Paul Nation, J. R. Johansson, Shahnawaz Ahmed, Simon Cross, Alexander Pitchford, Franco Nori

arXiv:2412.04705v2quant-ph

TL;DR

QuTiP v5 addresses the need for accessible, reproducible tools that can handle quantum noise, dynamics, circuits, and large state spaces. It introduces a generalized data layer and expands solvers, circuit tools, and quantum-control capabilities, with examples illustrating the resulting applications. The release is intended to keep QuTiP relevant as an open-source toolkit, while maintainability and some feature-support boundaries remain ongoing concerns.

  • Problem

    Practical quantum simulations face large Hilbert spaces and require broadly accessible open-source tools for quantum noise, dynamics, and circuits.

  • Method

    QuTiP v5 generalizes its data layer and adds or improves solvers, quantum-circuit support, and quantum-control tools, with examples documenting their use.

  • Results

    The examples demonstrate applications of QuTiP’s existing and new solvers and features, including support for flexible environment descriptions and quantum-circuit workflows.

  • Takeaways & Limitations

    QuTiP v5 enables the toolkit to remain relevant as the open-source quantum-software community grows.

  • Takeaways & Limitations

    Some decomposition methods currently support only bosonic environments, not all gates decompose into hardware-native gates, and non-core features may become difficult to maintain.

Abstract

from arXiv · show

QuTiP, the Quantum Toolbox in Python, has been at the forefront of open-source quantum software for the past 13 years. It is used as a research, teaching, and industrial tool, and has been downloaded millions of times by users around the world. Here we introduce the latest developments in QuTiP v5, which are set to have a large impact on the future of QuTiP and enable it to be a modern, continuously developed and popular tool for another decade and more. We summarize the code design and fundamental data layer changes as well as efficiency improvements, new solvers, applications to quantum circuits with QuTiP-QIP, and new quantum control tools with QuTiP-QOC. Additional flexibility in the data layer underlying all ``quantum objects'' in QuTiP allows us to harness the power of state-of-the-art data formats and packages like JAX, CuPy, and more. We explain these new features with a series of both well-known and new examples. The code for these examples is available in a static form on GitHub and as continuously updated and documented notebooks in the qutip-tutorials package.

1. Introduction

QuTiP v5 modernizes the toolkit around a flexible data layer, expanded solver interfaces, and modular subpackages. The release supports new data formats and hardware-oriented packages while documenting their use through examples and benchmarks.

  • 1.1. QuTiP v5: QuTiP v5 generalizes quantum objects beyond CSR to support formats including Dense, Dia, and JAX-based representations.Objects can be converted between formats, allowing the data type to be chosen for a particular task.
  • 1.1. Additional substantial changes: QuTiP v5 adds solver class interfaces, new differential-equation integration methods, updated tutorials, and unit-test-driven bug fixes.The unified solver interface is especially useful when reusing Hamiltonian data across many simulations, where speed-ups can become significant.
  • 1.1. Additional substantial changes: QuTiP-QIP and QuTiP-QOC move circuit simulation and optimal control into subpackages, reducing core-package maintenance complexity and dependency risk.The project uses this family-subpackage strategy to keep feature-rich capabilities separate from core functionality.
  • 1. Introduction: The article demonstrates QuTiP features through examples that expose unusual use cases and compare the validity regimes of different solvers.Examples cover open-system dynamics, including cases where advanced solvers reveal limitations of simpler phenomenological models.
  • 1.1. QuTiP v5: The new data layer enables integration with JAX and exploration of CuPy, TensorFlow, and tensor-network formats for GPU acceleration and automatic differentiation.QuTiP-JAX was released alongside v5, while additional data-layer implementations remain under development.

Basic example.

QuTiP v5 expands Monte Carlo results and execution options, supporting parallel trajectory analysis, convergence-aware sampling, and direct comparison with master-equation states.

  • Parallel mapping simulates trajectories across multiple CPU cores, while keep_runs_results stores individual trajectories alongside the ensemble average.
  • Given sufficiently many trajectories, average_states approximates the states returned by the regular master equation solver.
  • The result object now provides a photocurrent property, replacing the photocurrent_sesolve() stochastic methods from earlier releases.

Changes in v5.

QuTiP v5 expands Monte Carlo and open-system solver capabilities while adding Floquet, stochastic, HEOM, and Bloch–Redfield functionality. These developments support more flexible simulations, though some methods require convergence checks or have physical-scope limitations.

  • Monte Carlo solvers: QuTiP v5 adds an improved Monte Carlo sampling algorithm for cases with very small dissipation rates.The algorithm addresses inefficient trajectories containing no jumps and only deterministic evolution.
  • Monte Carlo solvers: Mixed initial states are supported by running trajectories for each pure component and weighting them correctly in the final average.Users can control trajectory allocation manually or select it automatically from the requested total.
  • Monte Carlo solvers: The non-Markovian solver nm_mcsolve() maps time-local master equations with potentially negative rates to an equivalent Lindblad equation using an influence martingale.The reconstructed state is obtained by averaging trajectory states weighted by the influence martingale.
  • Monte Carlo solvers: Using only 1000 trajectories, the MCWF simulation reproduces mesolve() and heomsolve() solutions well in the demonstrated non-Markovian example.The influence martingale fluctuates when γ(t) is negative, and its deviation from tr ρ(t) = 1 indicates Monte Carlo convergence.
  • Floquet and related solvers: The Floquet method has computational time that is, on average, independent of the target evolution time, while agreeing with direct integration at stroboscopic times.Its overhead is disadvantageous when the target time is not long enough to offset computing at least one full period.
  • Floquet and related solvers: QuTiP v5 includes fmmesolve() for time-periodic Hamiltonians coupled to dissipative baths, but generalized Floquet methods can yield unphysical results when dissipation is too large.The package also supports Bloch–Redfield environments and non-secular, non-Lindblad equations through brmesolve().

Basic example.

The HEOM example constructs an underdamped bosonic environment, approximates its correlation function with a finite exponential decomposition, and uses that approximation for hierarchical simulation. The setup makes the approximation’s effect directly comparable with exact bath quantities and other solver results.

  • Environment construction: An underdamped bosonic environment is initialized from the spectral-density parameters λ, γ, T, and ω0.The environment object retains the exact bath description before approximation.
  • Environment approximation: The bath is approximated with a Matsubara series using truncation parameter Nk = 5 for HEOM simulation.The finite decomposition introduces an approximation to the true bath dynamics.
  • Environment approximation: Exact and approximated correlation functions, spectral densities, and power spectra can be computed side by side to assess the bath approximation.This comparison makes the impact of the Matsubara or Padé decomposition straightforward to inspect.
  • HEOM simulation: HEOMSolver uses the approximated bath, its coupled system operator Q, the system Hamiltonian, and max_depth = 9 to solve the hierarchy equations.The max_depth parameter specifies the hierarchy cutoff Nc.
  • HEOM simulation: QuTiP’s environment class supports several decompositions of arbitrary environments into the decaying-exponential form required by HEOMSolver.Most currently available decomposition methods work only for bosonic environments; fermionic support is planned for the near future.

Ohmic bath with exponential cutoff.

QuTiP provides multiple ways to construct and fit Ohmic environments for HEOM simulations, including spectral-density and correlation-function approaches. These tools support studies of nontrivial bath effects and comparisons among master-equation solvers.

  • QuTiP’s OhmicEnvironment class supports fitting either the bath correlation function or spectral density for HEOM simulations.The fitting routines produce exponential decompositions suitable for HEOMSolver.
  • The fitting output includes a BosonicEnvironment object and fit information that helps select the number of exponents, especially for non-standard baths.Non-standard baths may require more exponents for accurate representation, even at high temperatures.
  • The fitted bath can be passed directly to HEOMSolver to obtain the system dynamics.The example constructs HEOMSolver with the fitted correlation-function environment.
  • Figure 12 illustrates fitting an Ohmic spectral density with exponential cut-off using underdamped Brownian motion spectral densities.
  • Bath spectral-density structure can produce nontrivial effects such as the spin-boson localization-delocalization transition.At zero temperature, increasing bath coupling is associated with a transition from delocalized to apparently localized long-time behavior.

Zero temperature and the localization-delocalization phase transition.

QuTiP’s environment and visualization tools support zero-temperature bath studies, including the spin-boson localization-delocalization transition. The section also demonstrates broader v5 capabilities for visualizing, truncating, differentiating, and simulating quantum dynamics.

  • Zero temperature and the localization-delocalization phase transition.: At zero temperature, fitting the correlation function rather than the spectral density is required because the correlation function is non-exponential.The correlation function is obtained after constructing a BosonicEnvironment.
  • Zero temperature and the localization-delocalization phase transition.: Increasing bath coupling drives the system from a localized state to a delocalized state in the spin-boson phase-transition example.
  • Visualization: QuTiP provides visualization utilities for expectation values, Bloch spheres, Wigner functions, and Husimi functions.
  • Visualization: The Wigner function reveals negative values for a Schrödinger cat state, whereas the Husimi-Q function is non-negative by definition.
  • Visualization: QuTiP v5 adds automated animation tools for commonly used quantum-state visualizations and a colorblind-safe plotting palette.
  • Excitation number restricted states: Excitation-number restriction can reduce large composite-system simulations to a limited-excitation subspace.The approach is useful for many subsystems and can also truncate systems whose Hamiltonians do not conserve excitation number.
  • Excitation number restricted states: The waveguide example uses a 23-state space instead of 2^22 states from a brute-force Fock-space truncation.The mode occupations show excitation transport and dependence on the mirror reflection phase.
  • Additional QuTiP v5 features: JAX automatic differentiation is used in QuTiP-QOC to differentiate control objectives and optimize pulse shapes.

Counting statistics of an open quantum system..

QuTiP implements full counting statistics by introducing a counting field into a modified master equation and differentiating the resulting state. The example recovers analytical current and shot-noise values numerically.

  • Full counting statistics describes the distribution of exchanged excitations and yields observables such as current and shot noise.
  • The tilted density operator G(z,t) encodes jump-conditioned states through the counting field z.At z = 0, it reduces to the ordinary density operator and Lindblad equation.
  • JAX automatic differentiation obtains first and second counting-field derivatives directly from the solved dynamics.The example monitors jumps through a counting-field-modified reservoir coupling.
  • JAX auto-differentiation runs on CPU or GPU, with the example executing on a GPU without code modifications.
  • 0.5 analytic current versus 0.4999 numerical current demonstrates agreement for the current calculation.
  • 0.25 analytic shot noise versus 0.25125 numerical shot noise demonstrates agreement for the second cumulant.

Derivatives of a driven Rabi model..

This section combines a driven dissipative qubit model with QuTiP-JAX automatic differentiation and trajectory-solver parallelization. It also describes MPI-based distribution of trajectories across high-performance computing resources.

  • The driven qubit includes energy splitting, Rabi and driving frequencies, Pauli operators, and Lindblad energy relaxation through C = √γσ−.
  • JAX automatic differentiation computes the gradient of the final excited-state population with respect to the driving frequency ω using QuTiP’s Monte Carlo solver.
  • The example configures JAX as QuTiP’s backend, defines a JIT-compiled cosine drive, and returns the final excited-state population from mcsolve().
  • QuTiP v5 replaces the trajectory solvers’ map_func argument with a map option supporting serial, parallel, loky, and mpi execution.
  • MPI execution uses MPI for Python’s MPIPoolExecutor to parallelize trajectories across worker processes and nodes, with num_cpus controlling worker-process count.
  • MPI setup depends on the available MPI implementation and job scheduler, and MPIPoolExecutor may require an mpiexec workaround when MPI_Comm_spawn is unavailable.

4. QuTiP’s other main packages

QuTiP v5 reorganizes major functionality into independent sub-packages while expanding quantum optimal control. QuTiP-QOC adds new optimization capabilities alongside existing GRAPE and CRAB methods.

  • QuTiP v5 moves large independent features into distinct sub-packages to reduce core dependencies, improve maintainability, and support data-layer plug-ins.
  • QuTiP-QOC includes GRAPE and CRAB from QuTiP-QTRL plus two new methods, GOAT and JOPT, within a general control framework.
  • GOAT and JOPT use analytic control functions and can optimize the system evolution time, while all pulse routines support global and local parameter searches.
  • QuTiP-QOC supports parameterized analytic controls, local and global searches, variable evolution time, and multi-objective optimization.
  • The Hadamard-gate example applies these methods to parameterized σx, σy, and σz controls for a dissipative qubit.

Basic example of optimal control: optimizing the Hadamard gate.

The Hadamard-gate example compares QuTiP-QOC optimization methods for a dissipative single qubit. It defines drift and control Hamiltonians, supports multiple objectives, and evaluates the resulting controls through a common result object.

  • The qubit model uses independent σx, σy, and σz control functions, a drift Hamiltonian with energy splitting ω and tunneling rate δ, and damping rate γ.
  • For open-system map synthesis, the default objective minimizes trace distance to the target channel; closed-system gate synthesis minimizes overlap with the target gate.
  • GRAPE optimizes evenly spaced piecewise-constant pulse amplitudes by minimizing infidelity and updating controls from derivatives of discretized forward and backward evolution.
  • CRAB expands continuous-time controls in a random basis and optimizes the expansion coefficients, with support for multiple objectives and domain-informed initial frequencies.
  • GOAT uses analytic control functions and computes parameter derivatives through coupled equations of motion after numerical forward integration.
  • JOPT extends the control optimization to the overall time evolution, enabling faster convergence through time as an additional optimization parameter.
  • The qoc.Result object provides common optimization metrics and optimized_controls for comparing the algorithms after global and local optimization.
  • QuTiP-QIP integrates circuit unitaries with QuTiP objects, optimal-control packages, and open-system solvers for pulse-level simulation with realistic noise.

5. QuTiP’s community

QuTiP is developed as an open, globally distributed community with volunteer, student, institutional, and nonprofit support. Its ecosystem includes numerous dependent and interfacing libraries for quantum simulation and control.

  • QuTiP welcomes community contributions through an active mailing list, while a largely voluntary team limits participation mainly by available development time.
  • A global administration team reviews code, contributes features, and plans development, with a governance board resolving serious conflicts and advising on major decisions.
  • RIKEN remains a development focus within the global team, including contributions such as HEOM expansion, QuTiP-QOC, a general environment class, and an experimental tensor-network data layer.
  • NumFOCUS supports QuTiP through Google Summer of Code mentoring and periodic mini-grants, while the Unitary Foundation provides micro-grants, hackathon bounties, and community visibility.
  • The qutip.Qobj class has enabled an ecosystem of 733 GitHub repositories and 83 released packages that depend on QuTiP.
  • Related packages include Krotov, SCqubits, Sqcircuit, Dynamiqs, Qibo, Pulser, NVIDIA CUDA-Q, and Qiskit, which use QuTiP for control, circuit, visualization, or simulation capabilities.

6. Future development

QuTiP’s future development targets state-of-the-art performance, cloud-hardware support, and continued maintainability while expanding its role as an independent quantum-software platform. Planned additions include common physical models and broader processor support, alongside efforts to address the risk that some subpackages become poorly maintained.

  • 6. Future development: QuTiP aims to maintain its academic independence while improving quantum-computing simulation and cloud-backend support.The stated future direction is a system-agnostic platform able to access hardware platforms across industrial and academic settings.
  • 6. Future development: Maintainability remains a strategic goal because subpackages may become abandoned as developers change tasks and academic funding fluctuates.The administration identifies solutions to this common open-source problem as an important future objective.
  • 6. Future development: Future releases may add a library of common Hamiltonians and master equations for physical systems encountered by academics and educators.The models are initially planned as Python functions in QuTiP core, with possible later export to a common format.

Hamiltonian library.

QuTiP-QIP plans to broaden its processor library across physical systems and connect this expansion to common models and longer-term cloud access to hardware QPUs.

  • Hamiltonian library.: QuTiP-QIP plans to add processors for a larger range of physical systems.The extension is intended to tie into a common Hamiltonian library and eventually support physical hardware through cloud API services.

Simulating QPUs.

QuTiP-QIP plans tutorials that show how to construct models of different quantum processors, complementing its predefined processor offerings.

  • Simulating QPUs.: Tutorials will demonstrate how to create models for different types of quantum processors beyond predefined QPUs.

QIP Tutorials.

QuTiP plans to preserve state-of-the-art support for open quantum systems by incorporating broadly useful methods and improving solver efficiency. Candidate developments include cumulant-expansion methods and non-Markovian master-equation approaches.

  • QIP Tutorials.: Future solver development will target broadly useful open-quantum-system methods and faster, more efficient solvers.
  • QIP Tutorials.: Candidate methods include iterative operator-equation construction, sometimes called cumulant expansion, and time-convolutionless non-Markovian master-equation truncation.

More and faster solvers.

QuTiP v5 expands parallelism across GPUs, CPU cores, multiple nodes, and optimized underlying libraries while exploring tensor-based methods and broader language support. These developments aim to improve simulation speed and scale while preserving QuTiP’s open-source relevance.

  • GPU support includes custom data layers such as JAX and the in-development cuquantum layer.
  • Parallel execution spans explicit multi-core functions, naturally parallel stochastic and Monte Carlo solvers, and multiple nodes through MPI.
  • Underlying libraries such as Intel-MKL can accelerate ODE solving and steady-state calculations through multi-core execution.
  • The qutip-cuquantum data layer is being developed with NVIDIA to distribute mesolve and sesolve simulations across multiple GPUs.The symbolic problem representation is intended to support speed-ups and larger simulations than single-core CPU execution.
  • QuTiP v5 began exploring tensor-network representations, including MPS, MPOs, and other truncation methods, for structured many-body problems.These methods exploit algebraic structure and are useful for certain one-dimensional spin-chain simulations.
  • QuTiP’s ecosystem is extending beyond Python through QuantumToolbox.jl, a Julia package aiming for syntax compatibility and related solver support.

Appendix A. Tables

Appendix A supplies reference tables, while the accompanying tutorials modernize QuTiP examples and demonstrate time-dependent objects, dynamics, noise, and solver workflows. Together, they connect concise API summaries with practical demonstrations across common quantum models.

  • Appendix A. Tables: Appendix A provides tables covering Qobj methods, superoperator functions, entropy and entanglement measures, and commonly used metrics.
  • The v5 notebooks are being unified, modernized, made more compact with Markdown, and equipped with rudimentary functionality tests.The tests also provide an additional check of QuTiP itself.
  • QobjEvo represents time-dependent quantum objects using coefficients expressed as functions, strings, or arrays, with intermediate array times interpolated by cubic splines.
  • The tutorials demonstrate sesolve for Larmor precession, time-dependent magnetic fields, Bloch-sphere visualization, and observable expectation values.
  • mesolve examples cover noisy qubit dynamics, the Rabi model, Heisenberg spin chains, dephasing, relaxation, and visualization of resulting states.
  • Monte Carlo tutorials use mcsolve to reproduce cavity photon creation and annihilation under thermal noise for different trajectory counts.

Appendix B.1.7. 0007_brmesolve_tls

The tutorials extend QuTiP’s solver demonstrations from Bloch-Redfield calculations and time-dependent dissipation to Floquet, non-Markovian, measurement, steady-state, and quantum-circuit applications. They also document scope boundaries and provide repositories for updated and legacy examples.

  • 0007_brmesolve_tls: The Bloch-Redfield tutorial constructs the superoperator equation-of-motion tensor and uses it to calculate steady states for a two-level system.
  • Bloch-Redfield time-dependent coupling requires a Hermitian environmental operator, with complex dependence implemented through conjugate operator-function pairs.
  • For strong light–matter coupling, local Lindblad dissipation can produce unphysical continuous cavity emission, whereas Bloch-Redfield treatment is presented as the more physically accurate approach.
  • The non-Markovian Monte Carlo tutorial covers time-dependent and sometimes negative rates, with MPI used to solve trajectories in parallel on a cluster.
  • Additional tutorials demonstrate heterodyne and inefficient photodetection, nonlinear Kerr resonators, steady-state solvers, periodic dissipative steady states, and photonic correlations.
  • QuTiP-QIP tutorials range from CNOT and Toffoli circuits and OpenQASM exchange to quantum algorithms including the Quantum Fourier transform and Deutsch–Jozsa algorithm.
Loading 2412.04705v2…