<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},
}
Raw data
{
"_id": null,
"home_page": null,
"name": "magtense",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "Micromagnetism, Magnetostatics, Demagnetization tensor",
"author": null,
"author_email": "Stefan Pollok <spol@dtu.dk>",
"download_url": null,
"platform": null,
"description": "<div align=\"center\">\n <picture>\n <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>\n <img alt=\"MagTense Logo\" src=\"https://raw.githubusercontent.com/cmt-dtu-energy/MagTense/refs/heads/master/docs/source/static/MagTense_logo.png\" height=250>\n </picture>\n <br>\n</div>\n\n# MagTense\n\nMagTense is a framework for magnetostatic and micromagnetic calculations.\n\n## Features\n\n- Interfaces for MATLAB and Python, with the core implemented in Fortran for speed;\n- Fully analytical calculation of demagnetization tensor for cylinders, pieces of cylinders, prisms, circular pieces and tetrahedrons;\n- Micromagnetic solutions of the Landau-Lifshitz equations, using the analytical demagnetization tensor described above;\n- GPU-accelerated code with [CUDA\u00ae](https://developer.nvidia.com/cuda-zone) (requires NVIDIA graphics card).\n- Uses Intel MKL for the micromagnetic simlations and can also utilize [CVODE](https://computing.llnl.gov/projects/sundials/cvode).\n- Tested in Linux and Windows 11+ (macOS not supported at the moment).\n\n## Installation and usage with the Python interface\n\nInstallation is recommended via `pip` (requires >=**Python 3.12**):\n\n```\npip install magtense\n```\n\nExamples of how to calculate magnetostatic and micromagnetic problems using the Python interface can be found [python/examples/](./python/examples/).\n\n## Installation and usage with the Matlab interface\n\nMagTense 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.\n\nExamples of how to calculate magnetostatic and micromagnetic problems using the Matlab interface can be found in [matlab/examples](./matlab/examples).\n\n## Building from source\n\nIf 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).\n\nFor Python you can find detailed instructions for building the Python interface with the Fortran core [here](/python/README.md).\n\nFor 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).\n\n## Further documentation\n\nThe webpage of the code is available at https://www.magtense.org.\n\nThe TechManual on the code is available at https://cmt-dtu-energy.github.io/MagTense.\n\n## Citation\nIf you use this package in a publication, or simply want to refer to it, please cite the paper below:\n\n```bibtex\n@article{BJORK2021168057,\ntitle = {MagTense: A micromagnetic framework using the analytical demagnetization tensor},\njournal = {Journal of Magnetism and Magnetic Materials},\nvolume = {535},\npages = {168057},\nyear = {2021},\nissn = {0304-8853},\ndoi = {https://doi.org/10.1016/j.jmmm.2021.168057},\nurl = {https://www.sciencedirect.com/science/article/pii/S0304885321003334},\nauthor = {R. Bj{\\o}rk and E. B. Poulsen and K. K. Nielsen and A. R. Insinga},\n}\n",
"bugtrack_url": null,
"license": null,
"summary": "MagTense - a micromagnetism and magnetostatic framework",
"version": "2.2.3",
"project_urls": {
"Documentation": "https://cmt-dtu-energy.github.io/MagTense/",
"Homepage": "https://www.magtense.org/",
"Source": "https://github.com/cmt-dtu-energy/MagTense"
},
"split_keywords": [
"micromagnetism",
" magnetostatics",
" demagnetization tensor"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "77b3c09abe352780993e47395d7bdafe29c1c4abbf703cecde12f8d1953e79ab",
"md5": "58601df9b48045b9035bb5093b0c7b7a",
"sha256": "51fac7de98520d6f94a5979ef55badd464aa8126dc092b50d0ed53442881e07b"
},
"downloads": -1,
"filename": "magtense-2.2.3-1-py312-none-manylinux1_x86_64.whl",
"has_sig": false,
"md5_digest": "58601df9b48045b9035bb5093b0c7b7a",
"packagetype": "bdist_wheel",
"python_version": "py312",
"requires_python": ">=3.12",
"size": 706858,
"upload_time": "2025-08-18T14:24:01",
"upload_time_iso_8601": "2025-08-18T14:24:01.268978Z",
"url": "https://files.pythonhosted.org/packages/77/b3/c09abe352780993e47395d7bdafe29c1c4abbf703cecde12f8d1953e79ab/magtense-2.2.3-1-py312-none-manylinux1_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c53de53c3fc763b24364814745929dfa326309902a4cfa2d01a766b7a5fa97b3",
"md5": "2b81682bf617b7d5c4fec544fa5f9a29",
"sha256": "2cfcd8b7ed70f3f7590b824d7385cd40fd57bc0d396cf207a304f544359a8ece"
},
"downloads": -1,
"filename": "magtense-2.2.3-1-py312-none-win_amd64.whl",
"has_sig": false,
"md5_digest": "2b81682bf617b7d5c4fec544fa5f9a29",
"packagetype": "bdist_wheel",
"python_version": "py312",
"requires_python": ">=3.12",
"size": 638065,
"upload_time": "2025-08-18T14:24:03",
"upload_time_iso_8601": "2025-08-18T14:24:03.374523Z",
"url": "https://files.pythonhosted.org/packages/c5/3d/e53c3fc763b24364814745929dfa326309902a4cfa2d01a766b7a5fa97b3/magtense-2.2.3-1-py312-none-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1254f6ca782d66c8d8665c540008e2e036f535d3686dc45b3856439e495b0345",
"md5": "4ad048f723cf3a1ff1bc32a87a2ed38a",
"sha256": "4e280efd901d6384fca761b3ea240dbede7f7242bca62fd7df189eae1ac3fa9e"
},
"downloads": -1,
"filename": "magtense-2.2.3-1-py313-none-manylinux1_x86_64.whl",
"has_sig": false,
"md5_digest": "4ad048f723cf3a1ff1bc32a87a2ed38a",
"packagetype": "bdist_wheel",
"python_version": "py313",
"requires_python": ">=3.12",
"size": 706872,
"upload_time": "2025-08-18T14:24:05",
"upload_time_iso_8601": "2025-08-18T14:24:05.261849Z",
"url": "https://files.pythonhosted.org/packages/12/54/f6ca782d66c8d8665c540008e2e036f535d3686dc45b3856439e495b0345/magtense-2.2.3-1-py313-none-manylinux1_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "b44bf2501b0b50e6c6cad088216f458ab45470a3b4aec8400d3a1e19d08ceb6c",
"md5": "2c8e3ea519ae88530c83e9f486e6f9f2",
"sha256": "ddaec6d5a89290be6c769a166a39a5b0f44cdb44e4e0d9a8fb75f5883d51deb1"
},
"downloads": -1,
"filename": "magtense-2.2.3-1-py313-none-win_amd64.whl",
"has_sig": false,
"md5_digest": "2c8e3ea519ae88530c83e9f486e6f9f2",
"packagetype": "bdist_wheel",
"python_version": "py313",
"requires_python": ">=3.12",
"size": 638055,
"upload_time": "2025-08-18T14:24:07",
"upload_time_iso_8601": "2025-08-18T14:24:07.277322Z",
"url": "https://files.pythonhosted.org/packages/b4/4b/f2501b0b50e6c6cad088216f458ab45470a3b4aec8400d3a1e19d08ceb6c/magtense-2.2.3-1-py313-none-win_amd64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-18 14:24:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cmt-dtu-energy",
"github_project": "MagTense",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "magtense"
}