Skip to main content

PySCF VQE plugin powered by Qoro Quantum — works on CPU, upgrade to GPU for speed

Project description

qoro-pyscf

PySCF integration plugin for the Qoro quantum simulator by Qoro Quantum.

Run quantum chemistry VQE and QSCI calculations — works on CPU out of the box, upgrade to GPU for speed.

Installation

pip install qoro-pyscf

Dependencies: PySCF, OpenFermion, SciPy, NumPy, and the Maestro runtime. No compiler needed — pre-built wheels for Linux and macOS (x86_64, arm64). Fully functional on CPU-only machines; no GPU required to install or run.

Quick Start — CASCI with VQE

No GPU needed. Install and run:

from pyscf import gto, scf, mcscf
from qoro_pyscf import QoroSolver

mol = gto.M(atom="Li 0 0 0; H 0 0 1.6", basis="sto-3g", verbose=0)
hf = scf.RHF(mol).run()

# Exact reference (PySCF's built-in FCI)
cas_fci = mcscf.CASCI(hf, 2, 2)
cas_fci.verbose = 0
fci_e = cas_fci.kernel()[0]

# VQE with Qoro
cas = mcscf.CASCI(hf, 2, 2)
cas.fcisolver = QoroSolver(ansatz="uccsd", maxiter=500)
vqe_e = cas.kernel()[0]

print(f"FCI energy:  {fci_e:.8f} Ha")
print(f"VQE energy:  {vqe_e:.8f} Ha")
print(f"Error:       {abs(vqe_e - fci_e) * 1000:.4f} mHa")

Runs on CPU by default — no license key required. You should see ~0.01 mHa error, well within chemical accuracy (1.6 mHa).

QSCI — Beyond VQE

Quantum-Selected Configuration Interaction (QSCI) uses a VQE circuit to select important electron configurations, then classically diagonalizes in that subspace. The result is variational, noise-robust, and often significantly more accurate than raw VQE.

from pyscf import gto, scf, mcscf
from qoro_pyscf import QoroSolver, QSCISolver

mol = gto.M(atom="Li 0 0 0; H 0 0 1.6", basis="sto-3g", verbose=0)
hf = scf.RHF(mol).run()

# Wrap any QoroSolver with QSCISolver
cas = mcscf.CASCI(hf, 3, 2)
inner = QoroSolver(ansatz="uccsd", maxiter=100)
cas.fcisolver = QSCISolver(inner_solver=inner)
e_qsci = cas.kernel()[0]

QSCI recovers near-FCI accuracy even when VQE doesn't fully converge — see examples/14_qsci.py for a full LiH dissociation curve demo.

Reference: Kanno et al., arXiv:2302.11320

Running Your Own Molecule

Swap in your molecule, basis set, and active space:

Choosing Your Setup

Question Guidance
Basis set? Start with sto-3g for testing. Use cc-pVDZ or 6-31G* for production.
Active space? (n_electrons, n_orbitals) — use chemical intuition or suggest_active_space() for automatic selection. Each spatial orbital = 2 qubits.
Which ansatz? Up to (6,6): use uccsd — chemistry-motivated, converges fast. Beyond (6,6): use hardware_efficient with 3–4 layers. For the most compact circuit: try adapt.
How long? (2,2) on CPU: seconds. (6,6) on CPU: minutes. (10,10)+: use MPS or GPU.

Automatic Active Space Selection

Not sure which orbitals to include? Let PySCF + MP2 natural orbitals decide:

from pyscf import gto, scf, mcscf
from qoro_pyscf import QoroSolver, suggest_active_space_from_mp2

mol = gto.M(atom="Li 0 0 0; H 0 0 1.6", basis="sto-3g", verbose=0)
hf = scf.RHF(mol).run()

norb, nelec, mo_coeff = suggest_active_space_from_mp2(hf)
cas = mcscf.CASCI(hf, norb, nelec)
cas.mo_coeff = mo_coeff
cas.fcisolver = QoroSolver(ansatz="uccsd", maxiter=500)
cas.run()

Scaling Up

Hitting limits on larger active spaces? Two options:

MPS Mode (still CPU, no license needed)

Switch to Matrix Product State simulation for larger systems without needing a GPU:

cas.fcisolver = QoroSolver(
    ansatz="hardware_efficient",
    ansatz_layers=3,
    simulation="mps",
    mps_bond_dim=128,
)

GPU Acceleration (fastest)

For maximum performance, add GPU support. Get your key instantly at maestro.qoroquantum.net, then:

cas.fcisolver = QoroSolver(
    ansatz="uccsd",
    backend="gpu",
    license_key="XXXX-XXXX-XXXX-XXXX",
)

GPU + MPS for the largest active spaces:

cas.fcisolver = QoroSolver(
    ansatz="hardware_efficient",
    ansatz_layers=3,
    backend="gpu",
    simulation="mps",
    mps_bond_dim=128,
)

GPU Setup & Licensing

GPU simulation requires an NVIDIA GPU and a license key. Get your key instantly at maestro.qoroquantum.net.

Three ways to provide your key:

Option 1 — Pass directly to the solver:

cas.fcisolver = QoroSolver(
    ansatz="uccsd",
    backend="gpu",
    license_key="XXXX-XXXX-XXXX-XXXX",
)

Option 2 — Set it once in your script:

from qoro_pyscf import set_license_key
set_license_key("XXXX-XXXX-XXXX-XXXX")

Option 3 — Environment variable (recommended for production):

export MAESTRO_LICENSE_KEY="XXXX-XXXX-XXXX-XXXX"

Note: First activation requires an internet connection (one-time). After that, the license is cached locally for offline use.

Migrating from Qiskit

qiskit-nature-pyscf qoro-pyscf
from qiskit_nature_pyscf import QiskitSolver from qoro_pyscf import QoroSolver
cas.fcisolver = QiskitSolver(algorithm) cas.fcisolver = QoroSolver(ansatz="uccsd")
Requires Qiskit, qiskit-nature, qiskit-algorithms Zero Qiskit dependencies
CPU-only estimator GPU-accelerated (CUDA)
Statevector only Statevector + MPS

Features

  • Works on CPU out of the box — no GPU or license needed to get started
  • GPU-accelerated statevector & MPS simulation via Maestro's CUDA backend (with license)
  • Drop-in PySCF solver — implements the full fcisolver protocol (kernel, make_rdm1, make_rdm1s, make_rdm12, make_rdm12s)
  • QSCI solver — Quantum-Selected Configuration Interaction for variational, noise-robust energy estimation beyond raw VQE (arXiv:2302.11320)
  • CASCI and CASSCF support (CASCI recommended; CASSCF works but VQE convergence can be tricky in the macro-iteration loop)
  • Multiple ansatze — hardware-efficient, UCCSD, UpCCD, ADAPT-VQE, and custom (inject any QuantumCircuit callable, e.g. QCC)
  • Custom Pauli evaluationevaluate_custom_paulis() bypasses Hamiltonian generation for measurement-reduction research
  • Raw state extractionget_final_statevector() for exact fidelity benchmarking against exact diagonalisation
  • UHF support — handles spin-unrestricted integrals
  • Pre-computed amplitudes — skip VQE with maxiter=0 + initial_point
  • State fidelity — compare circuit states via compute_state_fidelity()

Architecture

qoro_pyscf/
├── qoro_solver.py   # QoroSolver — PySCF fcisolver drop-in
├── qsci_solver.py      # QSCISolver — QSCI post-processing on top of VQE
├── hamiltonian.py      # PySCF integrals → QubitOperator (Jordan-Wigner)
├── ansatze.py          # HF initial state, hardware-efficient, UCCSD, UpCCD
├── adapt.py            # ADAPT-VQE adaptive circuit growing
├── expectation.py      # Maestro circuit evaluation wrapper
├── rdm.py              # RDM reconstruction from VQE circuit
├── properties.py       # Dipole moments, natural orbitals
└── backends.py         # GPU/CPU/MPS backend configuration

Dependencies

Package Purpose
qoro-maestro Quantum circuit simulation (GPU/CPU)
pyscf Molecular integrals & classical reference
openfermion Jordan-Wigner mapping & RDM operators
scipy Classical parameter optimisation

Examples

See the examples/ directory for 14 worked examples covering H₂ dissociation, LiH UCCSD, GPU benchmarking, MPS bond dimensions, CASSCF, NEVPT2, dipole moments, geometry optimisation, UpCCD paired doubles, GPU benchmarks, ADAPT-VQE, custom QCC ansatze, iterative QCC with fidelity benchmarking, and QSCI on LiH dissociation curves.

License

Apache 2.0 — see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qoro_pyscf-0.6.1.tar.gz (61.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qoro_pyscf-0.6.1-py3-none-any.whl (57.4 kB view details)

Uploaded Python 3

File details

Details for the file qoro_pyscf-0.6.1.tar.gz.

File metadata

  • Download URL: qoro_pyscf-0.6.1.tar.gz
  • Upload date:
  • Size: 61.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for qoro_pyscf-0.6.1.tar.gz
Algorithm Hash digest
SHA256 4ba6179d3328b08e3e57322379aef782547df2d1994e161ab9ace3376cf5d8d3
MD5 5693b26d589b91bedcc94a576e3673fd
BLAKE2b-256 14e4916adef652f1cffb23842f51ee6b05ade5569bb0953a9a25a18b901c6f54

See more details on using hashes here.

Provenance

The following attestation bundles were made for qoro_pyscf-0.6.1.tar.gz:

Publisher: publish.yml on QoroQuantum/qoro-pyscf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qoro_pyscf-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: qoro_pyscf-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 57.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for qoro_pyscf-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e96f4a0f40cc73be4ab068352af8265f380c885568298ea25a8e572c021b8702
MD5 e6285009e4b6647006c5bf8017f3a781
BLAKE2b-256 9d83caa930d5f5dacd3529295b4323a6fb0840b387c5fe195fb0f0b44390d567

See more details on using hashes here.

Provenance

The following attestation bundles were made for qoro_pyscf-0.6.1-py3-none-any.whl:

Publisher: publish.yml on QoroQuantum/qoro-pyscf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page