TensorMixedStates.jl

A Julia library to simulate closed and open quantum systems, pure and mixed states, using
matrix product states.
TMS represents the density matrix of the system as a matrix product state. It offers
manipulations of systems and states, a rich set of sites and operators that the user can
extend, and the algorithms that go with them: ground states by DMRG, Hamiltonian and
Lindbladian evolution by TDVP and others, thermal states by evolution in imaginary time, and
the application of gates, noisy ones included. It prepares states such as Fermi seas, GHZ,
Dicke and AKLT states, and the fully mixed state of a sector. Open systems can also be followed
by quantum trajectories, pure states drawn at random whose average is the density matrix. Small
systems can also be held
whole, without truncation, by ExactState, which runs the same programs exactly to check a
simulation.
Being built on ITensor, it computes fast and runs in parallel naturally. Its syntax for
operators is meant to make observables, gates, Hamiltonians and Lindbladians easy to write,
and an optional high level interface expresses a whole simulation in a few lines, averages over
disorder included, whose samples several processes share.
Two results of the article, each against its exact
solution: above, the decoherence of a complete-graph state of 8, 64 and 512 qubits
(script); below, free fermions injected by a
localized source, their density profile at three times
(script).
Installation
]add TensorMixedStates
TMS requires Julia 1.10.5 or later. Note the ], which enters the package manager.
A first simulation
What TMS is for is open systems: the state it carries is the density matrix, so dissipation
is written directly into the evolution rather than approximated away. Here six qubits evolve
under a transverse field Ising hamiltonian while each one jumps from up to down, and the high
level interface describes the run as a list of phases, executes them, takes the measurements
and writes everything to disk.
using TensorMixedStates, .Qubits
runTMS(SimData(
name = "dissipative_ising",
description = "six qubits under a transverse field Ising hamiltonian, each jumping from up to down",
phases = [
CreateState{Mixed}(6, Qubit(), "Up"),
Evolve(
duration = 2.0,
time_step = 0.1,
algo = Tdvp(),
limits = Limits(maxdim = 64),
evolver = -im * (-sum(Z(i)Z(i + 1) for i in 1:5) - sum(X(i) for i in 1:6))
+ sum(Dissipator(sqrt(0.2) * Sm)(i) for i in 1:6),
measurements = "data" => [Z, Purity],
),
],
))
The Mixed of CreateState{Mixed} is what makes the state a density matrix, and the
Dissipator terms added to the hamiltonian are what turn the evolution into a Lindblad equation. The run writes a
dissipative_ising directory: log for what happened, data for the measurements,
description and stamp for what was asked and when, and prog.jl, a copy of the script
that produced it. data is a table, a line naming its columns and then a line per time step:
the magnetization on the six sites and the purity, here after the first step and at the end of
the evolution:
time Z(1) Z(2) Z(3) Z(4) Z(5) Z(6) Purity
0.1 0.9409894108307 0.941176821604 0.9411768236482 0.9411768236508 0.9411768216059 0.9409894108332 0.7898070092902
...
2 -0.09518209547961 -0.1901119643657 -0.1449804250078 -0.1449804249806 -0.190111964564 -0.0951820957316 0.1086794010911
The qubits start pure and pointing up; by the end the magnetization has reversed and the
purity has fallen to 0.11, which is a state no pure state code could have represented.
Everything is available directly too, without the phases: build a State, call evolve or
ground_state on it, and measure the result. The manual covers both styles, and
examples/ holds twenty-four working scripts.
Documentation
https://jerhoud.github.io/TensorMixedStates.jl
For an introduction to matrix product states and tensor networks, see the lecture notes of the
course Grégoire Misguich gave at the 9th Les Houches summer school on Computational Physics:
Open Quantum Systems, in June 2026, arXiv:2606.24803, and
their sixteen Julia examples,
some of them written with TMS.
Article of reference
TMS is described in TensorMixedStates: A Julia library for simulating pure and mixed
quantum states using matrix product states,
SciPost Phys. Codebases 72 (2026).
SciPost asks that it be cited together with the
codebase release it documents. BibTeX
entries for both are in the documentation,
and GitHub’s “Cite this repository” button reads them from CITATION.cff.
If TMS helped produce the data of a publication, a word in your acknowledgements would be
warmly appreciated. And please do not hesitate to get in touch, at the address given in the
article, to say what you are doing with TMS, how you find it and what you would need: such
messages are what shapes what comes next.
Contributing
See CONTRIBUTING.md, and CHANGELOG.md for what changed.
Licence
TensorMixedStates is distributed under the GNU General Public License, version 3 or
later. It builds on ITensor, which is distributed under the Apache License 2.0.
评论