Skip to content

Commit cdef1ac

Browse files
authored
Fix atomistic demag scaling bug
1 parent a57e654 commit cdef1ac

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

fidimag/atomistic/demag.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ def __init__(self, calc_every=0, name='Demag'):
4141

4242
def setup(self, mesh, spin, mu_s, mu_s_inv):
4343
super(Demag, self).setup(mesh, spin, mu_s, mu_s_inv)
44-
self.scale = 1e-7 / mesh.unit_length**3
45-
# could be wrong, needs carefully tests!!!
46-
# David Tue 19 Jun 2018: This variable is updated in the SIM class in
47-
# case mu_s changes
44+
45+
# Ryan Pepper 04/04/2019
46+
# We *do not* need to scale by mesh.unit_length**3 here!
47+
# This is because in the base energy class, dx, dy and dz
48+
# are scaled.
49+
self.scale = 1e-7
4850
self.mu_s_scale = mu_s * self.scale
4951

5052
self.demag = clib.FFTDemag(self.dx, self.dy, self.dz,

0 commit comments

Comments
 (0)