A WebGPU port of Geant4-DNA — the CNRS/IN2P3-coordinated Monte Carlo track-structure toolkit for radiobiology. One GPU thread per primary electron, the full particle history in a single fused compute dispatch, Karamitros 2011 IRT chemistry in a worker, and SSB / DSB damage scoring on a 21×21 B-DNA fiber grid. No server, no install, no download.
dom.webgpu.enabled. Full matrix: caniuse.com/webgpu. A discrete or Apple-silicon GPU is recommended at N ≥ 4096 primaries.
Same physics, radically different access. The table below is the before / after — traditional Geant4-DNA the way medical physicists and radiobiology labs have run it for two decades, vs. this WebGPU port.
| Traditional Geant4-DNA | WebGPU-DNA (this project) | |
|---|---|---|
| Install | Multi-GB toolkit · ~1–4 hr C++ compile · CMake, ROOT, Xerces, GDML dependencies · data files from CERN | None. Open a URL. ~100 KB of JavaScript (~50 KB gzipped), 1.2 MB of cross-section data, served over CDN. |
| Hardware | Linux / macOS / Windows workstation; HPC cluster for production-scale runs (Geant4 MT scales modestly — E15c shows MT-8 is only 1.6× faster than single-thread on this workload) | Any laptop or phone with a WebGPU-capable browser. Validated on Apple M2 Pro (Metal-3) — see [B0]. |
| Time to first result | Hours of setup, then minutes to hours per 10 keV run depending on primaries & core count | ~50 ms for primary tracking at 4096 × 10 keV (the fused Phase A dispatch). The full 8-energy harness with IRT radiolysis chemistry at 10 keV is ~3 min end-to-end — IRT on CPU is the bottleneck. |
| Physics fidelity @ 10 keV | Reference (by construction) | CSDA 0.956–1.005× across all 8 energies (100 eV–20 keV; the chronic sub-keV deficit closed by real Born excitation, v0.7.0) · energy conservation 100.0% · cascade ions/primary 0.942× (full electron cascade; primary track bit-exact vs Geant4) · chemistry G-values RMS 7.0% vs Geant4 chem6 at matched 10 keV LET (H₂/H₂O₂ gap closed) · indirect/direct SSB ratio 3.26 (a calibrated fit, reported honestly — see §Numbers); DNA-damage yields are methodology, not validated absolute physics All numbers backed by JSON artifacts — see README § Numbers for the falsifiable source of truth |
| Reproducibility | Depends on your Geant4 build, compiler, OS, library versions, random seed — "works on my cluster" is a real problem | Same URL, same bundle hash, same WGSL shader — same numbers everywhere |
| Access cost | Institutional cluster time, or a workstation admin who lets you install Geant4 | $0. No account, no sign-in, no API key, no rate limit. |
| Who can use it | Graduate students and staff in labs with the infrastructure — effectively gate-kept behind institutional access | Anyone — med students, high-schoolers, independent researchers, developers curious about WebGPU. |
| Intended scope | Production radiation-therapy planning, space-mission dosimetry, published radiobiology research | Education, rapid prototyping, teaching, method exploration. Not a replacement for clinical Geant4-DNA. |
Bottom line: a faithful-enough version of the tool that used to require a PhD and a compute cluster, now one click away from anyone.
Geant4-DNA is a large toolkit — decades of accumulated physics models for radiobiology. This project ports the electron-only, water-only, Born + Emfietzoglou + Champion + Sanche + Melton + Karamitros option1 slice. Heavier ions, alternative low-energy models, the option3 reaction set, and full-cell chromatin geometry are explicitly out of scope. Honest picture below — backed by source-tree inspection of Geant4 11.4.1.
| Geant4-DNA 11.4.1 | WebGPU-DNA | |
|---|---|---|
| Primary particle | e⁻, p⁺, α, Li, Be, B, C, N, O ions (light + heavy) | e⁻ only · 7.4 eV – 30 keV (validated at 8 ESTAR energies) |
| Target medium | Liquid water; some support for amorphous ice (PTB), DNA bases (PTB) | Liquid water only. 33.4 molecules/nm³, 298 K |
| Ionization (e⁻) | Born (5 shells, 11 eV–1 MeV), Emfietzoglou (5 shells, 11 eV–10 keV), CPA100 (11 eV–256 keV) | Born (5 shells, data-driven differential CDF) — matches Geant4 11.4.1 σ_ion within 6.1% mean over 6 energy bins [E1, E6b] |
| Excitation (e⁻) | Born, Emfietzoglou, CPA100, Dingfelder, Miller-Green, Quinn plasmon, Dirac-RMatrix, RPWBA | Born (5 water levels: A¹B₁, B¹A₁, Ryd A+B, Ryd C+D, Diffuse) with data-driven branching · real Born XS, parameter-free, matches G4EmDNAPhysics_option2 (v0.7.0) [E2, E2b, E29] |
| Elastic scattering (e⁻) | Champion (tabulated, < 1 keV), Uehara-Screened Rutherford, Screened Rutherford, CPA100, ELSEPA | Champion tabulated angular CDF (< 200 eV) + Screened Rutherford analytical (> 200 eV) · σ_el 5.7% high vs Geant4 mean [E3, E3b, E6b] |
| Vibrational excitation | Sanche (9 modes, 2–100 eV) | Sanche (9 modes, bit-exact match to G4EMLOW) [E4, E4b] |
| Dissociative attachment | Melton (4–13 eV) | Melton (4–13 eV, σ matches G4EMLOW) |
| Heavy-particle physics | Rudd ionization (p⁺, α), Dingfelder charge exchange, ion elastic, multiple/double/triple/quadruple ionization, ion charge inc/decrease | Out of scope. Electron-only port. |
| Solvation / thermalization | Meesungnoen 2002, Ritchie 1994, Terrisol 1990, Kreipl 2009, Meesungnoen amorphous | Meesungnoen 2002 (13-coefficient polynomial fit, e⁻aq at 1.7 eV — Geant4's autoionization default) |
| Pre-chemistry | 2 nm mother displacement · per-species product displacement · Onsager e-h recombination with time-integration during the chemistry step | 2 nm mother · species-specific displacement · Onsager geminate recomb (one-shot at t=0, RECOMB_BOOST = 1.0 / parameter-free) · B1A1 / L2-4 branching matches G4ChemDissociationChannels_option1 bit-identical [E9, E10e-i] |
| Radiolysis chemistry | option1 — Karamitros 2011 (9 reactions, 7 species: OH, e⁻aq, H, H₃O⁺, OH⁻, H₂, H₂O₂) · option2 — extended pulse · option3 — full set with HO₂°, HO₂⁻, O, O⁻, O₂, O₂⁻, O₃, O₃⁻ (25+ reactions) | option1 only — Karamitros 2011 9-reaction table, line-for-line match to chem6's /chem/reaction/add macro · TDC + Onsager-screened PDC types · runs in a dedicated Web Worker [E10c, E11] |
| Chemistry solver | IRT, IRT_syn (synchronized IRT), SBS (step-by-step), Gillespie direct method, Smoluchowski reaction model | IRT only (Independent Reaction Time) · per-primary partitioning · 8 time checkpoints from 0.1 ps to 1 μs |
| DNA target geometry | molecularDNA full chromatin cell (8.7 × 10¹² Da) · dsbandrepair · arbitrary GDML user geometry |
21 × 21 parallel B-DNA fiber grid × 3 μm × 150 nm spacing = 3.89 Mbp target. Full-cell chromatin is deferred (E14, planned). |
| DNA damage scoring | SSB (direct + indirect), DSB clustering, complex damage classification (PARTRAC-style) | Event-level direct SSB (rad_buf ionization sites) · IRT-time indirect SSB (scored during chemistry timeline, not post-hoc) · greedy ±10 bp DSB clustering · kernel-level backbone counter as cross-check [E13c] |
| Output / analysis | ROOT ntuples (G4VAnalysisManager) · HDF5 · custom score managers | JSON artifacts per experiment under experiments/results/<date>/ · in-browser results table · dose XY/YZ projections (log-magma colormap) |
| Validation discipline | Comparison plots vs measured data in published papers | Falsifiable JSON artifact per metric with named seed, pass bar, σ-significance, status (pass/fail/noisy). 30+ experiments shipped. README § Numbers is the single source of truth. |
Read this as: Geant4-DNA is the reference for the full radiobiology problem space; this project covers a specific, well-validated slice (e⁻, water, 7.4 eV – 30 keV, option1 chemistry, fiber grid) with browser-level accessibility. Use Geant4 for production clinical or published research. Use this for teaching, method exploration, prototyping, and reading the source code with no install pain.
Data-driven cross sections from G4EMLOW, the full 9-reaction IRT chemistry table from Karamitros 2011, and event-level DNA damage scoring — all ported from Geant4 source and validated against a direct dnaphysics ntuple.
Born ionization across 5 shells with paired CDF / E-transfer tables (binary search, 58 energies × 100 breakpoints), Emfietzoglou excitation with level-dependent dissociative branching, Champion tabulated elastic below 200 eV, Sanche 9-mode vibrational.
Full 9-reaction Independent Reaction Times table from G4EmDNAChemistry_option1. Runs in a dedicated Web Worker so the main thread stays responsive. Includes pre-chemistry: 2.0 nm mother displacement, species-specific product displacement, e⁻aq thermalization at 1.7 eV.
Direct SSB from rad_buf ionization sites (nm-scale spatial correlation), indirect SSB from diffused OH at 1 μs, greedy ±10 bp DSB clustering. A kernel-level backbone hit counter cross-checks the JS post-processing — kernel_hits == reach_dir, exactly.
The core trick: invert Geant4's sequential tracking loop. Phase A dispatches one GPU thread per primary and runs the full particle history in a WGSL loop — no per-step dispatch overhead. Phase B wavefront-steps secondaries. Phase C is 133 chemistry ticks × 4 dispatches (diffuse → hash → react). Everything writes to a shared 128³ atomic voxel grid and a 16M × 16 B radical buffer.
That “one dispatch, full history” shape is the same single-kernel fusion pattern that has given 3–4 orders of magnitude of speedup on other GPU workloads dominated by launch overhead — here it is what makes the entire electron history cheap enough to run live in a browser tab.
Full pipeline diagram, buffer sizing, and WGSL constraints are in ARCHITECTURE.md. Physics provenance and known gaps are in CLAUDE.md.
Every validation run can hand its radical-chemistry result straight to a WebGPU viewer that plays back the full evolution: 50,000 OH / e⁻aq / H / H₃O⁺ radicals diffusing and recombining across 6 decades of time, 1 ps → 1 μs, on the same B-DNA fiber grid the harness scored damage on. No download step — clicking 🌌 Visualize chemistry below opens it in a new tab with the snapshot already loaded.
Two correctness checks ride along inside the viewer. The round-trip panel verifies that the .bin contains exactly what the harness computed (alive-count monotonicity, species partition sum, position finiteness). The compare overlay draws sprites on top of the volume so the two render paths can be visually checked across all 8 checkpoints and any camera angle — no drift means the splat math is faithful to the data.
Runs the full 8-energy ESTAR sweep. Chemistry + DNA damage scoring fire at 10 keV. 4096 primaries takes about 6–10 seconds on an M-series laptop GPU.
dom.webgpu.enabled in Firefox.| Energy | Therm | Esc | CSDA Total (nm) | ESTAR CSDA | Ratio | Prod (nm) | dE/dx (eV/nm) | ESTAR SP | Ratio | Ions/pri | Sec/pri | E cons | G(OH) | G(e⁻aq) | G(H) | SSB dir | SSB ind | DSB | DSB/Gy/Gbp | Total ms |
|---|