Skip to content

Commit

Permalink
Merge branch 'master' into improved-zhang-li-support
Browse files Browse the repository at this point in the history
  • Loading branch information
lang-m committed Jul 14, 2024
2 parents 5a51064 + 545fd95 commit 8c4fba8
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
- conda-forge

dependencies:
- python==3.8
- python=PYTHON_VERSION
- pip
- oommf
- pip:
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/workflow-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ jobs:
defaults:
run:
shell: bash -i {0}
strategy:
matrix:
python-version: ["3.8", "3.10"]

steps:
- name: Initialisation
Expand All @@ -73,6 +76,10 @@ jobs:
pwd
echo $PATH
which conda
- name: Prepare env file
run: sed -i "s/PYTHON_VERSION/${{ matrix.python-version }}/g" .github/environment.yml

- name: Create conda env
run: conda env create -f ".github/environment.yml"

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,4 @@ Licensed under the BSD 3-Clause "New" or "Revised" License. For details, please
- [OpenDreamKit](http://opendreamkit.org/) – Horizon 2020 European Research Infrastructure project (676541)

- EPSRC Programme Grant on [Skyrmionics](http://www.skyrmions.ac.uk) (EP/N032128/1)
-
4 changes: 4 additions & 0 deletions mumax3c/scripts/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def driver_script(driver, system, compute=None, ovf_format="bin4", **kwargs):
mx3 = "tableadd(E_total)\n"
mx3 += "tableadd(dt)\n"
mx3 += "tableadd(maxtorque)\n"

if isinstance(driver, mc.MinDriver):
for attr, value in driver:
if attr != "evolver":
Expand All @@ -34,6 +35,9 @@ def driver_script(driver, system, compute=None, ovf_format="bin4", **kwargs):
mx3 += "tablesave()\n\n"

if isinstance(driver, mc.TimeDriver):
# Need temperature only here
if system.T > 0:
mx3 += f"Temp = {system.T}\n"
# Extract dynamics equation parameters.
gamma0 = (
precession[0].gamma0
Expand Down
31 changes: 31 additions & 0 deletions mumax3c/tests/test_micromagnetictests.py
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@
import discretisedfield as df
import micromagneticmodel as mm
import numpy as np
from micromagnetictests.calculatortests import * # noqa: F401,F403

import mumax3c as mc


def test_temperature():
p1 = (0, 0, 0)
p2 = (5e-9, 5e-9, 5e-9)
n = (2, 2, 2)
Ms = 1e6
A = 1e-13
region = df.Region(p1=p1, p2=p2)
mesh = df.Mesh(region=region, n=n)

system = mm.System(name="mumax3_temperature")
system.energy = mm.Exchange(A=A)
system.dynamics = mm.Precession(gamma0=mm.consts.gamma0) + mm.Damping(alpha=1)
system.m = df.Field(mesh, nvdim=3, value=(0, 0.1, 1), norm=Ms)
system.T = 1000 # Set a high temperature so it is almost random
assert f"Temp = {system.T}" in mc.scripts.driver_script(
mc.TimeDriver(), system, compute=None, t=1, n=1
)

td = mc.TimeDriver()
td.drive(system, t=0.2e-9, n=1)

# If random then there should be no overall direction
assert np.linalg.norm(system.m.orientation.mean()) < 0.5
mc.delete(system)

0 comments on commit 8c4fba8

Please sign in to comment.