@@ -148,7 +148,8 @@ def __init__(self):
148148 nx = 20 , ny = 20 , nz = layers ,
149149 x0 = 0 , y0 = 0 , z0 = 0 ,
150150 unit_length = 1e-9 )
151- self .sim = fidimag .micro .Sim (self .mesh )
151+ self .microSim = fidimag .micro .Sim (self .mesh )
152+ self .atomSim = fidimag .atomistic .Sim (self .mesh )
152153
153154 # Absolute tolerance used for comparisons.
154155 self .aTol = 5e-2
@@ -169,22 +170,41 @@ def test_skyrmion_number_monolayer():
169170
170171 testCase = Case ()
171172
172- print ("Case: skyrmion in one layer only." )
173- testCase .sim .set_m (skyrmion_centre_z (testCase .mesh ))
173+ # Micromagnetic simulation
174+ print ("Case: skyrmion in one layer only (micromagnetics)." )
175+ testCase .microSim .set_m (skyrmion_centre_z (testCase .mesh ))
174176
175- clibSk = testCase .sim .skyrmion_number ()
177+ clibSk = testCase .microSim .skyrmion_number ()
176178 print ("CLib calculates the skyrmion number as: {:1.2f}." .format (clibSk ))
177179
178- centreSk = testCase .sim .skyrmion_number_centre ()
180+ centreSk = testCase .microSim .skyrmion_number_centre ()
179181 print ("I calculate the skyrmion number at the centre as: {:1.2f}."
180182 .format (centreSk ))
181183
182- leeSk = testCase .sim .skyrmion_number_lee ()
184+ leeSk = testCase .microSim .skyrmion_number_lee ()
183185 print ("I calculate the 3D skyrmion number as: {:1.2f}." .format (leeSk ))
184186
185187 assert abs (clibSk - 0 ) < testCase .aTol
186- assert abs (centreSk - 1. ) < testCase .aTol
187- assert abs (leeSk - 1 / float (testCase .sim .mesh .nz )) < testCase .aTol
188+ assert abs (centreSk - 1 ) < testCase .aTol
189+ assert abs (leeSk - 1 / float (testCase .microSim .mesh .nz )) < testCase .aTol
190+
191+ # Atomistic simulation
192+ print ("Case: skyrmion in one layer only (atomistic)." )
193+ testCase .atomSim .set_m (skyrmion_centre_z (testCase .mesh ))
194+
195+ clibSk = testCase .atomSim .skyrmion_number ()
196+ print ("CLib calculates the skyrmion number as: {:1.2f}." .format (clibSk ))
197+
198+ centreSk = testCase .atomSim .skyrmion_number_centre ()
199+ print ("I calculate the skyrmion number at the centre as: {:1.2f}."
200+ .format (centreSk ))
201+
202+ leeSk = testCase .atomSim .skyrmion_number_lee ()
203+ print ("I calculate the 3D skyrmion number as: {:1.2f}." .format (leeSk ))
204+
205+ assert abs (clibSk - 0 ) < testCase .aTol
206+ assert abs (centreSk - 1 ) < testCase .aTol
207+ assert abs (leeSk - 1 / float (testCase .atomSim .mesh .nz )) < testCase .aTol
188208
189209
190210def test_skyrmion_number_multilayer ():
@@ -202,22 +222,41 @@ def test_skyrmion_number_multilayer():
202222
203223 testCase = Case ()
204224
205- print ("Case: skyrmion consistent across layers (skyrmion trouser leg)" )
206- testCase .sim .set_m (skyrmion_trouser_leg (testCase .mesh ))
225+ # Micromagnetic simulation
226+ print ("Case: skyrmion consistent across layers (micromagnetics)." )
227+ testCase .microSim .set_m (skyrmion_trouser_leg (testCase .mesh ))
228+
229+ clibSk = testCase .microSim .skyrmion_number ()
230+ print ("CLib calculates the skyrmion number as: {:1.2f}." .format (clibSk ))
231+
232+ centreSk = testCase .microSim .skyrmion_number_centre ()
233+ print ("I calculate the skyrmion number at the centre as: {:1.2f}."
234+ .format (centreSk ))
235+
236+ leeSk = testCase .microSim .skyrmion_number_lee ()
237+ print ("I calculate the 3D skyrmion number as: {:1.2f}." .format (leeSk ))
238+
239+ assert abs (clibSk - 1 ) < testCase .aTol
240+ assert abs (centreSk - 1 ) < testCase .aTol
241+ assert abs (leeSk - 1 ) < testCase .aTol
242+
243+ # Atomistic simulation
244+ print ("Case: skyrmion consistent across layers (atomistic)." )
245+ testCase .atomSim .set_m (skyrmion_trouser_leg (testCase .mesh ))
207246
208- clibSk = testCase .sim .skyrmion_number ()
247+ clibSk = testCase .atomSim .skyrmion_number ()
209248 print ("CLib calculates the skyrmion number as: {:1.2f}." .format (clibSk ))
210249
211- centreSk = testCase .sim .skyrmion_number_centre ()
250+ centreSk = testCase .atomSim .skyrmion_number_centre ()
212251 print ("I calculate the skyrmion number at the centre as: {:1.2f}."
213252 .format (centreSk ))
214253
215- leeSk = testCase .sim .skyrmion_number_lee ()
254+ leeSk = testCase .atomSim .skyrmion_number_lee ()
216255 print ("I calculate the 3D skyrmion number as: {:1.2f}." .format (leeSk ))
217256
218- assert abs (clibSk - 1. ) < testCase .aTol
219- assert abs (centreSk - 1. ) < testCase .aTol
220- assert abs (leeSk - 1. ) < testCase .aTol
257+ assert abs (clibSk - 1 ) < testCase .aTol
258+ assert abs (centreSk - 1 ) < testCase .aTol
259+ assert abs (leeSk - 1 ) < testCase .aTol
221260
222261
223262# Run tests if this script was executed.
0 commit comments