Skip to content

Commit 9f2e78a

Browse files
author
Weiwei Wang
committed
fix the tests
1 parent e07131a commit 9f2e78a

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

fidimag/atomistic/llg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def set_default_options(self, gamma=1, mu_s=1, alpha=0.1):
8686
self.default_c = -1
8787
self._alpha[:] = alpha
8888
self._mu_s[:] = mu_s
89+
self.mu_s_const = mu_s
8990
self.gamma = gamma
9091
self.do_precession = True
9192

fidimag/atomistic/llg_stt.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ def __init__(self, mesh, name='unnamed'):
3030
self.update_j_fun = None
3131

3232
# FIXME: change the u0 to spatial
33-
self.u0 = const.g_e * const.mu_B / (2 * const.c_e)
33+
v = self.mesh.dx* self.mesh.dy * self.mesh.dz * (self.mesh.unit_length**3)
34+
self.u0 = const.g_e * const.mu_B / (2 * const.c_e) * v
3435

3536
def get_jx(self):
3637
return self._jx
@@ -84,6 +85,6 @@ def sundials_rhs(self, t, y, ydot):
8485
self.field_stt,
8586
self.alpha,
8687
self.beta,
87-
self.u0 * self.p / self.Ms_const,
88+
self.u0 * self.p / self.mu_s_const,
8889
self.gamma,
8990
self.n)

fidimag/atomistic/sim.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
KNOWN_DRIVERS = {'llg': LLG,
88
'sllg': SLLG,
9-
'llg_stt': SLLG_STT,
9+
'llg_stt': LLG_STT,
1010
'llg_stt_cpp': LLG_STT_CPP
1111
}
1212

fidimag/micro/llg_stt.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ def __init__(self, mesh, name='unnamed'):
3030
self.update_j_fun = None
3131

3232
# FIXME: change the u0 to spatial
33-
v = self.mesh.dx* self.mesh.dy * self.mesh.dz * (self.mesh.unit_length**3)
34-
self.u0 = const.g_e * const.mu_B / (2 * const.c_e) * v
33+
self.u0 = const.g_e * const.mu_B / (2 * const.c_e)
3534

3635
def get_jx(self):
3736
return self._jx
@@ -85,6 +84,6 @@ def sundials_rhs(self, t, y, ydot):
8584
self.field_stt,
8685
self.alpha,
8786
self.beta,
88-
self.u0 * self.p / self.mu_s_constant,
87+
self.u0 * self.p / self.Ms_const,
8988
self.gamma,
9089
self.n)

tests/test_stt_slonczewski.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def test_dynamic():
99

1010
mesh = CuboidMesh(nx=1, ny=1, nz=1)
1111

12-
sim = Sim(mesh, name='dyn_spin', driver='slonczewski')
12+
sim = Sim(mesh, name='dyn_spin', driver='llg_stt_cpp')
1313
# sim.set_options(rtol=1e-10,atol=1e-14)
1414
sim.gamma = 1.0
1515
sim.mu_s = 1.0

0 commit comments

Comments
 (0)