llg3d.element

Define the chemical elements.

Module Attributes

k_B

Boltzmann constant \([J.K^{-1}]\)

mu_0

Vacuum permeability \([H.m^{-1}]\)

gamma

Gyromagnetic ratio \([rad.s^{-1}.T^{-1}]\)

Functions

get_element_class(element_name)

Get the class of the chemical element by its name.

Classes

Cobalt(T, H_ext, g, dt[, dtype])

Cobalt element.

Element(T, H_ext, g, dt[, dtype])

Abstract class for chemical elements.

Iron(T, H_ext, g, dt[, dtype])

Iron element.

Nickel(T, H_ext, g, dt[, dtype])

Nickel element.

k_B = 1.38e-23

Boltzmann constant \([J.K^{-1}]\)

mu_0 = 1.2566370614359173e-06

Vacuum permeability \([H.m^{-1}]\)

gamma = 176000000000.0

Gyromagnetic ratio \([rad.s^{-1}.T^{-1}]\)

class Element(T, H_ext, g, dt, dtype=None)[source]

Bases: ABC

Abstract class for chemical elements.

Parameters:
  • T (float) – Temperature in Kelvin

  • H_ext (float) – External magnetic field strength

  • g (Grid) – Grid object representing the simulation grid

  • dt (float) – Time step for the simulation

  • dtype (dtype | None) – Optional numpy dtype to cast scalar coefficients to

A: float = 0.0

Exchange constant \([J.m^{-1}]\)

K: float = 0.0

Anisotropy constant \([J.m^{-3}]\)

lambda_G: float = 0.0

Damping parameter \([1]\)

M_s: float = 0.0

Saturation magnetization \([A.m^{-1}]\)

a_eff: float = 0.0

Effective lattice constant \([m]\)

anisotropy: Literal['uniaxial', 'cubic']

Type of anisotropy

gamma_0

Rescaled gyromagnetic ratio [mA^-1.s^-1]

d_0

Domain wall width [m]

_cast_to_dtype(dtype)[source]

Cast all float attributes of the instance to the specified numpy dtype.

Parameters:

dtype (dtype) – The numpy dtype to cast to (e.g., np.float32, np.float64)

get_CFL()[source]

Returns the value of the CFL.

\[CFL = \frac{dt \cdot 2 \gamma_0 A}{\mu_0 M_s dx^2}\]
Returns:

The CFL value

Return type:

float

to_dict()[source]

Export element parameters to a dictionary for JAX JIT compatibility.

Returns:

Dictionary containing element parameters needed for computations

Return type:

dict

compute_H_anisotropy(m, H_aniso)[source]

Compute the anisotropy field.

For uniaxial anisotropy:

\[\boldsymbol{H}_{\text{ani, uniaxial}}=\frac{2K}{\mu_0M_s}(\boldsymbol{e}_x \cdot\boldsymbol{m})\boldsymbol{e}_x,\label{uniaxial}\]

For cubic anisotropy:

\[\boldsymbol{H}_{\text{ani, cubic}}=-\frac{2K}{\mu_0M_s}\sum_{(i,j,k)\in I} \left((\boldsymbol{e}_j\cdot\boldsymbol{m})^2+(\boldsymbol{e}_k\cdot \boldsymbol{m})^2+(\boldsymbol{e}_j\cdot\boldsymbol{m})^2(\boldsymbol{e}_k \cdot\boldsymbol{m})^2\right)(\boldsymbol{e}_i\cdot\boldsymbol{m})\boldsymbol{e}_i,\label{cubic}\]
Parameters:
  • m (ndarray) – Magnetization array (shape (3, nx, ny, nz)).

  • H_aniso (ndarray) – Pre-allocated output array (shape (3, nx, ny, nz)).

Raises:

ValueError – If the anisotropy type is unknown

class Cobalt(T, H_ext, g, dt, dtype=None)[source]

Bases: Element

Cobalt element.

Parameters:
  • T (float)

  • H_ext (float)

  • g (Grid)

  • dt (float)

  • dtype (dtype | None)

A: float = 3e-11

Exchange constant \([J.m^{-1}]\)

K: float = 520000.0

Anisotropy constant \([J.m^{-3}]\)

lambda_G: float = 0.5

Damping parameter \([1]\)

M_s: float = 1400000.0

Saturation magnetization \([A.m^{-1}]\)

a_eff: float = 2.5e-10

Effective lattice constant \([m]\)

anisotropy: Literal['uniaxial', 'cubic'] = 'uniaxial'

Type of anisotropy (e.g., “uniaxial”, “cubic”)

class Iron(T, H_ext, g, dt, dtype=None)[source]

Bases: Element

Iron element.

Parameters:
  • T (float)

  • H_ext (float)

  • g (Grid)

  • dt (float)

  • dtype (dtype | None)

A: float = 2.1e-11

Exchange constant \([J.m^{-1}]\)

K: float = 48000.0

Anisotropy constant \([J.m^{-3}]\)

lambda_G: float = 0.5

Damping parameter \([1]\)

M_s: float = 1700000.0

Saturation magnetization \([A.m^{-1}]\)

a_eff: float = 2.86e-10

Effective lattice constant \([m]\)

anisotropy: Literal['uniaxial', 'cubic'] = 'cubic'

Type of anisotropy (e.g., “uniaxial”, “cubic”)

class Nickel(T, H_ext, g, dt, dtype=None)[source]

Bases: Element

Nickel element.

Parameters:
  • T (float)

  • H_ext (float)

  • g (Grid)

  • dt (float)

  • dtype (dtype | None)

A: float = 9e-12

Exchange constant \([J.m^{-1}]\)

K: float = -5700.0

Anisotropy constant \([J.m^{-3}]\)

lambda_G: float = 0.5

Damping parameter \([1]\)

M_s: float = 490000.0

Saturation magnetization \([A.m^{-1}]\)

a_eff: float = 3.45e-10

Effective lattice constant \([m]\)

anisotropy: Literal['uniaxial', 'cubic'] = 'cubic'

Type of anisotropy (e.g., “uniaxial”, “cubic”)

get_element_class(element_name)[source]

Get the class of the chemical element by its name.

Example

>>> cls = get_element_class("Cobalt")
>>> cls.__name__
'Cobalt'
Parameters:

element_name (str) – The name of the element

Returns:

The class of the element

Raises:

ValueError – If the element is not found

Return type:

type[Element]