An interactive LLG + spin–orbit-torque magnetization dynamics simulator in the macrospin approximation. Inject a current pulse, watch the magnetization switch in real time on a 3D Bloch sphere, and map out switching phase diagrams — all from a desktop GUI.
| Real-time trajectory | Precession dynamics |
|---|---|
![]() |
![]() |
Warning
The AFM (antiferromagnet) tab is a work in progress. The two-sublattice engine passes its physics checks (exchange-enhanced AFMR frequency matches theory to ~4×10⁻⁴, FM limit agrees with the single-spin kernel), but the feature set and UI are incomplete and results should not be used for research conclusions yet. Everything else described below is validated and stable.
- Landau–Lifshitz–Gilbert equation (explicit form) with damping-like and field-like spin–orbit torques, Oersted field, and thermal fluctuation
- RK4 and Heun integrators; fields specified in Tesla
- Optional Numba JIT kernel — ~150 ns/step (≈2000× NumPy); falls back to pure NumPy automatically if Numba is unavailable
- Validated against analytic limits; run the test suite with
python main.py --test
- Real-time 3D trajectory on the Bloch sphere, time series, and torque-decomposition views
- Phase diagram tab — 2D parameter sweeps over 9 axis choices → switching O/X maps with 50 % boundary curves; set the Y axis to pulse width to get critical-current curves J_c(τ); enable thermal fluctuation and repeat for switching-probability maps
- Current sweep tab — final magnetization vs J with the switching window shaded; current-loop mode traces hysteresis loops and extracts coercivity
- Export — PNG / GIF / MP4 / CSV with the full parameter set saved alongside as YAML
- English & Korean manuals in manual/
git clone https://github.com/shr0eq/MacrospinSimulator.git
cd MacrospinSimulator
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
python main.py # GUI
python main.py --test # physics validation suitePython 3.10+, PySide6, matplotlib, NumPy (Numba optional but recommended).
tools/make_launcher.sh builds a double-clickable macOS launcher.
The original (more detailed) Korean README lives in docs/README_KO.md.
MIT — © 2026 Won-Young Choi. Built with the help of Claude Code.

