Namespace llg

namespace llg

Functions for evaluating the Landau-Lifshitz-Gilbert equation.

Includes the basic equation as well as Jacobians and combined functions to update fields during integration.

Author
Oliver Laslett
Date
2017

Functions

void drift(double *deriv, const double *state, const double time, const double alpha, const double *heff)

Deterministic drift component of the stochastic LLG.

Parameters
  • deriv: drift derivative of the deterministic part of the stochastic llg [length 3]
  • state: current state of the magnetisation vector [length 3]
  • t: time (has no effect)
  • alpha: damping ratio
  • the: effective field on the magnetisation [length 3]

void ito_drift(double *deriv, const double *state, const double time, const double alpha, const double sig, const double *heff)

Deterministic drift component of the stochastic Ito form of the LLG.

Parameters
  • deriv: drift derivative of the deterministic part of the stochastic llg [length 3]
  • state: current state of the magnetisation vector [length 3]
  • t: time (has no effect)
  • alpha: damping ratio
  • sig: thermal noise strength
  • the: effective field on the magnetisation [length 3]

void drift_jacobian(double *deriv, const double *state, const double time, const double alpha, const double *heff, const double *heff_jac)

Jacobian of the deterministic drift component of the stochastic LLG Since, in the general case, the effective field is a function of the magnetisation, the Jacobian of the effective field must be known in order to compute the Jacobian of the drift component.

Parameters
  • jac: Jacobian of the drift [length 3x3]
  • m: state of the magnetisation vector [length 3]
  • t: time (has no effect)
  • a: damping ratio \(\alpha\)
  • h: effective field acting on the magnetisation [length 3]
  • hj: Jacobian of the effective field evaluated at the current value of m [length 3x3]

void diffusion(double *deriv, const double *state, const double time, const double sr, const double alpha)

The stochastic diffusion component of the stochastic LLG.

Parameters
  • deriv: diffusion derivatives [length 3x3]
  • state: current state of the magnetisation [length 3]
  • t: time (has no effect)
  • sr: normalised noise power of the thermal field (see notes on LLG normalisation for details)
  • alpha: damping ratio

void diffusion_jacobian(double *jacobian, const double *state, const double time, const double sr, const double alpha)

Jacobian of the stochastic diffusion component of the LLG.

Parameters
  • jacobian: Jacobian of the LLG diffusion [length 3x3]
  • state: current state of the magnetisation vector [length 3]
  • t: time (has no effect)
  • sr: normalised noise power of the thermal field (see notes on LLG normalisation for details)
  • alpha: damping ratio

void sde_with_update(double *drift, double *diffusion, double *heff, const double *current_state, const double drift_time, const double diffusion_time, const double *happ, const double *anisotropy_axis, const double alpha, const double noise_power)

Computes drift and diffusion of LLG after updating the field.

The effective field is first computed based on the applied field and current state of the magnetisation. This is then used to compute the current drift and diffusion components of the LLG. Assumes uniaxial anisotropy.

Parameters
  • drift: deterministic component of the LLG [length 3]
  • diffusion: stochastic component of the LLG [length 3x3]
  • heff: effective field including the applied field contribution [length 3]
  • state: current state of the magnetisation [length 3]
  • a_t: time at which to evaluate the drift
  • b_t: time at which to evaluate the diffusion
  • happ: the applied field at time a_t [length 3]
  • aaxis: the anisotropy axis of the particle [length 3]
  • alpha: damping ratio
  • sr: normalised noise power of the thermal field (see notes on LLG normalisation for details)

void jacobians_with_update(double *drift, double *diffusion, double *drift_jac, double *diffusion_jac, double *heff, double *heff_jac, const double *current_state, const double drift_time, const double diffusion_time, const double *happ, const double *anisotropy_axis, const double alpha, const double noise_power)

Computes effective field, drift, diffusion and Jacobians of LLG.

The effective field is first computed based on the applied field and current state of the magnetisation. This is then used to compute the drift, diffusion, and their respective Jacobians. Assumes uniaxial anisotropy.

Parameters
  • drift: deterministic component of the LLG [length 3]
  • diffusion: stochastic component of the LLG [length 3x3]
  • drift_jac: Jacobian of the deterministic component [length 3x3]
  • diffusion_jac: Jacobian of the diffusion component [length 3x3x3]
  • heff: effective field including the applied field contribution [length 3]
  • heff_jac: Jacobian of the effective field [length 3x3]
  • state: current state of the magnetisation [length 3]
  • a_t: time at which to evaluate the drift
  • b_t: time at which to evaluate the diffusion
  • happ: the applied field at time a_t [length 3]
  • aaxis: the anisotropy axis of the particle [length 3]
  • alpha: damping ratio
  • s: normalised noise power of the thermal field (see notes on LLG normalisation for details)

void multi_drift(double *deriv, const double *state, const double *alphas, const double *heff, const size_t N_particles)

Deterministic drift component of the stochastic LLG for many particles.

Parameters
  • deriv: drift derivative of the deterministic part of the stochastic llg for each particle [length 3xN]
  • state: current state of the magnetisation vectors [length 3xN]
  • t: time (has no effect)
  • alpha: damping ratio
  • heff: the effective field on each particle [length 3xN]
  • N_particles: the number of particles

void ito_multi_drift(double *deriv, const double *state, const double *alphas, const double *sigs, const double *heff, const size_t N_particles)

Deterministic drift component of the stochastic Ito LLG for many particles

Parameters
  • deriv: drift derivative of the deterministic part of the stochastic llg for each particle [length 3xN]
  • state: current state of the magnetisation vectors [length 3xN]
  • t: time (has no effect)
  • alphas: damping ratio of each particle
  • sigs: the thermal noise strength for each particle
  • heff: the effective field on each particle [length 3xN]
  • N_particles: the number of particles

void multi_diffusion(double *deriv, const double *state, const double *field_strengths, const double *alphas, const size_t N_particles)

Compute 3x3 block diagonal multi diffusion.

Note zero terms are not written.

void multi_stochastic_llg_field_update(double *drift, double *diffusion, double *heff, const std::function<void(double *, const double *, const double)> heff_func, const double *state, const double t, const double *alphas, const double *field_strengths, const size_t N_particles, )

Updates field and computes LLG for N interacting particles.

heff_fuc is a function that returns the effective field given the current state and the current time. This can be whatever you want e.g. cubic anisotropy terms and interactions. EZEEE.

void multi_stochastic_ito_llg_field_update(double *drift, double *diffusion, double *heff, const std::function<void(double *, const double *, const double)> heff_func, const double *state, const double t, const double *alphas, const double *field_strengths, const size_t N_particles, )

Updates field and computes Ito LLG for N interacting particles.

heff_fuc is a function that returns the effective field given the current state and the current time. This can be whatever you want e.g. cubic anisotropy terms and interactions. EZEEE.

void multi_drift_quasijacobian(double *jac, const double *m, const double *alphas, const double *h, const double *hj, size_t N_particles)

Computes the Jacobian of the drift for N interacting particles.

Assumes that jac is zero’d (i.e. function will not fill in 0 entries)

void multi_diffusion_jacobian(double *jacobian, const double *state, const double *therm_field_strengths, const double *alphas, const size_t N_particles)

Computes the Jacobian of the diffusion for N interacting particles.

Only computes non-zero values. jacobian must be 0 initialised before function call.

void multi_stochastic_llg_jacobians_field_update(double *drift, double *diffusion, double *drift_jac, double *diffusion_jac, double *heff, double *heff_jac, const double *state, const double t, const double *alphas, const double *field_strengths, const size_t N_particles, const std::function<void(double *, const double *, const double)> heff_func, const std::function<void(double *, const double *, const double)> heff_jac_func)

Computes all fields, drift/diffusion, jacobians for N particles.

The effective field is first computed based on the applied field and current state of the magnetisation. This is then used to compute the drift, diffusion, and their respective Jacobians. Assumes uniaxial anisotropy.

Parameters
  • drift: deterministic component of the LLG [length 3]
  • diffusion: stochastic component of the LLG [length 3x3]
  • drift_jac: Jacobian of the deterministic component [length 3x3]
  • diffusion_jac: Jacobian of the diffusion component [length 3x3x3]
  • heff: effective field including the applied field contribution [length 3]
  • heff_jac: Jacobian of the effective field [length 3x3]
  • state: current state of the magnetisation [length 3]
  • a_t: time at which to evaluate the drift
  • b_t: time at which to evaluate the diffusion
  • happ: the applied field at time a_t [length 3]
  • aaxis: the anisotropy axis of the particle [length 3]
  • alpha: damping ratio
  • s: normalised noise power of the thermal field (see notes on LLG normalisation for details)