Introduction

Micromagnetic calculations have been an indispensable tool for the development of the field of modern magnetism. Especially the availability of open-source1,2,3,4,5,6,7,8,9,10,11,12 and GPU-accelerated software packages5,8,9,10,12,13,14,15,16,17 boosted research by enabling efficient numerical studies of nano- and micrometer-sized magnetic systems, complementary to experimental investigations. More recently, research efforts have shifted to more complex magnetic systems such as antiferromagnets18 and 2D magnetic heterostructures (Van der Waals systems)19. Different ways of manipulating the magnetization are being explored as well, e.g., by applying strain20 or electric fields21.

In order to model these materials, software tools must go beyond the standard micromagnetic theory of ferromagnets; preferably, they should be easily extensible to include other physical phenomena of interest. With this in mind, we designed mumax+, a versatile GPU-accelerated simulation package. It calculates the space- and time-evolution of nano- to microscale magnets using a finite difference scheme. The software has been designed from scratch, independently of mumax3 5 and features a Python-based22 user interface. This allows users to directly use common packages such as NumPy23, SciPy24 and Matplotlib25 to process and view their data directly. The Python module wraps the main part of the code, which is written in C++26 and CUDA27. The latter allows calculations to be performed in parallel on a GPU, reducing simulation time compared to CPU-based codes.

The extensible framework of mumax+ stands in stark contrast to the design of mumax3. This extensibility provides a plethora of new possibilities, many of which have been brought together in the implementation of (non-collinear) antiferromagnets with full support for magnetoelastic interactions. Therefore, in this paper, we will present the design and application of these two features, emphasizing their practical importance for the current research field of magnetism.

We provide a brief description of the design of the software package along with an overview of the implemented physics. Next, we examine the domain wall motion in a polycrystalline antiferromagnet under the influence of an applied current. Furthermore, we show the working principle of a strain-driven magnetic racetrack in NiO and, lastly, reproduce nitrogen-vacancy magnetometry images of the non-collinear antiferromagnet \({{\rm{Mn}}}_{3}{\rm{Sn}}\).

The development of mumax+ is motivated by the “plus” mindset, i.e., versatility and extensibility, combined with user-friendliness, in favor of performance and speed. Our intention is not to replace mumax3, but rather to offer a platform where additional functionalities can easily be developed and used.

All capabilities of the code have been tested with the μMAG micromagnetic standard problems28, mumax3 5 and analytical results. These tests will not be repeated here, but can be found freely in the test folder in the GitHub repository (https://github.com/mumax/plus), along with the complete open-source code under the GPLv3 license. The repository also contains the Python input scripts to generate the figures from this paper. These can be found under the paper2025 tag. Details about dependencies and installation instructions can also be found in the repository. These, along with some examples and tutorial scripts, can also be found on the website (https://mumax.github.io/plus/). Here we outline the physics included in mumax+ with an emphasis on the differences compared to mumax3. A more detailed description of the different functionalities and features can be found in the API on the website.

Results

Micromagnetism

For each ferromagnet defined in the simulation world, mumax+ solves the dynamic equation

$$\frac{\partial {\bf{m}}}{\partial t}={\boldsymbol{\tau }}\,,$$
(1)

where m is the magnetization normalized with respect to the saturation magnetization MS and τ is the sum of the Landau-Lifshitz-Gilbert (LLG) torque29 and any additional spin-transfer torques as formulated by Zhang and Li30 or Slonczewski31, which are implemented in the same way as in mumax3 5. The LLG torque is given by

$${{\boldsymbol{\tau }}}_{{\rm{LLG}}}=-\frac{\gamma }{1+{\alpha }^{2}}\left[\,{\bf{m}}\times {{\bf{B}}}_{{\rm{eff}}}+\alpha \left({\bf{m}}\times \left({\bf{m}}\times {{\bf{B}}}_{{\rm{eff}}}\right)\right)\,\right]\,,$$
(2)

with γ the gyromagnetic ratio and α the dimensionless Gilbert damping constant29,32. The different field terms which play a role and add up to the effective field Beff are calculated based on the current magnetization state mm(r, t). These fields include an external field, the uniaxial or cubic anisotropy field, the exchange field, a demagnetizing field, stray fields from other magnets, the field induced by the Dzyaloshinskii-Moriya interaction (DMI), a thermal field and the magnetoelastic field. Of these, the external field, anisotropy fields and thermal field for ferromagnets33 are implemented in the same way as in mumax3. Their details will not be repeated here, and we refer the interested reader to their thorough description in Ref. 5.

A micromagnetic theory of ferromagnets assumes that the magnetization field can be described by a mesoscopic continuous function of space and time34, essentially coarse-graining the atomistic structure of a magnetic material. Each simulation cell in that sense contains one macrospin which is the result of the averaging of spins within multiple crystal unit cells. This continuum picture is only valid under the so-called small-angle approximation when considering the exchange interaction between neighboring cells5,35. When extending this formalism to antiferromagnets, we consider two sublattices, meaning each simulation cell contains two macrospins instead of only one15,36,37 and the LLG equation (1) is solved for each one simultaneously. These are exchange-coupled to each other and to each of the neighboring spins. Here, the same small-angle approximation remains satisfied when considering spins from the same sublattice. Additionally, neighboring spins which are antiferromagnetically coupled (i.e., from different sublattices) must also adhere to a small-angle approximation in the sense that the deviation from a relative 180 angle must be small.

The remainder of this section highlights features and implementations that differ from those present in mumax3. While our focus is on ferromagnets and collinear antiferromagnets, the underlying formalism naturally generalizes to ferrimagnets and non-collinear antiferromagnets. The former is achieved by considering two different sublattices in an antiferromagnet, while the latter can be simulated by adding a third sublattice with the same interaction terms as the first two.

The exchange field present in an antiferromagnet acting on sublattice s under the influence of the other sublattice \(s^{\prime}\) is described in Refs. 36,37 and is given by

$${{\bf{B}}}_{\,\text{exch}}^{(s)}=\frac{2{A}_{11}^{(s)}}{{M}_{\text{S}\,}^{(s)}}{\nabla }^{2}{{\bf{m}}}^{(s)}+\frac{{A}_{12}}{{M}_{\,\text{S}\,}^{(s)}}{\nabla }^{2}{{\bf{m}}}^{({s}^{{\prime} })}+\frac{4{A}_{0}}{{M}_{\,\text{S}\,}^{(s)}{a}^{2}}{{\bf{m}}}^{({s}^{{\prime} })}\,.$$
(3)

The first term in Eq. (3) accounts for the standard ferromagnetic exchange interaction. This is the only term present when simulating ferromagnetic systems and is implemented as in mumax3 5. The second term contains the inhomogeneous exchange stiffness constant A12 < 0 J/m and describes a similar antiferromagnetic exchange interaction between sublattices. The last term accounts for the homogeneous exchange interaction between antiferromagnetically coupled spins within the same simulation cell. This interaction is described by a homogeneous exchange constant A0 < 0 J/m and a lattice parameter a.

The last term in Eq. (3) must not adhere to the small-angle approximation mentioned above, since it describes the interaction between spins of two different sublattices at the same point in space. The functional form of the first two field terms, however, assumes this approximation5,35,36. A derivation of these nearest-neighbor interaction terms is given in Ref. 36 and provides an exchange length which is a minimal length scale at which spin modulations manifest. The antiferromagnetic exchange interaction term is of the same form as the ferromagnetic one5,36, meaning the exchange length can be calculated analogously. Following this, the exchange length corresponding to the ferromagnetic and antiferromagnetic exchange interactions can be calculated as

$${l}_{\,\text{ex}}^{{\rm{FM}}}=\sqrt{\frac{2{A}_{11}}{{\mu }_{0}{M}_{{\rm{S}}}^{2}}}\quad{\text{and}}\quad{l}_{{\rm{ex}}}^{{\rm{AFM}}}=\sqrt{\frac{| {A}_{{\rm{12}}}| }{{\mu }_{0}{M}_{\text{S}\,}^{2}}}\,,$$
(4)

respectively. Here, μ0 denotes the vacuum permeability. In order to be able to resolve spin modulations in any micromagnetic simulation, the cell size should be chosen to be smaller than the (smallest) exchange length.

In mumax+, the user can set the individual components of the antisymmetric rank-3 tensor Dijk of the Dzyaloshinskii-Moriya interaction (DMI), which encompasses the DMI strengths and chiral properties of the considered lattice. Since the DMI tensor is determined by the crystallographic and magnetic symmetries of the material, each sublattice in an antiferromagnet can have its own crystallographic environment and thus its own DMI tensor. Furthermore, a third DMI tensor is used to describe the intersublattice interaction.

Generally, the energy density due to DMI in an antiferromagnet can be written as38,39

$${\mathcal{E}}=\sum _{s,{s}^{{\prime} }}\sum _{i,j,k}{D}_{ijk}^{(s,{s}^{{\prime} })}{m}_{j}^{(s)}{\partial }_{i}{m}_{k}^{({s}^{{\prime} })}\,,$$
(5)

where \((s,{s}^{{\prime} })\) denote the different sublattices, the indices (i, j, k) indicate spatial components and it is assumed that the intersublattice DMI is symmetric in the sublattices, meaning \({D}_{ijk}^{(s,{s}^{{\prime} })}={D}_{ijk}^{({s}^{{\prime} },s)}\). The ferromagnetic expression is obtained by considering \(s={s}^{{\prime} }\).

The tensorial character of the DMI also comes into play when calculating the Neumann boundary conditions. Given the structure of the exchange field in Eq. (3), the boundary conditions for a sublattice s in an antiferromagnet are given by37,38

$$2{A}_{11}^{(s)}{\partial }_{{\bf{n}}}{{\bf{m}}}^{(s)}={A}_{12}\left({\partial }_{{\bf{n}}}{{\bf{m}}}^{({s}^{{\prime} })}\times {{\bf{m}}}^{(s)}\right)\times {{\bf{m}}}^{(s)}+{\hat{{\bf{D}}}}^{(s)}\cdot \left({\bf{n}}\otimes {{\bf{m}}}^{(s)}\right)\,,$$
(6)

where n is the surface normal and a term proportional to the inhomogeneous exchange constant A12 takes the interaction with the other sublattice into account. This term is not present when considering ferromagnets.

The Neumann boundary conditions as given in Eq. (6) are the default in mumax+. Alternatively, open (∂nm = 0) or periodic boundary conditions can be used. The chosen boundary conditions will not only affect the DMI field calculations, but also the ferromagnetic and antiferromagnetic inhomogeneous exchange calculations. Periodic boundary conditions also affect the calculation of the magnetostatic fields.

Apart from the inhomogeneous interaction described by Eq. (5), mumax+ also considers a homogeneous DMI between spins within the same simulation cell, given by the energy density40,41

$${\mathcal{E}}={\bf{d}}\cdot \left({{\bf{m}}}^{(s)}\times {{\bf{m}}}^{({s}^{{\prime} })}\right)\,,$$
(7)

where s and \({s}^{{\prime} }\) denote two distinct sublattices and d is the DMI vector. The latter lies parallel to the principal axis of the material40.

The random thermal field to include finite temperatures in antiferromagnets is implemented with each sublattice having its own effective field, as if it were an independent ferromagnetic lattice, in the same way it is done in Boris15. To validate this approach, one can consider a thought experiment with two sublattices with uniaxial anisotropy, a positive homogeneous exchange coupling between them and no demagnetizing field. The anisotropy results in two energy minima, with uniform magnetization, separated by an energy barrier. The spins can switch from one minimum to the other under the influence of a thermal field. The analytical expression of this switching rate for the case of ferromagnets is well-known5,42. In the limit of low exchange coupling, each sublattice is expected to have the same switching time as a ferromagnet with the same saturation magnetization MS and uniaxial anisotropy constant Ku1 as either sublattice, since each sublattice acts independently as a single ferromagnetic lattice. In the limit of high coupling, the sublattice moments within a simulation cell must behave collectively, effectively doubling the magnetic moment. This can be compared with a ferromagnet with double the value for MS and double the value for Ku1 to keep the anisotropic energy per moment constant. We simulate an ensemble of spins with uniaxial anisotropy at 400 K for a range of coupling constants using mumax+, the results of which are shown in Fig. 1. In the limit of low exchange coupling, the sublattices behave as a ferromagnet with the same MS and Ku1. In the limit of high coupling, the datapoints coincide with the switching time of a ferromagnet with 2MS and 2Ku1, confirming the validity of this approach. Following the same argument, this thought experiment can be repeated in the case of a non-collinear antiferromagnet. The resulting switching times in Fig. 1 again show excellent agreement with the switching time of the corresponding ferromagnet.

Fig. 1: Datapoints show the simulated switching times of spins in an antiferromagnet (AFM) and a non-collinear antiferromagnet (NCAFM) as a function of the homogeneous exchange coupling constant \(A_0\) between sublattices with a saturation magnetization of \(M_{\text{S}}\) = 400 kA/m and a uniaxial anisotropy constant Ku1=2.5 kJ/m3.
figure 1

The left dashed line shows simulated results of the switching time of a ferromagnet with the same MS and Ku1 as each individual sublattice, while the lower (upper) right line shows results for a ferromagnet with 2MS and 2Ku1 (3MS and 3Ku1). All simulations were performed at 400 K.

Elasticity

Apart from the magnetodynamic equation (1), mumax+ can also solve the second order elastodynamic equation43,44

$$\rho \frac{{\partial }^{2}{\bf{u}}}{\partial {t}^{2}}={{\bf{f}}}_{{\rm{tot}}}$$
(8)

or, equivalently, the two first order differential equations

$$\begin{array}{ll}\displaystyle\dfrac{\partial {\bf{u}}}{\partial t}&={\bf{v}}\,,\\ \displaystyle\dfrac{\partial {\bf{v}}}{\partial t}&=\dfrac{{{\bf{f}}}_{{\rm{tot}}}}{\rho }\,,\end{array}$$
(9)

with u the elastic displacement, v the velocity, ρ the mass density and the total body force density ftot = fd + fext + fmel + fel. The latter contains a damping force fd = − ηv with a phenomenological damping parameter η, an external force fext set by the user, the magnetoelastic body force fmel described in the next section, and the elastic body force \({{\bf{f}}}_{{\rm{el}}}=\nabla \cdot \hat{\sigma }\). The second order mechanical stress tensor \(\hat{\sigma }\) is given by Hooke’s law \(\hat{\sigma }=\hat{{\bf{c}}}:\hat{\varepsilon }\), where \(\hat{{\bf{c}}}\) is the fourth order stiffness tensor and \(\hat{\varepsilon }=\frac{1}{2}\left({\mathbf{\nabla }}{\bf{u}}+{\left({\mathbf{\nabla }}{\bf{u}}\right)}^{\top }\right)\) is the symmetric second order strain tensor43,44.

Viscous damping can be added to the stress \(\hat{\sigma }\) via an extra term \({\hat{\sigma }}_{{\rm{d}}}=\hat{\eta }:\partial \hat{\varepsilon }/\partial t\), which is proportional to the strain rate45,46,47. The fourth order viscosity tensor \(\hat{\eta }\) is usually set to be proportional to the stiffness tensor \(\hat{{\bf{c}}}\). This tends to dampen high frequency oscillations48.

Both first order equations (9) are solved simultaneously using one of the available Runge-Kutta methods in Table 1. Each body force is implemented for cubic crystal symmetries and is based on a previous extension of mumax3 49, with the exceptions of the additional viscous stress \({\hat{\sigma }}_{{\rm{d}}}\) and the fact that fel does not utilize second order differences of the elastic displacement. Rather, it is computed as the numeric divergence of the stress \(\hat{\sigma }\), while the strain is calculated with the numeric gradient of the displacement. In this way, traction and traction-free boundary conditions50 are easily implemented. These impose \(\hat{\sigma }\cdot {\bf{n}}={\bf{t}}\) at the boundary, where n is the normal to the boundary and t is the applied traction as force per unit area. Both spatial derivative calculations utilize a fourth order accurate central difference scheme51 in the bulk material. Lower order schemes are used close to and at the boundaries.

Table 1 Runge–Kutta solvers available in mumax+, along with their convergence and error estimate order, the latter of which is used for adaptive time stepping76,77,78,79,80

Magnetoelasticity

Magnetoelasticity for ferromagnets with cubic crystal symmetry is implemented in the same way as described in Ref. 49. The magnetoelastic energy density, given by52,53

$${{\mathcal{E}}}_{{\rm{mel}}}={B}_{1}\sum _{i}{m}_{i}^{2}{\varepsilon }_{ii}+{B}_{2}\sum _{i\ne j}{m}_{i}{m}_{j}{\varepsilon }_{ij}\,,$$
(10)

gives rise to magnetostriction and the Villari effect or inverse magnetostriction54. Here, the summation indices indicate spatial components, B1 and B2 are the magnetoelastic coupling constants and \(\hat{\varepsilon }\) is the strain tensor. In the case of magnetostriction the magnetization affects the elastic displacement by applying a magnetoelastic force given by

$${{\bf{f}}}_{{\rm{mel}}}=2{B}_{1}\left[\begin{array}{c}{m}_{x}{\partial }_{x}{m}_{x}\\ {m}_{y}{\partial }_{y}{m}_{y}\\ {m}_{z}{\partial }_{z}{m}_{z}\end{array}\right]+{B}_{2}\left[\begin{array}{c}{m}_{x}\left({\partial }_{y}{m}_{y}+{\partial }_{z}{m}_{z}\right)+{m}_{y}{\partial }_{y}{m}_{x}+{m}_{z}{\partial }_{z}{m}_{x}\\ {m}_{y}\left({\partial }_{x}{m}_{x}+{\partial }_{z}{m}_{z}\right)+{m}_{x}{\partial }_{x}{m}_{y}+{m}_{z}{\partial }_{z}{m}_{y}\\ {m}_{z}\left({\partial }_{x}{m}_{x}+{\partial }_{y}{m}_{y}\right)+{m}_{x}{\partial }_{x}{m}_{z}+{m}_{y}{\partial }_{y}{m}_{z}\\ \end{array}\right]\,,$$
(11)

while for the Villari effect the elastic strain affects the magnetization by generating an effective field given by

$${{\bf{B}}}_{{\rm{mel}}}=-\frac{2}{{M}_{{\rm{S}}}}\left({B}_{1}\left[\begin{array}{c}{\varepsilon }_{xx}{m}_{x}\\ {\varepsilon }_{yy}{m}_{y}\\ {\varepsilon }_{zz}{m}_{z}\end{array}\right]+{B}_{2}\left[\begin{array}{c}{\varepsilon }_{xy}{m}_{y}+{\varepsilon }_{xz}{m}_{z}\\ {\varepsilon }_{xy}{m}_{x}+{\varepsilon }_{yz}{m}_{z}\\ {\varepsilon }_{xz}{m}_{x}+{\varepsilon }_{yz}{m}_{y}\\ \end{array}\right]\right)\,.$$
(12)

For antiferromagnets, magnetoelasticity is implemented as it is reported in Ref. 55. Both sublattices have a shared elastic displacement, velocity, stiffness, strain and total body force, while each ferromagnetic sublattice s has its own magnetoelastic coupling constants \({B}_{1}^{(s)}\) and \({B}_{2}^{(s)}\), magnetization \({{\bf{m}}}^{(s)}\) and saturation magnetization \({M}_{\,\text{S}\,}^{(s)}\). Each sublattice then creates a magnetoelastic body force \({{\bf{f}}}_{\,\text{mel}\,}^{(s)}\). Conversely, each sublattice magnetization is affected by a unique magnetoelastic field \({{\bf{B}}}_{\,\text{mel}\,}^{(s)}\) created by its own magnetization \({{\bf{m}}}^{(s)}\) and the shared strain.

Demonstration 1: Current-driven domain wall mobility in a polycrystalline antiferromagnetic strip

Understanding the mobility properties of magnetic solitons like domain walls and skyrmions in various materials has been an important field of study for the development of future spintronic devices18,56,57,58. We can use mumax+ to investigate such dynamics in antiferromagnets. To this end, we base our antiferromagnetic system on the one described in Ref. 37 and illustrate how the current-induced motion of a domain wall can be studied in an antiferromagnetic strip with polycrystalline structure. The domain wall is stabilized by interfacial DMI and can be moved by applying a spin-polarized current in the direction of the strip, effectively causing a spin transfer torque as formulated by Slonczewski31. Following mumax3, we are able to define multi-grain geometries inside a material by generating a Voronoi tessellation59. The ferromagnetic and antiferromagnetic exchange constants are then reduced at the different grain boundaries60.

We simulate a strip with a width of 200 nm and a thickness of 10 nm. The strip is discretized into cells of size 2 × 2 × 10 nm3 and we define grains with an average diameter of 10 nm. This simulation setup is illustrated in Fig. 2a and described in more detail in the caption of Fig. 2.

Fig. 2: Simulation of domain wall mobility in a polycrystalline antiferromagnet.
figure 2

The panels show the simulation setup (a) and mobility curves (b). Each sublattice has a uniaxial out-of-plane anisotropy with a strength of 64 kJ/m3, a saturation magnetization of 400 kA/m, interfacial DMI strength of 0.11 mJ/m2 and a damping constant of 0.137. The homogeneous antiferromagnetic exchange constant is set at -50 pJ/m. The top panel in (a) shows the relaxed Néel vector of a polycrystalline antiferromagnetic strip. The domain wall, in which the Néel vector lies along the positive x direction, separates two out-of-plane domains. The ferromagnetic and inhomogeneous antiferromagnetic exchange constants, 10 pJ/m and -10 pJ/m respectively, are reduced by 75 % at the grain boundaries. The bottom panel in (a) shows the different grains inside the material, generated using a Voronoi tessellation59 with an average grain diameter of 10 nm. Panel (b) shows the simulated domain wall velocity in an antiferromagnetic strip under the influence of an applied current density, with each curve corresponding to a different percentage reduction in exchange constants at the grain boundaries. The dashed curve shows the analytical model derived in Ref. 37 for the monocrystalline case.

We monitor the velocity of the domain wall in a time frame of 0.5 ns for different values of the current density and for different reductions of the exchange constants at the various grain boundaries. Results can be found in Fig. 2b. We see a distinct decrease in the slope of the velocity curves for decreasing values of the intergrain exchange along with a stronger domain wall pinning at lower current densities. These results are very similar to those reported in Refs. 59,60, where similar simulations based on permalloy have been performed. The dashed curve in Fig. 2b represents the model derived in Ref. 37 for the ideal case without grains. Our simulation data for a 0% reduction of the exchange constants, effectively disregarding any grain boundaries, agree very well with this model, with the maximal deviation being about 1%.

Demonstration 2: Strain-driven antiferromagnetic racetrack memory

Previous studies have demonstrated the possibility to move domain walls in both ferromagnets and antiferromagnets through the application of surface acoustic waves or strain gradients61,62,63. Building on this concept, we use mumax+ to investigate the controlled movement of domain walls in antiferromagnetic NiO under the influence of strain caused by the application of traction. The simulation consists of 512 × 128 × 1 cubic cells with a side length of 3 nm. The magnet has an easy anisotropy axis along the length axis of the magnet and an interfacial DMI which can be produced by placing NiO in contact with a heavy metal64. This stabilizes two out-of-plane domain walls, separating domains in which the Néel vector lies along the easy axis. Four small notches are introduced from 300 nm onward with 150 nm spacing, which serve as pinning sites for the domain walls. The material parameters used in the simulation can be found in Table 2.

Table 2 The NiO simulation parameters used for the strain-driven domain wall motion discussed in demonstration 2, which apply to both sublattices

Initially, two domain walls are placed on the first and third notch. In order to move both domain walls one notch along the strip, we generate an elastic shear pulse by applying one period of a sinusoidal out-of-plane traction oscillation with a frequency of 8 GHz and an amplitude of 0.3 GPa at a boundary. The resulting dynamics are shown in Fig. 3. The induced strain, approximately 0.14% in amplitude, detaches the domain wall from the first notch via the Villari effect54 and transports it along the length axis of the magnet. The elastic pulse, traveling with a velocity of about 4 km/s, overtakes the domain wall which gets pinned at the second notch. The pulse then detaches the second domain wall which is transported to the final notch in the same manner. This effectively simulates the underlying working principle of a traction-driven magnetic racetrack65. This concept can be extended to various domains with varying sizes in a single antiferromagnetic strip where each domain corresponds to a series of 0 or 1 bits. The domain walls can be shifted one notch at a time by the controlled application of traction pulses.

Fig. 3: An elastic pulse is generated through the application of a traction oscillation at the left edge at \({x}\) = 0 μm, and subsequently propagates through the antiferromagnetic NiO film.
figure 3

This pulse mobilizes the domain walls, which are initially pinned at the notches at 300 nm and 600 nm, as discussed in demonstration 2. The top row shows the out-of-plane elastic displacement, while the bottom row shows the Néel vector of the antiferromagnet. The in-plane domains, oriented in the directions indicated by the arrows, are separated by out-of-plane domain walls, shown in black or white, whose Néel vectors lie into, and out of the plane of the film, respectively. Different snapshots after the introduction of the pulse at t = 0 ns are shown. The domain walls have moved to the second and fourth notches at 450 nm and 750 nm, respectively, after passage of the pulse.

Demonstration 3: Stray field imaging of the non-collinear antiferromagnet \({{\rm{Mn}}}_{3}{\rm{Sn}}\)

The non-collinear antiferromagnet \({{\rm{Mn}}}_{3}{\rm{Sn}}\) is a prototypical material in the research field of antiferromagnetic spintronics66,67,68,69. Owing to the interplay between exchange, DMI and magnetocrystalline anisotropy, it exhibits a small net magnetic moment67,69, which makes direct imaging of magnetic structures more evident than in collinear antiferromagnets70,71,72.

Li et al.71 imaged magnetic domain structures using nitrogen-vacancy (NV) magnetometry measurements of \({{\rm{Mn}}}_{3}{\rm{Sn}}\) films. Here, we demonstrate the simulation of the measured magnetostatic field using mumax+ by considering an antiferromagnet with three exchange-coupled sublattices. We define a square 500 × 500 × 30 nm3 non-collinear antiferromagnetic film discretized into cells of size 1 × 1 × 30 nm3. Grains with an average diameter of 40 nm are generated using a Voronoi tessellation59. Each grain has an easy axis which lies either out-of-plane, perpendicular to the film’s surface, or in a random in-plane direction71. Furthermore, the exchange coupling between neighboring grains is reduced to 10% of the intragrain value. To reproduce the NV scans shown in Ref. 71, we let the non-collinear antiferromagnet relax to an energy minimum starting from a random state. We then calculate the out-of-plane component of the magnet’s stray field in a grid which lies 60 nm above the film’s surface. The results, along with the simulation parameters, can be found in Fig. 4. The qualitative agreement between Figures 4a and 4b, along with the order of magnitude of the stray field showcases the ability of mumax+ to simulate non-collinear antiferromagnetic systems.

Fig. 4: The out-of-plane component of the stray field of a Mn3Sn thin film, as discussed in demonstration 3.
figure 4

Panel (a) shows the calculated field using mumax+ after letting a non-collinear antiferromagnet relax from a random state. Each sublattice has a saturation magnetization of 1 MA/m, uniaxial anisotropy constant of 5 MJ/m2 (based on Ref. 67), a Gilbert damping constant of 0.01 and a typical lattice constant of 3.5 Å. The ferromagnetic, inhomogeneous and homogeneous antiferromagnetic exchange constants are set at 10 pJ/m, -15 pJ/m and -25 pJ/m respectively. The homogeneous DMI vector is set at 10 MJ/m3 in the direction perpendicular to the film, while the interfacial DMI has a set value of 3.5 mJ/m2 84. Panel (b) shows an NV measurement image of a \({{\rm{Mn}}}_{3}{\rm{Sn}}\) thin film with a thickness of 30 nm, measured ~ 60 nm above the film’s surface. The scale bar denotes 0.5 μm. Reprinted (adapted) with permission from Li, S. et al. (2023). Nanoscale Magnetic Domains in Polycrystalline \({{\rm{Mn}}}_{3}{\rm{Sn}}\) Films Imaged by a Scanning Single-Spin Magnetometer. Nano Letters, 23(11), 5326–5333. https://doi.org/10.1021/acs.nanolett.3c01523. Copyright 2023 American Chemical Society.

Performance and memory usage

The object-oriented design of mumax+ allows for great flexibility, versatility and transparency, both in the source code and in an input script. The downside of this framework, along with the Python wrapper, is a performance loss as compared to mumax3. To illustrate this, Fig. 5 compares the throughput of mumax+ and mumax3, which is a measure for the amount of cells that can be processed per second5, as well as the peak GPU memory usage. The data in Fig. 5 shows that the ratio of the throughput of mumax3 and mumax+ (32-bit) is approximately 2.5 in the rising regime and 1.6 in the constant regime. The latter ratio is about 3 in the case of 64-bit precision. The throughput of antiferromagnetic simulations is 2 to 3 times lower than that of equally sized ferromagnetic simulations using mumax+, depending on the grid size. Before saturation, part of the performance decrease can be explained by the two magnetization vectors per finite difference cell which have to be accounted for. In the saturated regime where the performance no longer depends directly on the grid size (or the number of magnetization vectors per simulation cell), the difference shows the overhead cost of the increased number of exchange and magnetostatic interactions.

Fig. 5: The left figure shows the throughput of the simulation of a square 2D ferromagnet and antiferromagnet (AFM, 32-bit) utilizing the Dormand-Prince solver80 on an NVIDIA H100 NVL GPU with CUDA 12.6.
figure 5

Only exchange interactions and magnetostatic interactions are considered. The right figure shows the peak GPU memory usage in those simulations.

The peak GPU memory usage, also shown in Fig. 5, indicates that the object-oriented framework also comes at a memory cost when compared to mumax3. However, it exhibits an overhead for small grid sizes which is independent of the used software package or simulation. The actual grid size becomes a relevant factor at about 100 thousand cells.

Accuracy

A prototypical test of the numerical accuracy of a micromagnetic solver is the μMAG standard problem 428. Here, we compare the simulation results obtained with mumax+ and mumax3 5 to the ones obtained with OOMMF1. Figure 6 shows the deviation of the y-component of the average magnetization between the two simulations. The other two components are not shown and have a maximal deviation which is about 5 times smaller. The data in Fig. 6 shows that the deviation between mumax+ and OOMMF is smaller than that between OOMMF and mumax3, meaning the implementation of mumax+ is adequate for this benchmarking test.

Fig. 6: Difference in the computed evolution of the y-component of the average magnetization of the μMAG standard problem 4 (field 1)28, comparing results from mumax+ and mumax3 5 against OOMMF1.
figure 6

All simulations use cells with a cell size of 1 × 1 × 1 nm3.

Discussion

We presented the micromagnetic package mumax+ and highlighted the key differences from mumax3. These advancements include a Python-based interface, support for calculations involving (non-collinear) antiferromagnets and ferrimagnets, and the integration of magnetoelasticity across all magnet types in the package.

As a demonstration of the capabilities of mumax+ that are not present in mumax3, we first presented the current-driven domain wall mobility in a polycrystalline antiferromagnet. Furthermore, the addition of magnetoelastics has provided a way to simulate the working principle of a racetrack memory in NiO driven by strain through the application of traction. Finally, we were able to reproduce nitrogen-vacancy magnetometry images in the non-collinear antiferromagnet \({{\rm{Mn}}}_{3}{\rm{Sn}}\).

The development of mumax+ is ongoing and more functionalities are expected to be added in future releases. Some possibilities include adaptive time stepping appropriate for magnetoelastic simulations, a more general stiffness tensor and piezoelectric coupling. Since mumax+ is open-source and built with an object-oriented design for easy extensibility, anyone can fork the repository (https://github.com/mumax/plus) and enhance the module with additional features.

Methods

The mumax+ module is written in C++ and CUDA for GPU support and can be compiled using either single or double precision. The module is wrapped in Python, allowing it to be imported in a Python script like any other package. The object-oriented character of Python and C++ allows for a very flexible and transparent use of classes and accompanying instances. For example, each magnetic instance has its own set of material parameters and multiple magnets from different magnet classes can simultaneously coexist. This contrasts with mumax3, where the user has to resort to defining a limited number of regions in order to create inhomogeneities in material parameters5. Other advantages of the use of a Python-based interface are prominent, like the use of NumPy’s23 intuitive array indexing logic to set material parameters in different subsets of cells. These benefits are illustrated in the various examples in the Github repository and the website.

Magnetostatic field

The calculation of the magnetostatic field is similar to the method used in OOMMF1. It is done by using the analytical result73 below a certain cutoff radius and the asymptotic result74 above that radius, as the latter is numerically more accurate at large distances. In the case of antiferromagnets, the vector sum of the spins within a simulation cell is computed prior to evaluating the resulting field. Similar to mumax3, periodic boundary conditions for the magnetostatic field are implemented using a macro geometry approach5,6,75.

Time integration

Several embedded Runge–Kutta methods are available for time integration, as listed in Table 1, with the option to use adaptive time stepping76,77,78,79,80.