Skip to content

Commit db3ccbd

Browse files
author
davidcorteso
committed
Moved micromag DMI type check to initialisation of DMI class
1 parent df00e45 commit db3ccbd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

fidimag/micro/dmi.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ def __init__(self, D, name='DMI', dmi_type='bulk'):
9090
self.n_dmi_ngbs = 4
9191
elif self.dmi_type == 'D_2d':
9292
self.n_dmi_ngbs = 4
93+
else:
94+
raise Exception(
95+
"Unsupported DMI type: {}, " +
96+
"available options: ".format(self.dmi_type) +
97+
"'bulk', 'interfacial', 'D_2d'."
98+
)
9399

94100
def setup(self, mesh, spin, Ms):
95101
super(DMI, self).setup(mesh, spin, Ms)
@@ -143,12 +149,6 @@ def compute_field(self, t=0, spin=None):
143149
0, 0, 0, # -z
144150
0, 0, 0 # +z
145151
])
146-
else:
147-
raise Exception(
148-
"Unsupported DMI type: {}, " +
149-
"available options: ".format(self.dmi_type) +
150-
"'bulk', 'interfacial', 'D_2d'."
151-
)
152152

153153
micro_clib.compute_dmi_field(m,
154154
self.field,

0 commit comments

Comments
 (0)