Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/coupling expansion #73

Merged
merged 49 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
e13ad7d
updating the docs to benefit from stubs
LemurPwned May 16, 2024
425911a
adding a trivial hdmi holder
LemurPwned May 29, 2024
a77233a
hdmi
LemurPwned Jun 5, 2024
dcf5295
initial work on generalising coupled drivers
LemurPwned Jun 10, 2024
308ee35
initial work on generalising coupled drivers
LemurPwned Jun 10, 2024
7ef5c80
initial work on generalising coupled drivers
LemurPwned Jun 10, 2024
24d8c10
initial work on generalising coupled drivers
LemurPwned Jun 10, 2024
16b0d7a
small fixes and tests
LemurPwned Jun 11, 2024
d64be06
exposing the new constructor and documenting the changes
LemurPwned Jun 12, 2024
4e19598
some bugfixes for PR
LemurPwned Jun 15, 2024
3cfbb12
Apply suggestions from code review
LemurPwned Jun 15, 2024
c3dd869
test fix
LemurPwned Jun 15, 2024
07b0acc
documentation update with how to design new drivers
LemurPwned Jul 22, 2024
01d27c7
fixing the order in stack simulation
LemurPwned Jul 28, 2024
c6874d6
adding idmi
LemurPwned Sep 7, 2024
aeb8688
get junction now correctly returns a reference instead of a copy
LemurPwned Sep 8, 2024
0a4cb19
IDMI now renormalised like IEC
LemurPwned Sep 8, 2024
db75eaa
return a layer reference
LemurPwned Sep 8, 2024
dd8e1db
return a layer reference
LemurPwned Sep 8, 2024
3da8527
return a layer reference
LemurPwned Sep 8, 2024
97bcf4d
trying out new cpp config
LemurPwned Sep 8, 2024
699e276
ruff transition
LemurPwned Sep 8, 2024
01d43d8
fixing typing
LemurPwned Sep 8, 2024
0b793c1
Update CHANGELOG.md
LemurPwned Sep 8, 2024
6ef4989
reworking IDMI macro formula
LemurPwned Sep 9, 2024
a86a140
Merge branch 'feat/ruff-transition' of github.com:LemurPwned/cmtj int…
LemurPwned Sep 9, 2024
672a426
adding ruff spec
LemurPwned Sep 10, 2024
37d6b4b
Update core/junction.hpp
LemurPwned Sep 10, 2024
c30b3a8
Update core/junction.hpp
LemurPwned Sep 10, 2024
c6c0b75
Merge pull request #80 from LemurPwned/feat/ruff-transition
LemurPwned Sep 10, 2024
a7ef4ed
Merge branch 'master' into feat/coupling-expansion
LemurPwned Sep 10, 2024
39a959e
extra grad term
LemurPwned Oct 11, 2024
7e1323d
adding dynamic layer VSD computation based on voltage and oersted field
LemurPwned Oct 13, 2024
157eb5f
updates to the SD computation with efficient caching and inverse comp…
LemurPwned Oct 21, 2024
7e0090e
unifying energy and notation for dynamic layer models
LemurPwned Oct 23, 2024
ae1d603
unblocking all energy terms for new layer dynamic objects
LemurPwned Nov 3, 2024
837d1e5
Merge pull request #82 from LemurPwned/feat/fmr-dynamic
LemurPwned Nov 3, 2024
99d851c
test update
LemurPwned Nov 3, 2024
aa13c6d
adding group interaction code
LemurPwned Nov 4, 2024
6a35567
linearised resistance added
LemurPwned Nov 5, 2024
bdd579f
readme update and stubs
LemurPwned Nov 11, 2024
f274b36
fixing nomura style dipole tensor
LemurPwned Nov 11, 2024
e13c3d9
small PR fixes
LemurPwned Nov 11, 2024
f2735b8
Merge pull request #85 from LemurPwned/feat/reservoir-interaction
LemurPwned Nov 11, 2024
f952c2f
small PR fixes
LemurPwned Nov 11, 2024
212ad8b
formatting and checking for uniqness of the coordinate vectors
LemurPwned Nov 24, 2024
dfe6816
fixing some of the issues with the out of bounds references
LemurPwned Dec 6, 2024
6774b8b
some basic tests
LemurPwned Dec 6, 2024
51c8bd4
update github workflow
LemurPwned Dec 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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](http://cmtj-simulations.streamlit.app/). You can simulate PIMM spectra and Spin-Diode spectra there. Let us know if you have any issues with the demo.
Expand Down Expand Up @@ -144,13 +176,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 @@ -168,8 +203,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
Loading