Skip to main content

NWQLib: Northwest Quantum Library

PyPI Python License Documentation DOI

NWQLib applies quantum algorithms to scientific problems. You state the problem and choose a method, and NWQLib plans the construction, runs it on the backend you choose and returns the result with its resource counts and what is known about its error. Circuits are built with Qiskit.

Documentation: https://pnnl.github.io/NWQLib/

Installation

NWQLib requires Python 3.12 or later. Install the package with the local Aer simulator:

python -m pip install "nwqlib[aer]"

The base package, python -m pip install nwqlib, describes the methods, accepts inputs, plans LCHS with its default settings and runs the classical methods. Building and running circuits needs the extra of the chosen backend (aer, ibm, ionq, nexus), each of which includes Qiskit. Install and first result lists every extra, and Choose a backend explains what each backend supports. To work on NWQLib itself, see Set up, test and build.

First result

To solve du/dt = -A u with a small physical input:

from nwqlib import LinearDynamics, solve
from nwqlib.algorithms import LCHS

problem = LinearDynamics(
    A=[[0.4, 0.15], [0.05, 0.25]],
    initial_state=[1.0, 0.0],
    time=0.1,
)
result = solve(problem, method=LCHS())
print(result.solution)
[ 0.96006038-1.54102084e-12j -0.00513885+3.61167323e-13j]

The default returns an approximation of the physical solution using nine qubits in total. Install and first result compares it with an independent reference and shows how to change the approximation. Each method accepts its own input forms and conversions, which its algorithm guide describes.

The example notebooks solve complete scientific problems from input to result, error and circuit cost: molecular ground-state energy, a linear system, linear dynamics and optimization. One more notebook estimates the resources of a linear system, heat flow, two spin chains and a GCiM trial basis at 80 to 100 system qubits, where the largest circuit, LCHS for heat flow, has 109 qubits in total. It also estimates one QHD step on a three-variable grid of 32 points per variable, which takes 96 qubits in the one-hot encoding. The examples guide points you to the notebook that matches your problem. The mathematics page states the bounds, resource formulas and error budgets that NWQLib uses, each with its proof or source and the code that implements it.

Choose a task

Task Read
Install and get a first result Install and first result, examples
Learn what Problem, Method, Plan, Run and Result are How NWQLib works
Choose a problem and output Choose a problem and output
Compare NWQLib with other quantum packages Why NWQLib
Compare methods and inspect results Plan, compare and solve
Supply operators and states Supply inputs
Estimate resources and check device fit Estimate resources, Check device fit and run time
Check a result against a reference or tolerance Check accuracy and verify a result
Run locally or submit to a provider Run on a backend, Choose a backend
Save results or continue an interrupted run Save, load and reanalyze results, Continue an interrupted run
Run your own circuit or compare your own method Run your own circuit, Add a method
List methods or use the command line Use the command line
Look up a signature API reference
Check known defects in Qiskit and other dependencies, and how NWQLib handles them Dependency issues
Trace code to its paper, equation and reason Code tour, references
Find the bound, resource formula or error budget behind a result, its proof or source, and its code Mathematics
Maintain NWQLib Set up, test and build, Contributing

Algorithms

Scientific task Methods
Normalized expectation of a finite real Pauli sum Expectation
Energy estimates from moments or a chosen subspace Chebyshev Lanczos, fixed and adaptive GCiM
Phase or energy estimation QPE: QCELS, RWPE, SPE and RFE
Time-independent linear dynamics LCHS
Linear systems QLS: QSVT inverse polynomial (qsvt_inverse, the default) and the Dalzell kernel shortcut (shortcut_native_svp, shortcut_dilation)
Box-constrained optimization QHD
Optimization over a box with equality or inequality constraints QHD augmented Lagrangian

Each method reports the quantity it obtained and any accuracy conditions that remain unresolved. A projected energy, a local statistical interval or a completed simulation does not by itself establish the full requested scientific claim. Limitations and open work lists current limitations. State preparation, block encoding, LCU, QSP/QSVT and evolution subroutines have their own API reference pages.

Backend support

Backend Runs where Tested against the live service
Aer Locally Not applicable
NWQ-Sim Locally, with the NWQ-Sim build described in its guide. CPU execution, and continuing a run after Python exits, were tested on macOS and Linux with that build Not applicable
Slurm NWQ-Sim on your cluster, with explicit site configuration No. Scheduler and site-configuration handling is tested offline. Site allocation, MPI and GPU execution are not tested
IBM Runtime IBM Quantum service No. SDK calls and result handling are tested offline. Live accounts, queues and QPUs are not tested
IonQ IonQ service No. Circuit conversion and result handling are tested offline. QPUs are not tested
Quantinuum Nexus Nexus H2 service No. Conversion, remote-job handling and results are tested offline. Nexus needs a pandas dependency exception and has no per-request timeout

A backend runs a method only when it supports that method's circuits and readout. Choose a backend gives the details.

Citation

If you use NWQLib in your work, please cite it through its Zenodo record, which resolves to the latest version:

@software{nwqlib,
  author  = {Zheng, Muqing and Liu, Chenxu and Song, Zhixin and Wu, Zeguan and Li, Xiangyu and Li, Mingze and Bauman, Nicholas P. and Stein, Samuel A. and M{\"u}lmenst{\"a}dt, Johannes and Chen, Yousu and Wiebe, Nathan and Li, Ang and Kowalski, Karol},
  title   = {NWQLib},
  year    = {2026},
  version = {1.0.0},
  doi     = {10.5281/zenodo.23074265},
  url     = {https://github.com/pnnl/NWQLib}
}

The references page lists the papers behind each algorithm and subroutine, with the equations NWQLib implements.

Authors and Developers

For questions, bug reports or collaboration, contact Muqing Zheng (muqing.zheng@pnnl.gov).

Affiliations are those at the time of contribution.

  • Muqing Zheng, Pacific Northwest National Laboratory
  • Chenxu Liu, Pacific Northwest National Laboratory
  • Zhixin Song, Pacific Northwest National Laboratory and Georgia Institute of Technology
  • Zeguan Wu, Pacific Northwest National Laboratory and University of Pittsburgh
  • Xiangyu Li, Pacific Northwest National Laboratory
  • Mingze Li, Pacific Northwest National Laboratory
  • Nicholas P. Bauman, Pacific Northwest National Laboratory
  • Samuel A. Stein, Pacific Northwest National Laboratory
  • Johannes Mülmenstädt, Pacific Northwest National Laboratory
  • Yousu Chen, Pacific Northwest National Laboratory
  • Nathan Wiebe, Pacific Northwest National Laboratory and University of Toronto
  • Ang Li, Pacific Northwest National Laboratory and University of Washington
  • Karol Kowalski, Pacific Northwest National Laboratory

Acknowledgements

This work was supported by Pacific Northwest National Laboratory's Quantum Algorithms and Architecture for Domain Science (QuAADS) Laboratory Directed Research and Development (LDRD) Initiative. This material is based upon work supported by the U.S. Department of Energy, Office of Science, National Quantum Information Science Research Centers, Quantum Science Center (QSC). The Pacific Northwest National Laboratory is operated by Battelle for the U.S. Department of Energy under Contract DE-AC05-76RL01830.

NWQLib is released under the BSD 2-Clause License; see LICENSE. Information release number PNNL-SA-227989.

Metadata

Release files for nwqlib 1.0.0.post3

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

Source distribution (sdist)

Source distribution for nwqlib 1.0.0.post3
File Size Uploaded
nwqlib-1.0.0.post3.tar.gz 6.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for nwqlib 1.0.0.post3
File Interpreter ABI Platform
nwqlib-1.0.0.post3-py3-none-any.whl Python 3 none any Details

Total release size: 8.2 MB

Release files / nwqlib-1.0.0.post3.tar.gz

Download URL nwqlib-1.0.0.post3.tar.gz
Size 6.0 MB
Tags Source
SHA-256 checksum
How to use checksums
54cb0d8ffbee352fca2fbcfb3f671ddc58dc875b6f9df27292e3b2b239374413
BLAKE2b-256 checksum
How to use checksums
1deb7808d2432e611d77f6b4c5ccae3a9b1f90195be71706719f34c17ea9b8f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 3, 2026.

Transparency log

Release files / nwqlib-1.0.0.post3-py3-none-any.whl

Download URL nwqlib-1.0.0.post3-py3-none-any.whl
Size 2.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
8ec846b97f87938d0ff8e78ef129db8bda66126ae1d37e846c524f1ee674e160
BLAKE2b-256 checksum
How to use checksums
3fb1de5af185fda2719adc62d0c202f62d96c56564a03078039633303d677d3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 3, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0.post3 This release

2 release files

1.0.0

2 release files

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