Skip to content

Commit

Permalink
Add workshop for Spintalks
Browse files Browse the repository at this point in the history
  • Loading branch information
lang-m committed May 27, 2022
0 parents commit e7b859e
Show file tree
Hide file tree
Showing 58 changed files with 103,313 additions and 0 deletions.
11 changes: 11 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Copyright 2020, Marijan Beg and Hans Fangohr

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
PROJECT=workshop
IPYNBPATH=tutorials/*.ipynb
PYTHON?=python3

test-ubermag:
$(PYTHON) -c "import ubermag; ubermag.test()"

test-ipynb:
$(PYTHON) -m pytest -v --nbval-lax $(IPYNBPATH)

test-pycodestyle:
$(PYTHON) -m pycodestyle --filename=*.py .

test-all: test-ubermag test-ipynb test-pycodestyle

travis-build: SHELL:=/bin/bash
travis-build:
docker build -f docker/Dockerfile -t dockertestimage .
docker run -e ci_env -ti -d --name testcontainer dockertestimage
docker exec testcontainer conda run -n ubermag make test-all
docker stop testcontainer
docker rm testcontainer

test-docker:
docker build -f docker/Dockerfile -t dockertestimage .
docker run -ti -d --name testcontainer dockertestimage
docker exec testcontainer find . -name '*.pyc' -delete
docker exec testcontainer conda run -n ubermag make test-all
docker stop testcontainer
docker rm testcontainer
100 changes: 100 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Workshop: Micromagnetics with Ubermag
Marijan Beg<sup>1</sup>, Ryan A. Pepper<sup>1</sup>, and Hans Fangohr<sup>1,2</sup>

<sup>1</sup> *Faculty of Engineering and Physical Sciences, University of Southampton, Southampton SO17 1BJ, United Kingdom*
<sup>2</sup> *European XFEL GmbH, Holzkoppel 4, 22869 Schenefeld, Germany*

| Description | Badge |
| --- | --- |
| Builds | [![Build Status](https://travis-ci.org/ubermag/workshop.svg?branch=master)](https://travis-ci.org/ubermag/workshop) |
| | [![Build status](https://ci.appveyor.com/api/projects/status/frw46id1gk7i5440?svg=true)](https://ci.appveyor.com/project/marijanbeg/workshop) |
| Binder | [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/ubermag/workshop/master?filepath=tutorials%2Findex.ipynb) |
| YouTube | [![Youtube](https://img.shields.io/badge/YouTube-ubermag-red)](https://www.youtube.com/channel/UC7MSqVQSMFV42R1jAYmKGLg) |
| License | [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) |

## About this repository

This repository is a place where all the information and materials related to the workshop will be shared. Apart from that, we are going to communicate here with the participants using `Issues`. This is a public repository and all its content can be seen and downloaded by everybody. Therefore, you do not need a GitHub account to be able to download anything. However, if you want to ask a question or request support, you are going to need a GitHub account, which is free and very easy to create.

## People

The workshop is going to be delivered by:

- [Marijan Beg](https://cmg.soton.ac.uk/people/mb1a15/) - `@marijanbeg`,
- Ryan A. Pepper - `@rpep`,
- [Hans Fangohr](https://fangohr.github.io) - `@fangohr`.

## Workshop information

The current workshop is organised by [Spintalks](https://www.spintalks.org/home) and [IEEE Magnetic Society](http://www.ieeemagnetics.org). It is a free workshop and it is open to all scientists and students working in magnetism and magnetic materials fields. To subscribe, please send an email to [listserv@listserv.unl.edu](listserv@listserv.unl.edu) with `subscribe oommf-tutorial Full Name` in the body of the message (replace "Full Name" by your full name, for example "Jane Doe"). After you send a subscription email, you are going to get a confirmation and then, before each session, you are going to get a Zoom registration request. Please register for each session and you are going to be sent a Zoom session link. In addition to Zoom, the tutorial sessions will be broadcast live at [Twitch](https://www.twitch.tv/onlinespintronics). The recording of each live broadcast will be available on Twitch immediately after each session.

The workshop consists of 3 sessions:

1. Thursday, June 18 2020, 12:00-13:30 (ET) - Introduction to micromagnetics and Ubermag
2. Thursday, June 25 2020, 12:00-13:30 (ET) - Micromagnetic models and drivers in Ubermag
3. Thursday, July 02 2020, 12:00-13:30 (ET) - Data analysis and visualisation

(12:00 in New York = 17:00 in London = 18:00 in Paris/Rome/Berlin = 21:30 in Mumbai = 00:00 Beijing)

In each session, there is going to be a 5-10 minutes break, approximately after the first 45 minutes.

## What to do before the workshop?

1. Subscribe (if you have not done it already) by following the instructions in "Workshop information" section.

2. The workshop will delivered using [Zoom](https://zoom.us). Please install it before the workshop.

3. To follow the tutorials and exercises, you do not need to install anything on your machine or download (clone) this repository. The tutorials and exercises can be run in the cloud and all you need is a web browser (we recommend Google Chrome) and internet connection. Ubermag in the cloud can be accessed using Binder badge in the table above. Please note that Binder is a free shared service and starting it can sometimes take a few minutes, so please be patient.

(4.) If you want to install `ubermag` on your machine, please follow the installation instructions from the [documentation](https://ubermag.readthedocs.io/en/latest/ipynb/installation-testing-update.html) or from one of the [YouTube videos](https://www.youtube.com/playlist?list=PL4PY0wNkaCWzy2kbhkp3NtZJNRvtPddLC) depending on your operating system.

**WARNING:** The most recent update of Safari browser on MacOS sometimes does not deal with Jupyter widgets well and we recommend using [Google Chrome](https://www.google.com/chrome/) for running Ubermag in Jupyter.

## Materials

1. Slides used during the workshop can be found in `slides` directory. We are not going to split the slides into separate files for each session, so all the slides are always going to be in a single PDF file.
*(PDF slides do not have animations in order to make sure the files are of reasonable size and accessible by everybody. If you want the presentation in original Keynote (or exported PowerPoint) format, please raise an issue and we will do our best you get them.)*

2. Tutorials and exercises as Jupyter notebooks are available in `tutorials` directory. Similar to slides, more will be added as we go through the workshop. Those notebooks are the ones you see when you open Binder.

3. In `extras` directory, we share all the other materials, which do not belong to `slides` or `tutorials`.

## How to ask questions?

If you require support, have questions, want to report a bug, want to suggest an improvement, or have any criticism, please feel free to let us know. In order to make sure we stay organised as much as possible, we kindly ask all participants to ask questions in one of the two ways:

1. Raise an issue in this repository at any time during the workshop (18 June 2020 - 03 July 2020). Please be aware that questions and answers in GitHub issues can be seen by everybody, so please be careful not to share any personal information you do not want being public or any confidential research-related information.

2. During live sessions, please send your question to either Ryan A. Pepper or Hans Fangohr as a private message and they will do their best to answer. During live sessions Marijan Beg will go through the questions and answer some of them (if he knows the answer). Unfortunately, due to the limited time of live sessions and potentially large number of questions, there is a chance you do not get an answer. However, if your question is not answered, please raise an issue in this repository.

After the workshop (03 July 2020), we kindly ask all participants not to raise any new issues in this workshop repository, but in the official [ubermag help repository](https://github.com/ubermag/help).

## YouTube

In order to help explain certain topics in more details, for which we do not have enough time during live sessions, we are going to be making video tutorials and uploading them to our [YouTube channel](https://www.youtube.com/channel/UC7MSqVQSMFV42R1jAYmKGLg).

## What happens after the workshop?

After the workshop, this repository is going to be available indefinitely. When we schedule a new workshop, we are going to make a release (a snapshot of the repository as it was at the end of workshop). You can find the it under "releases". This allows you to download a zip-file of all the materials.

All issues (questions and answers) are going to stay in this repository, so you can refer to them at any time.

We ask all participants to keep asking questions in our dedicated [support repository](https://github.com/ubermag/help).

## Survey

We ask all participants to complete our online survey (coming soon).

## License

Licensed under the BSD 3-Clause "New" or "Revised" License. For details, please refer to the [LICENSE](LICENSE) file.

## Acknowledgements

- [OpenDreamKit](http://opendreamkit.org/) – Horizon 2020 European Research Infrastructure project (676541)

- EPSRC Programme grant on [Skyrmionics](http://www.skyrmions.ac.uk) (EP/N032128/1).

- [IEEE Magnetic Society](http://www.ieeemagnetics.org)

- We thank [Xin Fan](https://sites.google.com/view/xinfan/people) and [Kiril Belashchenko](http://physics.unl.edu/belashchenko/) for giving us an opportunity to deliver this workshop all the hard work organising it.
21 changes: 21 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
environment:
matrix:
- PYTHON_VERSION: 3.7
MINICONDA: C:\Miniconda3-x64

platform:
- x64

build: off

install:
- "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%"
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- "conda create -q -n test-environment python=%PYTHON_VERSION%"
- activate test-environment
- conda install --channel conda-forge ubermag==0.21 nbval pycodestyle

test_script:
- python -c "import ubermag as um; import sys; sys.exit(um.test())"
- python -m pytest --nbval-lax tutorials\
8 changes: 8 additions & 0 deletions binder/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: binder-environment

channels:
- conda-forge

dependencies:
- python==3.8
- ubermag==0.23
167 changes: 167 additions & 0 deletions dev/animations/cubic-anisotropy.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Cubic anisotropy"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Running OOMMF (ExeOOMMFRunner) [2020/06/17 20:39]... (3.6 s)\n",
"Average m: (-0.20117063840593352, 0.10051877331412676, 0.10027314596088388)\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "04cc21556c2b4b1d9e0c1d11cee8f716",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import os\n",
"import k3d\n",
"import random\n",
"import discretisedfield as df\n",
"import micromagneticmodel as mm\n",
"import micromagneticdata as md\n",
"import oommfc as oc\n",
"\n",
"p1 = (-15e-9, 0, 0)\n",
"p2 = (15e-9, 1e-9, 1e-9)\n",
"n = (10, 1, 1)\n",
"\n",
"region = df.Region(p1=p1, p2=p2)\n",
"mesh = df.Mesh(region, n=n)\n",
"\n",
"Ms = 1e6\n",
"u1 = (1, 0, 0)\n",
"u2 = (0, 1, 0)\n",
"K = 7e5\n",
"\n",
"random.seed(3)\n",
"def value_random(point):\n",
" m = [random.random()*2 - 1 for i in range(3)]\n",
" return m\n",
"\n",
"system = mm.System(name='cubic_anisotropy')\n",
"system.energy = mm.CubicAnisotropy(K=K, u1=u1, u2=u2)\n",
"system.dynamics = mm.Damping(alpha=0.5) # No precession to make animations faster\n",
"system.m = df.Field(mesh, dim=3, value=value_random, norm=Ms)\n",
"\n",
"try:\n",
" oc.delete(system)\n",
"except FileNotFoundError:\n",
" pass\n",
"\n",
"td = oc.TimeDriver()\n",
"td.drive(system, t=70e-12, n=250) # The aim is to have 10s videos n=10*25=250\n",
"\n",
"print(f'Average m: {system.m.orientation.average}')\n",
"\n",
"system.m.k3d_vector()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "428a5e72644144f497af6c299d32068e",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(BoundedIntText(value=0, description='drive', max=1), IntSlider(value=0, continuous_updat…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2f0762b084604cd381325f63b2b25794",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"data = md.Data(name=system.name)\n",
"\n",
"plot = k3d.plot()\n",
"\n",
"@df.interact(drive_number=data.selector(),\n",
" timestep=data.drive(0).slider(continuous_update=False))\n",
"def my_plot(drive_number, timestep):\n",
" data.drive(drive_number).step(timestep).orientation.k3d_vector(plot=plot, interactive_field=system.m, head_size=2)\n",
"\n",
"plot.display()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"data.drive(0).ovf2vtk()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading

0 comments on commit e7b859e

Please sign in to comment.