Skip to content

Commit cdc2cfb

Browse files
authored
Merge pull request #73 from LemurPwned/feat/coupling-expansion
Feat/coupling expansion
2 parents 58f58a2 + 51c8bd4 commit cdc2cfb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+6923
-6157
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
name: Python Package Publication
33

44
on:
5+
pull_request:
6+
types: [closed]
7+
branches: [master]
58
workflow_dispatch:
69
inputs:
710
release-version:
811
required: true
9-
dry-run:
10-
required: true
11-
default: true
12-
type: boolean
1312
linux:
1413
type: boolean
1514
required: true
@@ -37,7 +36,7 @@ jobs:
3736
with:
3837
python-versions: 'cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311'
3938
- name: upload wheel
40-
if: ${{ !inputs.dry-run }}
39+
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
4140
run: |
4241
python -m pip install --upgrade pip
4342
python -m pip install wheel setuptools twine
@@ -68,13 +67,13 @@ jobs:
6867
python -m pip install wheel setuptools twine
6968
python setup.py bdist_wheel
7069
- name: upload wheel
71-
if: ${{ !inputs.dry-run }}
70+
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
7271
run: |
7372
twine upload dist/*
7473
continue-on-error: false
7574

7675
release-build:
77-
if: ${{ !inputs.dry-run }}
76+
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
7877
needs: [ linux-build, other-os-build ]
7978
runs-on: ubuntu-latest
8079
steps:

.pre-commit-config.yaml

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33

44
exclude: "^\
5-
(third-party/.*)|\
5+
(third_party/kissfft)|\
66
(build/.*)|\
77
(.github/.*)|\
88
(.vscode/.*)|\
99
(^tests)|\
10-
(docs/api/.*)
10+
(docs/api/.*)|\
11+
(core/compute.hpp)|\
12+
(defaults.cfg)
1113
"
1214

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

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

35-
- repo: https://github.com/pycqa/isort
36-
rev: 5.10.1
37+
- repo: https://github.com/astral-sh/ruff-pre-commit
38+
# Ruff version.
39+
rev: v0.6.4
3740
hooks:
38-
- id: isort
39-
name: isort (python)
40-
41-
- repo: https://github.com/pre-commit/mirrors-yapf
42-
rev: v0.32.0
43-
hooks:
44-
- id: yapf
45-
files: "^cmtj"
46-
args: [--in-place, --recursive]
41+
# Run the linter.
42+
- id: ruff
43+
files: ^cmtj
44+
args: ["--fix"]
45+
types_or: [python, pyi]
46+
# Run the formatter.
47+
- id: ruff-format
48+
files: ^cmtj
49+
types_or: [python, pyi]
4750

4851
- repo: https://github.com/pocc/pre-commit-hooks
4952
rev: v1.3.5
5053
hooks:
5154
- id: cppcheck
52-
# - id: clang-format
53-
# - id: oclint
54-
# - id: uncrustify
55-
- id: include-what-you-use
55+
args: ["--check-level=exhaustive"]
56+
files: ^(cmtj|core)/.*\.(cpp|hpp)$
57+
exclude: ^third_party/ | ^core/compute.hpp
58+
- id: clang-format
59+
args: [-i]
60+
files: ^(cmtj|core)/.*\.(cpp|hpp)$
61+
exclude: ^third_party/ | ^core/compute.hpp
62+
- id: clang-tidy
63+
args: [-checks=*]
64+
files: ^(cmtj|core)/.*\.(cpp|hpp)$
65+
exclude: ^third_party/ | ^core/compute.hpp

CHANGELOG.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
# Changelog
22

3-
# 1.5.0 (WIP)
3+
# 1.6.0
4+
5+
- Extended the `Stack` models allowing for non-symmetric coupling between devices.
6+
`Stack` current drivers can now be of any type and are adequately scaled.
7+
- Custom definition of the `ScalarDriver` is now possible and documented.
8+
- Fixed a bug in the `Stack` class which inverted the connection order of in-series connections.
9+
- Exposed IDMI interaction to Layer and Junction classes.
10+
- Added `getLayer` method to the `Junction` class and `getJunction` method to the `Stack` class that return a reference to the object.
11+
- 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).
12+
13+
# 1.5.0-1.5.4
414

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

1223
# 1.4.1
1324

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

4657
## 1.2.0
4758

48-
- 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.
59+
- 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.
4960
- 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.
5061
- Stack class now supports arbitrary layer ids to be coupled.
5162
- Extended the plotting capabilities of the Stack class. Now supports plotting of the magnetic field and the current density.

README.md

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- [CMTJ](#cmtj)
1515
- [Table of contents](#table-of-contents)
1616
- [Short description](#short-description)
17+
- [What can you simulate?](#what-can-you-simulate)
1718
- [Web GUI](#web-gui)
1819
- [Quickstart](#quickstart)
1920
- [Installation :rocket:](#installation-rocket)
@@ -34,6 +35,37 @@ The `cmtj` name may be misleading -- the MTJ (Magnetic Tunnel Junctions) are not
3435
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.
3536
It is also possible to connect devices in parallel or in series to have electrically coupled arrays.
3637

38+
### What can you simulate?
39+
40+
Below is a brief list of examples (it's not exhaustive! Check the docs for more).
41+
42+
**Magnetic devices:**
43+
44+
- Magnetic Tunnel Junctions
45+
- Voltage-Driven Magnetic Tunnel Junctions
46+
- Spin-Torque Oscillators
47+
- VCMA sensors and devices
48+
- Magnetic Tunnel Junction Arrays
49+
- SOT devices
50+
- Current-Driven SOT
51+
- Advanced device coupling
52+
- Reservoirs (dipole coupling)
53+
- Electrically coupled MTJs
54+
- Base equations
55+
- Landau-Lifshitz-Gilbert-Slonczewski equation
56+
- Stochastic Landau-Lifshitz-Gilbert-Slonczewski equation
57+
- Landau-Lifshitz-Gilbert-Bloch equation
58+
- Domain wall motion
59+
60+
**Experimental methods:**
61+
62+
Some of the experimental methods available:
63+
64+
- PIMM
65+
- Spin-Diode
66+
- CIMS
67+
- R(H), M(H)
68+
3769
## Web GUI
3870

3971
Check out the [streamlit hosted demo here](https://cmtj-app.streamlit.app/spectrum).
@@ -151,13 +183,16 @@ pre-commit run -a (or --files core/* cmtj/*)
151183

152184
## Documentation builds
153185

154-
There are couple of stages to building the documentation
186+
**Note**
187+
For stub generation add `__init__.py` to the `cmtj` directory.
188+
189+
There are a couple of stages to building the documentation
155190

156191
1. Build Doxygen documentation
157192
```
158193
doxygen Doxyfile
159194
```
160-
This is mostly for the C++ documentation. Furture changes may couple C++ and Python docs.
195+
This is mostly for the C++ documentation. Future changes may couple C++ and Python docs.
161196
2. Build stubs
162197
The stubgen is `pybind11-stubgen` or `mypy stubgen` with the latter being preferred now.
163198
Before running the stubgen, make sure to install the package with:
@@ -175,8 +210,7 @@ There are couple of stages to building the documentation
175210
```
176211
More info here: https://mypy.readthedocs.io/en/stable/stubgen.html.
177212
3. Parse stubs to Markdown.
178-
This stage is done by running:
179-
`python3 docs/docgen.py `
213+
This stage is done by running: `python3 docs/docgen.py `
180214
The deployment of the documentation is done via:
181215
```bash
182216
mkdocs gh-deploy

0 commit comments

Comments
 (0)