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

Generalised zhang li #133

Merged
merged 7 commits into from
Aug 8, 2024
Merged
Changes from 4 commits
Commits
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
15 changes: 13 additions & 2 deletions oommfc/scripts/evolver.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numbers

import discretisedfield as df
import numpy as np

import oommfc as oc
Expand All @@ -22,7 +23,14 @@ def evolver_script(evolver, **kwargs):
evolver.alpha = alphaname
mif += alphamif
if hasattr(evolver, "u"):
umif, uname = oc.scripts.setup_scalar_parameter(evolver.u, "zl_u")
if isinstance(evolver.u, numbers.Real) or (
isinstance(evolver.u, df.Field) and evolver.u.nvdim == 1
):
scalar_u = True
umif, uname = oc.scripts.setup_scalar_parameter(evolver.u, "zl_u")
else:
scalar_u = False
umif, uname = oc.scripts.setup_vector_parameter(evolver.u, "zl_u")
evolver.u = uname
mif += umif

Expand Down Expand Up @@ -97,7 +105,10 @@ def evolver_script(evolver, **kwargs):
elif isinstance(evolver, oc.SpinTEvolver):
# time dependence
mif += "# Zhang-Li evolver\n"
mif += "Specify Anv_SpinTEvolve:evolver {\n"
if scalar_u:
mif += "Specify Anv_SpinTEvolve:evolver {\n"
else:
mif += "Specify Anv_SpinTEvolve_3d:evolver {\n"
elif isinstance(evolver, oc.SpinXferEvolver):
# time dependence
mif += "# Slonczewski evolver\n"
Expand Down
Loading