SkillAgentSearch skills...

NQPU

Neural Quantum Processing Unit - High-performance quantum computing SDK with GPU acceleration

Install / Use

/learn @robertcprice/NQPU
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

nQPU - Neural Quantum Processing Unit

<div align="center">

nQPU Logo

High-Performance Quantum Computing SDK with GPU Acceleration

Rust Python License: MIT Metal

</div>

What is nQPU?

nQPU is a quantum computing platform that combines:

| Feature | Description | |---------|-------------| | GPU Acceleration | Metal-based GPU acceleration for 100x speedup | | Multiple Backends | State vector, tensor network, stabilizer simulation | | Model QPU Research API | Model Hamiltonians, exact diagonalization, Rust-backed DMRG, quenches, and parameter sweeps | | Drug Discovery | Quantum molecular fingerprinting & ADMET prediction | | Quantum Biology | Photosynthesis, enzyme catalysis, quantum coherence | | Ever-Growing Library | Drug design, quantum biology, finance, and more |

Competitive Advantages

| vs Qiskit | vs Cirq | vs PennyLane | |-----------|---------|--------------| | ✅ Native GPU (Metal) | ❌ CPU only | ❌ CPU only | | ✅ Rust core (fast) | ❌ Python only | ❌ Python only | | ✅ Drug design tools | ❌ General QC only | ❌ General QC only | | ✅ Growing tool library | ❌ General QC only | ❌ General QC only | | ✅ Real-time dashboard | ❌ No dashboard | ❌ No dashboard |

Quick Start

Installation

# Core SDK (quantum simulation)
pip install nqpu

# With chemistry/drug design tools
pip install nqpu[chem]

# With biology tools
pip install nqpu[bio]

# With quantum trading tools
pip install nqpu[trading]

# Everything
pip install nqpu[all]

# Or from source
git clone https://github.com/robertcprice/nQPU.git
cd nqpu/sdk/python
pip install -e ".[all]"

Optional Extras

| Package | Install | Description | |---------|---------|-------------| | Core | pip install nqpu | Quantum simulation, GPU acceleration | | Chemistry | pip install nqpu[chem] | Drug design, ADMET, molecular fingerprints | | Biology | pip install nqpu[bio] | Quantum biology, genome tools | | Trading | pip install nqpu[trading] | Quantum volatility, regime detection, signal processing | | Finance | pip install nqpu[finance] | QAE option pricing, QAOA portfolios, VaR/CVaR (adds matplotlib) | | Web | pip install nqpu[web] | QKD network planning REST API (adds FastAPI + uvicorn) | | All | pip install nqpu[all] | Everything |

Basic Usage

from nqpu import QuantumCircuit, NQPUBackend

# Create a circuit
circuit = QuantumCircuit(4)
circuit.h(0)
circuit.cnot(0, 1)
circuit.cnot(1, 2)
circuit.measure_all()

# Run with GPU acceleration
backend = NQPUBackend(gpu=True)
result = backend.run(circuit, shots=1000)
print(result.counts)

Quantum Physics Research

import numpy as np
from nqpu import (
    ModelQPU,
    TransverseFieldIsing1D,
    load_entanglement_spectrum_result,
    load_loschmidt_echo_result,
    load_response_spectrum_result,
    load_ground_state_result,
    load_sweep_result,
    load_tensor_network_state,
    load_two_time_correlator_result,
    save_entanglement_spectrum_result,
    save_loschmidt_echo_result,
    save_response_spectrum_result,
    save_ground_state_result,
    save_sweep_result,
    save_tensor_network_state,
    save_two_time_correlator_result,
)

qpu = ModelQPU()
model = TransverseFieldIsing1D(
    num_sites=8,
    coupling=1.0,
    transverse_field=0.8,
    boundary="open",
)

# Ground state with observables and entanglement entropy
ground_state = qpu.ground_state(
    model,
    observables=["magnetization_z", "Z0Z1"],
    subsystem=[0, 1, 2, 3],
)
print(ground_state.ground_state_energy)
print(ground_state.observables)

# Warm-start a nearby ground-state solve from a prior tensor-network state
retuned_state = qpu.ground_state(
    TransverseFieldIsing1D(num_sites=8, coupling=1.0, transverse_field=0.9),
    initial_state=ground_state,
    observables=["magnetization_z"],
)

# Parameter sweep across a phase transition
sweep = qpu.sweep_parameter(
    model,
    "transverse_field",
    np.linspace(0.2, 1.8, 17),
    observables=["magnetization_z"],
    subsystem=[0, 1, 2, 3],
)
print(sweep.energies)
print(sweep.spectral_gaps)
print(sweep.entanglement_entropy)

# Adaptive phase-transition zoom on top of the coarse grid
adaptive = qpu.adaptive_sweep_parameter(
    model,
    "transverse_field",
    [0.2, 0.6, 1.0, 1.4, 1.8],
    observables=["magnetization_z"],
    subsystem=[0, 1, 2, 3],
    metric="spectral_gap",
    max_refinement_rounds=2,
    refinements_per_round=1,
    checkpoint_path="checkpoints/tfim_adaptive.json",
)
print(adaptive.values)
print(adaptive.refinement_history)

# Reuse a prepared state as the initial condition for a quench
quench = qpu.quench(
    TransverseFieldIsing1D(num_sites=8, coupling=1.0, transverse_field=1.1),
    times=[0.0, 0.05, 0.10],
    initial_state=ground_state,
    observables=["magnetization_z", "Z0Z1"],
    subsystem=[0, 1, 2, 3],
)
print(quench.observables["Z0Z1"])
print(quench.entanglement_entropy)

# Build correlation functions and structure factors from the same solver surface
correlations = qpu.correlation_matrix(model, pauli="Z", connected=True)
static_sf = qpu.structure_factor(model, [0.0, np.pi / 2.0, np.pi], connected=True)
dynamic_sf = qpu.dynamic_structure_factor(
    model,
    times=[0.0, 0.05, 0.10],
    momenta=[0.0, np.pi],
    pauli="Z",
    connected=True,
    initial_state="neel",
)
frequency_sf = qpu.frequency_structure_factor(
    dynamic_sf,
    frequencies=[-20.0, 0.0, 20.0],
    window="hann",
)
two_time = qpu.two_time_correlator(
    model,
    times=[0.0, 0.05, 0.10],
    pauli="Z",
    connected=True,
)
local_response = qpu.linear_response_spectrum(
    model,
    times=[0.0, 0.05, 0.10],
    pauli="Z",
    source_sites=[0, 2, 4],
    frequencies=[-20.0, 0.0, 20.0],
    window="hann",
)
spectrum = qpu.entanglement_spectrum(
    model,
    subsystem=[0, 1, 2, 3],
    num_levels=4,
)
echo = qpu.loschmidt_echo(
    model,
    times=[0.0, 0.05, 0.10],
    initial_state="neel",
)
response = qpu.linear_response_spectrum(
    two_time,
    momenta=[0.0, np.pi],
    frequencies=[-20.0, 0.0, 20.0],
    window="hann",
)
print(correlations.matrix)
print(static_sf.values)
print(dynamic_sf.values.shape)
print(frequency_sf.intensity)
print(two_time.values.shape)
print(local_response.measure_sites)
print(spectrum.eigenvalues, spectrum.entanglement_energies)
print(echo.echo, echo.return_rate)
print(response.intensity)

# Checkpoint and restore a Rust-backed tensor-network state
save_tensor_network_state(ground_state, "checkpoints/tfim_ground.json")
restored_state = load_tensor_network_state("checkpoints/tfim_ground.json")

# Save the full ground-state result manifest plus sidecar backend state
save_ground_state_result(ground_state, "checkpoints/tfim_ground_result.json")
restored_ground = load_ground_state_result("checkpoints/tfim_ground_result.json")
save_entanglement_spectrum_result(spectrum, "checkpoints/tfim_entanglement_spectrum.json")
restored_spectrum = load_entanglement_spectrum_result(
    "checkpoints/tfim_entanglement_spectrum.json"
)
save_two_time_correlator_result(two_time, "checkpoints/tfim_two_time.json")
restored_two_time = load_two_time_correlator_result("checkpoints/tfim_two_time.json")
save_response_spectrum_result(response, "checkpoints/tfim_response.json")
restored_response = load_response_spectrum_result("checkpoints/tfim_response.json")
save_loschmidt_echo_result(echo, "checkpoints/tfim_echo.json")
restored_echo = load_loschmidt_echo_result("checkpoints/tfim_echo.json")

# Save a sweep manifest with phase-diagram data and per-point metadata
save_sweep_result(sweep, "checkpoints/tfim_sweep.json")
restored_sweep = load_sweep_result("checkpoints/tfim_sweep.json")

# Long sweeps can checkpoint progress and resume later
resumable = qpu.sweep_parameter(
    model,
    "transverse_field",
    np.linspace(0.2, 1.8, 17),
    observables=["magnetization_z"],
    subsystem=[0, 1, 2, 3],
    checkpoint_path="checkpoints/tfim_resume.json",
)
resumed = qpu.sweep_parameter(
    model,
    "transverse_field",
    np.linspace(0.2, 1.8, 17),
    observables=["magnetization_z"],
    subsystem=[0, 1, 2, 3],
    checkpoint_path="checkpoints/tfim_resume.json",
    resume=True,
)
print(resumed.completed_points, resumed.is_complete)

For larger open-boundary 1D chains, ModelQPU() will use the Rust tensor-network path automatically when the optional nqpu_metal bindings are installed with maturin develop --release --features python: DMRG for supported ground-state workflows and TDVP for supported real-time quenches from product states or previously prepared tensor-network states. The same Rust path can also compress dense statevectors and dense exact-result states into MPS handles when the model is supported. Quenches can also request a single entanglement-entropy trace with subsystem=[...]; the Rust TDVP path currently supports prefix cuts that map onto one MPS bond. Rust tensor-network states can also be checkpointed to JSON and loaded back into later quench(...) calls, and full result manifests can be saved with observable data plus a backend-state sidecar for restartable research workflows. Supported product-state labels now include "all_up", "all_down", "neel", "plus_x", "minus_x", "plus_y", "minus_y", "domain_wall", "anti_domain_wall", and explicit per-site strings like "+-RL01". Rust-backed Loschmidt echo manifests also retain the evolved tensor-network state as a sidecar checkpoint. Parameter sweeps can also be saved as JSON manifests that preserve energy curves, spectral gaps, entanglement traces, solver provenance, per-point model metadata, and

Related Skills

View on GitHub
GitHub Stars4
CategoryDevelopment
Updated18d ago
Forks0

Languages

Rust

Security Score

85/100

Audited on Mar 17, 2026

No findings