RKKY energy term#

In this tutorial we demonstrate how to use RKKY energy term in ubermag simulations. We start by importing the modules we are going to use. Please note that we are importing random as well, so we can initialise our magnetisation as a random state.

[1]:
import random
import discretisedfield as df
import micromagneticmodel as mm
import oommfc as mc

random.seed(2)  # this way we ensure reproducibility

Our sample consists of three subregions. More precisely, two magnetic, and a non-magnetic spacer.

[2]:
p1 = (0, 0, 0)
p2 = (60e-9, 60e-9, 22e-9)
region = df.Region(p1=p1, p2=p2)
subregions={'bottom': df.Region(p1=(0, 0, 0), p2=(60e-9, 60e-9, 10e-9)),
            'spacer': df.Region(p1=(0, 0, 10e-9), p2=(60e-9, 60e-9, 12e-9)),
            'top': df.Region(p1=(0, 0, 12e-9), p2=(60e-9, 60e-9, 22e-9))}
mesh = df.Mesh(region=region, n=(20, 20, 11), subregions=subregions)
[3]:
mesh.mpl.subregions()
../../_images/examples_notebooks_rkky_4_0.png

Our energy equation consists of exchange, uniaxial anisotropy and RKKY energy terms. In order to define RKKY interaction, we have to pass sigma and sigma2 parameters, as well as subregions between which RKKY occurs. More precisely, by passing two subregions, two closest mutually facing surfaces are going to be identified automatically. In addition, please note that we set up norm of the field using a dictionary and the value using a lambda function. We could have done the same thing by writing full Python functions, but here we want to show that there are many different ways how a field can be defined.

[4]:
system = mm.System(name='rkky')
system.energy = (mm.Exchange(A=1e-12) +
                 mm.RKKY(sigma=-1e-4, sigma2=0, subregions=['bottom', 'top']) +
                 mm.UniaxialAnisotropy(K=1e5, u=(1, 0, 0)))

norm = {'bottom': 8e6, 'top': 8e6, 'spacer': 0}
system.m = df.Field(mesh, nvdim=3, value=lambda point: [2*random.random()-1 for i in range(3)], norm=norm, valid="norm")

The initial magnetisation is:

[5]:
system.m.sel('y').mpl(figsize=(15, 4))
../../_images/examples_notebooks_rkky_8_0.png

And the energy equation:

[6]:
system.energy
[6]:
$- A \mathbf{m} \cdot \nabla^{2} \mathbf{m}+ \text{RKKY}(\text{bottom}, \text{top})-K (\mathbf{m} \cdot \mathbf{u})^{2}$

Now we can relax the system, and plot its magnetisation.

[7]:
md = mc.MinDriver()
md.drive(system)
Running OOMMF (ExeOOMMFRunner)[2023/10/23 16:08]... (0.6 s)
[8]:
system.m.sel('y').mpl(figsize=(12, 3))
../../_images/examples_notebooks_rkky_13_0.png

We can see that two layers are “antiferromagnetically coupled” because we used negative \(\sigma\).