CrysFiPy under mikibox package

class mikibox.crysfipy.CEFion(ion: Ion, Hfield: tuple, cfp: CEFpars, diagonalize: bool = True)[source]

Object representing a rare-earth ion in CF potential. It is internally calculated in the meV units.

Parameters:
  • ion – string Name of the ion. They are tabulated in ion with their parameters.

  • Hfield – 1D array of floats External magnetic field in T units.

  • cfpcrysfipy.CEFpars Crystal field parameters

  • diagonalize – bool, optional If true (default) then it automatically diagonalizes Hamiltonian, calculates energy levels and sorts all matrices so that the first eigenvector corresponds to the lowest energy level and the last one to the highest.

Examples

TODO ce = CEFion(“Ce”, [0,0,0], [“T”, 10]) print(ce) Energy levels: E(0) = 0.0000 2fold-degenerated E(1) = 3600.0000 4fold-degenerated

ion

crysfipy:ion The ion object that represents an isolated rare-earth ion.

Jval

int/2 The J value corresponding to the L+S quantum numbers. Not to be confused with the J operator.

Hfield

array_like Vector in real space corresponding to the external magnetic field in T units.

cfp

crysfipy.reion.cfp Crystal field parameters

hamiltonian

ndarray Hamiltonian operator. \(\hat{\mathcal{H}} = \sum_{ij} B_i^j \hat{O}_i^j + g_J (H_x \hat{J}_x + H_y \hat{J}_y + H_z \hat{J}_z)\)

Jx, Jy, Jz

ndarray Matrices representing the prinicpal quantum operators \(\hat{J}_\\alpha`\) with \(\\alpha=[x,y,z]\).

J

ndarray Total angular momentum vector operator \(\hat{J}=[\hat{J}_x, \hat{J}_y, \hat{J}_z]\). It’s multidimensionality takes some time to get used to.

energies

ndarray Eigenenergies of the Hamiltonian.

eigenvectors

ndarray Eigenvectors of the Hamiltonian.

degeneracies

list List containing entries like [energy, degeneracy], which describes how degenerated is the given energy level.

freeionkets

list List of kets corresponding to the J basis of the free ion problem.

class mikibox.crysfipy.Ion(ion_name: str)[source]

Class representing an isolated rare-earth ion and its fundamental parameters.

J

int/2 Quantum number describing the total angular momentum L-S

J2p1

int Degeneracy of the manifold

gJ

float Lande coefficient

Alpha

float \(\alpha\) parameter

Beta

float \(\beta\) parameter

Gamma

float \(\gamma\) parameter

mffCoefficients

dict Dictionary of coefficients, used to calculate the magnetic form factor

boltzman_population(energies: list[float], temperature: float) list[float]

Calculate the population of energy levels at given temperature based on the Boltzmann statistic. \(p_i = \frac{1}{Z} e^{-E_i/k_B T}\) \(Z = \sum_i e^{-Ei/k_BT}\) One important distinction, is that this function works with eigenvalues (energies) from the whole Hilbert space, as it needs to evaluate \(Z\) on its own. This works well for the total angular momentum Hilbert space, and does care about degeneracies.

Parameters:
  • energies – List of energy levels in meV units

  • temperature – Temperature at which to evaluate the statistic

Returns:

List of occupation probabilities for each energy level.

magnetization(cefion: CEFion, temperature: float, Hfield: tuple[float, float, float])

Calculate the magnetization of the single ion in the crystal field. Returned value is in \(\mu_B\) units.

\(M_\alpha = g_J \sum_n p_n |<\lambda_n | \hat{J}_\alpha | \lambda_n>|\)

Parameters:
  • cefion – Rare-earth ion in the crystal field

  • temperature – temperature at which to calculate magnetization

  • Hfield – Applied magnetic field. Both direction and vlue are important.

neutronint(cefion: CEFion, temperature: float, Q: tuple, scheme: str, Ei: float = 1000000.0)

Returns matrix of energies and inelastic neutron scattering spectral weights for all possible transitions at given temperature.

The spectral weight is calculated by equation from Enderle book following Stephane Raymond article.

\(S(\vec{Q},\omega) = N (\gamma r_0)^2 f^2_m(Q) e^{-2W(Q)} \sum_{if} \frac{k_f}{k_i} p_i |<\lambda_f|J_\perp|\lambda_i>|^2 \delta(E_i - E_f - \hbar \omega)\)

where:

\(N (\gamma r_0)^2\) : ignored, acts as units.
\(f^2_m(Q)\) : magnetic form factor, taken from internal tables in mikibox.crysfipy.Ion class.
\(e^{-2W(Q)}\) : \(W(Q)\) is the Debye-Waller factor. It is quite problematic, is set to 1 at the moment.
\(\frac{k_f}{k_i}\) : scaling factor calculated from energy, which is used more widely \(\frac{k_f}{k_i} = \sqrt{1-\frac{\Delta E}{E_i}}\). there is a minus under the square root, because positive energy transfer corresponds to neutron energy loss.
\(p_i\) : Boltzmann population factor.
\(|<\lambda_f|J_\perp|\lambda_i>|^2\) : matrix elements, exact description depends on Q, see below.

The intensities are evaluated based on the \(|<\lambda_f|J_\perp|\lambda_i>|^2\) matrix elements, which form a matrix \(|J_\perp|^2\). Two main cases are implemented and encoded in the Q parameter.

Parameters:
  • cefionCEFion Rare-earth ion in the crystal field

  • tempreature – Temperature in K

  • Q – List of Q vectors used to evaluate the spectral weight

  • scheme

    ‘powder’, ‘single-crystal’: Scheme according to which \(|J_\perp|^2\) is calculated.

    • powder : \(|<\lambda_f|J_\perp|\lambda_i>|^2 = 2/3\sum_\alpha |<\lambda_f|J_\alpha|\lambda_i>|^2\) (default).

    • (single-crystal : \(|<\lambda_f|J_\perp|\lambda_i>|^2 = \sum_\alpha (1-\frac{Q_\alpha}{Q})|<\lambda_f|J_\alpha|\lambda_i>|^2\). Q is a vector representing a direction in the reciprocal space in respect to which a perpendicular projection of \(J\) will be calculated.

Returns:

Array containing energies of the transitions intensities: Array containing intensities of the transitions

Return type:

energies

Raises:
  • ValueError – When an invalid Q parameter is chosen, or the dimension of the Q vector is not 3.

  • RuntimeWarning – When Q=[0,0,0], where the spectral weight is ill defined.

susceptibility(cefion: CEFion, temperatures: list[float], Hfield_direction: tuple[float, float, float], method: str = 'perturbation') list[float]

Calculate the magnetic susceptibility at listed temperatures, based on one of the implemented methods.

perturbation: Based on assuming an infitezimal applied field that perturbes the Hamiltonian, the eigenstates are calculated by means od perturbation theory and given by formula:

\(\chi_{CEF} = (g_J \mu_B)^2 \left[ \sum_{n,m \neq n} p_n \frac{1-exp(-\Delta_{m,n}/k_B T)}{\Delta_{m,n}} |<\lambda_m|J|\lambda_n>|^2 + \frac{1}{k_B T} \sum_{n} p_n |<\lambda_n|J|\lambda_n>|^2 \right]\)

where

\(g_J \mu_B\) : Lande factor, Bohr magneton.
\(p_n\) : Ptobabitlity of occupying the energy level \(\lambda_n\) at given temperature.
\(\Delta_{m,n}\) : Energy of transition between the \(\lambda_n\) and \(\lambda_m\) levels.
\(<\lambda_m|J|\lambda_n>\) : J matrix elements.

magnetization: Based on calculating a numerical derivative of the magnetization, with a very small magnetic field

\(\chi_{CEF} = \left. \frac{\partial \vec{M}}{\partial \vec{H}} \right|_{\vec{H}=\epsilon}\)

Magnetization is calculated internally by magnetization(). Value \(\epsilon = 10^{-8}\)

ALL BELOW MADE A CRASH FOR ANOTER SYSTEM In calculations a dangerous trick is used. The \(\frac{1-exp(-\Delta_{m,n}/k_B T)}{\Delta_{m,n}}\) factor is computed as a matrix, so naturally it will be divergent on the diagonal, since \(\Delta_{m,n}=0\) there. This raises a RuntimeWarning which is ignored , and the diagonal is replaced with the \(1/k_B T\) values, and the two summations are bundled together. This feels dirty, but works so far, even for spin-half systems, which have degenerated energy levels. Maybe because the transitions between degenerated levels are not exactly 0 in the calculations (1e-15 rather).

Parameters:
  • cefioncrysfipy.CEFion Rare-earth ion in crystal field

  • temperatures – ndarray Array ocntaining temperatures at which to compute the susceptibility.

  • Hfield_direction – Direction of the applied magnetic field. Value can be arbitrary, it is normalized in the code.

  • method – optional, ‘perturbation’, ‘magnetization’ Method by which to calculate susceptibility. Old implementation

Returns:

List of susceptibility values calculated at given temperatures. In the units of \(\mu_B^2\).

thermodynamics(cefion, T)

Calculate the fundamental thermodynamic values as a function of temperature.

These functions are calculated alltogether taking advantage of the fact that thermodynamics can be determined from the partition function \(Z\), upon differentiation on \(\beta\), where \(\beta = \frac{1}{k_B T}\).

Partition function: \(Z = \sum_n e^{-\beta E_n}\)
Average energy: \(\langle E \rangle = - \frac{\partial Z}{\partial \beta}\)
Entropy: \(S = k_B ( \ln Z - \beta \frac{\partial Z}{\partial \beta} )\)
Heat capacity: \(C_V = k_B \beta^2 \frac{\partial^2 Z}{\partial \beta^2}\)
Parameters:
  • cefioncrysfipy.CEFion Rare-earth ion in crystal field

  • T – ndarray Temperature

Returns:

The partition function, average energy (internal energy), entropy and heat capacity, respectively.

Return type:

Z, E, S CV