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.11.0.tar.gz (10.8 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.11.0-cp313-cp313-win_amd64.whl (317.7 kB view details)

Uploaded CPython 3.13Windows x86-64

cmtj-1.11.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.11.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (458.5 kB view details)

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

cmtj-1.11.0-cp313-cp313-macosx_11_0_arm64.whl (422.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

cmtj-1.11.0-cp312-cp312-win_amd64.whl (317.6 kB view details)

Uploaded CPython 3.12Windows x86-64

cmtj-1.11.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.11.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (457.9 kB view details)

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

cmtj-1.11.0-cp312-cp312-macosx_11_0_arm64.whl (421.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

cmtj-1.11.0-cp311-cp311-win_amd64.whl (316.1 kB view details)

Uploaded CPython 3.11Windows x86-64

cmtj-1.11.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.11.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (457.9 kB view details)

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

cmtj-1.11.0-cp311-cp311-macosx_11_0_arm64.whl (420.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for cmtj-1.11.0.tar.gz
Algorithm Hash digest
SHA256 c406baa999abbe480d928d061106d661fc6353652e741a9eb08908a37834e70c
MD5 34e2ed382f450a6abb5b8d036eba3a3f
BLAKE2b-256 f99600cb98403f5c7d366097b53a343e6230e53e96835011a2dc1680645ebb95

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cmtj-1.11.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 317.7 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.11.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d6e6108649593496b9df9e4f4bb55d7d2ebd1948a904e51cb30c96150c674562
MD5 90b612207a801caca713b407e037df23
BLAKE2b-256 ac26b5211dd8d02713f82dbae8f5b2bede670ab48549321cfb649f6d6df37908

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cmtj-1.11.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d50073cb83502bbb03c3001212aedbfb4f9c87e5fff9fd77998baf706540dc59
MD5 3b8560db0588f8b86febe9f72f3896ed
BLAKE2b-256 8f90dc20896cf20c711beab99d71d01fcef0f3290196bc53858515427fe1a67e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cmtj-1.11.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9ac2550fe17c618fc98728222f316e4062f202e4c3c76f092344927190347fad
MD5 500d63468bcabac10e4d928d39ea3386
BLAKE2b-256 239d2f9b51cf3dbcc9a18270353d44c1fc74f0d922b4bde57f270cb480f3d2f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cmtj-1.11.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 23e5f395ca5bae73fc5021483f94477d2997b7420e4dc824f3bc7414e4b55b36
MD5 0808f296241c4451770d810a9956c42e
BLAKE2b-256 43c2315ef1f29b8b3f37a120316809174eaca6dabcc14dbc07f31346e4bd5273

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cmtj-1.11.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 317.6 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.11.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4dfd2bdd54fd30b8b48b82fc5f51b748030c95324514e57b15085b49bb94136d
MD5 b1f913c2d1a2fa76fdf59bbb527f3ddd
BLAKE2b-256 962b17101411d3d532c0662e564ff078f4758b007475d5946a425a78d195f30d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cmtj-1.11.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 76701b44e4cbe3171e0a340c35c0675a79ddb7d4e39a88f236abf6a59478f683
MD5 becd3427b76c3ffa728461db28698fa6
BLAKE2b-256 d02dc95ba25432a78a731633bcfef575846609ec7517d996a5956a7e9de7dfdf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cmtj-1.11.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 97d7658ad953608b7fcffcdef62efede169d1a8518ecb363af763972fcc5fdd7
MD5 92482891adca4868a83af7cb20196369
BLAKE2b-256 a0dbd5fbdb6bdb9fc49ef07ff8519357e6fe3e5475d4f24549a1c4193f070172

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cmtj-1.11.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eafd3ded57cd4df440185ce1222a34e7fa74fa4cfb65d05133b17e53e17b7cb4
MD5 d14335f65bbbc202911ffa96bb6400dc
BLAKE2b-256 30d0be3c833f92df58a589a35276be27e48c950e621a32f64dbaaec4f485aaf2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cmtj-1.11.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 316.1 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.11.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7c4920948bf953a8291dc70b8223a1db11980b3a5b476bcccfd832e68ec6d2c1
MD5 20a47ff9c2809edc929cc3c3616021eb
BLAKE2b-256 a26e3722aab2bf0160401a74113bbaa6437ec12eb393b9ca1dce504102f5fb25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cmtj-1.11.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4206b57f07b56e6b0893774fbee91e276df47e93cc15e05bc44da8097deb1efe
MD5 98c72dcb58712fb94bca2911abce042b
BLAKE2b-256 de0b066e6ad7d1ddc8d057aba2192167e6102a55939f99cd0264e6e5c204ef38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cmtj-1.11.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d07057096af7631ea3e977c696c0a626e522939d4b14f52d306ed9844486a8e7
MD5 b103a49d710ef0a5e63a23db335a329c
BLAKE2b-256 b33d20d01019d8edec5fb8176885f2de14a0120709c56ad51aee0539c548bad3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cmtj-1.11.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2cf22bfc948780444dee7a29b1930a8f32ce543f14d1f24ecfee3672080c33c0
MD5 dcc8f2d7bca53224d640c8d4e0aa92b4
BLAKE2b-256 6d9563fc3aa2778144d054c864f82f87547be68494807244e375f259976ed6f9

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