Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Macrospin Simulator

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
In-plane switching trajectory Precession demo

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.

Physics

  • 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

GUI features

  • 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/

Run

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 suite

Python 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.

License

MIT — © 2026 Won-Young Choi. Built with the help of Claude Code.

About

Interactive LLG + spin-orbit-torque macrospin dynamics simulator — real-time 3D Bloch sphere, switching phase diagrams, hysteresis loops. AFM mode in development.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages