Energy terms and energy equation#

There are several different energy terms that are implemented in micromagneticmodel. Here, we will provide a short list of them, together with some basic properties.

Energy terms#

1. Exchange energy#

The main parameter required for the exchange energy is the exchange energy constant A.

[1]:
import micromagneticmodel as mm

exchange = mm.Exchange(A=1e-11)

The values of its arguments are

[2]:
exchange.A
[2]:
1e-11
[3]:
exchange.name
[3]:
'exchange'

String and LaTeX representations are

[4]:
repr(exchange)
[4]:
'Exchange(A=1e-11)'
[5]:
exchange
[5]:
$- A \mathbf{m} \cdot \nabla^{2} \mathbf{m}$

2. Zeeman energy#

Time-independent#

Zeeman energy requires the external magnetic field vector to be provided. Optionally, name can be given to the energy term.

[6]:
zeeman = mm.Zeeman(H=(0, 0, 1e6))

The values of attributes are

[7]:
zeeman.H
[7]:
(0, 0, 1000000.0)
[8]:
zeeman.name
[8]:
'zeeman'

LaTeX representation is

[9]:
repr(zeeman)
[9]:
'Zeeman(H=(0, 0, 1000000.0))'
[10]:
zeeman
[10]:
$-\mu_{0}M_\text{s} \mathbf{m} \cdot \mathbf{H}$
[11]:
type(zeeman.wave)
[11]:
ubermagutil.typesystem.descriptors.Subset

Time-dependent#

Several different options can be used to specify a time-dependent field:

  • Predefined functions sin and sinc

  • Arbitratry time dependence specified as a function

  • Custom tcl code for OOMMF

In this notebook, only the predefined functions are shown. For the other options please refer to this notebook.

Either sine or sinc wave can be used to multiply H. For instance, in order to define a time-dependent external field, which is a sine wave with \(1 \,\text{GHz}\) frequency and \(t_{0} = 2\,\text{ps}\) shift.

[12]:
zeeman_sin = mm.Zeeman(H=(0, 0, 1e6), func="sin", f=1e9, t0=2e-12)

LaTeX representation is:

[13]:
repr(zeeman_sin)
[13]:
"Zeeman(H=(0, 0, 1000000.0), f=1000000000.0, t0=2e-12, func='sin')"

Similarly, we can define a “sinc” pulse:

[14]:
zeeman_sinc = mm.Zeeman(H=(0, 0, 1e6), func="sinc", f=1e9, t0=2e-12)

LaTeX representation is:

[15]:
zeeman_sinc
[15]:
$-\mu_{0}M_\text{s} \mathbf{m} \cdot \mathbf{H}$

3. Uniaxial anisotropy#

This energy term requires the anisotropy constant \(K_{1}\) and uniaxial anisotropy axis \(\mathbf{u}\) to be passed. As before, name is optional as well.

[16]:
uniaxialanisotropy = mm.UniaxialAnisotropy(K=1e5, u=(0, 1, 0))

The attributes are:

[17]:
uniaxialanisotropy.K
[17]:
100000.0
[18]:
uniaxialanisotropy.u
[18]:
(0, 1, 0)

String and LaTeX representations are

[19]:
repr(uniaxialanisotropy)
[19]:
'UniaxialAnisotropy(K=100000.0, u=(0, 1, 0))'
[20]:
uniaxialanisotropy
[20]:
$-K (\mathbf{m} \cdot \mathbf{u})^{2}$

In order to define higher-order uniaxial anisotropy term, K1 and K2 should be passed.

[21]:
uniaxialanisotropy = mm.UniaxialAnisotropy(K1=1e5, K2=1e3, u=(0, 1, 0))
[22]:
uniaxialanisotropy
[22]:
$-K_{1} (\mathbf{m} \cdot \mathbf{u})^{2} - K_{2} (\mathbf{m} \cdot \mathbf{u})^{4}$

4. Demagnetisation energy#

Demagnetisation energy does not require any input parameters. If needed, name can be passed.

[23]:
demag = mm.Demag()

The only attribute is

[24]:
demag.name
[24]:
'demag'

String and LaTeX representations are

[25]:
repr(demag)
[25]:
'Demag()'
[26]:
demag
[26]:
$-\frac{1}{2}\mu_{0}M_\text{s}\mathbf{m} \cdot \mathbf{H}_\text{d}$

5. Dzyaloshinskii-Moriya energy#

DM energy takes two mandatory input parameters: DM constant \(D\) and the crystallographic class crystalclass. The allowed crystallographic classes are 1. Cnv 2. T or O 3. D2d

For Cnv and D2d the normal axis must also be specified. Allowed values for crystalclass are: 1. Cnv_x, Cnv_y, or Cnv_z 2. D2d_x, D2d_y, or D2d_z

As usual, name argument is optional.

[27]:
dmi_cnv_x = mm.DMI(D=5e-3, crystalclass="Cnv_x")
dmi_cnv_y = mm.DMI(D=5e-3, crystalclass="Cnv_y")
dmi_cnv_z = mm.DMI(D=5e-3, crystalclass="Cnv_z")
dmi_t = mm.DMI(D=5e-3, crystalclass="T")
dmi_d2d_x = mm.DMI(D=5e-3, crystalclass="D2d_x")
dmi_d2d_y = mm.DMI(D=5e-3, crystalclass="D2d_y")
dmi_d2d_z = mm.DMI(D=5e-3, crystalclass="D2d_z")

Attributes are

[28]:
dmi_cnv_x.D == dmi_cnv_y.D == dmi_cnv_z.D == dmi_t.D == dmi_d2d_x.D == dmi_d2d_y.D == dmi_d2d_z.D
[28]:
True
[29]:
dmi_cnv_x.crystalclass
[29]:
'Cnv_x'

LaTeX representations are different for different crystallographic classes.

[30]:
dmi_cnv_x
[30]:
$D ( \mathbf{m} \cdot \nabla m_{x} - m_{x} \nabla \cdot \mathbf{m} )$
[31]:
dmi_cnv_y
[31]:
$D ( \mathbf{m} \cdot \nabla m_{y} - m_{y} \nabla \cdot \mathbf{m} )$
[32]:
dmi_cnv_z
[32]:
$D ( \mathbf{m} \cdot \nabla m_{z} - m_{z} \nabla \cdot \mathbf{m} )$
[33]:
dmi_t
[33]:
$D \mathbf{m} \cdot (\nabla \times \mathbf{m})$
[34]:
dmi_d2d_x
[34]:
$D\mathbf{m} \cdot \left( \frac{\partial \mathbf{m}}{\partial y} \times \hat{y} - \frac{\partial \mathbf{m}}{\partial z} \times \hat{z} \right)$
[35]:
dmi_d2d_y
[35]:
$D\mathbf{m} \cdot \left( \frac{\partial \mathbf{m}}{\partial z} \times \hat{z} - \frac{\partial \mathbf{m}}{\partial x} \times \hat{x} \right)$
[36]:
dmi_d2d_z
[36]:
$D\mathbf{m} \cdot \left( \frac{\partial \mathbf{m}}{\partial x} \times \hat{x} - \frac{\partial \mathbf{m}}{\partial y} \times \hat{y} \right)$

6. Cubic anisotropy#

Cubic anisotropy energy term requires the anisotropy constant \(K_{1}\) and two mutually perpendicular anisotropy axes \(\mathbf{u}_{1}\) and \(\mathbf{u}_{2}\). Argument name is optional.

[37]:
cubicanisotropy = mm.CubicAnisotropy(K=1e5, u1=(1, 0, 0), u2=(0, 1, 0))

The attributes are:

[38]:
cubicanisotropy.K
[38]:
100000.0
[39]:
cubicanisotropy.u1
[39]:
(1, 0, 0)
[40]:
cubicanisotropy.u2
[40]:
(0, 1, 0)

String and LaTeX representations are:

[41]:
repr(cubicanisotropy)
[41]:
'CubicAnisotropy(K=100000.0, u1=(1, 0, 0), u2=(0, 1, 0))'
[42]:
cubicanisotropy
[42]:
$-K [(\mathbf{m} \cdot \mathbf{u}_{1})^{2}(\mathbf{m} \cdot \mathbf{u}_{2})^{2}+(\mathbf{m} \cdot \mathbf{u}_{2})^{2}(\mathbf{m} \cdot \mathbf{u}_{3})^{2}+(\mathbf{m} \cdot \mathbf{u}_{3})^{2}(\mathbf{m} \cdot \mathbf{u}_{1})^{2}]$

7. RKKY#

RKKY energy term requires the sigma constant \(\sigma\) and optionally \(\sigma_{2}\). In addition, two subregions defined in the mesh must be passed as a list.

[43]:
rkky = mm.RKKY(sigma=-1e-4, subregions=["subregion1", "subregion2"])

The attributes are:

[44]:
rkky.sigma
[44]:
-0.0001
[45]:
rkky.subregions
[45]:
['subregion1', 'subregion2']

String and LaTeX representations are:

[46]:
repr(rkky)
[46]:
"RKKY(sigma=-0.0001, subregions=['subregion1', 'subregion2'])"
[47]:
rkky
[47]:
$\text{RKKY}(\text{subregion1}, \text{subregion2})$

Energy equation#

The energy equation of the micromagnetic system is the sum of energy terms. For instance, if we sum two energy terms, we get:

[48]:
type(exchange + dmi_cnv_z)
[48]:
micromagneticmodel.energy.energy.Energy

If we assign this value to a separate variable, we can explore some of its properties.

[49]:
energy = exchange + dmi_cnv_z

The string representation is:

[50]:
repr(energy)
[50]:
"Exchange(A=1e-11) + DMI(D=0.005, crystalclass='Cnv_z')"

Similarly, the LaTeX representation is

[51]:
energy
[51]:
$- A \mathbf{m} \cdot \nabla^{2} \mathbf{m}+ D ( \mathbf{m} \cdot \nabla m_{z} - m_{z} \nabla \cdot \mathbf{m} )$

This Hamiltonian consists of two energy terms. To add another term to it += operator can be used.

[52]:
energy += zeeman

The Hamiltonian is now

[53]:
energy
[53]:
$- A \mathbf{m} \cdot \nabla^{2} \mathbf{m}+ D ( \mathbf{m} \cdot \nabla m_{z} - m_{z} \nabla \cdot \mathbf{m} )-\mu_{0}M_\text{s} \mathbf{m} \cdot \mathbf{H}$

Accesing the individual energy terms from the energy equation#

There are two ways of retrieving an individual energy term from the energy equation. Let us say we want to change the value of the Dzyaloshinkii-Moriya constant \(D\).

If an energy term with name myenergy was added to the Hamiltonian, that term can be accessed by typing energy.myenergy. In the case of DMI:

[54]:
energy.dmi
[54]:
$D ( \mathbf{m} \cdot \nabla m_{z} - m_{z} \nabla \cdot \mathbf{m} )$
[55]:
energy.dmi.D
[55]:
0.005
[56]:
energy.dmi.D = 5e-3
[57]:
energy.dmi.D
[57]:
0.005

Similarly, the exchange energy term is

[58]:
energy.exchange
[58]:
$- A \mathbf{m} \cdot \nabla^{2} \mathbf{m}$

because we used name 'myexchange' at the time of initialisation.

[59]:
exchange.name
[59]:
'exchange'