Skip to main content

NeuralMag is a micromagnetic GPU code implementing the nodal FD discretization

Project description

NeuralMag

NeuralMag is a micromagnetic simulation software using the nodal finite-difference discretization scheme, designed specifically with inverse problems in mind. It uses either JAX or PyTorch as a numerical backend for tensor operations and automatic differentiation, enabling computations on both CPU and GPU systems. At the moment NeuralMag implements the most common micromagnetic effective-field contributions

  • external field
  • exchange field
  • demagnetization field
  • uniaxial/cubic anisotropy
  • DMI (interface and bulk)
  • interlayer exchange

as well as a differentiable time-domain solver for the Landau-Lifshitz-Gilbert equation.

NeuralMag is designed in a modular fashion resulting in a very high flexibility for the problem definition. For instance, all simulation parameters (e.g. material parameters) can be functions of space, time or any other simulation parameter.

At the heart of NeuralMag is a form compiler powered by SymPy that translates arbitrary functionals and linear weak forms into vectorized PyTorch code. This allows to easily add new effective-field contributions by simply stating the corresponding energy as a sympy expression.

Documentation

The documentation of NeuralMag including a reference to all classes as well as several examples can found here.

NeuralMag in the cloud

Experience NeuralMag without installing it locally by accessing it directly in the cloud via Binder. Simply click the badge to get started: Binder

Using NeuralMag on Binder allows you to experience its features, without the hassle of setting up your local environment. It provides a quick and accessible way to test and experiment with the software from any device with a web browser. It is important to note that the Binder-hosted version is a CPU-only JAX implementation, and it will run slower than a local installation. Sessions are temporary and may time out after a period of inactivity, and any files created or modified during your session will not be saved. To avoid losing your work, please remember to download any files you create or edit before your session ends.

Download and Install

NeuralMag is a Python package and requires Python >=3.8 (>=3.10 for JAX backend). To install the latest version with pip either run

pip install "neuralmag[jax]"

to install NeuralMag with JAX as a backend or

pip install "neuralmag[torch]"

to install NeuralMag with PyTorch as a backend. You can also install NeuralMag with both backends and choose the backend at runtime.

How to cite

If you use NeuralMag in scientific work, please cite the accompanying paper:

C. Abert, F. Bruckner, A. Voronov, M. Lang, S. A. Pathak, S. Holt, R. Kraft, R. Allayarov, P. Flauger, S. Koraltan, T. Schrefl, A. Chumak, H. Fangohr, D. Suess, "NeuralMag: an open-source nodal finite-difference code for inverse micromagnetics", npj Comput. Mater. 11, 193 (2025). doi:10.1038/s41524-025-01688-1

BibTeX:

@article{Abert2025NeuralMag,
  author  = {Abert, Claas and Bruckner, Florian and Voronov, Andrii and
             Lang, Martin and Pathak, Swapneel Amit and Holt, Sam and
             Kraft, Roman and Allayarov, Rustam and Flauger, Paul and
             Koraltan, Sabri and Schrefl, Thomas and Chumak, Andrii and
             Fangohr, Hans and Suess, Dieter},
  title   = {{NeuralMag}: an open-source nodal finite-difference code for
             inverse micromagnetics},
  journal = {npj Computational Materials},
  volume  = {11},
  pages   = {193},
  year    = {2025},
  doi     = {10.1038/s41524-025-01688-1},
}

Contribute

Thank you for considering contributing to our project! We welcome any contributions, whether they are in the form of bug fixes, feature enhancements, documentation improvements, or any other kind of enhancement. NeuralMag is licensed under the MIT License. By contributing to this project, you agree to license your contributions under the terms of the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neuralmag-0.9.4.tar.gz (44.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neuralmag-0.9.4-py3-none-any.whl (60.7 kB view details)

Uploaded Python 3

File details

Details for the file neuralmag-0.9.4.tar.gz.

File metadata

  • Download URL: neuralmag-0.9.4.tar.gz
  • Upload date:
  • Size: 44.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for neuralmag-0.9.4.tar.gz
Algorithm Hash digest
SHA256 ede803be9a93850d7926f232161cf26a2cb3d4cc3877d35b952dab57a8a3c055
MD5 1dc1105a5f4d9d31b1a064bce7564a04
BLAKE2b-256 636e9e85bcae3c1c486d8732e1a9597f2679413b6a44a6c82b64cb2cfc7e48f2

See more details on using hashes here.

File details

Details for the file neuralmag-0.9.4-py3-none-any.whl.

File metadata

  • Download URL: neuralmag-0.9.4-py3-none-any.whl
  • Upload date:
  • Size: 60.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for neuralmag-0.9.4-py3-none-any.whl
Algorithm Hash digest
SHA256 41ed8674a3e42af5d579cd573b65aa92b7b8b127f15248b5a26844655f26c057
MD5 d5ef064e45dd920797ea2aef8516cc0f
BLAKE2b-256 6cd954eebdfae9a1ab9776252b54ddd6f4448e224600f25934028cd381dcefae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page