Skip to content
/ magpy Public

C++ accelerated python module for simulating magnetic nanostructures

License

Notifications You must be signed in to change notification settings

owlas/magpy

Repository files navigation

magpy

magpy is a C++ accelerated python package for simulating systems of magnetic nanoparticles.

Current status

CircleCI Documentation Status Stories in Ready conda-version conda-license conda-downloads conda-link DOI

Features

  • C++ accelerated time-integration
  • Stochastic Landau-Lifshitz-Gilbert equation
  • Explicit Heun scheme integration
  • Implicit Midpoint method
  • Parallelism at the highest level. Use the power of embarrassingly parallel!
  • Thermal activation model for single particles
  • Energy dissipation and SAR calculations

Join the chat at:

Join the chat at https://gitter.im/magpy-users/Lobby

Documentation

Getting started guides, example code, tutorials, and the API documentation are available at http://magpy.readthedocs.io

They can also be built locally with sphinx. Requirements are found in the enviornment.yml file:

    $ cd docs
    $ cat environment.yml
    $ make html

Installation

Detailed instructions can be found at http://magpy.readthedocs.io

Tests

Unit tests

Unit tests exist for the C++ code (gtest) and python code (pytest).

The following code snippet will run the C++ unit tests with gtest.

    $ cd /path/to/magpy/project
    $ make run-tests

In order to run the python unit tests:

    $ cd /path/to/magpy/project
    $ pytest -v magpy

Numerical tests

The numerical tests check the stability of the numerical integrators:

    $ cd /path/to/magpy/project
    $ make test/convergence/run
    $ cd test/convergence
    $ chmod +x run
    $ ./run

This command will populate the directory ./test/convergence/output with results. The results are explained and visualised in ./docs/source/notebooks/convergence.ipynb (also see hosted docs)

Physics tests

For details see the docs in ./docs or at magpy.readthedocs.io

The notebooks are validated using nbval. Nbval reruns all the documentation notebooks and checks that there has been no change in output. This is particularly important to check if you have updated interfaces or changed the code base in anyway.

The notebooks take a long time to rerun and aren't included in the continuous integration testing.

    $ cd /path/to/magpy/project
    $ pytest --nbval-lax docs/source/notebooks

Contributing

  • Open an issue
  • Make a pull request
  • Join us on gitter