Hi,
In mumax+, the passed configuration can be any function of x, y and z, so we can combine multiple functions in a larger one and return the output of the appropriate basic configuration. For example, in the code below the multiple_skyrmions function will initialize multiple neelskyrmion configuration functions and it will define a new combined function multiple_skyrmions_config. That function accepts (x, y ,z) coordinates and will call the closest skyrmion function based on the x position. It is that configuration function that is ultimately passed to and evaluated by the magnetization variable.
Kind regards,
Ian
```python
from mumaxplus import Antiferromagnet, Grid, World
from mumaxplus.util import neelskyrmion, show_field
# create the world
cellsize = (1e-9, 1e-9, 0.4e-9)
world = World(cellsize)
# create the antiferromagnet
nx, ny, nz = 256, 64, 1
magnet = Antiferromagnet(world, Grid(size=(nx, ny, nz)))
# these are just the first parameters I came up with, use different ones
magnet.afmex_cell = -10e-12
magnet.afmex_nn = -5e-12
magnet.enable_demag = False
for sub in magnet.sublattices:
sub.msat = 580e3
sub.aex = 15e-12
sub.ku1 = 0.8e6
sub.anisU = (0, 0, 1)
sub.alpha = 0.2
sub.dmi_tensor.set_interfacial_dmi(3.2e-3)
def multiple_skyrmions(first_x_pos, y_pos, distance, number, radius, charge, polarization):
# define desired number of skyrmion functions once
config_functions = []
for i in range(number):
x_pos = first_x_pos + i * distance
skyrmion = neelskyrmion((x_pos, y_pos, 0), radius, charge, polarization)
config_functions.append(skyrmion)
# define configuration function that will be evaluated at every cell
def multiple_skyrmions_config(x, y, z):
# find closest skyrmion index
idx = round((x - first_x_pos) / distance)
idx = min(max(0, idx), number - 1) # clip
return config_functions[idx](x, y, z) # return evaluation of appropriate config
# return that function for use
return multiple_skyrmions_config
my_combined_config = multiple_skyrmions(first_x_pos=60e-9, y_pos=32e-9, distance=50e-9, number=4,
radius=5e-9, charge=-1, polarization=1)
# the combined function will be evaluated at every cell
magnet.sub1.magnetization = my_combined_config
magnet.sub2.magnetization = - magnet.sub1.magnetization.eval() # opposite
show_field(magnet.sub1.magnetization)
show_field(magnet.sub2.magnetization)
show_field(magnet.neel_vector)
magnet.minimize()
show_field(magnet.sub1.magnetization)
show_field(magnet.sub2.magnetization)
show_field(magnet.neel_vector)
```