Magnetic#

The magnetic module contains functions for working with magnetic moments required for setting up a magnetic refinement.

cartesian(mu1, mu2, mu3, C)[source]#

Components of magnetic moment in Cartesian coordiantes \(\mu_x\), \(\mu_x\), and \(\mu_x\).

Parameters:
mu1, mu2, mu3float or 1d array

Components of magnetic momenet \(\mu_1\), \(\mu_2\), and \(\mu_3\).

C2d array, 3x3

Transform matrix from crystal axis to Cartesian coordiante system.

Returns:
mu_x, mu_y, mu_z1d array

Magnetic moment components in Cartesian coordinates. Has same size as input magnetic moment components.

f(Q, j0, j2=0, K2=0)[source]#

Magnetic form factor \(f(Q)\).

Parameters:
Q1d array.

Magnitude of wavevector.

j0, j21d array

\(j_0\) and \(j_2\) constant with same shape as wavevector.

K21d array, optional

Coupling constant, defualt K2=0.

Returns:
f1d array

Form factor. Has the same shape as the input wavevector.

form(Q, ions, g=2)[source]#

Magnetic form factor \(f(Q)\).

Parameters:
Q1d array

Magnitude of wavevector.

ions1d array, str

Magnetic ions.

gfloat, 1d array, optional

\(g\) factor of the spins, defualt g=2.

Returns:
f1d array

Form factor. Has the same shape as the input wavevector.

intensity(Qx_norm, Qy_norm, Qz_norm, Sx_k, Sy_k, Sz_k, i_dft, factors)[source]#

Magnetic scattering intensity.

Parameters:
Qx_norm, Qy_norm, Qz_norm1d array

Normalized wavevector component \(\hat{Q}_x\), \(\hat{Q}_y\), and \(\hat{Q}_z\).

Sx_k, Sy_k, Sz_k1d array

Fourier transform of the spin vector component \(S_x\), \(S_y\), and \(S_z\) component.

i_dft1d array, int

Array indices of Fourier transform corresponding to reciprocal space.

factors1d array

Prefactors of form factors and phase factors.

Returns:
I1d array

Intensity. Array has a flattened shape of size i_dft.shape[0].

j0(Q, A, a, B, b, C, c, D)[source]#

Appoximation of the integral with the zeroth-order spherical Bessesl function \(j_0(Q)\).

Parameters:
Q1d array

Magnitude of wavevector \(Q\).

A, a, B, b, C, c, Dfloat

Constants \(A_0\), \(a_0\), \(B_0\), \(b_0\), \(C_0\), \(c_0\) and \(D_0\).

Returns:
j01d array

Approximation of \(\langle j_0(Q)\rangle\). Has the same shape as the input wavevector.

j2(Q, A, a, B, b, C, c, D)[source]#

Appoximation of the integral with the second-order spherical Bessesl function \(j_2(Q)\).

Parameters:
Q1d array

Magnitude of wavevector \(Q\).

A, a, B, b, C, c, Dfloat

Constants \(A_2\), \(a_2\), \(B_2\), \(b_2\), \(C_2\), \(c_2\) and \(D_2\).

Returns:
j21d array

Approximation of \(\langle j_2(Q)\rangle\). Has the same shape as the input wavevector.

magnitude(mu1, mu2, mu3, C)[source]#

Magnitude of magnetic moment \(\mu\).

Parameters:
mu1, mu2, mu31d array

Components of magnetic momenet \(\mu_1\), \(\mu_2\), and \(\mu_3\).

C2d array, 3x3

Transform matrix from crystal axis to Cartesian coordiante system.

Returns:
mu1d array

Magnetic moment magnitude. Has same size as input magnetic moment components.

spin(nu, nv, nw, n_atm, value=1, fixed=True)[source]#

Generate random spin vectors.

Parameters:
nu, nv, nwint

Number of grid points \(N_1\), \(N_2\), \(N_3\) along the \(a\), \(b\), and \(c\)-axis of the supercell.

n_atmint

Number of atoms in the unit cell.

Returns:
Sx, Sy, Sz1d array

Spin vector components. Each array has a flattened shape of size nu*nw*nv*n_atm.

structure(Qx_norm, Qy_norm, Qz_norm, Sx_k, Sy_k, Sz_k, i_dft, factors)[source]#

Partial magnetic structure factor.

Parameters:
Qx_norm, Qy_norm, Qz_norm1d array

Normalized wavevector component \(\hat{Q}_x\), \(\hat{Q}_y\), and \(\hat{Q}_z\).

Sx_k, Sy_k, Sz_k1d array

Fourier transform of the spin vector component \(S_x\), \(S_y\), and \(S_z\) component.

i_dft1d array, int

Array indices of Fourier transform corresponding to reciprocal space.

factors1d array

Prefactors of form factors and phase factors.

Returns:
Fx, Fy, Fz1d array

Magnetic structure factor components. Each array has a flattened shape of size i_dft.shape[0].

prod_x, prod_y, prod_z1d array

Magnetic partial structure factor components. Each array has a flattened shape of size i_dft.shape[0]*n_atm.

transform(Sx, Sy, Sz, H, K, L, nu, nv, nw, n_atm)[source]#

Discrete Fourier transform of spin vectors.

Parameters:
Sx, Sy, Sz1d array

Spin vector component \(S_x\), \(S_y\), and \(S_z\) in Cartesian components along the \(x\), \(y\), and \(z\)-direction.

H, K, L1d array, int

Supercell index along the \(a^*\), \(b^*\), and \(c^*\)-axis in reciprocal space.

nu, nv, nwint

Number of grid points \(N_1\), \(N_2\), \(N_3\) along the \(a\), \(b\), and \(c\)-axis of the supercell.

n_atmint

Number of atoms in the unit cell.

Returns:
Sx_k, Sy_k, Sz_k1d array

Fourier transform of spin vector components. Each array has a flattened shape of size nu*nw*nv*n_atm.

i_dft1d array, int

Fourier transform indices. Array has a flattened shape of size nu*nw*nv*n_atm.