Metadata-Version: 2.1
Name: magtense
Version: 2.1.0
Summary: MagTense - a micromagnetism and magnetostatic framework
Home-page: https://www.magtense.org/
Author: Stefan Pollok
Author-email: spol@dtu.dk
License: GPL 3.0
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
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.9, <3.11
Description-Content-Type: text/markdown
License-File: LICENSE

<div align="center">
  <img src="https://cmt-dtu-energy.github.io/MagTense/_static/MagTense_logo.PNG" height=250><br>
</div>

# MagTense version 2021

MagTense consists of both a magnetostatic and a micromagnetism calculation framework.

The magnetostatic framework can calculate the magnetic field from objects shaped as cylinders, pieces of cylinders, prisms, circular pieces and tetrahedrons. This is done using a fully analytical calculation of the demagnetization tensor. The framework is fully implemented in Fortran and has both a Matlab MEX interface and a Python interface.

The micromagnetism framework solves the Landau-Lifshitz equation. The framework is fully implemented in Fortran and has a Matlab MEX interface and a Python interface, as well as an older Matlab implementation. The micromagnetism framework utilizes the magnetostatic framework for calculating the demagnetization field.

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/.


## Usage with Matlab

MagTense is directly useable in Matlab on Windows by downloading the already compiled MEX-files in [Releases](https://github.com/cmt-dtu-energy/MagTense/releases). The files are directly useable with no compilation required, although Matlab 2018a or greater is required. Examples of how to calculate magnetostatic and micromagnetic problems using the Matlab interface can be found in [matlab/examples](https://github.com/cmt-dtu-energy/MagTense/tree/master/matlab/examples).


### Compilation with a Visual Studio project file

If you want to compile MagTense with a Visual Studio project file for Windows, [MagTense.sln](https://github.com/cmt-dtu-energy/MagTense/blob/master/MagTense.sln), is available, as well as a Matlab function to build the MEX-files, [buildMagTenseMEX.m](https://github.com/cmt-dtu-energy/MagTense/blob/master/buildMagTenseMEX.m). MagTense utilizes Intel MKL for the micromagnetic simlations and can also utilize CUDA and CVODE.


## Usage with Python interface

Instructions on how to build and use the Python interface are listed in [python/](https://github.com/cmt-dtu-energy/MagTense/tree/master/python). Installation is recommended via `conda` package manager (requires **Python 3.9** or **3.10**). Additionally, binary installers for the Python interface are available at the [Python
Package Index (PyPI)](https://pypi.org/project/magtense).

- [ Optional CUDA support] Find matching `${CUDA_VERSION}` from https://anaconda.org/nvidia/cuda, and append the channel to your conda environment:

  ```sh
  conda config --env --append channels nvidia/label/cuda-${CUDA_VERSION}
  ```

- Install `magtense`
  
  ```sh
  conda install magtense  
  ```

- [ CUDA toolkit not present ] Install CUDA runtimes
    ```sh
    conda install -y -c "nvidia/label/cuda-11.4.4" libcusparse libcublas cuda-cudart

    # Windows: Development package is required 
    conda install -y -c "nvidia/label/cuda-11.7.0" libcusparse-dev libcublas-dev cuda-cudart-dev
    ```

## Current code development
The main features being worked on at the moment are:
- Proper code documentation
- Non-uniform grids


