Skip to main content

Quantum Algebra for Lattice Models and Applications (QALMA)

QALMA logo

QALMA is a Python library for building and simulating many-body quantum systems on lattices. It provides an efficient algebraic representation of operators and states that exploits the tensor-product structure of lattice Hamiltonians, mean-field and Max-Ent projected-dynamics solvers, and a bridge between the ALPS XML model and lattice libraries and QuTiP.

Tests Docs Documentation on Read the Docs

Features

  • ALPS integration — load models and lattice geometries directly from ALPS XML libraries (spin models, Bose-Hubbard, Heisenberg, custom models, chain / square / triangular lattices, and more). Fermionic models (spinless fermions, Hubbard, t-J, Kondo) are mapped to qubits with the Jordan-Wigner transformation, so the signs are exact.

  • Algebraic operator representation — operators are stored as sums of local and few-body terms (including Pauli strings and their sums), not as full matrices. Memory and the cost of products, commutators and expectation values grow with the number of terms, not exponentially with the system size. Operations that need the full matrix (spectra, exact exponentials) are limited to small systems.

  • QuTiP interoperability — any QALMA operator or state can be converted to a QuTiP Qobj with a single call, making the full QuTiP solver ecosystem immediately available.

  • MaxEnt projected evolution — time-evolve density matrices projected onto a finite operator basis, enabling simulation of large systems beyond exact diagonalization.

  • Mean-field and RPA reductions — self-consistent and variational mean-field approximations for Gibbs states of large systems, and reduced states of small subsystems with an RPA correction, with Gaussian bosonic states as a building block. These modules are still evolving and their interface may change in future releases.

  • Matrix product ground states (experimental) — ground states of lattice Hamiltonians stored as matrix product states and computed with a built-in two-site DMRG, with the same state interface as Gibbs states.

  • Symbolic algebra — operators support addition, multiplication, commutators, exponentiation, traces, and partial traces out of the box.

  • Safe HDF5 storage — systems, operators, states and simulations are saved in a documented HDF5 format that does not use Python pickles.

Installation

QALMA needs Python 3.11 or newer. Install the latest release from PyPI with:

pip install qalma

The plotting helpers need matplotlib, which is installed with the plot extra (pip install "qalma[plot]").

To get the development version, install directly from the GitHub repository. For a clean setup it is recommended to use a virtual environment:

python -m venv qalma_env
source qalma_env/bin/activate          # macOS / Linux
# .\qalma_env\Scripts\activate.bat     # Windows Command Prompt
pip install git+https://github.com/QILPCM-IFLP-CONICET/QALMA/

Quick example

import numpy as np
import qutip
from qalma import build_system

# Spin-1/2 Heisenberg chain; by default, 4 sites ("chain lattice", "spin")
system = build_system()

H = system.global_operator("Hamiltonian")
Sz = system.global_operator("Sz")

# Algebraic manipulation: no explicit matrices needed
Htotal = (H - 2 * Sz).simplify()
print("Lowest levels:", Htotal.eigenenergies()[:4])

# Convert to QuTiP and evolve (exact methods: small systems only)
rho0 = (-Htotal).expm()
rho0 = rho0 / rho0.tr()
result = qutip.mesolve(
    H=Htotal.to_qutip(),
    rho0=rho0.to_qutip(),
    tlist=np.linspace(0, 10, 200),
    e_ops=[Sz.to_qutip()],
)

See the examples in the documentation for more complete walkthroughs.

Documentation

The documentation (user guide, API reference and examples) is at https://qalma.readthedocs.io. Its sources live in the docs/ directory; to build them locally:

pip install -e ".[docs]"
cd docs
make html

Citing

If you use QALMA in your research, please cite it using the metadata in CITATION.cff (GitHub shows it under “Cite this repository”).

License

QALMA is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 3 (LGPL-3.0), which supplements the GNU General Public License, version 3. In short: you can use QALMA from code under any license, but distributed modifications of QALMA itself must remain under the LGPL.

The model and lattice libraries in qalma/lib/*.xml come from the ALPS project and are distributed under the Boost Software License 1.0.

Metadata

Release files for qalma 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qalma 0.9.0
File Size Uploaded Provenance Actions
qalma-0.9.0.tar.gz 456.8 kB With provenance Details for qalma-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qalma 0.9.0
File Interpreter ABI Platform Actions
qalma-0.9.0-py3-none-any.whl Python 3 none any Details for qalma-0.9.0-py3-none-any.whl

Total release size: 823.5 kB

Release files / qalma-0.9.0.tar.gz

Download URL qalma-0.9.0.tar.gz
Size 456.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ad283d4d6fad88f32e036fc2e6c9b7a17fbf07365179084e371b19d431e13ac2
BLAKE2b-256 checksum
How to use checksums
4df5909e5964e2f2a474d68bb59c85dca1e82486a612adfc11d0a0571d18bb66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / qalma-0.9.0-py3-none-any.whl

Download URL qalma-0.9.0-py3-none-any.whl
Size 366.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a5e427c126f50a215255388db5a92860d5f812bac80a89f86c810e7dd29a668
BLAKE2b-256 checksum
How to use checksums
c84b0ccdc8eea69e98acb8772662f9c01c5668104cd405fe66e7ca2d574cc34d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for qalma 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for qalma-0.9.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page