Skip to main content

CMTJ - C Magnetic Tunnel Junctions.

Project description

CMTJ

PyPI pages-build-deployment Version License Streamlit PyPI Downloads

Table of contents

Short description

The cmtj name may be misleading -- the MTJ (Magnetic Tunnel Junctions) are not the only structures that may be simulated. The library allows for macromagnetic simulation of various multilayer spintronic structures. The package uses C++ implementation of (s)LLGS (stochastic Landau-Lifschitz-Gilbert-Slonczewski) equation with various field contributions included for instance: anisotropy, interlayer exchange coupling, demagnetisation, dipole fields etc. It is also possible to connect devices in parallel or in series to have electrically coupled arrays.

What can you simulate?

Below is a brief list of examples (it's not exhaustive! Check the docs for more).

Magnetic devices:

  • Magnetic Tunnel Junctions
    • Voltage-Driven Magnetic Tunnel Junctions
    • Spin-Torque Oscillators
    • VCMA sensors and devices
    • Magnetic Tunnel Junction Arrays
  • SOT devices
    • Current-Driven SOT
  • Advanced device coupling
  • Reservoirs (dipole coupling)
  • Electrically coupled MTJs
  • Base equations
    • Landau-Lifshitz-Gilbert-Slonczewski equation
    • Stochastic Landau-Lifshitz-Gilbert-Slonczewski equation
    • Landau-Lifshitz-Gilbert-Bloch equation
  • Domain wall motion

Experimental methods:

Some of the experimental methods available:

  • PIMM
  • Spin-Diode
  • CIMS
  • R(H), M(H)

Web GUI

Check out the streamlit hosted demo here. You can simulate:

  • PIMM spectra and Spin-Diode spectra
  • Try some optimization fitting
  • Fit multi-domain or multi-level M(H) or R(H) loops in Domain mode

Let us know if you have any issues with the demo.

Quickstart

Installation :rocket:

The recommended way is to use the pip package manager and virtualenv (or conda). Installation is as easy as doing:

Recommendation Use the following flagswhen installing/compiling from start. They provide optimimum performance, but even without them, cmtj is very fast.

export LDFLAGS="-O3"
export CXXFLAGS="-O3 -march=native -ffast-math"
  1. With virtualenv (recommended):
$(bash) python -m venv .my-venv
$(bash) source .my-venv/bin/activate
$(.my-venv) python -m pip install cmtj
  1. Straight from pip:
python3 -m pip install cmtj
  1. Straight from source:
python3 -m pip install git+https://github.com/LemurPwned/cmtj.git
  1. Clone the repository:
git clone --recurse-submodules https://github.com/LemurPwned/cmtj.git
python3 -m pip install .

if your git is older, you may need to use --recursive instead of --recurse-submodules.

Extra dependencies

The package requires (if utils subpackage is used):

- numpy
- scipy
- matplotlib

Documentation and examples

Documentation: https://lemurpwned.github.io/cmtj. There are many examples available, check out the examples section in the docs

Extensions

There's a GUI version available! If you wish to conduct a subset of simulations, mainly for experimental modelling, please see the PyMag project. It uses CMTJ as a backend for fast computation.

Citing

We would appreciate citing either of the listed work if you decide to use the project or using the cite button on the right hand side panel of the repository:

cmtj: Simulation package for analysis of multilayer spintronic devices

@article{mojsiejuk_cmtj_2023,
	title = {cmtj: Simulation package for analysis of multilayer spintronic devices},
	volume = {9},
	issn = {2057-3960},
	url = {https://www.nature.com/articles/s41524-023-01002-x},
	doi = {10.1038/s41524-023-01002-x},
	pages = {54},
	number = {1},
	journaltitle = {npj Comput Mater},
	author = {Mojsiejuk, Jakub and Ziętek, Sławomir and Grochot, Krzysztof and Skowroński, Witold and Stobiecki, Tomasz},
	date = {2023-04-06},
}

Development

Acknowledgements

Many thanks to professor Jack Sankey for his help with the development of thermal contributions, with inspiration from the macrospinmob project.

Contributions

All contributions are welcome, please leave an issue if you've encountered any trouble with setup or running the library.

Docker

In the docker directory there's a Dockerfile that can be used to build a docker image with the library installed. Dockerfile.app is used for streamlit development.

Precommit

There's a .pre-commit-config.yaml that does some basic python and cpp lints and checks. More static analysis to come in the future. This may be run with:

pre-commit run -v

or

pre-commit run -a (or --files core/* cmtj/*)

Documentation builds

Note For stub generation add __init__.py to the cmtj directory.

There are a couple of stages to building the documentation

  1. Build Doxygen documentation
    doxygen Doxyfile
    
    This is mostly for the C++ documentation. Future changes may couple C++ and Python docs.
  2. Build stubs The stubgen is pybind11-stubgen or mypy stubgen with the latter being preferred now. Before running the stubgen, make sure to install the package with:
    python3 -m pip install .
    
    avoid using -e flag as it may cause issues with the stubgen. Then to generate, for instance, Stack module stubs we can do:
    stubgen -m cmtj.stack -o target-stub-dir/
    
    or
    python3 -c "import mypy.stubgen; mypy.stubgen.main(['-p', 'cmtj.stack', '-o', 'target-stub-dir/'])"
    
    More info here: https://mypy.readthedocs.io/en/stable/stubgen.html.
  3. Parse stubs to Markdown. This stage is done by running: python3 docs/docgen.py The deployment of the documentation is done via:
    mkdocs gh-deploy
    
    But first, worth a check:
    mkdocs serve
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cmtj-1.12.0.tar.gz (11.5 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cmtj-1.12.0-cp313-cp313-win_amd64.whl (322.4 kB view details)

Uploaded CPython 3.13Windows x86-64

cmtj-1.12.0-cp313-cp313-musllinux_1_2_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

cmtj-1.12.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (461.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

cmtj-1.12.0-cp313-cp313-macosx_11_0_arm64.whl (442.3 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

cmtj-1.12.0-cp312-cp312-win_amd64.whl (322.4 kB view details)

Uploaded CPython 3.12Windows x86-64

cmtj-1.12.0-cp312-cp312-musllinux_1_2_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

cmtj-1.12.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (460.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

cmtj-1.12.0-cp312-cp312-macosx_11_0_arm64.whl (441.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

cmtj-1.12.0-cp311-cp311-win_amd64.whl (321.9 kB view details)

Uploaded CPython 3.11Windows x86-64

cmtj-1.12.0-cp311-cp311-musllinux_1_2_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

cmtj-1.12.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (465.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

cmtj-1.12.0-cp311-cp311-macosx_11_0_arm64.whl (441.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file cmtj-1.12.0.tar.gz.

File metadata

  • Download URL: cmtj-1.12.0.tar.gz
  • Upload date:
  • Size: 11.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for cmtj-1.12.0.tar.gz
Algorithm Hash digest
SHA256 5a27c17a2c460182e671f0b24e7b766d144abae0b78d3310705c3212c809ed3f
MD5 daf5e43dad60088addefe14fdd1ac875
BLAKE2b-256 f3858ba365e373994ff9a32387bb7eede9fb0495e72e56c8dd353b7dda43cdab

See more details on using hashes here.

File details

Details for the file cmtj-1.12.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: cmtj-1.12.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 322.4 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for cmtj-1.12.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 57d2daf78b5fbca769693a56686b895bb9cd89070ff00cc1f5c041b3da027f08
MD5 c9fd70516e262ffe40689908e955cfb9
BLAKE2b-256 50aaebee8b23c9163fca296152570985ef61888f890802e1b35d2b4d61530647

See more details on using hashes here.

File details

Details for the file cmtj-1.12.0-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for cmtj-1.12.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b4f570a474edd1c92da3584c64b3b3ca1e7c849ee7731b0626115caff0b45df8
MD5 ecb47a0a6b75b366a09eb32a890a5288
BLAKE2b-256 5c1b8608a4cefd003ead8ceaff203c22c76a157ed6324efd85bb9bdced1ec3ea

See more details on using hashes here.

File details

Details for the file cmtj-1.12.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cmtj-1.12.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7ecffe9724575732955ac5a6cf59c9f37a96d549cfc9ac12e5556484f11cb952
MD5 5fb0a415891dd00f63af3a46187a5199
BLAKE2b-256 0666ec3e1ebaeb9dd146379735644f5d844982b7cbab7cec89b3e3aa91f36113

See more details on using hashes here.

File details

Details for the file cmtj-1.12.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cmtj-1.12.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dff0210276559579ee0c87662775d3e8b0578470d2fcb848145fd62706c1fbb7
MD5 ae018a46409273b3d6f663b0ab58437f
BLAKE2b-256 f1fb5046771e8c3b7c959456db015721c9c41d2ad2e666d01205464d10b1dea0

See more details on using hashes here.

File details

Details for the file cmtj-1.12.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: cmtj-1.12.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 322.4 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for cmtj-1.12.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2ae11c1e6c1241e1f4513a1f91b7d0b80e4ab4b0505702bacf224fd393da98de
MD5 b0cd354bd3810fe29faad950b9fe40cc
BLAKE2b-256 5312f304fc1f94367a1f2b51f2719cf0c1c83c4092825ce54aee1e344ab7a4f8

See more details on using hashes here.

File details

Details for the file cmtj-1.12.0-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for cmtj-1.12.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 44a3bd4d3cdc85a7a04eacf3ea9c5e02c9565f7ffb0d4924b84651447c51924d
MD5 b1c058b2df07b76381fc7eef71f4b0db
BLAKE2b-256 cad8e2030c1c0123a6d2a3023943c80909ec3d9bb7fd069072e8ba020cf55fa8

See more details on using hashes here.

File details

Details for the file cmtj-1.12.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cmtj-1.12.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 860b7137c4986c5f2006237a55391368880818bab8a6fd5480a4ba719d29fe55
MD5 741f873a56cd390a2a1f06f615880fae
BLAKE2b-256 94458732dcce60db2c4abe4179f8911346b32317067564e86e85191df0b2830e

See more details on using hashes here.

File details

Details for the file cmtj-1.12.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cmtj-1.12.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d48d62eb7b629ca69491ef74b2d60048d8f17dcd2ca54ca18b56bca8c16b17e2
MD5 379bfcc68985f716911d5986f21691dc
BLAKE2b-256 c9a0e99d46c3811cba7b74037793e28f9e14dffc7308289c29225e8891f4150e

See more details on using hashes here.

File details

Details for the file cmtj-1.12.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: cmtj-1.12.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 321.9 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for cmtj-1.12.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a1b4efb5f39db6b2d1431a6edb3a0f117eda55d721f4ef572df355e51dce7132
MD5 dbf2a15041a3e9858162dc188f69ddc5
BLAKE2b-256 eb5622e2356f9a2b5466f79d3a343c5709d59ebcd1d099b7cdc91c3669135794

See more details on using hashes here.

File details

Details for the file cmtj-1.12.0-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for cmtj-1.12.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 404fe3d9fb6226f8c6e14cdc5000caf4a9a7f6eeb071a5d4731efb17db92325b
MD5 e985ad66c5cd9c454d7548b22ee26b5f
BLAKE2b-256 3a25f1a9c9fc0ccf081f7a28f6a6e8891567b9929f759589f001684173fd00cf

See more details on using hashes here.

File details

Details for the file cmtj-1.12.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cmtj-1.12.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9fa6dee0a45a40486035fecf1a403d6f25018d9586cd6f2f28ad9fbbc9d42b86
MD5 8af1a119c4f0732cae774a75725b770f
BLAKE2b-256 0b7128aae3983d25d4d52c72b07f18178e53e7f6ebc39ff5827585db2de1748b

See more details on using hashes here.

File details

Details for the file cmtj-1.12.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cmtj-1.12.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2cf8422b9d17a062e1b91c97b15ff06b2c8588d97718774e12a294640574f7fb
MD5 7287bdb2b6bce5b36de29245bb2e71b8
BLAKE2b-256 c845f41ec75169031251088148fcb361871a7d0bf750dec4a602e8546698e2c0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page