dense-evolution 8.0.3__tar.gz → 8.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dense_evolution-8.0.3 → dense_evolution-8.0.4}/PKG-INFO +540 -7
- {dense_evolution-8.0.3 → dense_evolution-8.0.4}/README.md +532 -1
- dense_evolution-8.0.4/dash.py +4075 -0
- {dense_evolution-8.0.3 → dense_evolution-8.0.4}/dense_evolution.egg-info/PKG-INFO +540 -7
- {dense_evolution-8.0.3 → dense_evolution-8.0.4}/dense_evolution.egg-info/SOURCES.txt +1 -1
- {dense_evolution-8.0.3 → dense_evolution-8.0.4}/dense_evolution.egg-info/requires.txt +6 -0
- {dense_evolution-8.0.3 → dense_evolution-8.0.4}/dense_evolution.egg-info/top_level.txt +1 -0
- {dense_evolution-8.0.3 → dense_evolution-8.0.4}/dense_evolution.py +5 -0
- dense_evolution-8.0.4/pyproject.toml +38 -0
- dense_evolution-8.0.3/LICENSE.md +0 -61
- dense_evolution-8.0.3/pyproject.toml +0 -75
- {dense_evolution-8.0.3 → dense_evolution-8.0.4}/dense_evolution.egg-info/dependency_links.txt +0 -0
- {dense_evolution-8.0.3 → dense_evolution-8.0.4}/setup.cfg +0 -0
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dense-evolution
|
|
3
|
-
Version: 8.0.
|
|
3
|
+
Version: 8.0.4
|
|
4
4
|
Summary: Micro-optimized High-Performance NISQ Statevector Quantum Circuit Simulator (Hardware-Adaptive Integration of Native NumPy, CUDA-Accelerated CuPy, and Linear Kernel Fusion via JAX JIT/XLA Compilation)
|
|
5
5
|
Author-email: Salvatore Pennacchio <jtatopenn@libero.it>
|
|
6
|
-
License:
|
|
6
|
+
License: Proprietary
|
|
7
7
|
Project-URL: Homepage, https://github.com/tatopenn-cell/Dense-Evolution
|
|
8
8
|
Project-URL: Documentation, https://github.com/tatopenn-cell/Dense-Evolution/blob/main/LICENSE
|
|
9
9
|
Project-URL: Repository, https://github.com/tatopenn-cell/Dense-Evolution
|
|
10
10
|
Project-URL: Bug Tracker, https://github.com/tatopenn-cell/Dense-Evolution/blob/main/dense_evolution.py
|
|
11
|
-
Keywords: quantum-computing,quantum-simulation,statevector,jax,cupy,cuda-acceleration,openqasm,nisq-noise,hpc,linear-kernel-fusion
|
|
11
|
+
Keywords: quantum-computing,quantum-simulation,statevector,jax,cupy,cuda-acceleration,openqasm,nisq-noise,hpc,linear-kernel-fusion,dashboard,visualization
|
|
12
12
|
Classifier: Development Status :: 5 - Production/Stable
|
|
13
13
|
Classifier: Intended Audience :: Science/Research
|
|
14
14
|
Classifier: Intended Audience :: Developers
|
|
15
|
-
Classifier: License :: Other/Proprietary License
|
|
16
15
|
Classifier: Programming Language :: Python :: 3
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.9
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -22,7 +21,6 @@ Classifier: Topic :: Scientific/Engineering :: Physics
|
|
|
22
21
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
22
|
Requires-Python: >=3.9
|
|
24
23
|
Description-Content-Type: text/markdown
|
|
25
|
-
License-File: LICENSE.md
|
|
26
24
|
Requires-Dist: numpy>=1.22.0
|
|
27
25
|
Requires-Dist: matplotlib>=3.5.0
|
|
28
26
|
Requires-Dist: psutil>=5.9.0
|
|
@@ -31,13 +29,17 @@ Requires-Dist: jax>=0.4.0; extra == "jax"
|
|
|
31
29
|
Requires-Dist: jaxlib>=0.4.0; extra == "jax"
|
|
32
30
|
Provides-Extra: gpu
|
|
33
31
|
Requires-Dist: cupy-cuda12x>=12.0.0; extra == "gpu"
|
|
32
|
+
Provides-Extra: dashboard
|
|
33
|
+
Requires-Dist: dash>=2.0.0; extra == "dashboard"
|
|
34
|
+
Requires-Dist: plotly>=5.0.0; extra == "dashboard"
|
|
34
35
|
Provides-Extra: full
|
|
35
36
|
Requires-Dist: jax>=0.4.0; extra == "full"
|
|
36
37
|
Requires-Dist: jaxlib>=0.4.0; extra == "full"
|
|
37
38
|
Requires-Dist: cupy-cuda12x>=12.0.0; extra == "full"
|
|
38
|
-
|
|
39
|
+
Requires-Dist: dash>=2.0.0; extra == "full"
|
|
40
|
+
Requires-Dist: plotly>=5.0.0; extra == "full"
|
|
39
41
|
|
|
40
|
-
# 💎 Dense Evolution
|
|
42
|
+
# 💎 Dense Evolution 8.0.4
|
|
41
43
|
|
|
42
44
|
|
|
43
45
|
[](https://github.com/tatopenn-cell/Dense-Evolution/actions/workflows/ci.yml)
|
|
@@ -1170,4 +1172,535 @@ Discovered different scaling behavior or performance metrics on your specific ha
|
|
|
1170
1172
|
* **Reproducible Example:** Code snippet or script used for the test run.
|
|
1171
1173
|
* **Execution Metrics:** Timing results and memory allocation logs.
|
|
1172
1174
|
|
|
1175
|
+
# Dense Evolution — Enterprise Dashboard v8.0.4
|
|
1173
1176
|
|
|
1177
|
+
**Interactive scientific visualization suite for the Dense Evolution quantum simulation ecosystem.**
|
|
1178
|
+
|
|
1179
|
+
---
|
|
1180
|
+
|
|
1181
|
+
## Table of Contents
|
|
1182
|
+
|
|
1183
|
+
1. [Overview](#1-overview)
|
|
1184
|
+
2. [Quick Start](#2-quick-start)
|
|
1185
|
+
3. [Configuration](#3-configuration)
|
|
1186
|
+
4. [Architecture](#4-architecture)
|
|
1187
|
+
5. [Control Panel Reference](#5-control-panel-reference)
|
|
1188
|
+
6. [Circuit Library](#6-circuit-library)
|
|
1189
|
+
7. [VQE Engine & ADAM Optimizer](#7-vqe-engine--adam-optimizer)
|
|
1190
|
+
8. [Hamiltonian Library](#8-hamiltonian-library)
|
|
1191
|
+
9. [Noise Models](#9-noise-models)
|
|
1192
|
+
10. [Molecular Dynamics](#10-molecular-dynamics)
|
|
1193
|
+
11. [Visualization Panels](#11-visualization-panels)
|
|
1194
|
+
12. [Export & Provenance](#12-export--provenance)
|
|
1195
|
+
13. [Technical Reference](#13-technical-reference)
|
|
1196
|
+
14. [Troubleshooting](#14-troubleshooting)
|
|
1197
|
+
15. [License](#15-license)
|
|
1198
|
+
|
|
1199
|
+
---
|
|
1200
|
+
|
|
1201
|
+
## 1. Overview
|
|
1202
|
+
|
|
1203
|
+
The Dense Evolution Enterprise Dashboard is a high-throughput interactive visualization layer built on top of the `dense-evolution` core engine. It runs entirely inside Google Colab or any Jupyter-compatible environment via `ipywidgets` and `matplotlib`, with zero external server dependencies.
|
|
1204
|
+
|
|
1205
|
+
**Key capabilities:**
|
|
1206
|
+
|
|
1207
|
+
- Live statevector simulation on up to 24 qubits (commercial-grade; up to 33 qubits in research mode) via a JAX XLA JIT-compiled backend with optional GPU acceleration
|
|
1208
|
+
- Six parallel telemetry channels: VQE energy, Von Neumann entropy, state purity, gradient norm, noise factor, and θ correction, updated on every run
|
|
1209
|
+
- Dynamic routing across six visualization panels — Overview, State Physics, 1008q Mosaic, VQE Results, MD Simulation Results, and Performance
|
|
1210
|
+
- Full NISQ noise simulation (depolarizing, amplitude damping, phase damping) with Bhattacharyya fidelity and TVD metrics computed live
|
|
1211
|
+
- Variational quantum eigensolver (VQE) with analytical Hellmann-Feynman gradient via JAX automatic differentiation and ADAM optimizer
|
|
1212
|
+
- Molecular dynamics (QM/MM) simulation with Pearson correlation heatmap across all telemetry variables
|
|
1213
|
+
- One-click JSON provenance export and publication-ready PNG output at 300 DPI
|
|
1214
|
+
- BSL 1.1 licensed with automatic Apache 2.0 conversion on 1 June 2029
|
|
1215
|
+
|
|
1216
|
+
---
|
|
1217
|
+
|
|
1218
|
+
## 2. Quick Start
|
|
1219
|
+
|
|
1220
|
+
### Installation
|
|
1221
|
+
|
|
1222
|
+
```bash
|
|
1223
|
+
pip install dense-evolution
|
|
1224
|
+
```
|
|
1225
|
+
|
|
1226
|
+
The dashboard auto-installs the core engine on first run if not detected.
|
|
1227
|
+
|
|
1228
|
+
### Launch
|
|
1229
|
+
|
|
1230
|
+
Upload `dash.py`, `dashboard.toml`, and optionally your custom QASM files to your Colab workspace, then run:
|
|
1231
|
+
|
|
1232
|
+
```python
|
|
1233
|
+
from dash import dashboard_unificata
|
|
1234
|
+
from IPython.display import display
|
|
1235
|
+
|
|
1236
|
+
display(dashboard_unificata)
|
|
1237
|
+
```
|
|
1238
|
+
|
|
1239
|
+
The full control panel appears inline. Press **▶ Run Simulation** to execute the selected circuit and render all panels.
|
|
1240
|
+
|
|
1241
|
+
### Minimal Example (headless)
|
|
1242
|
+
|
|
1243
|
+
```python
|
|
1244
|
+
import dense_evolution as de
|
|
1245
|
+
|
|
1246
|
+
sim = de.DenseSVSimulator(n_qubits=4, use_gpu=False, use_float32=False)
|
|
1247
|
+
parser = de.QASMParser()
|
|
1248
|
+
circuit = parser.parse(QASM_LIBRARY['Bell |Φ+⟩'])
|
|
1249
|
+
sim.run_circuit_jit_beast_mode(circuit.ops)
|
|
1250
|
+
|
|
1251
|
+
print(sim.get_probabilities()) # [0.5, 0.0, 0.0, 0.5]
|
|
1252
|
+
print(sim.memory_mb()) # 0.000256 MB
|
|
1253
|
+
```
|
|
1254
|
+
|
|
1255
|
+
---
|
|
1256
|
+
|
|
1257
|
+
## 3. Configuration
|
|
1258
|
+
|
|
1259
|
+
Persistent settings are stored in `dashboard.toml`. All values are readable by the dashboard on load; changes take effect on the next kernel restart.
|
|
1260
|
+
|
|
1261
|
+
```toml
|
|
1262
|
+
[theme]
|
|
1263
|
+
style = "dark"
|
|
1264
|
+
primary_color = "#FFA500"
|
|
1265
|
+
secondary_color = "#8A2BE2"
|
|
1266
|
+
background = "#0D0E15"
|
|
1267
|
+
font_family = "monospace"
|
|
1268
|
+
|
|
1269
|
+
[simulator_defaults]
|
|
1270
|
+
max_qubits = 24 # BSL commercial limit
|
|
1271
|
+
default_qubits = 4
|
|
1272
|
+
precision = "float64"
|
|
1273
|
+
use_gpu = false
|
|
1274
|
+
use_jax = true
|
|
1275
|
+
sealed_compiler_v4 = true # enables XLA kernel fusion
|
|
1276
|
+
|
|
1277
|
+
[nisq_settings]
|
|
1278
|
+
default_shots = 4096
|
|
1279
|
+
default_seed = 42
|
|
1280
|
+
default_noise_model = "ideal"
|
|
1281
|
+
default_p_noise = 0.00
|
|
1282
|
+
|
|
1283
|
+
[vqe_settings]
|
|
1284
|
+
epochs = 100
|
|
1285
|
+
learning_rate = 0.01
|
|
1286
|
+
beta1 = 0.90
|
|
1287
|
+
beta2 = 1.00
|
|
1288
|
+
optimizer = "ADAM"
|
|
1289
|
+
gradient_method = "Hellmann-Feynman"
|
|
1290
|
+
|
|
1291
|
+
[md_settings]
|
|
1292
|
+
steps = 100
|
|
1293
|
+
temperature_k = 300.00
|
|
1294
|
+
force_engine = "QM/MM"
|
|
1295
|
+
```
|
|
1296
|
+
|
|
1297
|
+
---
|
|
1298
|
+
|
|
1299
|
+
## 4. Architecture
|
|
1300
|
+
|
|
1301
|
+
```
|
|
1302
|
+
dash.py
|
|
1303
|
+
│
|
|
1304
|
+
├── PART 1 — JIT Compute Engine
|
|
1305
|
+
│ ├── dense-evolution auto-install & parametric patch injection
|
|
1306
|
+
│ ├── QASM_LIBRARY (80+ built-in circuits)
|
|
1307
|
+
│ ├── estrai_valore_puro() (deep AST token unwrapper)
|
|
1308
|
+
│ └── core_calcolo_quantistico()
|
|
1309
|
+
│ ├── QASMParser → AST → comandi_beast_mode[]
|
|
1310
|
+
│ ├── DenseSVSimulator.run_circuit_jit_beast_mode()
|
|
1311
|
+
│ ├── NoiseModel.apply_to_sv() (if noise ≠ ideal)
|
|
1312
|
+
│ ├── Shannon entropy, Bhattacharyya fidelity, TVD
|
|
1313
|
+
│ └── returns res{} dict → all panels
|
|
1314
|
+
│
|
|
1315
|
+
├── PART 2 — VQE Engine (ottimizza_vqe)
|
|
1316
|
+
│ ├── positional parameter injection into AST
|
|
1317
|
+
│ ├── QMMMForceEngine (Hellmann-Feynman via JAX AD)
|
|
1318
|
+
│ ├── ADAM optimizer (m, v moments, bias correction)
|
|
1319
|
+
│ └── df_vqe_telemetry → Step, VQE_Energy, Entropy,
|
|
1320
|
+
│ Purity, Gradient, Noise_Factor,
|
|
1321
|
+
│ Theta_Correction
|
|
1322
|
+
│
|
|
1323
|
+
├── PART 3 — MD Simulation (run_md_simulation_dummy)
|
|
1324
|
+
│ ├── df_md_telemetry
|
|
1325
|
+
│ └── matrice_correlazione (Pearson, full × full)
|
|
1326
|
+
│
|
|
1327
|
+
├── PART 4 — Visualization Panels
|
|
1328
|
+
│ ├── build_panel_overview() 8-row scientific dashboard
|
|
1329
|
+
│ ├── build_panel_fisica() state physics analysis
|
|
1330
|
+
│ ├── build_panel_mosaico() 1008-qubit probability mosaic
|
|
1331
|
+
│ ├── build_panel_vqe_results() VQE-specific telemetry
|
|
1332
|
+
│ ├── build_panel_md_results() MD telemetry + correlation heatmap
|
|
1333
|
+
│ └── build_panel_performance() benchmark metrics
|
|
1334
|
+
│
|
|
1335
|
+
└── PART 5 — ipywidgets UI + routing
|
|
1336
|
+
├── dashboard_unificata (VBox)
|
|
1337
|
+
├── trigger_esecuzione_dashboard() → run → route → display
|
|
1338
|
+
└── auxiliary triggers: benchmark, export, PNG, history
|
|
1339
|
+
```
|
|
1340
|
+
|
|
1341
|
+
**Data flow on each run:**
|
|
1342
|
+
|
|
1343
|
+
```
|
|
1344
|
+
▶ Run → core_calcolo_quantistico() → res{}
|
|
1345
|
+
│
|
|
1346
|
+
┌────────────────────┤
|
|
1347
|
+
│ │
|
|
1348
|
+
ottimizza_vqe() run_md_simulation_dummy()
|
|
1349
|
+
│ │
|
|
1350
|
+
df_vqe_telemetry df_md_telemetry + matrice_correlazione
|
|
1351
|
+
│ │
|
|
1352
|
+
└────────────────────┘
|
|
1353
|
+
│
|
|
1354
|
+
build_panel_*(res) → Figure → display()
|
|
1355
|
+
```
|
|
1356
|
+
|
|
1357
|
+
---
|
|
1358
|
+
|
|
1359
|
+
## 5. Control Panel Reference
|
|
1360
|
+
|
|
1361
|
+
### Source
|
|
1362
|
+
|
|
1363
|
+
| Control | Type | Description |
|
|
1364
|
+
|---|---|---|
|
|
1365
|
+
| **Source Mode** | RadioButtons | `Libreria Built-in` uses a preset from the QASM library. `Custom QASM Textarea` enables direct QASM 2.0 input. |
|
|
1366
|
+
| **Circuit** | Dropdown | Active when source mode is Built-in. Selects from 80+ preset circuits organized across five categories. |
|
|
1367
|
+
| **QASM Area** | Textarea | Active when source mode is Custom. Accepts any valid OpenQASM 2.0 string. |
|
|
1368
|
+
|
|
1369
|
+
### Hamiltonian
|
|
1370
|
+
|
|
1371
|
+
| Control | Type | Description |
|
|
1372
|
+
|---|---|---|
|
|
1373
|
+
| **Enable Hamiltonian Settings** | Checkbox | Activates the Hamiltonian sub-panel. When disabled, the engine uses a random diagonal Hamiltonian. |
|
|
1374
|
+
| **Hamiltonian Mode** | RadioButtons | `Hamiltonian Built-in` selects from the built-in chemical library. `Custom Hamiltonian Textarea` accepts a JSON array of energy eigenvalues. |
|
|
1375
|
+
| **Hamiltonian Selector** | Dropdown | Filters to Hamiltonians compatible with the declared qubit count. |
|
|
1376
|
+
| **Hamiltonian Area** | Textarea | JSON format: `[-1.13, -0.45, 0.12, 0.64]`. Length must equal `2^n_qubits`. |
|
|
1377
|
+
|
|
1378
|
+
### NISQ Settings
|
|
1379
|
+
|
|
1380
|
+
| Control | Type | Range | Description |
|
|
1381
|
+
|---|---|---|---|
|
|
1382
|
+
| **Noise Model** | Dropdown | ideal / depolarizing / amplitude_damping / phase_damping | Applies a Kraus channel to the statevector post-circuit. |
|
|
1383
|
+
| **p noise** | FloatSlider | 0.000 – 0.100 | Error probability per qubit per gate. |
|
|
1384
|
+
| **Shots** | IntSlider | 512 – 65536 | Number of projective measurement samples for the shot histogram. |
|
|
1385
|
+
| **Seed RND** | IntText | any int | NumPy seed for reproducible noise and shot sampling. |
|
|
1386
|
+
| **Double Precision** | Checkbox | — | Forces `complex128` / `float64` throughout. Disabled = `complex64` / `float32`. |
|
|
1387
|
+
|
|
1388
|
+
### VQE Settings
|
|
1389
|
+
|
|
1390
|
+
| Control | Type | Range | Description |
|
|
1391
|
+
|---|---|---|---|
|
|
1392
|
+
| **Enable VQE** | Checkbox | — | Activates the full `ottimizza_vqe()` pipeline. When disabled, `df_vqe_telemetry` is cleared. |
|
|
1393
|
+
| **VQE Epochs** | IntText | 1 – ∞ | Optimization iterations. |
|
|
1394
|
+
| **Adam LR** | FloatSlider | 0.0001 – 0.1 | ADAM learning rate α. |
|
|
1395
|
+
| **Adam Beta1** | FloatSlider | 0.0 – 0.999 | First-moment decay rate. |
|
|
1396
|
+
| **Adam Beta2** | FloatSlider | 0.0 – 0.999 | Second-moment decay rate. |
|
|
1397
|
+
|
|
1398
|
+
### MD Settings
|
|
1399
|
+
|
|
1400
|
+
| Control | Type | Range | Description |
|
|
1401
|
+
|---|---|---|---|
|
|
1402
|
+
| **Enable MD** | Checkbox | — | Activates `run_md_simulation_dummy()`. When disabled, `df_md_telemetry` and `matrice_correlazione` are cleared. |
|
|
1403
|
+
| **MD Steps** | IntSlider | 10 – 1000 | Number of molecular dynamics integration steps. |
|
|
1404
|
+
| **Temperature (K)** | FloatSlider | 0.1 – 1000.0 | Thermal bath temperature in Kelvin. |
|
|
1405
|
+
|
|
1406
|
+
### Panel Selector
|
|
1407
|
+
|
|
1408
|
+
| Panel | Description |
|
|
1409
|
+
|---|---|
|
|
1410
|
+
| **Overview** | 8-panel scientific dashboard (probability, top states, helix 3D, metrics, noise, shots, VQE telemetry × 6, correlation heatmap) |
|
|
1411
|
+
| **Fisica Stato** | State physics: Bloch-sphere projection, Schmidt rank, coherence vector |
|
|
1412
|
+
| **Mosaico 1008q** | 2D probability density map up to 1008 qubits |
|
|
1413
|
+
| **VQE Results** | Dedicated VQE telemetry: energy convergence, entropy, purity, gradient, noise factor, θ correction |
|
|
1414
|
+
| **MD Simulation Results** | MD energy + entropy + purity + gradient + noise + θ correction + full Pearson heatmap |
|
|
1415
|
+
| **Performance** | Benchmark metrics: gate throughput, JIT compile time, memory usage |
|
|
1416
|
+
|
|
1417
|
+
### Action Buttons
|
|
1418
|
+
|
|
1419
|
+
| Button | Description |
|
|
1420
|
+
|---|---|
|
|
1421
|
+
| **▶ Run Simulation** | Executes the full pipeline: circuit → VQE → MD → panel render |
|
|
1422
|
+
| **📊 Benchmark χ** | Runs the χ-scaling benchmark across qubit counts and plots throughput |
|
|
1423
|
+
| **💾 Export Provenance** | Saves a JSON file with full run metadata, circuit name, qubit count, entropy, dominant state, and timestamp |
|
|
1424
|
+
| **📄 Paper-Ready PNG** | Exports the current figure at 300 DPI to `figure_paper.png` |
|
|
1425
|
+
| **🕒 Cronologia** | Prints the run history log to the output cell |
|
|
1426
|
+
| **💊 Save Hamiltonian** | Serializes the current Hamiltonian configuration to the provenance record |
|
|
1427
|
+
|
|
1428
|
+
---
|
|
1429
|
+
|
|
1430
|
+
## 6. Circuit Library
|
|
1431
|
+
|
|
1432
|
+
The library ships with 30+ preset circuits across 4 categories. All circuits are stored as OpenQASM 2.0 strings in `QASM_LIBRARY` and can be extended without modifying the engine.
|
|
1433
|
+
|
|
1434
|
+
### Standard
|
|
1435
|
+
|
|
1436
|
+
Bell |Φ+⟩, QFT 4 qubit, Toffoli (CCX), Adder 2-bit, Deutsch-Jozsa balanced, Bernstein-Vazirani (101)
|
|
1437
|
+
|
|
1438
|
+
### Quantum Algorithms
|
|
1439
|
+
|
|
1440
|
+
Grover 3q Oracle |111⟩, Simon Algorithm 4q s=11, Shor 15 (Simplified), HHL Matrix Inversion, QAOA Max-Cut 4q, QPE Precision 5q, QFT 8q High-Res, Quantum Walk, Quantum Teleportation
|
|
1441
|
+
|
|
1442
|
+
### Advanced Topological
|
|
1443
|
+
|
|
1444
|
+
Anyonic Braiding Fibonacci 6q, Topological Charge Pump 8q, MultiControlled-Z 5q, Hyper Inversion 8q, Deep Topological Unified 8q
|
|
1445
|
+
|
|
1446
|
+
---
|
|
1447
|
+
|
|
1448
|
+
## 7. VQE Engine & ADAM Optimizer
|
|
1449
|
+
|
|
1450
|
+
### Positional Parameter Injection
|
|
1451
|
+
|
|
1452
|
+
Because the `QASMParser` tokenizes all parameter literals to `0.0` in the AST for maximum JIT throughput, the VQE engine uses a **positional injection** strategy:
|
|
1453
|
+
|
|
1454
|
+
1. Scan the AST and count parametric gates (`rx`, `ry`, `rz`, `u1`, `p`, `cp`, `crz`) — this gives `n_params`.
|
|
1455
|
+
2. Allocate `θ ∈ ℝⁿ` initialized uniformly in `[-π, π]`.
|
|
1456
|
+
3. On each epoch, inject `θ[i]` sequentially by gate appearance order in the AST via `risolvi_qasm()`.
|
|
1457
|
+
|
|
1458
|
+
This makes the engine compatible with any valid OpenQASM 2.0 custom circuit without pre-labelling parameters.
|
|
1459
|
+
|
|
1460
|
+
### Hellmann-Feynman Gradient
|
|
1461
|
+
|
|
1462
|
+
The gradient is computed analytically via JAX automatic differentiation through the `QMMMForceEngine`:
|
|
1463
|
+
|
|
1464
|
+
```
|
|
1465
|
+
∂E/∂θᵢ = ⟨ψ(θ)| ∂H/∂θᵢ |ψ(θ)⟩
|
|
1466
|
+
```
|
|
1467
|
+
|
|
1468
|
+
where the QM/MM Hamiltonian includes classical electrostatic contributions from atomic positions `r`, charges `q`, and orbital centers.
|
|
1469
|
+
|
|
1470
|
+
The gradient norm `‖∇L‖` per epoch is logged to `df_vqe_telemetry['Gradient']`.
|
|
1471
|
+
|
|
1472
|
+
### ADAM Update Rule
|
|
1473
|
+
|
|
1474
|
+
```
|
|
1475
|
+
mₜ = β₁ · mₜ₋₁ + (1 − β₁) · g
|
|
1476
|
+
vₜ = β₂ · vₜ₋₁ + (1 − β₂) · g²
|
|
1477
|
+
m̂ₜ = mₜ / (1 − β₁ᵗ)
|
|
1478
|
+
v̂ₜ = vₜ / (1 − β₂ᵗ)
|
|
1479
|
+
θ ← θ − α · m̂ₜ / (√v̂ₜ + ε)
|
|
1480
|
+
```
|
|
1481
|
+
|
|
1482
|
+
`Theta_Correction` per epoch = `‖α · m̂ₜ / (√v̂ₜ + ε)‖` — logged to `df_vqe_telemetry['Theta_Correction']`.
|
|
1483
|
+
|
|
1484
|
+
### Telemetry Columns
|
|
1485
|
+
|
|
1486
|
+
| Column | Unit | Description |
|
|
1487
|
+
|---|---|---|
|
|
1488
|
+
| `VQE_Energy` | Ha | `⟨ψ|H|ψ⟩` expectation value |
|
|
1489
|
+
| `Entropy` | bit | Von Neumann entropy S = −Tr(ρ log₂ ρ) |
|
|
1490
|
+
| `Purity` | — | Tr(ρ²) ∈ [1/d, 1] |
|
|
1491
|
+
| `Gradient` | — | `‖∇L‖` Euclidean norm of parameter gradient |
|
|
1492
|
+
| `Noise_Factor` | — | Fidelity-derived noise proxy (heuristic) |
|
|
1493
|
+
| `Theta_Correction` | rad | ADAM step norm per epoch |
|
|
1494
|
+
|
|
1495
|
+
### Fallback Mock
|
|
1496
|
+
|
|
1497
|
+
If the circuit has no parametric gates (`n_params == 0`), the engine falls back to `_run_vqe_mock_simulation()`, which generates physically plausible synthetic telemetry curves for demonstration purposes. The output DataFrame has the same schema as the analytical run.
|
|
1498
|
+
|
|
1499
|
+
---
|
|
1500
|
+
|
|
1501
|
+
## 8. Hamiltonian Library
|
|
1502
|
+
|
|
1503
|
+
Real chemical Hamiltonians derived from molecular integrals. Automatically filtered by qubit count to prevent shape mismatch errors.
|
|
1504
|
+
|
|
1505
|
+
| Molecule | Qubits | Bond length | E₀ (Ha) |
|
|
1506
|
+
|---|---|---|---|
|
|
1507
|
+
| H₂ (Hydrogen) | 2 | 0.74 Å (equilibrium) | −1.13 |
|
|
1508
|
+
| H₃⁺ (Trihydrogen cation, linear) | 3 | 0.85 Å | −1.28 |
|
|
1509
|
+
| LiH (Lithium hydride) | 4 | 1.40 Å (minimum) | −2.31 |
|
|
1510
|
+
| H₂O (Water, embedding core) | 5 | 0.96 Å | −4.12 |
|
|
1511
|
+
|
|
1512
|
+
Custom Hamiltonians are accepted as JSON arrays of diagonal energy eigenvalues (length must equal `2^n_qubits`):
|
|
1513
|
+
|
|
1514
|
+
```json
|
|
1515
|
+
[-4.12, -3.79, -3.47, -3.15, -2.83, -2.51, -2.18, -1.85,
|
|
1516
|
+
-1.52, -1.19, -0.86, -0.53, -0.20, 0.13, 0.46, 0.79,
|
|
1517
|
+
1.12, 1.45, 1.78, 2.11, 2.44, 2.77, 3.10, 3.43,
|
|
1518
|
+
3.76, 4.09, 4.42, 4.75, 5.08, 5.41, 5.74, 6.07]
|
|
1519
|
+
```
|
|
1520
|
+
|
|
1521
|
+
---
|
|
1522
|
+
|
|
1523
|
+
## 9. Noise Models
|
|
1524
|
+
|
|
1525
|
+
All models are applied as Kraus channels to the full statevector after circuit execution.
|
|
1526
|
+
|
|
1527
|
+
| Model | Kraus operators | Physical process |
|
|
1528
|
+
|---|---|---|
|
|
1529
|
+
| `ideal` | Identity | Noiseless simulation |
|
|
1530
|
+
| `depolarizing` | {√(1−p)I, √(p/3)X, √(p/3)Y, √(p/3)Z} | Equiprobable Pauli errors |
|
|
1531
|
+
| `amplitude_damping` | {K₀, K₁} | Energy relaxation T₁ decay |
|
|
1532
|
+
| `phase_damping` | {K₀, K₁} | Dephasing T₂ decay |
|
|
1533
|
+
|
|
1534
|
+
**Fidelity metrics computed on every noisy run:**
|
|
1535
|
+
|
|
1536
|
+
- **Bhattacharyya Fidelity**: `F = Σᵢ √(pᵢ · qᵢ)` where p = ideal distribution, q = noisy distribution
|
|
1537
|
+
- **Total Variation Distance**: `TVD = ½ Σᵢ |pᵢ − qᵢ|`
|
|
1538
|
+
- **Theoretical depolarizing fidelity**: `F(p,n) = (1 − p(d−1)/d)ⁿ` where d = 2ⁿ, shown as an inset curve in the Noise Analysis panel
|
|
1539
|
+
|
|
1540
|
+
**Dtype alignment note:** The engine enforces a consistent dtype across all Kraus branches before `jax.lax.cond` evaluation to prevent `TypeError: cond branches must have equal output types`. The alignment patch is injected automatically via `de.patch_dense_parametric()` on startup.
|
|
1541
|
+
|
|
1542
|
+
---
|
|
1543
|
+
|
|
1544
|
+
## 10. Molecular Dynamics
|
|
1545
|
+
|
|
1546
|
+
The MD module (`run_md_simulation_dummy`) simulates quantum-classical (QM/MM) dynamics and populates two globals:
|
|
1547
|
+
|
|
1548
|
+
- `df_md_telemetry` — per-step DataFrame with the same six telemetry columns as VQE
|
|
1549
|
+
- `matrice_correlazione` — Pearson correlation matrix across all telemetry variables
|
|
1550
|
+
|
|
1551
|
+
Convergence validation (1500-epoch stress test at 5 K) confirms:
|
|
1552
|
+
|
|
1553
|
+
- Hellmann-Feynman gradient decays rigorously to zero at the molecular energy minimum (e.g., −4.1200 Ha for H₂O), certifying geometric stability.
|
|
1554
|
+
- Activating `depolarizing` or `amplitude_damping` noise introduces coherent micro-jitter on entropy and stabilizes purity below the ideal threshold — consistent with real noisy-chip behavior.
|
|
1555
|
+
|
|
1556
|
+
---
|
|
1557
|
+
|
|
1558
|
+
## 11. Visualization Panels
|
|
1559
|
+
|
|
1560
|
+
### Overview (8-row layout)
|
|
1561
|
+
|
|
1562
|
+
| Row | Left | Right |
|
|
1563
|
+
|---|---|---|
|
|
1564
|
+
| 0 | Header bar: circuit name, qubit count, gate count, wall time, RAM, noise parameters | — |
|
|
1565
|
+
| 1 | Probability distribution P(\|n⟩) with custom cyan→rose colormap, dominant state highlighted | Top-12 states ranked by probability, plasma colormap |
|
|
1566
|
+
| 2 | Wavefunction helix 3D: amplitude-colored scatter on (Re(ψ), Im(ψ), \|n⟩) | Simulation metrics table: 13 key values |
|
|
1567
|
+
| 3 | Noise Analysis: model label, p-gauge, fidelity/TVD table, theoretical F(p) curve inset | NISQ Shot Histogram with expected distribution overlay and σ annotation |
|
|
1568
|
+
| 4 | VQE Energy (Ha) — convergence epoch marked | Von Neumann Entropy (bit) |
|
|
1569
|
+
| 5 | State Purity Tr(ρ²) — ideal reference at 1.0 | ‖∇L‖ Gradient Norm — barren plateau detection |
|
|
1570
|
+
| 6 | Noise Factor — reference at 1.0 | θ Correction (rad) — reference at 0.0 |
|
|
1571
|
+
| 7 | Pearson Correlation Matrix (full width) — masked upper triangle, RdBu_r diverging colormap | — |
|
|
1572
|
+
|
|
1573
|
+
**Barren plateau detection (Row 5, gradient panel):** epochs where `|g| < 0.01 · max|g|` are highlighted with an `axvspan` region and labeled inline.
|
|
1574
|
+
|
|
1575
|
+
**Value badges:** every VQE telemetry panel carries a top-right badge showing the final epoch value (e.g., `Eₙ = −1.1302 Ha`).
|
|
1576
|
+
|
|
1577
|
+
### VQE Results
|
|
1578
|
+
|
|
1579
|
+
Dedicated 6-subplot panel showing all six telemetry columns from `df_vqe_telemetry` with the same enhanced rendering as Overview rows 4–6: fill-under area, rolling mean overlay, convergence annotations, and value badges.
|
|
1580
|
+
|
|
1581
|
+
### MD Simulation Results
|
|
1582
|
+
|
|
1583
|
+
Six time-series plots for `df_md_telemetry` plus a full-width masked Pearson correlation heatmap. Font size on the heatmap annotations is automatically scaled to `72 / n_variables` to remain legible at any matrix size.
|
|
1584
|
+
|
|
1585
|
+
---
|
|
1586
|
+
|
|
1587
|
+
## 12. Export & Provenance
|
|
1588
|
+
|
|
1589
|
+
### JSON Provenance
|
|
1590
|
+
|
|
1591
|
+
Triggered by **💾 Export Provenance**. Saves to `provenance_rnd42.json` (configurable in `dashboard.toml`):
|
|
1592
|
+
|
|
1593
|
+
```json
|
|
1594
|
+
{
|
|
1595
|
+
"run_id": "uuid4",
|
|
1596
|
+
"timestamp": "2026-05-30T14:22:11Z",
|
|
1597
|
+
"circuit": "Grover_3q_Oracle_111",
|
|
1598
|
+
"n_qubits": 3,
|
|
1599
|
+
"entropy": 1.584962,
|
|
1600
|
+
"dominant_state": "111",
|
|
1601
|
+
"p_dominant": 0.970312,
|
|
1602
|
+
"noise_model": "depolarizing",
|
|
1603
|
+
"noise_p": 0.005,
|
|
1604
|
+
"shots": 4096,
|
|
1605
|
+
"seed": 42,
|
|
1606
|
+
"wall_time_ms": 3.14,
|
|
1607
|
+
"ram_mb": 0.000064,
|
|
1608
|
+
"vqe_epochs": 100,
|
|
1609
|
+
"adam_lr": 0.01,
|
|
1610
|
+
"annotation": "optional user note"
|
|
1611
|
+
}
|
|
1612
|
+
```
|
|
1613
|
+
|
|
1614
|
+
### PNG Export
|
|
1615
|
+
|
|
1616
|
+
Triggered by **📄 Paper-Ready PNG** is work in progress...wain next upgrade
|
|
1617
|
+
|
|
1618
|
+
---
|
|
1619
|
+
|
|
1620
|
+
## 13. Technical Reference
|
|
1621
|
+
|
|
1622
|
+
### `core_calcolo_quantistico()`
|
|
1623
|
+
|
|
1624
|
+
Main compute function. Parses the QASM string, builds `comandi_beast_mode[]`, runs `DenseSVSimulator.run_circuit_jit_beast_mode()`, optionally applies noise, and returns `res{}`.
|
|
1625
|
+
|
|
1626
|
+
**Return dict keys:**
|
|
1627
|
+
|
|
1628
|
+
| Key | Type | Description |
|
|
1629
|
+
|---|---|---|
|
|
1630
|
+
| `prob` | ndarray | Measurement probability distribution |
|
|
1631
|
+
| `prob_ideal` | ndarray | Noiseless probability distribution |
|
|
1632
|
+
| `noise_factor` | ndarray | 100-point fidelity decay curve |
|
|
1633
|
+
| `fidelity` | float | Bhattacharyya fidelity (ideal vs noisy) |
|
|
1634
|
+
| `n_qubits` | int | Allocated qubit count |
|
|
1635
|
+
| `entropy` | float | Shannon entropy (bit) |
|
|
1636
|
+
| `idx_max` | int | Index of dominant computational basis state |
|
|
1637
|
+
| `stato_dominante` | str | Binary string of dominant state |
|
|
1638
|
+
| `tempo` | float | Wall-clock time (seconds) |
|
|
1639
|
+
| `ram` | float | Statevector RAM (MB) |
|
|
1640
|
+
| `nome` | str | Circuit name |
|
|
1641
|
+
| `porte_count` | int | Executed gate count |
|
|
1642
|
+
| `shots_data` | ndarray | Sampled measurement outcomes |
|
|
1643
|
+
| `sim` | DenseSVSimulator | Live simulator instance |
|
|
1644
|
+
| `parser` | QASMParser | Reusable parser instance |
|
|
1645
|
+
|
|
1646
|
+
### `estrai_valore_puro(elemento)`
|
|
1647
|
+
|
|
1648
|
+
Recursive deep-unwrapper for AST tokens. Handles callables, objects with `.index` or `.value` attributes, numpy scalars, and plain Python numerics. Returns a pure `int`, `float`, or `str`. Required because the `QASMParser` can return heterogeneous token types depending on gate context.
|
|
1649
|
+
|
|
1650
|
+
### `risolvi_qasm(parametric_commands, param_dict, n_qubits, theta_params, current_param_counter)`
|
|
1651
|
+
|
|
1652
|
+
Converts raw AST command dicts to the `[gate_name, target, control_or_param, ...]` list format accepted by `run_circuit_jit_beast_mode()`. Injects `theta_params[i]` sequentially into parametric gates via positional counter.
|
|
1653
|
+
|
|
1654
|
+
### Global Telemetry Variables
|
|
1655
|
+
|
|
1656
|
+
| Variable | Type | Description |
|
|
1657
|
+
|---|---|---|
|
|
1658
|
+
| `df_vqe_telemetry` | DataFrame | VQE per-epoch telemetry, index = Step |
|
|
1659
|
+
| `df_md_telemetry` | DataFrame | MD per-step telemetry, index = Step |
|
|
1660
|
+
| `matrice_correlazione` | DataFrame | Pearson correlation matrix |
|
|
1661
|
+
| `CRONOLOGIA_RUNS` | list[dict] | Run history log |
|
|
1662
|
+
|
|
1663
|
+
---
|
|
1664
|
+
|
|
1665
|
+
## 14. Troubleshooting
|
|
1666
|
+
|
|
1667
|
+
**`TypeError: cond branches must have equal output types`**
|
|
1668
|
+
|
|
1669
|
+
Occurs when the simulator's 1-qubit branch produces `complex128` while the 2-qubit branch produces `complex64`. Fixed automatically by `de.patch_dense_parametric(de.DenseSVSimulator)` on startup. If the error persists, check that the `dense-evolution` version is ≥ 8.0.4 and that the patch call succeeded in the startup cell.
|
|
1670
|
+
|
|
1671
|
+
**VQE telemetry is empty / plots show `[VQE_Energy — no data]`**
|
|
1672
|
+
|
|
1673
|
+
Either the **Enable VQE Settings** checkbox is unchecked, or the circuit has no parametric gates and `_run_vqe_mock_simulation` could not be found. Check that all dashboard cells have been executed top-to-bottom in order.
|
|
1674
|
+
|
|
1675
|
+
**Custom Hamiltonian size mismatch warning**
|
|
1676
|
+
|
|
1677
|
+
The JSON array length must equal `2^n_qubits` exactly. For a 4-qubit circuit, supply exactly 16 values. The dashboard prints a warning and falls back to a random Hamiltonian rather than crashing.
|
|
1678
|
+
|
|
1679
|
+
**Barren plateau span not visible on gradient plot**
|
|
1680
|
+
|
|
1681
|
+
Triggered only when more than 3 consecutive epochs have `|g| < 0.01 · max|g|`. With short runs (< 50 epochs) or fast-converging circuits, the threshold may never be crossed. Increase epochs or reduce the learning rate.
|
|
1682
|
+
|
|
1683
|
+
**`display(dashboard_unificata)` shows nothing in JupyterLab**
|
|
1684
|
+
|
|
1685
|
+
Ensure `ipywidgets` is enabled: `jupyter labextension install @jupyter-widgets/jupyterlab-manager`. In Google Colab this is pre-installed.
|
|
1686
|
+
|
|
1687
|
+
**Memory error on high-qubit circuits**
|
|
1688
|
+
|
|
1689
|
+
The statevector for n qubits requires `2ⁿ × 16 bytes` (`float64` complex). At 24 qubits: 268 MB. At 33 qubits: 536 GB — only feasible with high-RAM runtimes or GPU backends. Use `use_float32=True` to halve memory at reduced precision.
|
|
1690
|
+
|
|
1691
|
+
---
|
|
1692
|
+
|
|
1693
|
+
## 15. License
|
|
1694
|
+
|
|
1695
|
+
Dense Evolution is licensed under the **Business Source License 1.1 (BSL 1.1)**.
|
|
1696
|
+
|
|
1697
|
+
- **Non-commercial use:** unrestricted.
|
|
1698
|
+
- **Commercial use:** permitted up to 24 allocated qubits and 1000 distinct circuits / 10,000 shots per circuit per day without a separate commercial license.
|
|
1699
|
+
- **Change date:** 1 June 2029 — the software converts permanently to **Apache License 2.0** on that date.
|
|
1700
|
+
- **Attribution required:** all copies or derivatives must carry `© 2026 Salvatore Pennacchio <jtatopenn@libero.it> — Dense Evolution`.
|
|
1701
|
+
|
|
1702
|
+
Full license text: [LICENSE.md](LICENSE.md)
|
|
1703
|
+
|
|
1704
|
+
---
|
|
1705
|
+
|
|
1706
|
+
*© 2026 Salvatore Pennacchio — Dense Evolution v8.0.4*
|