Skip to main content

Quantum-native reformulations of SCPN spiking, phase dynamics, and plasma control

Project description

scpn-quantum-control

CI codecov License: MIT Python 3.9+ Qiskit 1.0+ Tests: 199 Version: 0.3.0 Hardware: ibm_fez

The Self-Consistent Phenomenological Network (SCPN) models hierarchical dynamics as 16 coupled Kuramoto oscillators with a coupling matrix K_nm. The Kuramoto model is isomorphic to the XY spin Hamiltonian — superconducting qubits simulate it natively via Trotterized time evolution. This repo implements that mapping: it compiles SCPN coupling parameters into Qiskit circuits and validates them on IBM Heron r2 hardware (156 qubits), achieving 0.05% VQE ground-state error and the first quantum simulation of all 16 SCPN layers on real hardware.

If you work on quantum simulation of coupled oscillators, NISQ benchmarking, or Kuramoto/XY physics, this repo gives you a tested pipeline from coupling matrices to hardware results.

Background: SCPN and the Quantum Mapping

SCPN is a theoretical framework in which 16 oscillator layers — each with a natural frequency omega_n — interact through a coupling matrix K_nm:

K_nm = K_base * exp(-alpha * |n - m|)

with K_base = 0.45, alpha = 0.3, and empirical calibration anchors (K[1,2] = 0.302, K[2,3] = 0.201, K[3,4] = 0.252, K[4,5] = 0.154). Cross-hierarchy boosts link distant layers (L1-L16 = 0.05, L5-L7 = 0.15). See docs/equations.md for the full parameter set.

The classical dynamics follow the Kuramoto ODE:

d(theta_i)/dt = omega_i + sum_j K_ij sin(theta_j - theta_i)

The core isomorphism: this ODE maps to the quantum XY Hamiltonian

H = -sum_{i<j} K_ij (X_i X_j + Y_i Y_j) - sum_i omega_i Z_i

where X, Y, Z are Pauli operators. Superconducting transmon qubits implement XX+YY interactions natively through controlled-Z gates, making quantum hardware a natural simulator for Kuramoto phase dynamics. The order parameter R — a measure of global synchronization — is extracted from qubit expectations: R = (1/N)|sum_i (<X_i> + i<Y_i>)|.

Layer coherence vs coupling strength Coherence R as a function of coupling strength K_base across 16 SCPN layers. Strongly-coupled layers (L3, L4, L10) synchronize first; weakly-coupled L12 lags behind, consistent with the exponential decay in K_nm.

Reference: M. Sotek, Self-Consistent Phenomenological Network: Layer Dynamics and Coupling Structure, Working Paper 27 (2025). Manuscript in preparation.

Hardware Results (ibm_fez, February 2026)

Experiment Qubits Depth Hardware Exact Error
VQE ground state 4 12 CZ -6.2998 -6.3030 0.05%
Kuramoto XY (1 rep) 4 85 R=0.743 R=0.802 7.3%
Qubit scaling 6 147 R=0.482 R=0.532 9.3%
UPDE-16 snapshot 16 770 R=0.332 R=0.615 46%
QAOA-MPC (p=2) 4 -- -0.514 0.250 --

Full results with all 12 decoherence data points: results/HARDWARE_RESULTS.md

Key findings:

  • VQE with K_nm-informed ansatz achieves publication-quality 0.05% error
  • Coherence wall at depth 250-400 on Heron r2 — shallow Trotter (1 rep) beats deep Trotter on NISQ devices

Trotter depth tradeoff More Trotter repetitions improve mathematical accuracy but increase circuit depth. On NISQ hardware, decoherence from the extra gates outweighs the Trotter error reduction. Optimal strategy: fewest reps that capture the physics.

  • First quantum simulation of all 16 SCPN layers on real hardware — per-layer structure matches coupling topology

UPDE-16 per-layer expectations Per-layer X-basis expectations from the 16-qubit UPDE snapshot on ibm_fez. L12 (most weakly coupled) shows near-complete decoherence; strongly-coupled layers (L3, L4, L10) maintain coherence.

  • 12-point decoherence curve from depth 5 to 770 with exponential decay fit

Decoherence curve Hardware-to-exact ratio R_hw/R_exact vs circuit depth. The three regimes: near-perfect readout (depth < 25), linear decoherence (85-400), and noise-dominated (> 400).

Architecture

scpn_quantum_control/
├── qsnn/           Quantum spiking neural networks
│   ├── qlif.py         Ry-rotation LIF neuron (P(spike) = sin^2(theta/2))
│   ├── qsynapse.py     Controlled-Ry synapse (CRy weight encoding)
│   ├── qstdp.py        Parameter-shift STDP learning rule
│   └── qlayer.py       Multi-qubit entangled dense layer
├── phase/          Quantum phase dynamics
│   ├── xy_kuramoto.py  Kuramoto -> XY Hamiltonian + Trotter evolution
│   ├── trotter_upde.py 16-layer UPDE as multi-site spin chain
│   └── phase_vqe.py    VQE ground state with Knm-informed ansatz
├── control/        Quantum control algorithms
│   ├── qaoa_mpc.py     QAOA binary MPC trajectory optimization
│   ├── vqls_gs.py      VQLS for Grad-Shafranov equilibrium
│   ├── qpetri.py       Quantum Petri net (superposition tokens)
│   └── q_disruption.py Quantum kernel disruption classifier
├── bridge/         Classical <-> quantum converters
│   ├── knm_hamiltonian.py  Knm matrix -> SparsePauliOp compiler
│   ├── spn_to_qcircuit.py  SPN topology -> quantum circuit
│   └── sc_to_quantum.py    Bitstream probability <-> rotation angle
├── qec/            Quantum error correction
│   └── control_qec.py     Toric code + MWPM decoder (Knm-weighted)
├── mitigation/     Error mitigation
│   ├── zne.py          Zero-noise extrapolation (unitary folding)
│   └── dd.py           Dynamical decoupling (XY4, X2)
└── hardware/       IBM Quantum hardware runner
    ├── runner.py       ibm_fez job submission + result parsing
    ├── experiments.py  Pre-built experiment circuits
    └── classical.py    Classical Kuramoto reference solver

Quick Start

pip install -e ".[dev]"
pytest tests/ -v

Examples

See examples/README.md for a guided walkthrough. Summary:

Example What it does
01_qlif_demo.py Quantum LIF neuron: maps membrane potential to Ry rotation, compares firing rates with classical Bernoulli expectation
02_kuramoto_xy_demo.py 4-oscillator Kuramoto dynamics on the XY Hamiltonian via Trotter evolution; prints R(t) trajectory
03_qaoa_mpc_demo.py QAOA-based binary MPC: optimizes 4-step coil control sequence by mapping quadratic cost to Ising Hamiltonian
04_qpetri_demo.py Quantum Petri net: 3 places, 2 transitions — tokens evolve in superposition via controlled rotations
05_vqe_ansatz_comparison.py Benchmarks three VQE ansatze (K_nm-informed, hardware-efficient, EfficientSU2) on the 4-qubit Kuramoto Hamiltonian
06_zne_demo.py Zero-noise extrapolation on a noisy simulator: unitary folding + Richardson extrapolation under synthetic Heron r2 noise

All examples run on statevector simulation (no QPU needed).

Hardware execution (requires IBM Quantum credentials)

pip install -e ".[ibm]"
python run_hardware.py --experiment kuramoto --qubits 4 --shots 10000

Modules

Quantum Spiking Neural Networks (qsnn/)

Maps stochastic LIF neurons to parameterized quantum circuits. A qubit with Ry(theta) rotation + Z-basis measurement produces spike/no-spike with probability sin^2(theta/2) — direct analog of stochastic membrane potential.

Quantum Phase Dynamics (phase/)

The Kuramoto ODE is isomorphic to the XY spin Hamiltonian (see Background). Quantum hardware simulates this natively via Trotterized time evolution. The 16-layer UPDE (Unified Phase Dynamics Equation — the master equation governing all SCPN layers) becomes a 16-qubit spin chain with K_nm coupling.

Quantum Control (control/)

  • QAOA-MPC: Discretize MPC action space to binary, map quadratic cost to Ising Hamiltonian, solve via QAOA
  • VQLS-GS: Solve discretized Grad-Shafranov PDE as quantum linear system
  • Quantum Petri: SPN tokens as qubit amplitudes, transitions fire in superposition
  • Disruption classifier: 11-D feature amplitude encoding + parameterized circuit

Bridge (bridge/)

Compiles SCPN data structures into quantum circuits:

  • knm_to_hamiltonian(): 16x16 coupling matrix -> SparsePauliOp
  • knm_to_ansatz(): Physics-informed entanglement topology
  • probability_to_angle(): p -> 2*arcsin(sqrt(p))

QEC (qec/)

Toric surface code protecting quantum control signals. MWPM decoder uses Knm graph distance instead of lattice distance for physics-aware error correction.

Error Mitigation (mitigation/)

  • ZNE: Global unitary folding + Richardson extrapolation (Giurgica-Tiron et al. 2020)
  • DD: Dynamical decoupling pulse insertion (XY4, X2) for idle qubits (Viola et al. 1999)

Dependencies

Package Version Purpose
qiskit >= 1.0.0 Circuit construction, transpilation
qiskit-aer >= 0.14.0 Statevector + noise simulation
numpy >= 1.24 Array operations
scipy >= 1.10 Sparse linear algebra, optimization
networkx >= 3.0 Graph algorithms (QEC decoder)

Optional:

  • matplotlib >= 3.5 for visualization
  • qiskit-ibm-runtime >= 0.20.0 for hardware execution

Related Repositories

Repository Description
scpn-fusion-core Classical SCPN algorithms: Kuramoto solvers, coupling matrix calibration, transport models (v3.9.2, 1899 tests)

Citation

@software{scpn_quantum_control,
  title  = {scpn-quantum-control: Quantum-Native SCPN Phase Dynamics and Control},
  author = {Sotek, Miroslav},
  year   = {2026},
  url    = {https://github.com/anulum/scpn-quantum-control}
}

License

MIT

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

scpn_quantum_control-0.3.0.tar.gz (654.8 kB view details)

Uploaded Source

Built Distribution

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

scpn_quantum_control-0.3.0-py3-none-any.whl (47.7 kB view details)

Uploaded Python 3

File details

Details for the file scpn_quantum_control-0.3.0.tar.gz.

File metadata

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

File hashes

Hashes for scpn_quantum_control-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c2bba889fe66a888d3c515abbc7562f02375221d074b537baa9cff938b6ef0a7
MD5 5b55156550e197a5458faa12a4adfbaf
BLAKE2b-256 785f236a4f339669c7357b037097dd2859eb0696c702d7fc2f15da4bab6e7eed

See more details on using hashes here.

Provenance

The following attestation bundles were made for scpn_quantum_control-0.3.0.tar.gz:

Publisher: publish.yml on anulum/scpn-quantum-control

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

File details

Details for the file scpn_quantum_control-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for scpn_quantum_control-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 45b5553efaaa03e3b17efa67c7d456fa029bd1a0a4fe76e35141ca0d6acc1fee
MD5 6f5dc8263baaca5bb9e07b8e1d830ac8
BLAKE2b-256 8aad1cb3e24cd9557a17fec10e7e04caebabb7ef945eedc367442cf57590e2f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for scpn_quantum_control-0.3.0-py3-none-any.whl:

Publisher: publish.yml on anulum/scpn-quantum-control

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