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.13.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.13.0-cp313-cp313-win_amd64.whl (325.4 kB view details)

Uploaded CPython 3.13Windows x86-64

cmtj-1.13.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.13.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (462.6 kB view details)

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

cmtj-1.13.0-cp313-cp313-macosx_11_0_arm64.whl (448.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

cmtj-1.13.0-cp312-cp312-win_amd64.whl (325.4 kB view details)

Uploaded CPython 3.12Windows x86-64

cmtj-1.13.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.13.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (462.4 kB view details)

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

cmtj-1.13.0-cp312-cp312-macosx_11_0_arm64.whl (448.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

cmtj-1.13.0-cp311-cp311-win_amd64.whl (325.2 kB view details)

Uploaded CPython 3.11Windows x86-64

cmtj-1.13.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.13.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (466.4 kB view details)

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

cmtj-1.13.0-cp311-cp311-macosx_11_0_arm64.whl (447.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: cmtj-1.13.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.13.0.tar.gz
Algorithm Hash digest
SHA256 932f80567cc205b42fde6e4c46cface3f53aab52667cb3b366a053fa6db08448
MD5 6b7fba765df84e510d1fa1450ad74b3d
BLAKE2b-256 5fde646c8b2f692e6dd60f85677b410f5c17c64fd662ee5ce9f87976a120a82b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cmtj-1.13.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 325.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.13.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9578325b478faa1648d5939f5114ab86f0f9a017b1a2dfbd5b73967a70b692c6
MD5 25c59ba0f9e71dfeae2cbd05cbff28dd
BLAKE2b-256 f9053a14339e2295509983b1567f2b05b6ec73986830e1e86c36852bbaca9164

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cmtj-1.13.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4df476754e64eb2482e99428ceefb601d68fd935d063e405eaa33c6e6b4dd432
MD5 9c5bfaa47cbb1189d8066f32d5a6c05f
BLAKE2b-256 641dfb94cb3e76f91366ca975739c1081b1d55f850336dec9c12e6c678ec8bd3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cmtj-1.13.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 48042d3db37c21791abac8bc302181c627c19c9e98626158953cc65723d60593
MD5 aedc1adecb8f6a5377c2dd7b5d8f25a8
BLAKE2b-256 6476d5a72a7ce422ad66a05f123378f727b5ba23f61739b111a93aba4eb922b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cmtj-1.13.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ce24e75d08bc8b89f16c1e11baa046d7b523cf4cf0edc0290ede7709b01929c9
MD5 6612b4f3af338aac0e5b56c62c90dc12
BLAKE2b-256 e854c295185d423a05529efa0ee2f88b4d624700934bc4c2bf8a4f785e89798c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cmtj-1.13.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 325.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.13.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8f710bf43bee7cf12d2165cd7abc06d80e3bb94d330b732dc88e28a1f1f7980f
MD5 8ef45698dde433ec2737462baf78c20f
BLAKE2b-256 f9b45f54cd7db7f9839d33c252e17c0ea40d4767d69fcf42435aa73ee5924744

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cmtj-1.13.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 3cd76083ba1433563286947af5d29b3c68f7955aee8a44022d937f082ade1d0f
MD5 f2f16840f649895abd2d7a77a1b00c20
BLAKE2b-256 5bccce66443dfc34152668c8e4ab77d410b14cf7371ec512e2c975b38eadd712

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cmtj-1.13.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5b891cebe28a7fa6fda94bdfaf74161b578d6bdcc561d6b3e2e606df729d207f
MD5 070fb89650c87b53d6fd82de03caa381
BLAKE2b-256 a0dd724aeea38f6ef43d169291b108f1acd8631722be86e15575ea3119331b79

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cmtj-1.13.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d891327d68ceaeeb0c25253130868f8b36b679af4b64c4dd59da8a2777001b28
MD5 2d1e33aad297ba3924f9ba10be99a2c9
BLAKE2b-256 a9a8dc1d5fbcf6c8865494ab32a7f80cf672e57505c5c6d48104437bebdb0009

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cmtj-1.13.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 325.2 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.13.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9a7ea79cfd27b58644f80e27d1e02ab3e78ce6cbd84a24a6352d3640e4d6213f
MD5 3e112718ed9697af909429d2b6b89c71
BLAKE2b-256 1bed109db8f756ea6ac171c1e9c7a9937e2402f689c6b98abd325b73d26a0a21

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cmtj-1.13.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 2c809470d28e25809448dc26a5308415b0332f2bb17143b091961b36975e629e
MD5 03c0d6b44a4c129fa2eb3052678f99d0
BLAKE2b-256 c3c6d9f1a115b99e3271bac9f1cc19698a4c914bea724230440bcd20a01107b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cmtj-1.13.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 222a53b9d46cc63f7551520a4149e710228395bb05b84567056d38671f4f575f
MD5 449ad1ccc9e538114f1eb0c494401288
BLAKE2b-256 7228c8f0c45c5fca6ac86ec082c939379f428cff0b77dea9526b18137b5863f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cmtj-1.13.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0c28379110a06aeba47d3323f542cf7b8fdc80411bffdd46887f141983b29af5
MD5 2ad0d129fb1032a9637bc34d22486136
BLAKE2b-256 ebf5c1325d81c6da9dbfe21749dbecda16d2f3100e9d78d215ea354fc83be076

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