跳转到主要内容

费米子量子线路的快速模拟。

项目描述

ffsim

ffsim是一个用于模拟守恒粒子数和自旋Z分量的费米子量子线路的软件库。此类别包括许多用于量子化学模拟的量子线路。通过利用对称性和使用专用算法,ffsim可以比通用量子线路模拟器更快地模拟这些线路。

文档

文档位于项目网站

安装

建议在可能的情况下使用pip安装ffsim

pip install ffsim

然而,此方法在Windows上无法本地运行。有关在Windows上使用ffsim、从源安装以及将ffsim在容器中运行的说明,请参阅安装说明

代码示例

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

引用ffsim

您可以使用以下BibTeX引用ffsim

@software{ffsim,
  author = {{The ffsim developers}},
  title = {{ffsim: Faster simulations of fermionic quantum circuits.}},
  url = {https://github.com/qiskit-community/ffsim}
}

开发者指南

有关向ffsim贡献代码的说明,请参阅开发者指南

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源分发

ffsim-0.0.45.tar.gz (550.5 kB 查看哈希值)

上传时间

构建分发

ffsim-0.0.45-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.1 MB 查看哈希值)

上传时间 CPython 3.9+ manylinux: glibc 2.17+ x86-64

ffsim-0.0.45-cp39-abi3-macosx_11_0_arm64.whl (572.8 kB 查看哈希值)

上传时间 CPython 3.9+ macOS 11.0+ ARM64

ffsim-0.0.45-cp39-abi3-macosx_10_9_x86_64.whl (581.7 kB 查看哈希值)

上传时间 CPython 3.9+ macOS 10.9+ x86-64

支持者

AWSAWS 云计算和安全赞助商 DatadogDatadog 监控 FastlyFastly CDN GoogleGoogle 下载分析 MicrosoftMicrosoft PSF赞助商 PingdomPingdom 监控 SentrySentry 错误记录 StatusPageStatusPage 状态页