
magnum.np 2.0.1
magnum.np is a Python library for the solution of micromagnetic problems with the finite-difference method. It implements state-of-the-art algorithms and is based on pytorch, which allows to seamlessly run code either on GPU or on CPU. Simulation scripts are written in Python which leads to very readable yet flexible code. Due to pytorch integration, extensive postprocessing can be done directly in the simulations scripts. Alternatively, results can be written to PVD files and postprocessed with Paraview. Furthermore pytorch’s autograd feature makes it possible to solve inverse problems without significant modifications of the code. This manual is meant to give you both a quick start and a reference to magnum.np.
Version 2.0: The magnum.np interface slightly changed since version 2.0. Find more details about the necessary changes and the motivation here. The following table summarizes the most important syntax changes:
Features
Explicit / Implicit time-integration of the Landau-Lifshitz-Gilbert Equation
Fast FFT Demagnetization-field computation optimized for small memory footprint
Fast FFT Oersted-field optimized for small memory footprint
Fast FFT Vector-Potential optimized for small memory footprint
Periodic Boundary Conditions in 1D, 2D, and 3D (True and Pseudo-Periodic)
Non-Equidistant Mesh for Multilayer Structures
Arbitrary Material Parameters varying in space and time
Spin-torque model by Slonczewski
Spin-torque model by Zhang and Li
Spin-Orbit torque (SOT)
Antiferromagnetic coupling layers (RKKY)
Dzyaloshinskii-Moriya interaction (interface, bulk, D2d)
String method for energy barrier computations
Eigenmode Solver for efficient calculation of normal modes
Sophisticated domain handling, e.g. for spatially varying material parameters
efficient Voronoi Code for 2D and 3D problems (including intergrain phase)
Seamless VTK import / export via pyvista
Inverse Problems via pytorch’s autograd feature
List of Demos
Citation
If you use magnum.np in your work or publication, please cite the following reference:
[1] Bruckner, Florian, et al. “magnum.np – A pytorch based GPU enhanced Finite Difference Micromagnetic Simulation Framework for High Level Development and Inverse Design”, Scientific Reports volume 13, 12054 (2023).
Contributing
Contributions are gratefully accepted. The source code is hosted on www.gitlab.com/magnum.np/magnum.np. If you have any issues or question, just open an issue via gitlab.com. To contribute code, fork our repository on gitlab.com and create a corresponding merge request.