Negative exchange energy constant#

In this tutorial, we show how to set up a negative value of exchange energy constant between subregions in the mesh. We start by importing the modules we are going to use. We import random, because we plan to initialise our magnetisation as a random state.

import random
import discretisedfield as df
import micromagneticmodel as mm
import oommfc as mc

In order to make sure we always have the same random state generated, we set up the seed.


Our sample consists of three identical magnetic layers, which are (for some reason) coupled antiferomagnetically.

p1 = (0, 0, 0)
p2 = (60e-9, 60e-9, 30e-9)
region = df.Region(p1=p1, p2=p2)
subregions={'r1': df.Region(p1=(0, 0, 0), p2=(60e-9, 60e-9, 10e-9)),
            'r2': df.Region(p1=(0, 0, 10e-9), p2=(60e-9, 60e-9, 20e-9)),
            'r3': df.Region(p1=(0, 0, 20e-9), p2=(60e-9, 60e-9, 30e-9))}
mesh = df.Mesh(region=region, n=(20, 20, 9), subregions=subregions)


We use a dictionary to set up parameter \(A\). For individual subregions, we use r1, r2, and r3, whereas to define \(A\) between different subregions, we put a colon in dictionary key - for instance, r1:r2.

system = mm.System(name='negative_A')

A = 1e-12
Adict = {'r1': A, 'r2': A, 'r3': A, 'r1:r2': -A, 'r2:r3': -A} = mm.Exchange(A=Adict) + mm.UniaxialAnisotropy(K=1e4, u=(1, 0, 0))

As we mentioned previously, we are going to initialise the system using a random state.

def m_random(point):
    return [2*random.random()-1 for i in range(3)]

system.m = df.Field(mesh, nvdim=3, value=m_random, norm=8e6)

system.m.sel('y').mpl(figsize=(12, 3))

Now, we can minimise the system’s energy and plot its magnetisation.

md = mc.MinDriver()

system.m.sel('y').mpl(figsize=(12, 3))
Running OOMMF (ExeOOMMFRunner)[2023/10/23 16:08]... (0.5 s)

We can see that all three regions are uniformly magnetised, but mutually coupled antiferromagnetically.