Skip to main content

ffsim

ffsim is a software library for simulating fermionic quantum circuits that conserve particle number and the z component of spin. This category includes many quantum circuits used for quantum chemistry simulations. By exploiting the symmetries and using specialized algorithms, ffsim can simulate these circuits much faster than a generic quantum circuit simulator.

Documentation

Documentation is located at the project website. You might also be interested in the paper about ffsim.

Installation

On Linux and macOS, you can install ffsim using pip:

pip install ffsim

See the installation instructions for information about using ffsim on Windows, as well as instructions for installing from source and running ffsim in a container.

Get started

Visit State vectors and gates to start learning ffsim's core concepts, or jump straight into a tutorial. Check out the guides for help with specific tasks, or visit the API reference for detailed documentation of all function and classes available in the library.

Multithreading

Some ffsim functions implemented in Rust use multithreading. The number of threads can be controlled using the environment variable RAYON_NUM_THREADS. For example, to disable multithreading, set this variable as RAYON_NUM_THREADS=1.

Code example

import numpy as np
import pyscf

import ffsim

# Generate the Hamiltonian for an N2 molecule using PySCF and ffsim's wrapper for it
mol = pyscf.gto.Mole()
mol.build(atom=[["N", (0, 0, 0)], ["N", (1.0, 0, 0)]], basis="6-31g", symmetry="Dooh")
scf = pyscf.scf.RHF(mol).run()
mol_data = ffsim.MolecularData.from_scf(scf, active_space=range(4, mol.nao_nr()))
norb, nelec = mol_data.norb, mol_data.nelec
hamiltonian = mol_data.hamiltonian

# Convert the Hamiltonian to a SciPy LinearOperator
linop = ffsim.linear_operator(hamiltonian, norb=norb, nelec=nelec)

# Generate a random orbital rotation
orbital_rotation = ffsim.random.random_unitary(norb, seed=1234)

# Create the Hartree-Fock state and apply the orbital rotation to it
vec = ffsim.hartree_fock_state(norb, nelec)
vec = ffsim.apply_orbital_rotation(vec, orbital_rotation, norb=norb, nelec=nelec)

# Compute the energy of the state
energy = np.vdot(vec, linop @ vec).real
print(energy)  # prints -104.17181289596

Citing ffsim

You can cite ffsim using the following BibTeX:

@misc{sung2026ffsim,
      title={ffsim: Faster simulation of fermionic quantum circuits},
      author={Kevin J. Sung and Inho Choi and Mirko Amico and Bartholomew Andrews and Esra Ayantuna and Yukio Kawashima and Wan-Hsuan Lin and David Omanovic and Samuele Piccinelli and Javier Robledo Moreno and Abdullah Ash Saki and James Shee and Soyoung Shin and Minh C. Tran and Kento Ueda and Haimeng Zhang and Mario Motta},
      year={2026},
      eprint={2605.03123},
      archivePrefix={arXiv},
      primaryClass={quant-ph},
      url={https://arxiv.org/abs/2605.03123},
}

Developer guide

See the developer guide for instructions on contributing code to ffsim.

Metadata

Release files for ffsim 0.0.85

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

Source distribution (sdist)

Source distribution for ffsim 0.0.85
File Size Uploaded Provenance
ffsim-0.0.85.tar.gz 2.6 MB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for ffsim 0.0.85
File Interpreter ABI Platform
ffsim-0.0.85-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details
ffsim-0.0.85-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details
ffsim-0.0.85-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details

Total release size: 4.9 MB

Release files / ffsim-0.0.85.tar.gz

Download URL ffsim-0.0.85.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
03390c32252dd08b21b1b3707c0197da78812dbf577995fae3e750ccaa98cbba
BLAKE2b-256 checksum
How to use checksums
fc2e23ab9a404b75d38cdd70b14eed36f348813e78cc80e5727605a02f95744d
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 Oct 24, 2026.

Transparency log

Release files / ffsim-0.0.85-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL ffsim-0.0.85-cp311-abi3-manylinux_2_28_x86_64.whl
Size 783.4 kB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
fb5b02dd367f0770a07cd115ffdca3518e612fe6091c57db3988d72b0f92fded
BLAKE2b-256 checksum
How to use checksums
86f44f5195470fa079ec063a9304c451e1c4003011c53296744b72f3af38de69
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 Oct 24, 2026.

Transparency log

Release files / ffsim-0.0.85-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL ffsim-0.0.85-cp311-abi3-manylinux_2_28_aarch64.whl
Size 770.7 kB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
3ecd9cd00dca1b033c9b062fa4b83ed32fff2ce08fce22946a5ed9da14d298a8
BLAKE2b-256 checksum
How to use checksums
498790c38cd735d9c47e71a31e2d19f5e94447af43128615e87fd5a386e6ecdf
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 Oct 24, 2026.

Transparency log

Release files / ffsim-0.0.85-cp311-abi3-macosx_11_0_arm64.whl

Download URL ffsim-0.0.85-cp311-abi3-macosx_11_0_arm64.whl
Size 730.9 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
242859f7d242e923bfde6f291ed889694d24bd798fc794519e0a49c06852fb84
BLAKE2b-256 checksum
How to use checksums
8c76a29c88a0b0df8eeb4a7f41d6c5867d7a8e37c71e39f93d90f4790301715e
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 Oct 24, 2026.

Transparency log

Security for ffsim 0.0.85

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

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for ffsim-0.0.85.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 Oct 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.0.85 This release

4 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