CMTJ is a C++ code with Python for macromagnetic simulation of multilayer spintronic structures. The package uses C++ implementation of (s)LLGS (stochastic Landau-Lifshitz-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. There are also models using Smit-Beljers formalism which do not solve LLGS differential equations, but instead use static energy minimisation to find magnetisation vector positions and then compute frequencies.
core: core CMTJ C++ implementation.cmtj: Python bindings and other submodulescmtj/models/general_sb.py: Smit-Beljers formalism for static energy simulationsdocs: a comprehensive documentation for CMTJ, with examples and models.curated-examples: a list of curated, well written examples, a golden-standard on how to createcmtjsimulations
IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any cmtj tasks.
- Prefer dynamical LLGs solutions with
core/and Python bindings. - Always write Python code only, unless explicitly asked by the user to provide C++ simulation code.
- Start by exploring examples and bindings or docs first, before writing any code
- Make sure that you construct adequate layer type:
- if no SOT or STT is required, just use
Layer - if either STT or SOT is required, adjust for
p, polarisation vector and remember to pass adequate values
- if no SOT or STT is required, just use
- Run simulations with a fixed time step Δt = 1e-12 s, unless using the
Dormand-Princeadaptive solver - Sensible simulation times are from 1ns -- 500 ns. Above, rarely makes sense.
Critical note
Remember that we don't need to simulate a fixed or reference layer. Instead we model it with a fixed polarisation layer.
So 2 layers where 1 is fixed, you would not create 2 layer objects but one and set the polarisation reference for the first layer along the direction of the second
Example: layer.setReferenceLayer(CVector(0, 1.0, 0.0)) creates a reference layer to layer and sets it along y axis. It uses it during STT/SOT modelling.
! Key document reference: docs/physics/contributions
Always make sure of the units of key quantities. See unit reference section in docs/physics/contributions for all units. Please note that the Smit-Beljers model from general_sb.py is an exception: it uses Ms in A/m instead of T, and operates on spherical coordinates, instead of Cartesian. All core functionality and its bindings use Cartesian coordinates and T for Ms.
Generally, there are 3 types of units:
Ms--> mostlyT, except SB models whereA/mKu--> is anisotropy constant,J/m^3- effective and external fields are always in
A/m - interfacial interaction constants such as
Dfrom iDMI andJfrom IEC areJ/m^2
For all sensible starting values you are unsure of, always consult curated-examples or docs.
Here is a shortlist (not comprehensive):
| Parameter | Description | Typical/Sensible Value | Unit | Reference |
|---|---|---|---|---|
Ms |
Saturation magnetization | 0.5 – 1.6 (typically, closer to 1.) | T (SI, except SB: A/m) | docs/physics/contributions |
Ks |
Uniaxial anisotropy constant | (depends on system). PMA 1e2-1e6, IMA 1e2-1e3 | J/m³ | curated-examples, docs |
alpha |
Gilbert damping parameter | ~0.01 – 0.03 | dimensionless | curated-examples, literature |
J (J1, J2) |
Interlayer exchange coupling constants | ±0.001 – ±3.0 | J/m² (API; typical values in mJ/m²) | docs/physics/contributions |
D |
DMI constant | 0. – 3.0 | J/m² (API; typical values in mJ/m²) | docs/physics/contributions |
thickness |
Layer thickness | 0.8 – 2.0 | nm | curated-examples |
H_ext |
External magnetic field | ±0 – ±500e3 | A/m | experiment |
Notes:
- Always check
curated-examplesor documentation for specific device/material values. - In Smit-Beljers models:
Msis given inA/m, everywhere else inT. - All fields (
H_ext, effective fields) are inA/mthroughout the Python/C++ codebase.
- Do not create additional Readme.md files unless explicitly asked for. Do not explain your implementation in .md files too.
- Keep the code simple and organized. Make sure you do not duplicate functions, and import as much from the library as possible.
- For plotting, follow
scienplotsgraphing styling, you can see that incurated-examples- Plot mostly M(H) or R(H), clearly indicating the magnetisation component or R component (Rxx, Rxy, or R)
- If you want to present a trajectory, do it on a sphere, and make sure it's readable (the sphere must be mostly transparent, set low alpha)
- Try to follow industry naming for layers.
- In MTJs:
Freelayer is the one that we track the trajectory/switching.Referencerefers to a fixed layer.
- In Spin Hall bars:
- The reference polarisation is often set by the direction of the current through the heavy metal.
- The FM layers can be just named
topFM,bottomFMor if there are more than two,layerFM1, ...
- In MTJs:
- If you are providing an example on the new simulation method, place a good example in
curated-examples. Follow the standard from there, i.e.:- At the start of the example file, describe the physics of the simulation.
- Use good, sensible names for objects
- The result of the simulation must also be a figure showing the expected result.
- If you stub out a PR, please provide a standard description around the proposed change, and if relevant, the physics it affects