Skip to content

Repository files navigation

Stern Gerlach

An interactive simulation of the Stern–Gerlach experiment built with SceneryStack. Assemble analyzers, magnets, and counters; fire spin-½ or spin-1 atoms; and compare Monte Carlo counts with analytic quantum predictions.

Features

  • Build sequential Stern–Gerlach apparatus from analyzers, magnets, and counters
  • Fire spin-½ or spin-1 atoms one at a time or as a continuous beam
  • Exact Born-rule measurement and unitary magnet precession (SPINS-faithful model)
  • Monte Carlo counts with analytic expected-value overlays on counters
  • Watch / which-path mode to destroy interference in recombined paths
  • English, Spanish, and French UI, projector color profile, and installable PWA

Quick Start

Requires Node ≥ 22 (see .nvmrc; older Node fails at vitest startup).

npm install
npm run icons    # generate PNG icons from public/icons/icon.svg
npm start        # dev server → http://localhost:5173

Scripts

Command Description
npm start / npm run dev Start Vite dev server
npm run build Type-check + production build → dist/
npm test Run Vitest unit tests (includes memory-leak suite)
npm run preview Preview the production build locally
npm run check TypeScript type check
npm run lint Biome lint check
npm run format Auto-format all files
npm run fix Lint + auto-fix
npm run icons Regenerate PNG icons from public/icons/icon.svg
npm run clean Remove dist/

Tech Stack

Tool Version Purpose
SceneryStack ^3.0.0 Simulation framework
Vite ^8 Build tool + dev server
TypeScript ^7 Type-safe JavaScript
Biome ^2.5 Linting + formatting
vite-plugin-pwa ^1 PWA + service worker

License

GNU Affero General Public License v3.0 — see OpenPhysics org license.

Contributing

See OpenPhysics contributing guidelines. Report bugs via GitHub Issues; use org issue templates.

About

Interactive Stern–Gerlach experiment: assemble analyzers, magnets, and counters; fire spin-½ / spin-1 atoms; compare Monte Carlo counts with analytic quantum predictions.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages