Overview
TheHamiltonianBackend is a physics backend that performs first-order Schrödinger time evolution using a learned Hamiltonian operator. It applies the spectral neural network to evolve quantum amplitudes according to:
Architecture
The backend uses aHamiltonianBackboneNet neural network with the following structure:
Network Parameters
| Parameter | Default | Description |
|---|---|---|
grid_size | 16 | Spatial grid resolution (G×G) |
hidden_dim | 32 | Hidden layer dimensionality |
num_spectral_layers | 2 | Number of spectral convolution layers |
Initialization
From SimulatorConfig (quantum_computer.py)
From FrameworkConfig (quantum_simulator.py)
Checkpoint File
Default Path:weights/latest.pth
The checkpoint contains the trained weights for the Hamiltonian network:
- Expected keys:
model_state_dict(preferred) or direct state dict - Architecture match required: The checkpoint must match
grid_size,hidden_dim, andnum_spectral_layers - Fallback behavior: If checkpoint is missing or fails to load, the network uses random initialization with Laplacian-based physics
Methods
apply() / evolve_amplitude()
- Extract real and imaginary components:
psi_r = amp[0],psi_i = amp[1] - Apply Hamiltonian operator:
h_r = H(psi_r),h_i = H(psi_i) - First-order time evolution:
new_r = psi_r + dt * h_inew_i = psi_i - dt * h_r
- Normalize and return
apply_phase()
Technical Details
Spectral Convolution
TheSpectralLayer operates in Fourier space:
- Forward FFT: Real spatial field → complex frequency coefficients
- Kernel application: Complex multiplication with learned kernels
- Inverse FFT: Frequency domain → real spatial field
Laplacian Fallback
If the neural network is unavailable, the backend uses analytical Laplacian evolution:Usage in Quantum Circuits
Configuration Reference
SimulatorConfig Parameters
Performance Notes
- GPU acceleration: Supports CUDA for faster evolution
- Memory usage: Scales with
O(grid_size²)per amplitude - Computation: Spectral operations are efficient via FFT
Source Code
- quantum_computer.py: Lines 521-587
- quantum_simulator.py: Lines 418-466
See Also
- SchrodingerBackend - Full Schrödinger evolution network
- DiracBackend - Relativistic spinor evolution
- IPhysicsBackend - Abstract backend interface