GPU accelerated simulation software for Nuclear and Magnetic Small-Angle Neutron Scattering
Michael P. Adams1,2, Andreas Michels3
1 Max Planck Institute for the Structure and Dynamics of Matter, Luruper Ch 149, D-22761 Hamburg, Germany
2 Center for Free-Electron Laser Science (CFEL), Notkestrasse 85, D-22607 Hamburg, Germany
3 Department of Physics and Materials Science, University of Luxembourg, 162A Avenue de la Faiencerie, L-1511 Luxembourg, Grand Duchy of Luxembourg
| Description | Badge |
|---|---|
| ⚙️ CUDA Build | |
| ⚙️ Docs Build | |
| 📘 Documentation | |
| 🖥️ Platforms | |
| 📄 License |
NuMagSANS is a GPU-accelerated software package designed for the computation of nuclear and magnetic small-angle neutron scattering (SANS) cross sections and correlation functions. The program allows users to import discrete datasets representing the position-dependent nuclear scattering length density and magnetization in real space, providing exceptional flexibility for the analysis of complex and anisotropic magnetic materials.
NuMagSANS supports simulations across multiple length scales:
- Atomistic systems, featuring complex crystal lattices — e.g., data generated from atomistic spin-dynamics simulations with Vampire 7 or UppASD.
- Mesoscopic systems, such as micromagnetic models — e.g., data generated from micromagnetic simulations with MuMax3 or OOMMF.
The software offers full rotational control of the sample orientation, enabling comprehensive studies of angular-dependent scattering features. It includes a versatile library of more than +100 response functions, covering:
- 2D SANS cross sections (unpolarized, SANSPOL, POLARIS)
- 2D correlation functions
- 1D SANS cross sections (azimuthal average)
- 1D correlation functions
- 1D pair-distance distribution functions
- spectral analyser for angular anisotropy
These capabilities provide detailed insights into the structural and magnetic characteristics of complex systems. Leveraging GPU acceleration, NuMagSANS achieves high computational performance and scalability, making it a powerful and efficient tool for advanced SANS simulations and data analysis.
NuMagSANS ships a machine-readable, version-matched usage guide for AI assistants. After building and installing the package, print the context for the current installation with:
python -m NuMagSANS > numagsans-context.txtGive this file to an assistant before asking it to prepare a simulation. It contains the canonical workflow, input-data contract, coordinate and unit conventions, loop semantics, exact rotation conventions, output selection, validation rules, and common mistakes. The same context is available with from NuMagSANS import llm_context.
The assistant helps scaffold and check a deterministic NuMagSANS calculation; the user remains responsible for the physical model, numerical choices, validation, and scientific interpretation.
The benchmark datasets associated with NuMagSANS are openly available on Zenodo and serve as reference examples for validation and reproducibility. Each dataset contains both the real-space magnetic configuration (nuclear and magnetic scattering-length density distributions) and the corresponding SANS observables computed with NuMagSANS, including simulated 2D scattering cross-sections and azimuthally averaged intensity profiles.
Together, these datasets provide a consistent set of input and output examples that demonstrate the end-to-end workflow of NuMagSANS — from magnetic structure generation to Fourier-space analysis of small-angle neutron scattering.
- NuMagSANS – Example 1: Spherical nanoparticle with uniform magnetization (v1.0)
- NuMagSANS – Example 2: Spherical nanoparticle with linearized vortex magnetization (v1.0)
- NuMagSANS – Example 3: MuMax3-based simulation pipeline for an ensemble of iron nanoparticles with vortex spin textures (v1.1)
- NuMagSANS – Runtime Experiment: (v1.0)
Contributions, bug reports, and feature suggestions are always welcome! If you’d like to contribute code or improve the documentation, please follow these steps:
- Fork the repository to your own GitHub account.
- Create a new branch for your feature or fix:
git checkout -b feature/your-feature-name
If you use NuMagSANS in your research, please cite both the software release and the associated publication.
@software{adams2026numagsans,
author = {Adams, Michael P.},
title = {NuMagSANS},
version = {1.0.0},
year = {2026},
publisher = {Zenodo},
doi = {10.5281/zenodo.18824364},
url = {https://doi.org/10.5281/zenodo.18824364}
}NuMagSANS: a GPU-accelerated open-source software package for the generic computation of nuclear and magnetic small-angle neutron scattering observables of complex systems.
M. P. Adams, A. Michels, J. Appl. Cryst. 59, 3 (2026)
DOI: https://doi.org/10.1107/S160057672600258X
Preprint: https://doi.org/10.48550/arXiv.2601.18444
@article{adams2026numagsans_paper,
author = "Adams, Michael P. and Michels, Andreas",
title = "{{\it NuMagSANS}: a GPU-accelerated open-source software package for the generic computation of nuclear and magnetic small-angle neutron scattering observables of complex systems}",
journal = "Journal of Applied Crystallography",
year = "2026",
volume = "59",
number = "3",
pages = "",
month = "Jun",
doi = {10.1107/S160057672600258X},
url = {https://doi.org/10.1107/S160057672600258X},
}MIT License
This project was developed at the University of Luxembourg, Department of Physics and Materials Science, Nanomagnetism Group (Prof. Andreas Michels).
This work was carried out within the scientific framework of the Luxembourg National Research Fund (FNR) projects AFR 15639149, CORE DeQuSky, and PRIDE MASSENA, which have contributed to the broader research environment of this study.
We thank our colleagues for stimulating discussions and valuable scientific exchange: I. Titov, E. P. Sinaga, V. Kuchkin, A. Stellhorn, D. Honecker, J. Leliaert, E. Jefremovas, S. Liscak. Their insights and perspectives have indirectly contributed to the conceptual and computational development of this work.
