Overview
TheDiracBackend implements relativistic quantum mechanics using the Dirac equation. It expands 2-channel wavefunctions into 4-component spinors, applies the Dirac Hamiltonian (learned or analytical), and projects back to 2-channel representation.
Key features:
- 4-component spinor representation (particle + antiparticle)
- Gamma matrix algebra (Dirac or Weyl representation)
- Relativistic evolution with mass and speed of light
- Automatic fallback to analytical Dirac evolution
Architecture
The backend uses aDiracSpectralNet with 8-channel input/output:
Network Parameters
| Parameter | Default | Description |
|---|---|---|
grid_size | 16 | Spatial grid resolution (G×G) |
hidden_dim | 32 | Hidden layer dimensionality |
expansion_dim | 64 | Expanded feature dimension |
num_spectral_layers | 2 | Number of spectral convolution layers |
dirac_mass | 1.0 | Particle mass m |
dirac_c | 1.0 | Speed of light c |
gamma_representation | ”dirac” | Gamma matrix representation |
Initialization
From SimulatorConfig (quantum_computer.py)
From FrameworkConfig (quantum_simulator.py)
Checkpoint File
Default Path:weights/dirac_phase5_latest.pth
The checkpoint contains trained weights for the Dirac network:
- Expected keys:
model_state_dict(preferred) or direct state dict - Architecture match required: Must match all network dimensions
- Fallback behavior: If missing/failed, uses analytical Dirac evolution
- Phase naming:
phase5suggests multi-stage training
Methods
apply() / evolve_amplitude()
-
Pack: Expand
(2, G, G)→ 4-component spinor(4, G, G)complex -
Evolve: Apply Dirac evolution
- If network available:
spinor_out = DiracSpectralNet(spinor_channels) - If fallback:
spinor_out = spinor - i*dt*H_Dirac(spinor)
- If network available:
-
Unpack: Project spinor →
(2, G, G)amplitude - Normalize and return
apply_phase()
HamiltonianBackend.
Technical Details
Spinor Structure
The 4-component Dirac spinor represents:Gamma Matrices
The backend supports two representations: Dirac representation:Analytical Dirac Hamiltonian
When network is unavailable, uses analytical evolution:Packing and Unpacking
Packing: Non-relativistic → RelativisticUsage in Quantum Circuits
Relativistic Effects
The Dirac backend naturally includes:- Zitterbewegung: Rapid oscillatory motion of particle
- Spin-orbit coupling: Intrinsic from Dirac equation
- Antiparticle dynamics: Encoded in lower spinor components
- Fine structure: Relativistic corrections to energy levels
Configuration Reference
SimulatorConfig Parameters
FrameworkConfig Parameters
Performance Notes
- Computational cost: ~4× more expensive than Schrödinger (4 spinor components)
- Memory usage: 8 channels (real+imag for 4 components)
- GPU acceleration: Essential for practical use
- Fallback speed: Analytical Dirac evolution is slower than learned network
Physics Considerations
When to Use DiracBackend
✅ Use when:- Simulating high-energy physics
- Modeling relativistic effects
- Studying Zitterbewegung
- Including antiparticle dynamics
- Fine structure calculations
- Non-relativistic regime (v << c)
- Limited computational resources
- Simple gate operations suffice
Accuracy vs. SchrodingerBackend
Dirac backend provides additional physics:Source Code
- quantum_computer.py: Lines 638-735
- quantum_simulator.py: Lines 503-583
- GammaMatrices: quantum_computer.py:231-275, quantum_simulator.py:359-376
Advanced Usage
Direct Spinor Evolution
quantum_simulator.py DiracBackend.
Custom Gamma Representation
See Also
- HamiltonianBackend - Non-relativistic H operator
- SchrodingerBackend - Non-relativistic evolution
- IPhysicsBackend - Abstract backend interface
- Zitterbewegung - Relativistic oscillations