How to initialize multiple skyrmions in a geometry using mumax+ Python API?

26 views
Skip to first unread message

sateesh kandukuri

unread,
Aug 22, 2025, 4:02:21 AMAug 22
to mumax2

Hello everyone,

I am working on mumax+ for ferrimagnetic devices and want to initialize more than one Néel skyrmion in my simulation. Currently, using the Python API, each call to magnet.sub1.magnetization = neelskyrmion(…) seems to overwrite the previous configuration, so only the last skyrmion appears.

Is there a recommended way to combine skyrmion texture functions (e.g., evaluate both on the grid and merge their magnetization arrays before assignment), so that two or more skyrmions are present before running energy minimization? A short working code snippet for this would be very helpful!

Thanks in advance for your support.

Best regards,

Sateesh

Ian Lateur

unread,
Aug 22, 2025, 5:18:28 AMAug 22
to mum...@googlegroups.com
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)
```


Op vr 22 aug 2025 om 10:02 schreef sateesh kandukuri <sateesh...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "mumax2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mumax2+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mumax2/98ee09ad-b265-46c6-8ff5-39fe5e0e8d65n%40googlegroups.com.

sateesh kandukuri

unread,
Aug 22, 2025, 7:10:54 AMAug 22
to mumax2
Dear Ian, 
Thank you very much for your prompt reply and for providing the code. It is working perfectly.

Best regards,
Sateesh
Reply all
Reply to author
Forward
0 new messages