Metadata-Version: 2.4
Name: mammos-mumag
Version: 0.4.4
Summary: Finite element micromagnetic simulation tool.
Author: Thomas Schrefl, Swapneel Amit Pathak, Andrea Petrocchi, Samuel Holt, Martin Lang, Hans Fangohr
License: BSD 3-Clause License
        
        Copyright (c) 2024, MAgnetic Multiscale MOdelling Suite (MaMMoS)
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License-File: LICENSE
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.10
Requires-Dist: jax
Requires-Dist: jinja2<4,>=3.1.6
Requires-Dist: mammos-entity>=0.2.1
Requires-Dist: mammos-units
Requires-Dist: numpy
Requires-Dist: psutil>=7
Requires-Dist: pydantic
Requires-Dist: pyvista
Requires-Dist: pyyaml>6
Requires-Dist: scipy
Provides-Extra: docs
Requires-Dist: ipykernel; extra == 'docs'
Requires-Dist: jupyter; extra == 'docs'
Requires-Dist: nbsphinx; extra == 'docs'
Requires-Dist: numpy; extra == 'docs'
Requires-Dist: sphinx-rtd-theme==3.0.1; extra == 'docs'
Requires-Dist: sphinx==8.1.3; extra == 'docs'
Provides-Extra: format
Requires-Dist: ruff==0.8; extra == 'format'
Provides-Extra: gpu
Requires-Dist: jax[cuda12]; extra == 'gpu'
Provides-Extra: test
Requires-Dist: pytest; extra == 'test'
Description-Content-Type: text/markdown

# Info
`mammos-mumag` is a finite-element micromagnetic simulation tool capable of simulating hysteresis loops of magnetic materials with multiple grains, developed and maintained by Thomas Schrefl at Zentrum für Modellierung und Simulation, Universität für Weiterbildung Krems.

This package allows users to use the library `mammos_mumag` in Python and includes some useful scripts for the use and development of `mammos-mumag`. On way to install the package would be to execute `pip install .`, but we recommend using [pixi](https://prefix.dev).


# Installation

Clone the repository and install with pip, i.e. run
```console
git clone https://github.com/MaMMoS-project/mammos-mumag
pip install mammos-mumag
```

<!-- # Installation with conda-pip (discouraged)
The package `esys-escript` must be installed from `conda-forge` (see [here](https://github.com/LutzGross/esys-escript.github.io/)) with
```console
 conda install esys-escript -c conda-forge
 ```

`cuda` must be installed from the `nvidia` channeel with
```console
conda install cuda -c nvidia
```

Then, in the same environment where the two previous packages have been installed, we can install `mammos_mumag` with pip by running
```console
pip install .
```

> To install optional dependencies, run e.g. `pip install .[test]` or `pip install .'[test]'` (for example on zsh).


# Installation & usage with Pixi (recommended)
Run `pixi shell` in any subdirectory to activate a container where this package is installed.
This package comes with several pixi tasks (in alphabetical order):
- `clean`
- `docs`
- `docs-clean`
- `format`
- `lint`
- `pre-commit`
- `test`

To run a task, execute `pixi run <task_name>` or `pixi r <task_name>`.


## Style tasks
These tasks (`clean`, `format`, and `lint`) use [Ruff](https://docs.astral.sh/ruff/) to lint and format the code with the rules specified in [`pyproject.toml`](pyproject.toml)


## Test tasks
The task (`test`) executes tests found in the [`test`](test/) directory.


## Docs tasks
The tasks (`docs`, `docs-clean`) manage the documentation. In particular, `docs` builds the html docs, while `docs-clean` cleans the current build.


## Pre-commit task
The task to execute pre-commit can be run by the user to check that committed changes adhere to the formatting and linting rules.
If the pre-commit hook is installed, the command `pre-commit` is also executed automatically every time `git commit` is called, but one needs to activate the right environment first.
This is done with
```console
pixi shell -e pre-commit
```

> *pre-commit* has to be installed after the first activation of the environment. To do this, run
> ```console
> pixi run pre-commit install
> ``` -->


## Working examples
Please refer to the examples:
- [Materials i/o](docs/source/notebooks/materials_io.ipynb)
- [Parameters i/o](docs/source/notebooks/parameters_io.ipynb)
- [Using the pre-defined scripts](docs/source/notebooks/scripts.ipynb)
- [Run a hysteresis loop with pre-defined meshes](docs/source/notebooks/hysteresis_loop.ipynb)
- [Converting `unv` mesh to `fly`](docs/source/notebooks/unvtofly.ipynb)
