simulations.magnetization#

Classes:

Magnetization(S, force_recalc, **kwargs)

Base class for all magnetization simulations.

LLB(S, force_recalc, **kwargs)

Mean-field quantum Landau-Lifshitz-Bloch simulations.

class udkm1Dsim.simulations.magnetization.Magnetization(S, force_recalc, **kwargs)[source]#

Bases: Simulation

Base class for all magnetization simulations.

Parameters:
  • S (Structure) – sample to do simulations with.

  • force_recalc (boolean) – force recalculation of results.

Keyword Arguments:
  • save_data (boolean) – true to save simulation results.

  • cache_dir (str) – path to cached data.

  • disp_messages (boolean) – true to display messages from within the simulations.

  • progress_bar (boolean) – enable tqdm progress bar.

Attributes:
  • S (Structure) – sample structure to calculate simulations on.

  • force_recalc (boolean) – force recalculation of results.

  • save_data (boolean) – true to save simulation results.

  • cache_dir (str) – path to cached data.

  • disp_messages (boolean) – true to display messages from within the simulations.

  • progress_bar (boolean) – enable tqdm progress bar.

  • ode_options (dict) – options for scipy solve_ivp ode solver

Methods:

get_hash(**kwargs)

Calculates an unique hash given by the delays as well as the sample structure hash for relevant magnetic parameters.

check_initial_magnetization(init_mag[, ...])

Check if a given initial magnetization profile is valid.

get_magnetization_map(delays, **kwargs)

Returns an absolute magnetization_map for the sample structure with the dimension \(M \times N \times 3\) with \(M\) being the number of delays and \(N\) the number of layers in the structure or the length of the given spatial grid.

calc_magnetization_map(delays, **kwargs)

Calculates an absolute magnetization_map - see get_magnetization_map() for details.

conv_with_function(y, x, handle)

Convolutes the array \(y(x)\) with a function given by the handle on the argument array \(x\).

disp_message(message)

Wrapper to display messages for that class.

save(full_filename, data, *args)

Save data to file.

get_hash(**kwargs)[source]#

Calculates an unique hash given by the delays as well as the sample structure hash for relevant magnetic parameters. Optionally, part of the strain_map and temp_map are used.

Parameters:
  • delays (ndarray[float]) – delay grid for the simulation.

  • **kwargs (ndarray[float], optional) – optional delays, strain and temperature profile as well as external magnetic field and initial magnetization.

Returns:

hash (str) – unique hash.

check_initial_magnetization(init_mag, distances=[])[source]#

Check if a given initial magnetization profile is valid. The profile must be either a vector [amplitude, phi, gamma] describing a global initial magnetization or an array of shape [Nx3] with N being the number of layers or the length of the specific spatial grid. If no initial magnetization is given, the initial profile is determined from the magnetization of the layers on creation. In addition, a spatial grid can be provided.

Parameters:
  • init_mag (ndarray[float]) – initial global or local magnetization profile.

  • distances (ndarray[float, Quantity], optional) – spatial grid of the initial magnetization.

Returns:

init_mag (ndarray[float])

checked initial magnetization as array on

the according spatial grid.

get_magnetization_map(delays, **kwargs)[source]#

Returns an absolute magnetization_map for the sample structure with the dimension \(M \times N \times 3\) with \(M\) being the number of delays and \(N\) the number of layers in the structure or the length of the given spatial grid. Each element of the map contains the three magnetization components [amplitude, phi, gamma]. The angles phi and gamma must be returned in radians as pure numpy arrays. The magnetization_map can depend on the temp_map and strain_map that can be also calculated for the sample structure. More over an external magnetic field H_ext and initial magnetization profile init_mag can be provided.

Parameters:
  • delays (ndarray[Quantity]) – delays range of simulation [s].

  • **kwargs (ndarray[float], optional) – optional strain and temperature profile as well external magnetic field in [T] and initial magnetization.

Returns:

magnetization_map (ndarray[float])

spatio-temporal absolute

magnetization profile.

calc_magnetization_map(delays, **kwargs)[source]#

Calculates an absolute magnetization_map - see get_magnetization_map() for details.

This method is just an interface and should be overwritten for the actual simulations.

Parameters:
  • delays (ndarray[Quantity]) – delays range of simulation [s].

  • **kwargs (ndarray[float], optional) – optional strain and temperature profile as well external magnetic field and initial magnetization.

Returns:

magnetization_map (ndarray[float])

spatio-temporal absolute

magnetization profile.

static conv_with_function(y, x, handle)#

Convolutes the array \(y(x)\) with a function given by the handle on the argument array \(x\).

Parameters:
  • y (ndarray[float]) – y data.

  • x (ndarray[float]) – x data.

  • handle (@lamdba) – convolution function.

Returns:

y_conv (ndarray[float]) – convoluted data.

disp_message(message)#

Wrapper to display messages for that class.

Parameters:

message (str) – message to display.

save(full_filename, data, *args)#

Save data to file. The variable name can be handed as variable argument.

Parameters:
  • full_filename (str) – full file name to data file.

  • data (ndarray) – actual data to save.

  • *args (str, optional) – variable name within the data file.

class udkm1Dsim.simulations.magnetization.LLB(S, force_recalc, **kwargs)[source]#

Bases: Magnetization

Mean-field quantum Landau-Lifshitz-Bloch simulations.

Please find a detailed review on the Landau-Lifshitz-Bloch equation by Unai Atxitia et al. [11].

In collaboration with Theodor Griepe (@Nilodirf) from the group of Unai Atxitia at Instituto de Ciencia de Materiales de Madrid (ICMM-CSIC).

Parameters:
  • S (Structure) – sample to do simulations with.

  • force_recalc (boolean) – force recalculation of results.

Keyword Arguments:
  • save_data (boolean) – true to save simulation results.

  • cache_dir (str) – path to cached data.

  • disp_messages (boolean) – true to display messages from within the simulations.

  • progress_bar (boolean) – enable tqdm progress bar.

Attributes:
  • S (Structure) – sample structure to calculate simulations on.

  • force_recalc (boolean) – force recalculation of results.

  • save_data (boolean) – true to save simulation results.

  • cache_dir (str) – path to cached data.

  • disp_messages (boolean) – true to display messages from within the simulations.

  • progress_bar (boolean) – enable tqdm progress bar.

References

Methods:

calc_magnetization_map(delays, temp_map[, ...])

Calculates the magnetization map using the mean-field quantum Landau-Lifshitz-Bloch equation (LLB) for a given delay range and according temperature map:

get_mean_field_mag_map(temp_map)

Returns the mean-field magnetization map see calc_mean_field_mag_map() for details.

calc_mean_field_mag_map(temp_map)

Calculate the mean-field magnetization map \(m_\mathrm{eq}\) by solving the self consistent equation

get_directional_exchange_stiffnesses()

Returns the directional exchange stiffnesses with size \(N \times 2\), with \(N\) being the number of layers, between the \((i-1)^\mathrm{th}\) and \(i^\mathrm{th}\) layers as well as between the \(i^\mathrm{th}\) and \((i+1)^\mathrm{th}\) layers in the structure.

odefunc(t, m, delays, N, H_ext, temp_map, ...)

Ordinary differential equation that is solved for 1D LLB.

calc_uniaxial_anisotropy_field(mag_map, ...)

Calculate the uniaxial anisotropy component of the effective field.

calc_exchange_field(mag_map, ...)

Calculate the exchange component of the effective field, which is defined as for each \(i^\mathrm{th}\) layer in the structure as

calc_thermal_field(mag_map, mag_map_squared, ...)

Calculate the thermal component of the effective field.

calc_Brillouin(mag, temp, eff_spin, ...)

calc_dBrillouin_dx(temp_map, ...)

Calculate the derivative of the Brillouin function \(B_x\) at \(m = m_\mathrm{eq}\):

calc_transverse_damping(temp_map, ...)

Calculate the transverse damping parameter:

calc_longitudinal_damping(temp_map, ...)

calc_transverse_damping

calc_qs(temp_map, mf_magnetizations, ...)

Calculate the \(q_s\) parameter:

calc_long_susceptibility(temp_map, ...)

Calculate the the longitudinal susceptibility

check_initial_magnetization(init_mag[, ...])

Check if a given initial magnetization profile is valid.

conv_with_function(y, x, handle)

Convolutes the array \(y(x)\) with a function given by the handle on the argument array \(x\).

disp_message(message)

Wrapper to display messages for that class.

get_hash(**kwargs)

Calculates an unique hash given by the delays as well as the sample structure hash for relevant magnetic parameters.

get_magnetization_map(delays, **kwargs)

Returns an absolute magnetization_map for the sample structure with the dimension \(M \times N \times 3\) with \(M\) being the number of delays and \(N\) the number of layers in the structure or the length of the given spatial grid.

save(full_filename, data, *args)

Save data to file.

calc_magnetization_map(delays, temp_map, H_ext=array([0, 0, 0]), init_mag=[])[source]#

Calculates the magnetization map using the mean-field quantum Landau-Lifshitz-Bloch equation (LLB) for a given delay range and according temperature map:

\[\frac{d\mathbf{m}}{dt}=\gamma_e \left(\mathbf{m} \times \mathbf{H}_\mathrm{eff} + \frac{\alpha_{\perp}}{m^2}\mathbf{m} \times (\mathbf{m} \times \mathbf{H}_\mathrm{eff}) - \frac{\alpha_{\parallel}}{m^2}(\mathbf{m} \cdot \mathbf{H}_\mathrm{eff}) \cdot \mathbf{m}\right)\]

The three terms describe

  1. precession at Larmor frequency,

  2. transversal damping (conserving the macrospin length), and

  3. longitudinal damping (changing macrospin length due to incoherent atomistic spin excitations within the layer the macrospin is defined on).

\(\alpha_{\parallel}\) and \(\alpha_{\perp}\) are the longitudinal damping and transverse damping parameters, respectively. \(\gamma_e = -1.761\times10^{11}\,\mathrm{rad\,s^{-1}\,T^{-1}}\) is the gyromagnetic ratio of an electron.

The effective magnetic field is the sum of all relevant magnetic interactions:

\[\mathbf{H}_\mathrm{eff} = \mathbf{H}_\mathrm{ext} + \mathbf{H}_\mathrm{A} + \mathbf{H}_\mathrm{ex} + \mathbf{H}_\mathrm{th}\]

where

Parameters:
  • delays (ndarray[Quantity]) – delays range of simulation [s].

  • temp_map (ndarray[float]) – spatio-temporal temperature map.

  • H_ext (ndarray[float], optional) – external magnetic field (H_x, H_y, H_z) [T].

Returns:

magnetization_map (ndarray[float]) – spatio-temporal absolute magnetization profile.

get_mean_field_mag_map(temp_map)[source]#

Returns the mean-field magnetization map see calc_mean_field_mag_map() for details. The dimension of the map are \(M \times N\) with \(M\) being the number of delays and \(N\) the number of layers in the structure.

Parameters:

temp_map (ndarray[float]) – spatio-temporal electron temperature map.

Returns:

mf_mag_map (ndarray[float]) – spatio-temporal mean_field magnetization map.

calc_mean_field_mag_map(temp_map)[source]#

Calculate the mean-field magnetization map \(m_\mathrm{eq}\) by solving the self consistent equation

\[\begin{split}m_\mathrm{eq}(T) & = B_S(m_\mathrm{eq}, T) \\\end{split}\]

where \(B_S\) is the Brillouin function.

Parameters:

temp_map (ndarray[float]) – spatio-temporal electron temperature map.

Returns:

mf_mag_map (ndarray[float]) – spatio-temporal mean_field magnetization map.

get_directional_exchange_stiffnesses()[source]#

Returns the directional exchange stiffnesses with size \(N \times 2\), with \(N\) being the number of layers, between the \((i-1)^\mathrm{th}\) and \(i^\mathrm{th}\) layers as well as between the \(i^\mathrm{th}\) and \((i+1)^\mathrm{th}\) layers in the structure. In case two neighboring layers are identical the center entry of the 3-component exchange_stiffness is used. In case of an interface to the top \((i-1)\rightarrow i\) it will be the first entry and for an interface to the bottom \(i\rightarrow (i+1)\) it will be the third entry.

Returns:

A (ndarray[float]) – directional exchange stiffnesses.

static odefunc(t, m, delays, N, H_ext, temp_map, mean_mag_map, curie_temps, eff_spins, lambdas, mf_exch_couplings, mag_moments, aniso_exponents, anisotropies, mag_saturations, exch_stiffnesses, thicknesses, pbar, state)[source]#

Ordinary differential equation that is solved for 1D LLB.

Parameters:
  • t (ndarray[float]) – internal time steps of the ode solver.

  • m (ndarray[float]) – internal variable of the ode solver.

  • delays (ndarray[float]) – delays range of simulation [s].

  • N (int) – number of spatial grid points.

  • H_ext (ndarray[float]) – external magnetic field (H_x, H_y, H_z) [T].

  • temp_map (ndarray[float]) – spatio-temporal electron temperature map.

  • mean_mag_map (ndarray[float]) – spatio-temporal mean-field magnetization map.

  • curie_temps (ndarray[float]) – Curie temperatures of layers.

  • eff_spins (ndarray[float]) – effective spins of layers.

  • lambdas (ndarray[float]) – coupling-to-bath parameter of layers.

  • mf_exch_couplings (ndarray[float]) – mean-field exchange couplings of layers.

  • mag_moments (ndarray[float]) – atomic magnetic moments of layers.

  • aniso_exponents (ndarray[float]) – exponent of uniaxial anisotropy of layers.

  • anisotropies (ndarray[float]) – anisotropy vectors of layers.

  • mag_saturations (ndarray[float]) – saturation magnetization of layers.

  • exch_stiffnesses (ndarray[float]) – exchange stiffness of layers towards the upper and lower layer.

  • thicknesses (ndarray[float]) – thicknesses of layers.

  • pbar (tqdm) – tqdm progressbar.

  • state (list[float]) – state variables for progress bar.

Returns:

dmdt (ndarray[float]) – temporal derivative of internal variable.

static calc_uniaxial_anisotropy_field(mag_map, mf_magnetizations, aniso_exponents, anisotropies, mag_saturations)[source]#

Calculate the uniaxial anisotropy component of the effective field.

\[\begin{split}\mathbf{H}_\mathrm{A} = - \frac{2}{M_s} \left( K_x\,m_\mathrm{eq}(T)^{\kappa-2} \begin{bmatrix}0\\m_y\\m_z\end{bmatrix} + K_y\,m_\mathrm{eq}(T)^{\kappa-2} \begin{bmatrix}m_x\\0\\m_z\end{bmatrix} + K_z\,m_\mathrm{eq}(T)^{\kappa-2} \begin{bmatrix}m_x\\m_y\\0\end{bmatrix} \right)\end{split}\]

with \(K = (K_x, K_y, K_z)\) as the anisotropy and \(\kappa\) as the uniaxial anisotropy exponent.

Parameters:
  • mag_map (ndarray[float]) – spatio-temporal magnetization map - possibly for a single delay.

  • mf_magnetizations (ndarray[float]) – mean-field magnetization of layers.

  • aniso_exponents (ndarray[float]) – exponent of uniaxial anisotropy of layers.

  • anisotropies (ndarray[float]) – anisotropy vectors of layers.

  • mag_saturations (ndarray[float]) – saturation magnetization of layers.

Returns:

H_A (ndarray[float]) – uniaxial anisotropy field.

static calc_exchange_field(mag_map, exch_stiffnesses, mag_saturations, thicknesses)[source]#

Calculate the exchange component of the effective field, which is defined as for each \(i^\mathrm{th}\) layer in the structure as

\[H_{\mathrm{ex}, i}=\frac{2}{M_{s,i} \Delta z_i^2} \left(A_{i}^{i-1}\left(\mathbf{m}_{i-1}-\mathbf{m}_{i}\right) + A_i^{i+1}\left(\mathbf{m}_{i+1}-\mathbf{m}_{i}\right) \right),\]

where \(\Delta z\) is the thickness of the layers or magnetic grains and \(M_s\) is the saturation magnetization. \(A_{i}^{i-1}\) and \(A_i^{i+1}\) describe the exchange stiffness between the nearest neighboring layers provided by get_directional_exchange_stiffnesses().

Parameters:
  • mag_map (ndarray[float]) – spatio-temporal magnetization map - possibly for a single delay.

  • exch_stiffnesses (ndarray[float]) – exchange stiffness of layers towards the upper and lower layer.

  • mag_saturations (ndarray[float]) – saturation magnetization of layers.

Returns:

H_ex (ndarray[float]) – exchange field.

static calc_thermal_field(mag_map, mag_map_squared, temp_map, mf_magnetizations, eff_spins, curie_temps, mf_exch_couplings, mag_moments, under_tc, over_tc)[source]#

Calculate the thermal component of the effective field.

\[\begin{split}\mathbf{H}_\mathrm{th} = \begin{cases} \frac{1}{2\chi_{\parallel}}\left(1-\frac{m^2}{m_\mathrm{eq}^2} \right)\mathbf{m} & \mathrm{for}\ T < T_\mathrm{C} \\ -\frac{1}{\chi_{\parallel}}\left(1+\frac{3}{5} \frac{T_\mathrm{C}}{T-T_\mathrm{C}}m^2\right)\mathbf{m} & \mathrm{for}\ T \geq T_\mathrm{C} \end{cases}\end{split}\]

with \(\chi_{\parallel}\) being the longitudinal susceptibility.

Parameters:
  • mag_map (ndarray[float]) – spatio-temporal magnetization map - possibly for a single delay.

  • mag_map_squared (ndarray[float]) – spatio-temporal magnetization map squared- possibly for a single delay.

  • temp_map (ndarray[float]) – spatio-temporal temperature map - possibly for a single delay.

  • mf_magnetizations (ndarray[float]) – mean-field magnetization of layers.

  • eff_spins (ndarray[float]) – effective spin of layers.

  • curie_temps (ndarray[float]) – Curie temperature of layers.

  • mf_exch_couplings (ndarray[float]) – mean-field exch. coupling of layers.

  • mag_moments (ndarray[float]) – atomic magnetic moments of layers.

  • under_tc (ndarray[boolean]) – mask temperatures under the Curie temperature.

  • over_tc (ndarray[boolean]) – mask temperatures over the Curie temperature.

Returns:

H_th (ndarray[float]) – thermal field.

static calc_Brillouin(mag, temp, eff_spin, mf_exch_coupling, curie_temp)[source]#
\[B_S(m, T) = \frac{2 S+1}{2S} \coth{\left(\frac{2S+1}{2S} \frac{J \, m}{k_\mathrm{B}\, T}\right)} - \frac{1}{2S}\coth{\left(\frac{1}{2S} \frac{J \, m}{k_\mathrm{B}\,T}\right)}\]

where

\[J = 3\frac{S}{S+1}k_\mathrm{B} \, T_\mathrm{C}\]

is the mean field exchange coupling constant for effective spin \(S\) and Curie temperature \(T_\mathrm{C}\).

Parameters:
  • mag (ndarray[float]) – magnetization of layer.

  • temp (ndarray[float]) – electron temperature of layer.

  • eff_spin (ndarray[float]) – effective spin of layer.

  • mf_exch_coupling (ndarray[float]) – mean-field exch. coupling of layers.

  • curie_temp (ndarray[float]) – Curie temperature of layer.

Returns:

brillouin (ndarray[float]) – brillouin function.

static calc_dBrillouin_dx(temp_map, mf_magnetizations, eff_spins, mf_exch_couplings)[source]#

Calculate the derivative of the Brillouin function \(B_x\) at \(m = m_\mathrm{eq}\):

\[B_x = \frac{dB}{dx} = \frac{1}{4S^2\sinh^2(x/2S)} -\frac{(2S+1)^2}{4S^2\sinh^2\left(\frac{(2S+1)x}{2S}\right)}\]

with \(x=\frac{J\,m}{k_\mathrm{B}\,T}\).

Parameters:
  • temp_map (ndarray[float]) – spatio-temporal temperature map - possibly for a single delay.

  • mf_magnetizations (ndarray[float]) – mean-field magnetization of layers.

  • eff_spins (ndarray[float]) – effective spin of layers.

  • mf_exch_couplings (ndarray[float]) – mean-field exchange couplings of layers.

Returns:

dBdx (ndarray[float]) – derivative of Brillouin function.

static calc_transverse_damping(temp_map, curie_temps, lambdas, qs, mf_magnetizations, under_tc, over_tc)[source]#

Calculate the transverse damping parameter:

\[\begin{split}\alpha_{\perp} = \begin{cases} \frac{\lambda}{m_\mathrm{eq}(T)}\left(\frac{\tanh(q_s)}{q_s}- \frac{T}{3T_\mathrm{C}}\right) & \mathrm{for}\ T < T_\mathrm{C} \\ \frac{2 \lambda}{3}\frac{T}{T_\mathrm{C}} & \mathrm{for}\ T \geq T_\mathrm{C} \end{cases}\end{split}\]
Parameters:
  • temp_map (ndarray[float]) – spatio-temporal temperature map - possibly for a single delay.

  • curie_temps (ndarray[float]) – Curie temperatures of layers.

  • lambdas (ndarray[float]) – coupling-to-bath parameter of layers.

  • qs (ndarray[float]) – qs parameter.

  • mf_magnetizations (ndarray[float]) – mean-field magnetization of layers.

  • under_tc (ndarray[boolean]) – mask temperatures under the Curie temperature.

  • over_tc (ndarray[boolean]) – mask temperatures over the Curie temperature.

Returns:

alpha_trans (ndarray[float]) – transverse damping parameter.

static calc_longitudinal_damping(temp_map, curie_temps, eff_spins, lambdas, qs, under_tc, over_tc)[source]#

calc_transverse_damping

Calculate the transverse damping parameter:

\[\begin{split}\alpha_{\parallel} = \begin{cases} \frac{2\lambda}{S+1} \frac{1}{\sinh(2q_s)} & \mathrm{for}\ T < T_\mathrm{C} \\ \frac{2 \lambda}{3}\frac{T}{T_\mathrm{C}} & \mathrm{for}\ T \geq T_\mathrm{C} \end{cases}\end{split}\]
Parameters:
  • temp_map (ndarray[float]) – spatio-temporal temperature map - possibly for a single delay.

  • curie_temps (ndarray[float]) – Curie temperatures of layers.

  • eff_spins (ndarray[float]) – effective spins of layers.

  • lambdas (ndarray[float]) – coupling-to-bath parameter of layers.

  • qs (ndarray[float]) – qs parameter.

  • under_tc (ndarray[boolean]) – mask temperatures under the Curie temperature.

  • over_tc (ndarray[boolean]) – mask temperatures over the Curie temperature.

Returns:

alpha_long (ndarray[float]) – transverse damping parameter.

static calc_qs(temp_map, mf_magnetizations, curie_temps, eff_spins, under_tc)[source]#

Calculate the \(q_s\) parameter:

\[q_s=\frac{3 T_\mathrm{C} m_\mathrm{eq}(T)}{(2S+1)T}\]
Parameters:
  • temp_map (ndarray[float]) – spatio-temporal temperature map - possibly for a single delay.

  • mf_magnetizations (ndarray[float]) – mean-field magnetization of layers.

  • curie_temps (ndarray[float]) – Curie temperatures of layers.

  • eff_spins (ndarray[float]) – effective spins of layers.

  • under_tc (ndarray[boolean]) – mask temperatures below the Curie temperature.

Returns:

qs (ndarray[float]) – qs parameter.

static calc_long_susceptibility(temp_map, mf_magnetizations, curie_temps, eff_spins, mf_exch_couplings, mag_moments, under_tc, over_tc)[source]#

Calculate the the longitudinal susceptibility

\[\begin{split}\chi_{\parallel} = \begin{cases} \frac{\mu_{\rm{B}}\,B_x(m_{eq}, T)}{ T\,k_\mathrm{B}-J\,B_x(m_{eq}, T)} & \mathrm{for}\ T < T_\mathrm{C} \\ \frac{\mu_{\rm{B}}T_\mathrm{C}}{J(T-T_\mathrm{C})} & \mathrm{for}\ T \geq T_\mathrm{C} \end{cases}\end{split}\]

with \(B_x(m_{eq},T)\) being the derivative of the Brillouin function.

Parameters:
  • temp_map (ndarray[float]) – spatio-temporal temperature map - possibly for a single delay.

  • mf_magnetizations (ndarray[float]) – mean-field magnetization of layers.

  • curie_temps (ndarray[float]) – Curie temperatures of layers.

  • eff_spins (ndarray[float]) – effective spins of layers.

  • mf_exch_couplings (ndarray[float]) – mean-field exchange couplings of layers.

  • mag_moments (ndarray[float]) – atomic magnetic moments of layers.

  • under_tc (ndarray[boolean]) – mask temperatures below the Curie temperature.

  • over_tc (ndarray[boolean]) – mask temperatures over the Curie temperature.

Returns:

chi_long (ndarray[float]) – longitudinal susceptibility.

check_initial_magnetization(init_mag, distances=[])#

Check if a given initial magnetization profile is valid. The profile must be either a vector [amplitude, phi, gamma] describing a global initial magnetization or an array of shape [Nx3] with N being the number of layers or the length of the specific spatial grid. If no initial magnetization is given, the initial profile is determined from the magnetization of the layers on creation. In addition, a spatial grid can be provided.

Parameters:
  • init_mag (ndarray[float]) – initial global or local magnetization profile.

  • distances (ndarray[float, Quantity], optional) – spatial grid of the initial magnetization.

Returns:

init_mag (ndarray[float])

checked initial magnetization as array on

the according spatial grid.

static conv_with_function(y, x, handle)#

Convolutes the array \(y(x)\) with a function given by the handle on the argument array \(x\).

Parameters:
  • y (ndarray[float]) – y data.

  • x (ndarray[float]) – x data.

  • handle (@lamdba) – convolution function.

Returns:

y_conv (ndarray[float]) – convoluted data.

disp_message(message)#

Wrapper to display messages for that class.

Parameters:

message (str) – message to display.

get_hash(**kwargs)#

Calculates an unique hash given by the delays as well as the sample structure hash for relevant magnetic parameters. Optionally, part of the strain_map and temp_map are used.

Parameters:
  • delays (ndarray[float]) – delay grid for the simulation.

  • **kwargs (ndarray[float], optional) – optional delays, strain and temperature profile as well as external magnetic field and initial magnetization.

Returns:

hash (str) – unique hash.

get_magnetization_map(delays, **kwargs)#

Returns an absolute magnetization_map for the sample structure with the dimension \(M \times N \times 3\) with \(M\) being the number of delays and \(N\) the number of layers in the structure or the length of the given spatial grid. Each element of the map contains the three magnetization components [amplitude, phi, gamma]. The angles phi and gamma must be returned in radians as pure numpy arrays. The magnetization_map can depend on the temp_map and strain_map that can be also calculated for the sample structure. More over an external magnetic field H_ext and initial magnetization profile init_mag can be provided.

Parameters:
  • delays (ndarray[Quantity]) – delays range of simulation [s].

  • **kwargs (ndarray[float], optional) – optional strain and temperature profile as well external magnetic field in [T] and initial magnetization.

Returns:

magnetization_map (ndarray[float])

spatio-temporal absolute

magnetization profile.

save(full_filename, data, *args)#

Save data to file. The variable name can be handed as variable argument.

Parameters:
  • full_filename (str) – full file name to data file.

  • data (ndarray) – actual data to save.

  • *args (str, optional) – variable name within the data file.