Skip to content

Commit

Permalink
Merge pull request #73 from LemurPwned/feat/coupling-expansion
Browse files Browse the repository at this point in the history
Feat/coupling expansion
  • Loading branch information
LemurPwned authored Dec 6, 2024
2 parents 58f58a2 + 51c8bd4 commit cdc2cfb
Show file tree
Hide file tree
Showing 61 changed files with 6,923 additions and 6,157 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
name: Python Package Publication

on:
pull_request:
types: [closed]
branches: [master]
workflow_dispatch:
inputs:
release-version:
required: true
dry-run:
required: true
default: true
type: boolean
linux:
type: boolean
required: true
Expand Down Expand Up @@ -37,7 +36,7 @@ jobs:
with:
python-versions: 'cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311'
- name: upload wheel
if: ${{ !inputs.dry-run }}
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
run: |
python -m pip install --upgrade pip
python -m pip install wheel setuptools twine
Expand Down Expand Up @@ -68,13 +67,13 @@ jobs:
python -m pip install wheel setuptools twine
python setup.py bdist_wheel
- name: upload wheel
if: ${{ !inputs.dry-run }}
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
run: |
twine upload dist/*
continue-on-error: false

release-build:
if: ${{ !inputs.dry-run }}
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
needs: [ linux-build, other-os-build ]
runs-on: ubuntu-latest
steps:
Expand Down
48 changes: 29 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
# See https://pre-commit.com/hooks.html for more hooks

exclude: "^\
(third-party/.*)|\
(third_party/kissfft)|\
(build/.*)|\
(.github/.*)|\
(.vscode/.*)|\
(^tests)|\
(docs/api/.*)
(docs/api/.*)|\
(core/compute.hpp)|\
(defaults.cfg)
"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.6.0
hooks:
- id: check-added-large-files # prevents giant files from being committed.
- id: check-case-conflict # checks for files that would conflict in case-insensitive filesystems.
Expand All @@ -26,30 +28,38 @@ repos:
- id: trailing-whitespace # trims trailing whitespace.

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.5.1
rev: v4.0.0-alpha.8
hooks:
- id: prettier
files: \.(html|json|markdown|md|yaml|yml)$
exclude: (^docs/api/.*)

- repo: https://github.com/pycqa/isort
rev: 5.10.1
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.6.4
hooks:
- id: isort
name: isort (python)

- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.32.0
hooks:
- id: yapf
files: "^cmtj"
args: [--in-place, --recursive]
# Run the linter.
- id: ruff
files: ^cmtj
args: ["--fix"]
types_or: [python, pyi]
# Run the formatter.
- id: ruff-format
files: ^cmtj
types_or: [python, pyi]

- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
hooks:
- id: cppcheck
# - id: clang-format
# - id: oclint
# - id: uncrustify
- id: include-what-you-use
args: ["--check-level=exhaustive"]
files: ^(cmtj|core)/.*\.(cpp|hpp)$
exclude: ^third_party/ | ^core/compute.hpp
- id: clang-format
args: [-i]
files: ^(cmtj|core)/.*\.(cpp|hpp)$
exclude: ^third_party/ | ^core/compute.hpp
- id: clang-tidy
args: [-checks=*]
files: ^(cmtj|core)/.*\.(cpp|hpp)$
exclude: ^third_party/ | ^core/compute.hpp
25 changes: 18 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# Changelog

# 1.5.0 (WIP)
# 1.6.0

- Extended the `Stack` models allowing for non-symmetric coupling between devices.
`Stack` current drivers can now be of any type and are adequately scaled.
- Custom definition of the `ScalarDriver` is now possible and documented.
- Fixed a bug in the `Stack` class which inverted the connection order of in-series connections.
- Exposed IDMI interaction to Layer and Junction classes.
- Added `getLayer` method to the `Junction` class and `getJunction` method to the `Stack` class that return a reference to the object.
- Fixed and expanded the `reservoir` module. Now, `GroupInteraction` can use any dipole interaction function, with 3 provided as default: `computeDipoleInteraction`, `computeDipoleInteractionNoumra` and `nullDipoleInteraction` (0 dipole tensor).

# 1.5.0-1.5.4

- Dipole interaction added to the `SB Model`
- Kasdin 1/f noise generator added to the `noise` module and to the solvers
- reworking the solvers for better performance and stability
- added a simple noise model to the `utils` class. It exists outside standard simulation procedures.
- added LLGB bindings and code. The solver is still WIP and doesn't integrate with more advanced features yet.
- added aliases for `ScalarDriver` -- for example, instead of calling `ScalarDriver.getConstantDriver`, you can now call `constantDriver` directly to create a constant driver.
- Reworking the solvers for better performance and stability
- Added a simple noise model to the `utils` class. It exists outside standard simulation procedures.
- Added LLGB bindings and code. The solver is still WIP and doesn't integrate with more advanced features yet.
- Added aliases for `ScalarDriver` -- for example, instead of calling `ScalarDriver.getConstantDriver`, you can now call `constantDriver` directly to create a constant driver.
- Improve stub detection across editors and IDEs

# 1.4.1

Expand Down Expand Up @@ -40,12 +51,12 @@
- Adding DW dynamics 1D model with dynamic drivers. (Numba optimised)
- Adding SB model for energy-based FMR computation. Gradient computed using Adam optimiser.
- Moving resistance functions from `utils` to `resistance`
- Introducting docs updates for tutorial notebook (dark/light toggle works now).
- Introducing docs updates for tutorial notebook (dark/light toggle works now).
- Reservoir computing is now exposed in Python in the `reservoir` computing module.

## 1.2.0

- Oersted field computation helper class in [cmtj/models/oersted.py](cmtj/models/oersted.py). Basic functionality is there, but needs to be futher tested and documented. Next release potentially will move the computation to C++ for speed.
- Oersted field computation helper class in [cmtj/models/oersted.py](cmtj/models/oersted.py). Basic functionality is there, but needs to be further tested and documented. Next release potentially will move the computation to C++ for speed.
- Added Heun (2nd order) solver and made it default for thermal computation. This is a more stable solver than the Euler solver, but is slower. The Euler solver is still available as an option.
- Stack class now supports arbitrary layer ids to be coupled.
- Extended the plotting capabilities of the Stack class. Now supports plotting of the magnetic field and the current density.
Expand Down
42 changes: 38 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- [CMTJ](#cmtj)
- [Table of contents](#table-of-contents)
- [Short description](#short-description)
- [What can you simulate?](#what-can-you-simulate)
- [Web GUI](#web-gui)
- [Quickstart](#quickstart)
- [Installation :rocket:](#installation-rocket)
Expand All @@ -34,6 +35,37 @@ The `cmtj` name may be misleading -- the MTJ (Magnetic Tunnel Junctions) are not
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](https://cmtj-app.streamlit.app/spectrum).
Expand Down Expand Up @@ -151,13 +183,16 @@ pre-commit run -a (or --files core/* cmtj/*)

## Documentation builds

There are couple of stages to building the documentation
**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. Furture changes may couple C++ and Python docs.
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:
Expand All @@ -175,8 +210,7 @@ There are couple of stages to building the documentation
```
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 `
This stage is done by running: `python3 docs/docgen.py `
The deployment of the documentation is done via:
```bash
mkdocs gh-deploy
Expand Down
Loading

0 comments on commit cdc2cfb

Please sign in to comment.