Faster simulations of fermionic quantum circuits.
Project description
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.
Installation
We recommend installing ffsim using pip, when possible:
pip install ffsim
This method won't work natively on Windows, however. Refer to the installation instructions for information about using ffsim on Windows, as well as instructions for installing from source and running ffsim in a container.
Code example
import numpy as np
import pyscf
import ffsim
# Build an N2 molecule
mol = pyscf.gto.Mole()
mol.build(atom=[["N", (0, 0, 0)], ["N", (1.0, 0, 0)]], basis="6-31g", symmetry="Dooh")
# Get molecular data
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
# 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)
# Convert the Hamiltonian to a Scipy LinearOperator
linop = ffsim.linear_operator(mol_data.hamiltonian, 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:
@software{ffsim,
author = {{The ffsim developers}},
title = {{ffsim: Faster simulations of fermionic quantum circuits.}},
url = {https://github.com/qiskit-community/ffsim}
}
Developer guide
See the developer guide for instructions on contributing code to ffsim.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file ffsim-0.0.48.tar.gz
.
File metadata
- Download URL: ffsim-0.0.48.tar.gz
- Upload date:
- Size: 549.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2f5a2d107b9472abd025a61e2ce99aaac6997d42f97bf2f5c00c9ce160210c3 |
|
MD5 | cf542554111ed2634630f9b0bbf96131 |
|
BLAKE2b-256 | f843bb374f15163424d8a8296446233a879b31fc861c057ea585404cd4b20007 |
Provenance
The following attestation bundles were made for ffsim-0.0.48.tar.gz
:
Publisher:
build-and-release.yml
on qiskit-community/ffsim
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
ffsim-0.0.48.tar.gz
- Subject digest:
a2f5a2d107b9472abd025a61e2ce99aaac6997d42f97bf2f5c00c9ce160210c3
- Sigstore transparency entry: 145203642
- Sigstore integration time:
- Predicate type:
File details
Details for the file ffsim-0.0.48-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: ffsim-0.0.48-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 13.1 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d480456b5ab0a07242c2b830ea8ee660c9f775b9172318ac1ae425fbf0ab042 |
|
MD5 | 11ef3049cfc47ebdb71e3fdc639eed7e |
|
BLAKE2b-256 | bf855bce0c58ca4362a4d282da288548fbee126a6f7f0c414f221d83ab26fcf6 |
Provenance
The following attestation bundles were made for ffsim-0.0.48-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
:
Publisher:
build-and-release.yml
on qiskit-community/ffsim
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
ffsim-0.0.48-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Subject digest:
6d480456b5ab0a07242c2b830ea8ee660c9f775b9172318ac1ae425fbf0ab042
- Sigstore transparency entry: 145203649
- Sigstore integration time:
- Predicate type:
File details
Details for the file ffsim-0.0.48-cp39-abi3-macosx_11_0_arm64.whl
.
File metadata
- Download URL: ffsim-0.0.48-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 574.2 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f867f41233ce9de7437dc31ff2f5cf45ceec662de06b8d08427841baf4d476b8 |
|
MD5 | 78d7e649a1da183c6550eb1f95f86568 |
|
BLAKE2b-256 | fb2193e187c4a15d7bf7e404dde2e39fe4397b80cc12c1a68112e0ba8e9b73c4 |
Provenance
The following attestation bundles were made for ffsim-0.0.48-cp39-abi3-macosx_11_0_arm64.whl
:
Publisher:
build-and-release.yml
on qiskit-community/ffsim
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
ffsim-0.0.48-cp39-abi3-macosx_11_0_arm64.whl
- Subject digest:
f867f41233ce9de7437dc31ff2f5cf45ceec662de06b8d08427841baf4d476b8
- Sigstore transparency entry: 145203644
- Sigstore integration time:
- Predicate type:
File details
Details for the file ffsim-0.0.48-cp39-abi3-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: ffsim-0.0.48-cp39-abi3-macosx_10_9_x86_64.whl
- Upload date:
- Size: 580.3 kB
- Tags: CPython 3.9+, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a0e936dc4f2c11b8dd18eb34d9a355d50af0cd6b3717aee2c44411b4185f6f0 |
|
MD5 | 4bdc52d6fb127defc99fbf59586f80f7 |
|
BLAKE2b-256 | a72fefd18fa982ad821e5030cf5457ce1d961120ace75df59d484b8404a3a78c |
Provenance
The following attestation bundles were made for ffsim-0.0.48-cp39-abi3-macosx_10_9_x86_64.whl
:
Publisher:
build-and-release.yml
on qiskit-community/ffsim
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
ffsim-0.0.48-cp39-abi3-macosx_10_9_x86_64.whl
- Subject digest:
0a0e936dc4f2c11b8dd18eb34d9a355d50af0cd6b3717aee2c44411b4185f6f0
- Sigstore transparency entry: 145203647
- Sigstore integration time:
- Predicate type: