QuTiP 5
Scope
Use QuTiP for finite-dimensional quantum mechanics, quantum optics, Lindblad
dynamics, trajectories, weak-coupling Bloch-Redfield models, and specialized
Floquet, HEOM, and permutational-invariance methods. It is not a hardware
execution SDK. Circuit and control functionality moved to separate QuTiP family
packages.
This skill targets QuTiP 5.3.0, released 2026-05-22. QuTiP 5.3 requires
Python 3.11 or newer. Its required distributions are NumPy (>=1.23.2), SciPy
(>=1.9.2, excluding 1.16.0 and 1.17.0), and packaging.
Reproducible uv snapshot
Create a dedicated environment and pin every direct distribution:
uv venv --python 3.11
uv pip install "qutip==5.3.0"
For plots:
uv pip install "qutip[graphics]==5.3.0"
Optional QuTiP family packages are independently versioned:
uv pip install "qutip-qip==0.4.2"
uv pip install "qutip-qtrl==0.2.0"
uv pip install "qutip-jax==0.1.1"
qutip-qip 0.4.2 (2026-06-23) is the production/stable circuit, gate, and
noisy-device simulation package. Import from qutip_qip, not qutip.qip.
qutip-qtrl 0.2.0 (2026-06-23) provides GRAPE and CRAB quantum optimal
control. It is not a trajectory viewer. Import from qutip_qtrl, not
qutip.control; PyPI still classifies it pre-alpha.
qutip-jax 0.1.1 (2025-05-29) is the official JAX data backend for GPU and
automatic-differentiation experiments. It is explicitly pre-alpha.
qutip-cupy is an official QuTiP-organization repository, but it has no PyPI
release and its own README says it is not officially released. Do not put an
unreleased Git install into a reproducible workflow.
Use a project lockfile or a hash-generating uv pip compile workflow when
transitive dependency identity must also be frozen.
Non-negotiable model contract
Before solving, record:
- Units and convention. QuTiP equations normally set (\hbar=1).
Hamiltonian entries are angular frequencies and rates have reciprocal-time
units. Convert cyclic frequency with (2\pi f); never mix Hz and rad/s.
- Subsystem order.
tensor(A, B, C) fixes subsystem indices 0, 1, 2.
Preserve that order in every state, operator, collapse channel, and partial
trace. obj.ptrace([0, 2]) keeps those subsystems; it does not trace them.
- State validity. Check ket norm or density-matrix Hermiticity, unit trace,
and eigenvalues above a stated negative tolerance. Tiny negative values may
be numerical; material negativity invalidates a claimed state.
- Generator meaning. A Lindblad channel with rate
gamma is represented
by sqrt(gamma) * A, not gamma * A. Define what each rate measures. For
example, sqrt(gamma_phi / 2) * sigmaz() gives coherence decay
exp(-gamma_phi * t).
- Approximations. State rotating-wave, Born-Markov, secular, weak-coupling,
bath-equilibrium, truncation, symmetry, and initial-factorization assumptions
wherever used.
- Numerics. Justify Hilbert truncation, output grid, integration method,
tolerances, trajectory count, and random seeds. Report
result.stats.
- Convergence. Sweep every artificial cutoff: Fock dimension, time/frequency
window and spacing, ODE tolerances, trajectories, Floquet harmonics, HEOM
depth and bath exponents, or PIQS representation as applicable.
Qobj, dimensions, and tensor order
Prefer explicit imports and inspect both shape and structured dimensions:
from qutip import basis, qeye, sigmaz, tensor
psi = tensor(basis(2, 0), basis(3, 1))
z_on_first = tensor(sigmaz(), qeye(3))
assert psi.shape == (6, 1)
assert psi.dims == [[2, 3], [1]]
assert z_on_first.dims == [[2, 3], [2, 3]]
rho_first = psi.proj().ptrace(0) # keep subsystem 0
Matrix shape alone is insufficient: two objects can both be 6-by-6 but encode
different tensor factorizations. Read references/core_concepts.md before
building composite, superoperator, or channel models.
Choose the solver by physics
| Model |
Current API |
Required justification |
| Closed, pure, unitary |
sesolve |
Hermitian Hamiltonian; no dissipation |
| Lindblad/open or mixed |
mesolve |
Markovian completely positive model and channel rates |
| Quantum jumps |
mcsolve |
Unravelling, trajectory convergence, seeds |
| Microscopic weak bath |
brmesolve |
Born-Markov/weak coupling, spectra, secular choice |
| Diffusive measurement |
ssesolve, smesolve |
monitored versus unmonitored channels |
| Periodic drive |
FloquetBasis, fsesolve, fmmesolve |
verified period and Floquet convergence |
| Structured non-Markovian bath |
qutip.solver.heom |
bath expansion and hierarchy convergence |
| Symmetric spin ensemble |
qutip.piqs |
permutation symmetry and basis choice |
Do not select a more specialized solver merely because it exists.
Deterministic open-system example
QuTiP 5.3 uses ordinary option dictionaries. Solver controls, e_ops, and
args are keyword-only; the old mutable options object is gone.
import numpy as np
from qutip import basis, mesolve, sigmam, sigmaz
omega = 2.0
gamma = 0.15
tlist = np.linspace(0.0, 20.0, 401)
excited = basis(2, 0)
result = mesolve(
0.5 * omega * sigmaz(),
excited,
tlist,
c_ops=[np.sqrt(gamma) * sigmam()],
e_ops={"sigma_z": sigmaz(), "excited": excited.proj()},
options={
"method": "adams",
"atol": 1e-10,
"rtol": 1e-8,
"store_final_state": True,
"progress_bar": "",
},
)
population = np.asarray(result.e_data["excited"])
assert np.max(np.abs(population - np.exp(-gamma * tlist))) < 2e-6
assert isinstance(result.stats, dict)
If the problem is stiff, compare bdf or lsoda; do not change an integrator
without rerunning tolerance and invariant checks. QuTiP 5.3 also supports
options={"matrix_form": True} in mesolve; benchmark and validate it before
using it as a default.
Time-dependent systems
Prefer trusted Pythonic callables or numeric coefficient arrays. Do not create
coefficient source strings from user input.
import numpy as np
from qutip import QobjEvo, sigmax, sigmaz
def envelope(t, amplitude, center, width):
return amplitude * np.exp(-0.5 * ((t - center) / width) ** 2)
H = QobjEvo(
[0.5 * sigmaz(), [sigmax(), envelope]],
args={"amplitude": 0.2, "center": 5.0, "width": 1.0},
)
instantaneous_H = H(5.0)
H.arguments(amplitude=0.1)
The older f(t, args) coefficient signature is deprecated in 5.3 and is
scheduled for removal in 5.5. See references/time_evolution.md.
Trajectories and stochastic solvers
import numpy as np
from qutip import basis, mcsolve, sigmam, sigmaz
tlist = np.linspace(0.0, 10.0, 201)
result = mcsolve(
0.5 * sigmaz(),
basis(2, 0),
tlist,
[np.sqrt(0.2) * sigmam()],
e_ops=[basis(2, 0).proj()],
ntraj=400,
seeds=20260723,
options={"keep_runs_results": False, "progress_bar": ""},
)
Report ntraj, result.seeds, uncertainty or repeated-seed sensitivity, and
whether individual runs were retained. Reuse seeds=previous_result.seeds only
when paired trajectories are intentional. ssesolve and smesolve use the
boolean heterodyne argument, not legacy integer noise codes.
Steady states, spectra, and phase space
import numpy as np
from qutip import QFunc, liouvillian, operator_to_vector, qfunc, steadystate
rho_ss = steadystate(H, c_ops, method="direct")
residual = (liouvillian(H, c_ops) * operator_to_vector(rho_ss)).norm()
assert residual < 1e-9
xvec = np.linspace(-5.0, 5.0, 151)
Q_once = qfunc(rho_ss, xvec, xvec)
q_many = QFunc(xvec, xvec)
Q_again = q_many(rho_ss)
assert Q_once.shape == (len(xvec), len(xvec))
For wigner, qfunc, and QFunc, array element [j, k] corresponds to
yvec[j], xvec[k]. In QuTiP 5.3, QFunc is initialized with fixed
coordinates and called with a state; it has no .eval method. This skill never
uses Python dynamic-code execution. Prefer plot_wigner, Result.plot_expect,
or explicit Matplotlib axes as documented in references/visualization.md.
Direct spectrum is a stationary steady-state spectrum. An FFT of a finite
correlation requires explicit checks for tail decay, timestep aliasing,
frequency resolution, window sensitivity, and transform convention. See
references/analysis.md.
Advanced boundaries
- Import HEOM from
qutip.solver.heom; the legacy QuTiP 4 nonmarkov HEOM
namespace is stale.
- Use
FloquetBasis for modes and quasi-energies. Verify
H(t + T) == H(t) numerically and sweep basis/truncation choices.
- Access PIQS with
from qutip import piqs. Dicke.pisolve is only the
optimized diagonal-state/diagonal-Hamiltonian route; general Dicke-basis
dynamics use the Liouvillian with mesolve.
brmesolve can violate positivity, especially without secularization. Check
density-matrix eigenvalues over time.
- QIP and optimal control are extension-package concerns. Never present local
simulation as quantum-hardware execution.
See references/advanced.md for HEOM, Floquet, PIQS, stochastic, and extension
boundaries.
Safe local CLIs
All bundled tools are local-only, emit strict JSON, reject non-finite JSON and
unknown keys, and never load pickle files or executable model code. Simulation
imports are lazy, so every --help works without QuTiP installed.
| Script |
Purpose |
scripts/qobj_model_validator.py |
Validate bounded Qobj model JSON, dimensions, states, rates, and role compatibility |
scripts/two_level_simulation.py |
Run a bounded two-level Lindblad or jump simulation |
scripts/solver_config_planner.py |
Select a current solver and option/checklist plan |
scripts/convergence_sweep.py |
Sweep tolerances/grid size or trajectory count on a synthetic model |
scripts/result_audit.py |
Audit JSON output without deserializing Python objects |
scripts/steady_state_spectrum_planner.py |
Plan bounded steady-state and direct/FFT spectral checks |
Example:
python skills/qutip/scripts/two_level_simulation.py --help
python skills/qutip/scripts/two_level_simulation.py \
--decay-rate 0.2 --t-final 10 --time-points 201 \
--output two-level.json
python skills/qutip/scripts/result_audit.py two-level.json
Completion checklist
- Record units, (\hbar), tensor order, initial state, channels, and model
assumptions.
- Validate Hermiticity, norm/trace, positivity, dimensions, and generator units.
- Pin QuTiP and direct extensions; record platform, Python, NumPy, and SciPy.
- Inspect result options and stats; do not assume states were stored.
- Perform cutoff, grid, tolerance/integrator, and stochastic convergence sweeps.
- Save portable numeric/configuration summaries as JSON or text. Do not load
untrusted QuTiP object/result files because object serialization can execute
code.
References
references/core_concepts.md — Qobj, dimensions, tensor products, states,
channels, and unit conventions
references/time_evolution.md — current solver signatures, options, results,
QobjEvo, trajectories, and numerical controls
references/analysis.md — physical-state audits, steady states,
correlations, spectra, and convergence
references/visualization.md — Wigner, Q functions, QFunc, Bloch, result,
and matrix plots
references/advanced.md — Bloch-Redfield, stochastic, Floquet, HEOM, PIQS,
and QuTiP family package boundaries
Dated official sources
Verified 2026-07-23:
1---2name: qutip3description: Simulate and audit closed and open quantum-system models with QuTiP 5, including deterministic, trajectory, steady-state, spectral, and phase-space workflows. Use for local quantum-dynamics work where physical assumptions, dimensions, and numerical convergence must be explicit.4license: MIT5---67# QuTiP 589## Scope1011Use QuTiP for finite-dimensional quantum mechanics, quantum optics, Lindblad12dynamics, trajectories, weak-coupling Bloch-Redfield models, and specialized13Floquet, HEOM, and permutational-invariance methods. It is not a hardware14execution SDK. Circuit and control functionality moved to separate QuTiP family15packages.1617This skill targets **QuTiP 5.3.0**, released 2026-05-22. QuTiP 5.3 requires18Python 3.11 or newer. Its required distributions are NumPy (`>=1.23.2`), SciPy19(`>=1.9.2`, excluding `1.16.0` and `1.17.0`), and `packaging`.2021## Reproducible uv snapshot2223Create a dedicated environment and pin every direct distribution:2425```bash26uv venv --python 3.1127uv pip install "qutip==5.3.0"28```2930For plots:3132```bash33uv pip install "qutip[graphics]==5.3.0"34```3536Optional QuTiP family packages are independently versioned:3738```bash39uv pip install "qutip-qip==0.4.2"40uv pip install "qutip-qtrl==0.2.0"41uv pip install "qutip-jax==0.1.1"42```4344- `qutip-qip` 0.4.2 (2026-06-23) is the production/stable circuit, gate, and45 noisy-device simulation package. Import from `qutip_qip`, not `qutip.qip`.46- `qutip-qtrl` 0.2.0 (2026-06-23) provides GRAPE and CRAB **quantum optimal47 control**. It is not a trajectory viewer. Import from `qutip_qtrl`, not48 `qutip.control`; PyPI still classifies it pre-alpha.49- `qutip-jax` 0.1.1 (2025-05-29) is the official JAX data backend for GPU and50 automatic-differentiation experiments. It is explicitly pre-alpha.51- `qutip-cupy` is an official QuTiP-organization repository, but it has no PyPI52 release and its own README says it is not officially released. Do not put an53 unreleased Git install into a reproducible workflow.5455Use a project lockfile or a hash-generating `uv pip compile` workflow when56transitive dependency identity must also be frozen.5758## Non-negotiable model contract5960Before solving, record:61621. **Units and convention.** QuTiP equations normally set \(\hbar=1\).63 Hamiltonian entries are angular frequencies and rates have reciprocal-time64 units. Convert cyclic frequency with \(2\pi f\); never mix Hz and rad/s.652. **Subsystem order.** `tensor(A, B, C)` fixes subsystem indices `0, 1, 2`.66 Preserve that order in every state, operator, collapse channel, and partial67 trace. `obj.ptrace([0, 2])` keeps those subsystems; it does not trace them.683. **State validity.** Check ket norm or density-matrix Hermiticity, unit trace,69 and eigenvalues above a stated negative tolerance. Tiny negative values may70 be numerical; material negativity invalidates a claimed state.714. **Generator meaning.** A Lindblad channel with rate `gamma` is represented72 by `sqrt(gamma) * A`, not `gamma * A`. Define what each rate measures. For73 example, `sqrt(gamma_phi / 2) * sigmaz()` gives coherence decay74 `exp(-gamma_phi * t)`.755. **Approximations.** State rotating-wave, Born-Markov, secular, weak-coupling,76 bath-equilibrium, truncation, symmetry, and initial-factorization assumptions77 wherever used.786. **Numerics.** Justify Hilbert truncation, output grid, integration method,79 tolerances, trajectory count, and random seeds. Report `result.stats`.807. **Convergence.** Sweep every artificial cutoff: Fock dimension, time/frequency81 window and spacing, ODE tolerances, trajectories, Floquet harmonics, HEOM82 depth and bath exponents, or PIQS representation as applicable.8384## Qobj, dimensions, and tensor order8586Prefer explicit imports and inspect both shape and structured dimensions:8788```python89from qutip import basis, qeye, sigmaz, tensor9091psi = tensor(basis(2, 0), basis(3, 1))92z_on_first = tensor(sigmaz(), qeye(3))9394assert psi.shape == (6, 1)95assert psi.dims == [[2, 3], [1]]96assert z_on_first.dims == [[2, 3], [2, 3]]97rho_first = psi.proj().ptrace(0) # keep subsystem 098```99100Matrix shape alone is insufficient: two objects can both be 6-by-6 but encode101different tensor factorizations. Read `references/core_concepts.md` before102building composite, superoperator, or channel models.103104## Choose the solver by physics105106| Model | Current API | Required justification |107|---|---|---|108| Closed, pure, unitary | `sesolve` | Hermitian Hamiltonian; no dissipation |109| Lindblad/open or mixed | `mesolve` | Markovian completely positive model and channel rates |110| Quantum jumps | `mcsolve` | Unravelling, trajectory convergence, seeds |111| Microscopic weak bath | `brmesolve` | Born-Markov/weak coupling, spectra, secular choice |112| Diffusive measurement | `ssesolve`, `smesolve` | monitored versus unmonitored channels |113| Periodic drive | `FloquetBasis`, `fsesolve`, `fmmesolve` | verified period and Floquet convergence |114| Structured non-Markovian bath | `qutip.solver.heom` | bath expansion and hierarchy convergence |115| Symmetric spin ensemble | `qutip.piqs` | permutation symmetry and basis choice |116117Do not select a more specialized solver merely because it exists.118119## Deterministic open-system example120121QuTiP 5.3 uses ordinary option dictionaries. Solver controls, `e_ops`, and122`args` are keyword-only; the old mutable options object is gone.123124```python125import numpy as np126from qutip import basis, mesolve, sigmam, sigmaz127128omega = 2.0129gamma = 0.15130tlist = np.linspace(0.0, 20.0, 401)131excited = basis(2, 0)132133result = mesolve(134 0.5 * omega * sigmaz(),135 excited,136 tlist,137 c_ops=[np.sqrt(gamma) * sigmam()],138 e_ops={"sigma_z": sigmaz(), "excited": excited.proj()},139 options={140 "method": "adams",141 "atol": 1e-10,142 "rtol": 1e-8,143 "store_final_state": True,144 "progress_bar": "",145 },146)147148population = np.asarray(result.e_data["excited"])149assert np.max(np.abs(population - np.exp(-gamma * tlist))) < 2e-6150assert isinstance(result.stats, dict)151```152153If the problem is stiff, compare `bdf` or `lsoda`; do not change an integrator154without rerunning tolerance and invariant checks. QuTiP 5.3 also supports155`options={"matrix_form": True}` in `mesolve`; benchmark and validate it before156using it as a default.157158## Time-dependent systems159160Prefer trusted Pythonic callables or numeric coefficient arrays. Do not create161coefficient source strings from user input.162163```python164import numpy as np165from qutip import QobjEvo, sigmax, sigmaz166167def envelope(t, amplitude, center, width):168 return amplitude * np.exp(-0.5 * ((t - center) / width) ** 2)169170H = QobjEvo(171 [0.5 * sigmaz(), [sigmax(), envelope]],172 args={"amplitude": 0.2, "center": 5.0, "width": 1.0},173)174instantaneous_H = H(5.0)175H.arguments(amplitude=0.1)176```177178The older `f(t, args)` coefficient signature is deprecated in 5.3 and is179scheduled for removal in 5.5. See `references/time_evolution.md`.180181## Trajectories and stochastic solvers182183```python184import numpy as np185from qutip import basis, mcsolve, sigmam, sigmaz186187tlist = np.linspace(0.0, 10.0, 201)188result = mcsolve(189 0.5 * sigmaz(),190 basis(2, 0),191 tlist,192 [np.sqrt(0.2) * sigmam()],193 e_ops=[basis(2, 0).proj()],194 ntraj=400,195 seeds=20260723,196 options={"keep_runs_results": False, "progress_bar": ""},197)198```199200Report `ntraj`, `result.seeds`, uncertainty or repeated-seed sensitivity, and201whether individual runs were retained. Reuse `seeds=previous_result.seeds` only202when paired trajectories are intentional. `ssesolve` and `smesolve` use the203boolean `heterodyne` argument, not legacy integer noise codes.204205## Steady states, spectra, and phase space206207```python208import numpy as np209from qutip import QFunc, liouvillian, operator_to_vector, qfunc, steadystate210211rho_ss = steadystate(H, c_ops, method="direct")212residual = (liouvillian(H, c_ops) * operator_to_vector(rho_ss)).norm()213assert residual < 1e-9214215xvec = np.linspace(-5.0, 5.0, 151)216Q_once = qfunc(rho_ss, xvec, xvec)217q_many = QFunc(xvec, xvec)218Q_again = q_many(rho_ss)219assert Q_once.shape == (len(xvec), len(xvec))220```221222For `wigner`, `qfunc`, and `QFunc`, array element `[j, k]` corresponds to223`yvec[j]`, `xvec[k]`. In QuTiP 5.3, `QFunc` is initialized with fixed224coordinates and called with a state; it has no `.eval` method. This skill never225uses Python dynamic-code execution. Prefer `plot_wigner`, `Result.plot_expect`,226or explicit Matplotlib axes as documented in `references/visualization.md`.227228Direct `spectrum` is a stationary steady-state spectrum. An FFT of a finite229correlation requires explicit checks for tail decay, timestep aliasing,230frequency resolution, window sensitivity, and transform convention. See231`references/analysis.md`.232233## Advanced boundaries234235- Import HEOM from `qutip.solver.heom`; the legacy QuTiP 4 nonmarkov HEOM236 namespace is stale.237- Use `FloquetBasis` for modes and quasi-energies. Verify238 `H(t + T) == H(t)` numerically and sweep basis/truncation choices.239- Access PIQS with `from qutip import piqs`. `Dicke.pisolve` is only the240 optimized diagonal-state/diagonal-Hamiltonian route; general Dicke-basis241 dynamics use the Liouvillian with `mesolve`.242- `brmesolve` can violate positivity, especially without secularization. Check243 density-matrix eigenvalues over time.244- QIP and optimal control are extension-package concerns. Never present local245 simulation as quantum-hardware execution.246247See `references/advanced.md` for HEOM, Floquet, PIQS, stochastic, and extension248boundaries.249250## Safe local CLIs251252All bundled tools are local-only, emit strict JSON, reject non-finite JSON and253unknown keys, and never load pickle files or executable model code. Simulation254imports are lazy, so every `--help` works without QuTiP installed.255256| Script | Purpose |257|---|---|258| `scripts/qobj_model_validator.py` | Validate bounded Qobj model JSON, dimensions, states, rates, and role compatibility |259| `scripts/two_level_simulation.py` | Run a bounded two-level Lindblad or jump simulation |260| `scripts/solver_config_planner.py` | Select a current solver and option/checklist plan |261| `scripts/convergence_sweep.py` | Sweep tolerances/grid size or trajectory count on a synthetic model |262| `scripts/result_audit.py` | Audit JSON output without deserializing Python objects |263| `scripts/steady_state_spectrum_planner.py` | Plan bounded steady-state and direct/FFT spectral checks |264265Example:266267```bash268python skills/qutip/scripts/two_level_simulation.py --help269python skills/qutip/scripts/two_level_simulation.py \270 --decay-rate 0.2 --t-final 10 --time-points 201 \271 --output two-level.json272python skills/qutip/scripts/result_audit.py two-level.json273```274275## Completion checklist276277- Record units, \(\hbar\), tensor order, initial state, channels, and model278 assumptions.279- Validate Hermiticity, norm/trace, positivity, dimensions, and generator units.280- Pin QuTiP and direct extensions; record platform, Python, NumPy, and SciPy.281- Inspect result options and stats; do not assume states were stored.282- Perform cutoff, grid, tolerance/integrator, and stochastic convergence sweeps.283- Save portable numeric/configuration summaries as JSON or text. Do not load284 untrusted QuTiP object/result files because object serialization can execute285 code.286287## References288289- `references/core_concepts.md` — Qobj, dimensions, tensor products, states,290 channels, and unit conventions291- `references/time_evolution.md` — current solver signatures, options, results,292 QobjEvo, trajectories, and numerical controls293- `references/analysis.md` — physical-state audits, steady states,294 correlations, spectra, and convergence295- `references/visualization.md` — Wigner, Q functions, `QFunc`, Bloch, result,296 and matrix plots297- `references/advanced.md` — Bloch-Redfield, stochastic, Floquet, HEOM, PIQS,298 and QuTiP family package boundaries299300## Dated official sources301302Verified **2026-07-23**:303304- [QuTiP 5.3.0 PyPI metadata](https://pypi.org/project/qutip/)305- [QuTiP 5.3.0 release](https://github.com/qutip/qutip/releases/tag/v5.3.0)306- [QuTiP 5.3 changelog](https://qutip.readthedocs.io/en/stable/changelog.html)307- [QuTiP 5.3 API](https://qutip.readthedocs.io/en/stable/apidoc/apidoc.html)308- [QuTiP version-5 tutorials](https://github.com/qutip/qutip-tutorials/tree/main/tutorials-v5)309- [qutip-qip PyPI](https://pypi.org/project/qutip-qip/)310- [qutip-qtrl PyPI](https://pypi.org/project/qutip-qtrl/)311- [qutip-jax PyPI](https://pypi.org/project/qutip-jax/)312- [official unreleased qutip-cupy repository](https://github.com/qutip/qutip-cupy)