Metadata-Version: 2.4
Name: magtense
Version: 2.2.4
Summary: MagTense - a micromagnetism and magnetostatic framework
Author-email: Stefan Pollok <spol@dtu.dk>
License-Expression: GPL-3.0-or-later
Project-URL: Homepage, https://www.magtense.org/
Project-URL: Source, https://github.com/cmt-dtu-energy/MagTense
Project-URL: Documentation, https://cmt-dtu-energy.github.io/MagTense/
Keywords: Micromagnetism,Magnetostatics,Demagnetization tensor
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: h5py>=3.14.0
Requires-Dist: importlib_resources>=6.5.2
Requires-Dist: intel-fortran-rt==2025.2.0
Requires-Dist: matplotlib>=3.10.5
Requires-Dist: mkl==2025.2.0
Requires-Dist: notebook>=7.4.5
Requires-Dist: numpy==2.3.2
Requires-Dist: nvidia-cublas-cu12==12.*
Requires-Dist: nvidia-cuda-runtime-cu12==12.*
Requires-Dist: nvidia-cusparse-cu12==12.*
Requires-Dist: nvidia-nvjitlink-cu12==12.*
Requires-Dist: tqdm>=4.67.1
Dynamic: license-file

<div align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/cmt-dtu-energy/MagTense/refs/heads/master/docs/source/static/MagTenseLogo_White.svg" height=250>
    <img alt="MagTense Logo" src="https://raw.githubusercontent.com/cmt-dtu-energy/MagTense/refs/heads/master/docs/source/static/MagTense_logo.png" height=250>
  </picture>
  <br>
</div>

# MagTense

MagTense is a framework for magnetostatic and micromagnetic calculations.

## Features

- Interfaces for MATLAB and Python, with the core implemented in Fortran for speed;
- Fully analytical calculation of demagnetization tensor for cylinders, pieces of cylinders, prisms, circular pieces and tetrahedrons;
- Micromagnetic solutions of the Landau-Lifshitz equations, using the analytical demagnetization tensor described above;
- GPU-accelerated code with [CUDA®](https://developer.nvidia.com/cuda-zone) (requires NVIDIA graphics card).
- Uses Intel MKL for the micromagnetic simlations and can also utilize [CVODE](https://computing.llnl.gov/projects/sundials/cvode).
- Tested in Linux and Windows 11+ (macOS not supported at the moment).

## Installation and usage with the Python interface

Installation is recommended via `pip` (requires >=**Python 3.12**):

```
pip install magtense
```

Examples of how to calculate magnetostatic and micromagnetic problems using the Python interface can be found [python/examples/](./python/examples/).

## Installation and usage with the Matlab interface

MagTense is directly useable in Matlab on Windows by downloading the MEX-files in [Releases](https://github.com/cmt-dtu-energy/MagTense/releases). Only Matlab 2023a or greater is required.

Examples of how to calculate magnetostatic and micromagnetic problems using the Matlab interface can be found in [matlab/examples](./matlab/examples).

## Building from source

If you want to build MagTense yourself this is certainly also an option. If you want to compile MagTense on Linux we provide a Makefile, which also works on Windows, where we also provide a Visual Studio project file, [MagTense.sln](MagTense.sln).

For Python you can find detailed instructions for building the Python interface with the Fortran core [here](/python/README.md).

For Matlab MEX-files, we provide a Matlab function called [buildMagTenseMEX.m](matlab/buildMagTenseMEX.m) that works on both OS. You can find more information [here](/matlab/README.md).

## Further documentation

The webpage of the code is available at https://www.magtense.org.

The TechManual on the code is available at https://cmt-dtu-energy.github.io/MagTense.

## Citation
If you use this package in a publication, or simply want to refer to it, please cite the paper below:

```bibtex
@article{BJORK2021168057,
title = {MagTense: A micromagnetic framework using the analytical demagnetization tensor},
journal = {Journal of Magnetism and Magnetic Materials},
volume = {535},
pages = {168057},
year = {2021},
issn = {0304-8853},
doi = {https://doi.org/10.1016/j.jmmm.2021.168057},
url = {https://www.sciencedirect.com/science/article/pii/S0304885321003334},
author = {R. Bj{\o}rk and E. B. Poulsen and K. K. Nielsen and A. R. Insinga},
}
