A serverless scientific workbench for restricted and unrestricted Hartree–Fock Born–Oppenheimer molecular dynamics in a model two-dimensional universe.
The interaction convention is
Gε(r) = -½ log((r² + ε²) / r₀²)
in dimensionless 2D atomic units. This is model physics, not predictive three-dimensional chemistry; Hartree–Fock also omits electron correlation.
The generated WASM module is checked in, so the UI can start after installing JavaScript dependencies:
npm install
npm run devRebuilding the Rust reference kernel or running the production build requires the stable Rust toolchain, the wasm32-unknown-unknown target, and wasm-pack:
npm run wasm:build
npm run check- The float64 Rust/WASM module performs zero-padded FFT convolution and kinetic preconditioning for the real-space RHF/UHF solver.
- A TypeScript implementation remains as the portable diagnostic fallback and as a directly testable reference.
- WebGPU hybrid mode batches alpha/beta density reduction and every occupied-orbital kinetic stencil, then runs FFT convolution and kinetic preconditioning through reusable float32 GPU buffers. It reports float32 precision explicitly, uses a documented
2e-5SCF residual floor, and retains convergence-gated force acceptance. Rust/WASM remains the portable float64 reference path.
The solver uses a fourth-order finite-difference kinetic operator, exact occupied-orbital exchange convolutions, residual-based orbital optimization with optional kinetic preconditioning, and a convergence-gated Velocity Verlet step. Unconverged geometries are rejected without advancing time.
The SCF inspector exposes the active convergence strategy. None uses raw residual descent; Kinetic preconditioner retains the existing accelerated path and accepts a tunable positive spectral shift. Residual mixing is configurable for both modes, and existing v1 sessions default to the preconditioned strategy.
If an SCF solve reaches its iteration limit, the engine restores the finite iteration with the lowest electronic energy. Dynamics still requires convergence by default; Approximate dynamics is an explicit opt-in that permits steps from the retained iterate while keeping the result visibly marked unconverged.
The sandbox’s Real-space grid controls set the square integration grid and symmetric limits [-L, L]²; the inspector reports the derived spacing Δx = 2L / N. Orbitals are represented directly at those grid points, so “basis size” does not refer to a separate Gaussian or atom-centered basis family in this model.
The Field selector switches between total density, spin density, and individual occupied orbitals. RHF displays each paired spatial orbital once; UHF exposes every occupied α and β spin-orbital with signed amplitude.
Performance comparisons use the H₂ analogue in Chrome, discard the first solve after changing a backend or grid, and report the median of five worker-reported SCF durations. The 128² fixture runs to convergence with the default 200-iteration cap. Because the current 256² fixture does not converge on either backend within that cap, its throughput comparison uses exactly 20 iterations and requires both paths to report the same nonconverged state.
Backend comparisons must keep the total-energy difference within 5e-5 au, the integrated-density difference within 1e-5 electrons, and the residual difference within 5e-5; each converged result must also satisfy its reported precision floor. Accepted-step behavior must agree, and an accepted step must advance time by the configured Δt. Benchmark reports should include the browser, WebGPU adapter label, raw timing samples, convergence state, energy, residual, and density integral.
The Iteration speed control accepts any positive target rate, with 0.25, 0.5, 1, 2, and 4 steps per second retained as suggestions. Unlimited speed removes the artificial pacing delay and starts each accepted step as soon as the worker can proceed. Neither mode changes the physical timestep or relaxes SCF convergence.
Parameter edits are staged locally instead of starting a solve immediately. The canvas and diagnostics show a pending state until Solve SCF applies the complete edited configuration; Run and Step remain disabled while the electronic state is stale.
The physical Time step Δt is editable in both guided experiments and the open sandbox while the simulation is paused. Changing it reinitializes the current setup at t = 0 so every accepted force evaluation still begins from a converged electronic state.
The Damping γ control is also editable while paused. γ = 0 preserves molecular dynamics, while positive values exponentially dissipate nuclear velocities; large values provide a relaxation workflow toward local potential-energy minima without bypassing SCF convergence.
Recommended numerical ranges are advisory rather than hard limits. The inspector accepts finite, physically valid values outside those ranges and displays an inline instability warning; structural constraints such as positive masses, compatible spin occupations, supported grid sizes, and resource caps remain enforced.
Session export produces an hf2d-session/v1 ZIP containing the configuration, checkpoint metadata, density and orbital buffers, trajectory and convergence CSV files, backend metadata, and a PNG preview. The last stable configuration is autosaved locally in IndexedDB.
The validated configuration schema accepts up to 16 nuclei, 24 electrons, and 64²/128² grids plus an experimental 256² option. The interface supports RHF singlets and UHF spin multiplicities; ROHF, TDHF/Ehrenfest dynamics, correlation methods, thermostats, periodic boundaries, and geometry optimization are outside v1.
Contributions are welcome. Read CONTRIBUTING.md for the development workflow and SECURITY.md for responsible vulnerability reporting.