forked from tsdev/spinw
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add despatch workflow to publish to pypi * Add release scripts and CI files * Fix typo in publish_pypi.yml
- Loading branch information
Showing
10 changed files
with
366 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Publish to PyPI | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
pypi-publish: | ||
name: upload release to PyPI | ||
runs-on: ubuntu-latest | ||
permissions: | ||
# IMPORTANT: this permission is mandatory for trusted publishing | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Download wheels | ||
run: | | ||
python3 -m pip install twine requests | ||
python3 release.py --pypi --token=${{ secrets.GH_TOKEN }} | ||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
packages-dir: twine_wheelhouse | ||
verbose: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Release SpinW | ||
|
||
on: | ||
pull_request: | ||
branches: [master] | ||
types: [closed] | ||
|
||
jobs: | ||
create_release: | ||
name: Creates a SpinW release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- if: | | ||
contains(github.event.pull_request.title, 'RELEASE') && | ||
github.event.pull_request.merged | ||
shell: bash -l {0} | ||
run: | | ||
pip3 install requests | ||
python3 release.py --notest --github --create_tag --token=${{ secrets.GH_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# [v3.2.0](https://github.com/pace-neutrons/libpymcr/compare/0.0.1...v3.2.0) | ||
|
||
## Initial public beta of PySpinW | ||
|
||
This is an initial public beta version of PySpinW released on PyPI. | ||
|
||
Please install using: | ||
|
||
```bash | ||
pip install spinw | ||
``` | ||
|
||
This will install a module called `pyspinw` (note the `py` at the start). | ||
|
||
You can then run SpinW with: | ||
|
||
```python | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
from pyspinw import Matlab | ||
m = Matlab() | ||
swobj = m.spinw() | ||
swobj.genlattice('lat_const', [3, 3, 6], 'angled', [90, 90, 120], 'sym', 'P 1'); | ||
swobj.addatom('r', [0, 0, 0], 'S', 1/2, 'label', 'MCu2') | ||
swobj.gencoupling('maxDistance', 5) | ||
swobj.addmatrix('label', 'J1', 'value', 1.00, 'color', 'g') | ||
swobj.addcoupling('mat', 'J1', 'bond', 1) | ||
swobj.genmagstr('mode', 'helical', 'k', [-1/3, -1/3, 0], 'n',[0, 0, 1], 'unit', 'lu', 'S', [[1], [0], [0]]) | ||
spec = swobj.spinwave([[-1/2, 0, 0], [0, 0, 0], [1/2, 1/2, 0], 100], 'hermit', False) | ||
spec = m.sw_egrid(spec, 'component', 'Sxx+Syy', 'imagChk', False, 'Evect', np.linspace(0, 3, 100)) | ||
ax = plt.imshow(np.real(np.flipud(spec['swConv'])), aspect='auto', vmax=1) | ||
plt.show() | ||
``` | ||
|
||
On Windows and Linux systems, as long as you're running PySpinW locally, Matlab plotting commands like `m.plot(swobj)` will work. This is not the case on MacOS (a known bug) and on remote systems (e.g. via JupyterHub). | ||
|
||
|
||
# [v0.0.1](https://github.com/spinw/spinw/compare/v3.1.2...0.0.1) | ||
|
||
## pySpinW | ||
|
||
This is an initial release of pySpinW as a `pip` installable wheel for python >= 3.8 and MATLAB >= R2021a | ||
|
||
### Installation | ||
|
||
Please install with | ||
|
||
```bash | ||
pip install pyspinw*.whl | ||
``` | ||
|
||
This package can now be used in python if you have a version of MATLAB or MCR available on the machine. | ||
The package will try to automatically detect your installation, however if it is in a non-standard location, the path and version will have to be specified. | ||
|
||
```python | ||
from pyspinw import Matlab | ||
m = Matlab(matlab_version='R2023a', matlab_path='/usr/local/MATLAB/R2023a/') | ||
``` | ||
|
||
### Example | ||
|
||
An example would be: | ||
|
||
```python | ||
import numpy as np | ||
from pyspinw import Matlab | ||
|
||
m = Matlab() | ||
|
||
# Create a spinw model, in this case a triangular antiferromagnet | ||
s = m.sw_model('triAF', 1) | ||
|
||
# Specify the start and end points of the q grid and the number of points | ||
q_start = [0, 0, 0] | ||
q_end = [1, 1, 0] | ||
pts = 501 | ||
|
||
# Calculate the spin wave spectrum | ||
spec = m.spinwave(s, [q_start, q_end, pts]) | ||
``` | ||
|
||
### Known limitations | ||
|
||
At the moment graphics will not work on macOS systems and is disabled. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
cff-version: "1.1.0" | ||
message: "If you have used SpinW in your research, please cite it as below" | ||
abstract: "SpinW is a library for spin wave calculations" | ||
authors: | ||
- family-names: "Tóth" | ||
given-names: "Sándor" | ||
orcid: "https://orcid.org/0000-0002-7174-9399" | ||
- family-names: "Ward" | ||
given-names: "Simon" | ||
orcid: "https://orcid.org/0000-0001-7127-5763" | ||
- family-names: "Le" | ||
given-names: "Manh Duc" | ||
orcid: "https://orcid.org/0000-0003-3012-6053" | ||
- family-names: "Fair" | ||
given-names: "Rebecca L." | ||
orcid: "https://orcid.org/0000-0002-0926-2942" | ||
- family-names: "Waite" | ||
given-names: "Richard" | ||
title: "libpymcr" | ||
version: "3.2.0" | ||
date-released: "2023-06-12" | ||
license: "GPL-3.0-only" | ||
repository: "https://github.com/spinw/spinw" | ||
url: "https://www.spinw.org" | ||
keywords: | ||
- "Python" | ||
- "Matlab" | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.