Skip to main content

calc_dm_dt

Function calc_dm_dt 

Source
pub fn calc_dm_dt(
    m: Vector3<f64>,
    h_eff: Vector3<f64>,
    gamma: f64,
    alpha: f64,
) -> Vector3<f64>
Expand description

Calculate the time derivative of magnetization using the LLG equation

§Arguments

  • m - Normalized magnetization vector
  • h_eff - Effective magnetic field [T]
  • gamma - Gyromagnetic ratio [rad/(s·T)]
  • alpha - Gilbert damping constant (dimensionless)

§Returns

Time derivative of magnetization dm/dt [1/s]

§Physical Background

The LLG equation combines:

  • Precession term: -γ (m × H_eff) - magnetization precesses around H_eff
  • Damping term: α (m × dm/dt) - relaxation towards H_eff direction

§Example

use spintronics::dynamics::llg::calc_dm_dt;
use spintronics::constants::GAMMA;
use spintronics::Vector3;

// Magnetization pointing in x-direction
let m = Vector3::new(1.0, 0.0, 0.0);
// External field in z-direction
let h_ext = Vector3::new(0.0, 0.0, 1.0);
// Gilbert damping for Permalloy
let alpha = 0.01;

// Calculate magnetization dynamics
let dm_dt = calc_dm_dt(m, h_ext, GAMMA, alpha);

// dm/dt should be perpendicular to m (conserves |m|)
assert!(dm_dt.dot(&m).abs() < 1e-10);