# A model for fitting the spectral response¶

This module provides he framework to model the spectroscopic response of the scattering lengths around an 2p absorption edge. The approach was first presented by van der Laan [Laan97] for modelling the line shape of the XMCD (x-ray magnetic circular dichrosim) spectrum of the 3d metals and later used experimentally by Gold, Bayer and Goering [Gold04] for fitting XMCD spectra and extracting moments.

The ground state moment model has also been justified by Dörfler and Fähnle [Dörfler06].

## Theory¶

All the equation shown in this section are reproduced from [Laan97] if not otherwise stated.

The total intensity, $$I_{j,m}^{(r)}$$, from an $$j,m$$ level can be written as

$I_{j,m}^{(a), \mathrm{tot}} = \sum_{x,y,z} \left<\underline{w}^{x,y,z}\right> \sum_r C_j^{xyzar} u_{jm}^r = \sum_{x,y,z} \left<\underline{w}^{x,y,z}\right> h_{jm}^{xyza},$

where $$C_j^{xyzar}$$ is the probability of creating a core hole $$j$$ with a multipole moment $$r$$ using a polarised light that belongs to the ground state moment $$\left<\underline{w}^{x,y,z}\right>$$. The underscore signifies that the properties belong to the holes. The physical meaning of the different ground state moments can be found in the table below.

Ground state moment

Meaning

$$\left<\underline{w}^{000}\right>$$

The number of holes, $$n_h$$

$$\left<\underline{w}^{110}\right>$$

Spin orbit coupling $$-\sum_i{l_i \dot s_i}$$

$$\left<\underline{w}^{101}\right>$$

The orbital magnetic moment $$L_z/2$$

$$\left<\underline{w}^{011}\right>$$

The spin magnetic moment $$2S_z$$

$$\left<\underline{w}^{211}\right>$$

The “magnetic dipole” operator $$7T_z/2$$

$$\left<\underline{w}^{202}\right>$$

The quadrupole moment $$-Q_{zz}/2$$

$$\left<\underline{w}^{112}\right>$$

??

$$\left<\underline{w}^{312}\right>$$

??

$$\left<\underline{w}^{303}\right>$$

??

$$\left<\underline{w}^{213}\right>$$

??

$$\left<\underline{w}^{413}\right>$$

??

$$\left<\underline{w}^{404}\right>$$

??

$$\left<\underline{w}^{314}\right>$$

??

$$\left<\underline{w}^{415}\right>$$

??

Unpolarised light correspond to $$a = 0$$, circular dichroism correspond to $$a = 1$$ and linear dichroism to $$a = 2$$. The values for $$h_{jm}^{xyza}$$ has been tabulated in [Laan97] and can be found reproduced below.

Values for $$h_{jm}^{xyza}$$ for each ground state moment and j and light polarisation $$a$$.

a = 0

a = 1

a = 2

$$\left<\underline{w}^{xyz}\right>$$

$$j = \frac{3}{2}$$

$$j = \frac{1}{2}$$

$$j = \frac{3}{2}$$

$$j = \frac{1}{2}$$

$$j = \frac{3}{2}$$

$$j = \frac{1}{2}$$

$$\left<\underline{w}^{000}\right>$$

$$2u_{jm}^0$$

$$u_{jm}^0$$

$$\frac{5}{9}u_{jm}^1$$

$$\frac{1}{3}u_{jm}^1$$

$$\frac{1}{5}u_{jm}^2$$

$$\left<\underline{w}^{110}\right>$$

$$u_{jm}^0$$

$$-u_{jm}^0$$

$$\frac{4}{9}u_{jm}^1$$

$$-\frac{1}{3}u_{jm}^1$$

$$\frac{2}{5}u_{jm}^2$$

$$\left<\underline{w}^{101}\right>$$

$$\frac{5}{3}u_{jm}^1$$

$$-u_{jm}^1$$

$$2u_{jm}^0 + \frac{2}{5}u_{jm}^2$$

$$u_{jm}^0$$

$$\frac{2}{3}u_{jm}^1$$

$$\frac{2}{5}u_{jm}^1$$

$$\left<\underline{w}^{011}\right>$$

$$\frac{10}{9}u_{jm}^1$$

$$u_{jm}^1$$

$$\frac{1}{3}u_{jm}^0 + \frac{2}{3}u_{jm}^2$$

$$-\frac{1}{3}u_{jm}^0$$

$$\frac{2}{45}u_{jm}^1 + \frac{3}{6}u_{jm}^3$$

$$-\frac{2}{15}u_{jm}^1$$

$$\left<\underline{w}^{211}\right>$$

$$\frac{2}{9}u_{jm}^1$$

$$-\frac{1}{3}u_{jm}^1$$

$$\frac{2}{3}u_{jm}^0 + \frac{2}{15}u_{jm}^2$$

$$-\frac{2}{3}u_{jm}^0$$

$$\frac{22}{45}u_{jm}^1 + \frac{6}{35}u_{jm}^3$$

$$-\frac{4}{15}u_{jm}^1$$

$$\left<\underline{w}^{202}\right>$$

$$u_{jm}^2$$

$$-\frac{2}{3}u_{jm}^1$$

$$\frac{10}{9}u_{jm}^1$$

$$\frac{2}{3}u_{jm}^1$$

$$2u_{jm}^0 + \frac{2}{7}u_{jm}^2$$

$$u_{jm}^0$$

$$\left<\underline{w}^{112}\right>$$

$$2u_{jm}^0$$

$$\frac{34}{45}u_{jm}^1 + \frac{6}{5}u_{jm}^3$$

$$-\frac{4}{15}u_{jm}^1$$

$$\frac{2}{5}u_{jm}^0 + \frac{2}{5}u_{jm}^2$$

$$-\frac{2}{5}u_{jm}^0$$

$$\left<\underline{w}^{312}\right>$$

$$\frac{2}{15}u_{jm}^1 + \frac{3}{35}u_{jm}^3$$

$$-\frac{2}{5}u_{jm}^1$$

$$\frac{3}{5}u_{jm}^0 + \frac{6}{35}u_{jm}^2$$

$$-\frac{3}{5}u_{jm}^0$$

$$\left<\underline{w}^{303}\right>$$

$$\frac{3}{5}u_{jm}^2$$

$$u_{jm}^1$$

$$\frac{3}{5}u_{jm}^1$$

$$\left<\underline{w}^{213}\right>$$

$$3u_{jm}^3$$

$$\frac{6}{5}u_{jm}^2$$

$$\frac{24}{35}u_{jm}^1 + \frac{24}{35}u_{jm}^3$$

$$-\frac{9}{35}u_{jm}^1$$

$$\left<\underline{w}^{413}\right>$$

$$\frac{4}{35}u_{jm}^1 + \frac{4}{35}u_{jm}^3$$

$$-\frac{12}{35}u_{jm}^1$$

$$\left<\underline{w}^{404}\right>$$

$$\frac{18}{35}u_{jm}^2$$

$$\left<\underline{w}^{314}\right>$$

$$\frac{12}{7}u_{jm}^3$$

$$\frac{36}{35}u_{jm}^2$$

$$\left<\underline{w}^{415}\right>$$

$$\frac{10}{7}u_{jm}^3$$

The $$h_{jm}^{xyza}$$ expressions contain unevaluated $$u_{jm}^r$$ values.

$\begin{split}u_{jm}^r = \left(2r + 1\right) n_{jr} (-)^{(j - m)} \left(\begin{matrix} j & r & j \\ -m & 0 & m \end{matrix}\right),\end{split}$

where

$\begin{split}n_{jr} = \left(\begin{matrix} j & r & j \\ -j & 0 & j \end{matrix}\right),\end{split}$

is a normalisation factor. The symbols written out as matrices are Wigner 3j symbols. These have been evaluated using RREF [Stone80].

$$j$$

$$n_{j0}$$

$$n_{j1}$$

$$n_{j2}$$

$$n_{j3}$$

$$\frac{3}{2}$$

$$\frac{1}{2}$$

$$\frac{1}{2}\sqrt{\frac{3}{5}}$$

$$\frac{1}{2}\sqrt{\frac{1}{5}}$$

$$\frac{1}{2}\sqrt{\frac{1}{35}}$$

$$\frac{1}{2}$$

$$\frac{1}{\sqrt{2}}$$

$$\frac{1}{\sqrt{6}}$$

$$0$$

$$0$$

Calculating the $$u_{jm}^r$$ for the different combinations of $$j$$, $$m$$ and $$r$$ yields the following table.

$$j, m$$

$$u_{jm}^0$$

$$u_{jm}^1$$

$$u_{jm}^2$$

$$u_{jm}^3$$

$$\frac{3}{2}, -\frac{3}{2}$$

$$\frac{1}{4}$$

$$-\frac{9}{20}$$

$$\frac{1}{4}$$

$$-\frac{1}{20}$$

$$\frac{3}{2}, -\frac{1}{2}$$

$$\frac{1}{4}$$

$$-\frac{3}{20}$$

$$-\frac{1}{4}$$

$$\frac{3}{20}$$

$$\frac{3}{2}, \frac{1}{2}$$

$$\frac{1}{4}$$

$$\frac{3}{20}$$

$$-\frac{1}{4}$$

$$-\frac{3}{20}$$

$$\frac{3}{2}, \frac{3}{2}$$

$$\frac{1}{4}$$

$$\frac{9}{20}$$

$$\frac{1}{4}$$

$$\frac{1}{20}$$

$$\frac{1}{2}, -\frac{1}{2}$$

$$\frac{1}{2}$$

$$-\frac{1}{2}$$

$$0$$

$$0$$

$$\frac{1}{2}, \frac{1}{2}$$

$$\frac{1}{2}$$

$$\frac{1}{2}$$

$$0$$

$$0$$

$$I_{j,m}^{(a), \mathrm{tot}}$$ yields the total intensity of a certain state. In order to calculate the line shape the energy position of each line has to be known as well as its shape function. The energy splitting, $$E_s$$, between different $$m$$ is given by exchange field, $$H_s$$ as

$E_s = H_s m \frac{j(j+1) + s(s+1) - l(l+1)}{2j(j+1)}.$

Also, the edge energies of the $$L_2$$ and $$L_3$$ has to be known. This can be implemented as defining the energy of the $$L_3$$ edge, $$E_{L_3}$$, and the 2p-SOC which yields the splitting between the levels, $$E_\mathrm{SOC}$$.

The shape of a atomic transition will depend on the lifetime of the excitation and consequently it will have an lorentz shape. However, other broadening mechanisms exists as well. For example, the band structure will yield a broadening that corresponds to the band structure. This has successfully been modelled as a linear superposition of different gaussian contributions [Gold04]. Instrumental resolution is also usually considered to have a gaussian distribution. The Voigt function which is the convolution between a lorentzian function and a gaussian function is therefore suitable to use.

## References:¶

Laan97(1,2,3)

Laan, G. Van Der. (1997). Line shape of 2p magnetic-x-ray-dichroism spectra in 3d metallic systems. Physical Review B, 55(13), 8086–8089.

Laan, G. (1997). The role of the spin polarization in x-ray magnetic circular dichroism spectra of itinerant magnets. Journal of Physics: Condensed Matter, 9, L259–L265.

Gold04

Gold, S., Bayer, a., & Goering, E. (2004). Ground-State-Moment-Analysis: A quantitative tool for X-ray magnetic circular dichroism analysis for 3d transition metals. Applied Physics A: Materials Science & Processing, 78(6), 855–865. doi:10.1007/s00339-003-2442-8

Dörfler06

Dörfler, Fabian (2006). Contributions to the theory of x-ray magnetic dichroism. Max-Planck-Institut fur Metallforschung Stuttgart and Universität Stuttgart. PhD thesis.

Dörfler, F., & Fähnle, M. (2006). Theoretical justification of ground-state moment analysis of magnetic dichroic x-ray absorption spectra for 3d transition metals. Phys. Rev. B, 74(22), 224424. doi:10.1103/PhysRevB.74.224424

Stone80

Stone, A and Wood, (1980). C. Comp. Phys. Comm., 21 , 195.

class genx.models.lib.xmcd_moment.Background2p(parent, element, **kwargs)

A class to model the 2p background spectra, the non-resonant part, with a smoothed step function.

Parameters
• el3 (float) – Energy position of the L3 edge.

• sigma (float) – The width of the error function (std in eV).

• pre_edge (float) – The width of the pre edge region (eV).

• post_edge (float) – The width of the post edge region (eV).

• de (float) – The sampling spacing for the recalcualted table (eV).

• kk_emax (float) – The maximum energy values taken from the tables in eV. The value should be well above the K edge.

• element (string) – The element to which the background applies. Used to find theoretical f values (from the nist database), position of the L2/L3 edge and Z (number of electrons).

• parent (Spectra2p) – The parent spectra to which the Background applies.

The background, B, is modelled with two error function according to

$B = a_0 + a_1 e + (a_2 + a_3 e) \Phi(e, e_l3) + (a_4 + a_5 e) \Phi(e, e_l2),$

where

$\Phi(e, e_0) = \frac{1}{2}\left( 1 + \mathrm{erf}\left( \frac{e - e_0}{\sqrt{2} \sigma} \right)\right).$

This function is used to up-sample the theoretical, tabulates, f2 values for the spectral region (the L2/L3 within the pre and post edge values) to a point spacing of de. This data then replaces the data in the tabulated f2 values and a Kramer-Kronig (KK) transform is conducted to get the f1 values. Note that the tabulated values in the class contains a moved L2/L3 edge since this removes the necessity of conducting a full KK transform when a new background is calculated. The KK transform fulfill the superposition principle. The KK transform conducted when the complex are calculated, which is the difference between the tabulated and the current, over the spectral region only.

Note that this implementation does incorporates exchange split levels.

The parameters relating to KK transform are:
• sigma_tab (float): The width of the error function applied to the table (std in eV), defualt value 1 eV.

• edge_offset_tab (float): The offset of the stored tabulated data to the read data (eV), defualt value 40 eV.

Fitting parameters
• el3

• sigma

calc_abs(energy)

Calculates the absorption background function for the given energies.

Parameters

Returns

Absorption, the complex part of the scattering length.

Return type

Abs (array of floats)

calc_f(energy)

Calculates the complex background scattering length for energy.

Parameters

Returns

Scattering length.

Return type

f (array of complex)

create_bkg_f1(e_l3, e_l2, e_tab, f2_tab)

Create the background f1 data to be used in later calculations.

The method will fit the tabulated f2 value to analytical function and replace the step in the table with a error function (with a width (std) given by the parameter sigma_tab) whose steps are offset edge_offset_tab eV. This function is then regridded with a step size of de on a range of e_l3 + pre_edgeand e_l2 - pre_edge. These values are then merged into the original f2 values in the f2_tabarray. This array is Kramer-Kronig transformed to yield the corresponding f1 values. The values are stored as f1_tab and f2_tab.

Parameters
• e_l3 (float) – Position of the L3 edge in eV.

• e_l2 (float) – Position of the L2 edge in eV.

• e_tab (array of floats) – The scattering length tables energy values in eV.

• f2_tab (array of floats) – The f2 values of the scattering length tables.

Returns

Nothing.

fit_table_data(e_tab, f2_tab, pre_slice, between_slice, post_slice)

Fits the L2 and L3 steps in tabular data to parametrise the spectra in the fitting range.

Parameters
• e_tab (array of floats) – The scattering length tables energy values in eV.

• f2_tab (array of floats) – The f2 values of the scattering length tables.

• pre_slice (slice) – A slice object that contain the pre edge data.

• between_slice (slice) – A slice object that indexes the region between the L2 and L3 edge.

• post_slice (slice) – A slice object that indexes the region post edge region.

Returns

A function of the form f(e, e_l3, e_l2, sigma).

Return type

f (function)

Load an nff (scattering length table) file.

Parameters
• file_path (string) – Path to file.

• e_l3_tab (float) – Position of the L3 edge in the table (eV).

• e_l2_tab (float) – Position of the L2 edge in the table (eV).

Returns

Nothing.

class genx.models.lib.xmcd_moment.ModelGoering(w000=0.0, w110=0.0, w101=0.0, w011=0.0, w211=0.0, w202=0.0, gamma=0.5, sigma=0.1, soc=0.0, hs=0.0, e_L3=0.0, valid_e=710.0)

A fit model to simulate one xmcd spectral moment of a p_3/2, p_1/2 absorption edge.

calc_fm1(e)

Calculates the fm1 structure factor

Parameters

Returns

fm1 scattering factor

xmcd(e)

Calculates the xmcd absorption signal.

Parameters

e – The energy where the xmcd is calculated.

Returns

xmcd signal

class genx.models.lib.xmcd_moment.Spectrum2p(hs=0.0, soc=0.0, gsm=((0, 0, 0), (1, 1, 0), (1, 0, 1), (0, 1, 1), (2, 1, 1), (2, 0, 2)), norm_denom=(1.0, 1.0, 1, 1.0, 1.0, 1.0), valid_e=700.0)

Class to model the lineshape of a 2p level including dichroism.

Parameters
• hs (float) – The exchange field (eV).

• soc (float) – The spin orbit coupling (eV).

• gsm (list of tuples 3xint) – The ground state moments used in the spectra, a list of 3 int tuples.

• norm_denom (list of floats) – The normalisation denominators for the ground state moments (same order as gsm).

• valid_e (float) – Energy (eV) where a validation (type check) of the function is made when the scattering lengths are inserted in a validator (used in the Reflectivity plugin).

This class contains spectra-wide parameters for the model. It also contains the scattering lengths that can be used in a reflectivity model. The scattering lengths functions are

• fres - The resonant (unpolarised) part of the scattering length.

• fm1 - The dicroic part of the scattering length. The imaginary part correspond to the XMCD signal.

• fm2 - The linear dichroic signal. The imaginary part correspond to the XMLD signal.

The wXYZs from the SpectrumComponent class is scaled according to the following formula

$w^{xyxz}_\mathrm{eff} = w^{xyz}_\mathrm{SpectrumComponent} w^{xyz}_\mathrm{Spectrum2p}/\mathrm{norm\_denom}.$

The subscripts on the right hand side denote which class the w parameter belongs to. The use for these normalisation could be to define normalisation factors (norm_denom) from reference spectra with known values of number of holes, spin magnetic moment and orbital magnetic moment. While keeping the spectral shape constant, constant $$w^{xyz}_\mathrm{SpectrumComponent}$$ the overall spectra can be scaled to change the different values with the parameters $$w^{xyz}_\mathrm{Spectrum2p}$$.

Fitting Parameters
• hs(float) - The exchange field that causes the levels to split (eV).

• soc(float) - The spin orbit coupling (distance between L_2 and L_3 edge (eV).

• wXYZ(float) - The different global ground state moments (X, Y and Z are integers.

Member functions for simulation
• add_component - Add an component (ground state moment set) to the spectra.

• calc_spectra - Calculates a spectra (fm1, fres and fm2 can be used as well).

calc_fm1(energy)

Calculate the circular dirchroic compenet.

calc_fm2(energy)

Calculate the linear dichroic component.

calc_fres(energy)

Calculate the isotropic resonant scattering length.

calc_spectra(energy, a)

Calculates the total spectra.

Sums up all contributions from the different components.

Parameters
• energy (float or array) – The energy where to evaluate the spectra.

• a (int) – Number representing the exciting polarization.

Returns

Return type

spectra(complex array or complex)

calc_spectra_comp(energy, comp, a)

Calculates the spectra from one component

Parameters
• e (float array) – The energy values where the spectra are to be calcualted.

• comp (SpectralComponent) – The spectral component.

• a (int) – The polarization of the exciting light.

Returns

Return type

spectra (complex np.array)

class genx.models.lib.xmcd_moment.SpectrumComponent(spectra, gsm, **kwargs)

Class to keep the variables of a spectral component.

genx.models.lib.xmcd_moment.calc_de(hs, j, l, s)

Calculates the energy spacing between different m levels due to the exchange field hs.

Parameters
• hs (float) – The exchange filed in eV

• j (float) – The j quantum number of the core level

• l (float) – The l quantum number of the core level

• s (float) – The s quatum number of the core level

Returns

The energy spacing

Return type

de(float)

genx.models.lib.xmcd_moment.calc_h(xyz, j2, m2, a)

Calculate the h values for the given parameters.

For a full description see the Theory section in module documentation.

Parameters
• xyz (tuple, 3 int) – A tuple indicating the ground state moment.

• j2 (int) – The j quantum number multiplied by 2 (value 3 or 1).

• m2 (int) – The m quantum number multiplied by 2 (value [-j2 .. j2]).

• a (int) – The polarisation of the exciting light.

Returns

Transition probability of the given state with ground state moment 1.

Return type

h (float)

genx.models.lib.xmcd_moment.create_h_table(j2, xyz_values, a)

Create an h values for the given j level’s m subleves for the different xyz values

Parameters
• j2 (int) – 2*j where j is the j quatum number for the ground state.

• xyz_values (list) – A list of three int tuples denoting the ground state moment.

Returns

Return type

h_table(array)

genx.models.lib.xmcd_moment.create_interval(x, x_min, x_max)

Creates a closed slice [x_min, x_max] where x_min < x[slice] < x_max.

Returns

slice object

genx.models.lib.xmcd_moment.kk_int(e, f2, Z=0, e_min=None, e_max=None)

Do the Kramer Kronig transform from f2 to f1

If the parameters e_min or e_max is given the evaluation range is reduced so that the final size of f1kk is reduced. The Kramer-Kronig transformation is conducted as suggested by the Newville in the DIFFKK manual. The integrand is defined as in the XOP data booklet.

Parameters
• e (array of floats) – Energy values of the values found in f2 (eV).

• f2 (array of floats) – The imaginary part of the scattering length (electrons)

• Z (int) – The number of electrons of the element, (electrons).

• e_min (float) – The minimum value of the returned real part of f.

• e_max (float) – The maximum value of the returned real part of f.

Returns

The energy values for the calculated f1 (eV). array of floats: The real part of the scattering length, f1, (electrons).

Return type

array of floats

References

Newville, M. and Olmsted Cross J. DIFFKK Manual. Downloaded from http://cars9.uchicago.edu/dafs/diffkk/diffkk.pdf 20140902.

X-ray data booklet, CXRO, Lawrence Berkley National Laboratory, Downloaded from http://xdb.lbl.gov 20140902.

genx.models.lib.xmcd_moment.kk_int_old(e_new, e, f2, Z, offset=0.1, offset_outer=1, e_step=0.1)

Original Kramer-Kronig transform - a slower implementation of kk_int

genx.models.lib.xmcd_moment.step_func(x, x0, sigma)

Defines the step funciton (erf) of the L2/L3 edges

x (array of floats): x0 (float): sigma (float):

Returns

Return type

step_func (array of floats)

genx.models.lib.xmcd_moment.test_h()

Compare the calculations with previously tabulated values.

Validate the calculation of the u values by comparing the h values calculated by this module with the ones calculated from the (Gold, 2004)

References

Gold, S., Bayer, a., & Goering, E. (2004). Ground-State-Moment-Analysis: A quantitative tool for X-ray magnetic circular dichroism analysis for 3d transition metals. Applied Physics A: Materials Science & Processing, 78(6), 855–865. doi:10.1007/s00339-003-2442-8

genx.models.lib.xmcd_moment.voigt(x, x_0, gamma, sigma)

The complex Voigt function (a convolution of a Lorentzian and a Gaussian function).

Parameters
• x (array or float) – Independent value where to evaluate the Voigt function.

• x_0 (float or array) – Centre of the peak.

• gamma (float or array) – Scale parameter (HWHM) of the Lorentzian part.

• sigma (float or array) – The standard deviation of the Gaussian part.

Returns

The complex Voigt function evaluated at x

Return type

V(complex array)

The complex Voigt function is defined as

$V(x,\sigma,\gamma) = w(z)/(\sigma*sqrt(2*pi)),$

where

$z = (x+i*\gamma)/(\sigma*sqrt(2)).$

$$\gamma$$ is the half width at half max of the Lorentizan component and $$sigma$$ is the standard deviation of the Gaussian component.

References

http://en.wikipedia.org/wiki/Voigt_profile