# Documentation of user libs (user functions)¶

## Supeconducting Gap-Integrals to calculate \(1/\lambda^2\) vs \(T\)¶

The details about the various superconducting gap-integrals are found in the
pdf-file **GapIntegrals.pdf** which can be found in the musrfit source under
`<musrfit-dir>/src/external/libGapIntegrals/`

.

## Depth resolved information (AS libs)¶

A method to extract depth-resolved information from the implantation energy dependence of the experimental parameters in a low-energy muon spin spectroscopy experiment. For details see A. F. A. Simões, et al. Review of Scientific Instruments. 2020; 91(2): 023906 (7 pp.).

If you have a layered material (e.g. \(N\) layers), properties like the asymmetry might depend on the layer in which the muons are stopped. For instance there might be different probabilities for muonium formation depending on the material, charge transfer layers, etc.

Since the muon stopping distribution, \(n(z)\), has some finite range, these properties will be smeared out. For the following we define the stopping probability, \(p_{i}(E)\) for a finite slice \(i\), ranging from \(z \in [a, b]\) as

Furthermore it is assumes that there is a sharp transition between the layers of the property of interest, e.g. the diamagnetic fraction, \(f_i\). Hence the measured property as function of energy is

Note

Currently it is recommended to read in the data in ASCII or DAT format as a non-μSR fit (fit type 8).

The user library for the depth profile analysis looks for a **3 layer material**, assuming one is looking for the diamagnetic fraction, like

```
###############################################################
FITPARAMETER
# Nr. Name Value Step Pos_Error Boundaries
1 f1 0.54540 0.00072 none 0 1
2 f2 0.23957 0.00048 none
3 f3 0.05615 0.00047 none 0 1
4 x1 63.5000 0.0014 none
5 x2 101.5001 0.0044 none
###############################################################
THEORY
userFcn libPDepthProfile PDepthProfile 1 2 3 4 5
```

Here, \(f1\) is the diamagnetic fraction of the first layer, etc. \(x1\) is the thickness of the first layer, etc.

In order to find the muon stopping profile, \(n(z,E)\), needed for the calculation, the library needs to find the corresponding trimsp rge-files (muon stoppping profiles). For this the library reads at start-up the following xml-file (example):

```
<?xml version="1.0" encoding="UTF-8"?>
<depthProf xmlns="http://nemu.web.psi.ch/musrfit/depthProf">
<comment>
TrimSp information
</comment>
<trim_sp>
<data_path>./TRIMSP/</data_path>
<rge_fln_pre>SiO2_70nm2.0_30nm2.2_SiC_E</rge_fln_pre>
<energy_vect start="1000" stop="22000" step="1000"/>
</trim_sp>
</depthProf>
```

## Functions to analyze β-NMR data (BNMR libs)¶

This is a collection of `C++`

classes using the `musrfit`

user-functions
interface in order to facilitate the usage in conjunction with `musrfit`

. It consists of two libraries:

`libBNMR`

contains functions to fit spin lattice relaxation (SLR) data.`libLineProfile`

contains functions to fit resonance lineshapes.

Note

Currently it is recommended to read in the data in ASCII format as a non-μSR fit (fit type 8).

### libBNMR¶

In β-NMR the SLR is usually measured by implanting a pulse of \(^8\)Li with a length \(t_0\) into the sample. The asymmetry is measured both during the pulse and afterwards. For a a general spin relaxation function \(f(t)\) the time evolution of the asymmetry is then given by [Z. Salman, et al., PRL 96, 147601 (2006)]:

where \(\tau_{\mathrm{Li}}=1.21\)s is the \(^8\)Li lifetime.

#### Functions¶

The `libBNMR`

library currently contains the following functions:

**Exponential relaxation**

```
userFcn libBNMR ExpRlx 1 2
```

The parameters are:

- pulse length \(t_0\) (s)
- relaxation rate \(\lambda\) (s\(^{-1}\))

This function implements \(f(t)=e^{-\lambda t}\).

**Stretched exponential relaxation**

```
userFcn libBNMR SExpRlx 1 2 3
```

The parameters are:

- pulse length \(t_0\) (s)
- relaxation rate \(\lambda\) (s\(^{-1}\))
- stretching exponent \(\beta\)

This function implements \(f(t)=e^{-(\lambda t)^{\beta}}\).

### libLineProfile¶

In addition to some simple line shapes `libLineProfile`

contains functions to fit chemical shift anisotropies in the powder average.
Their functional form can be found in M. Mehring, Principles of High Resolution NMR in Solids (Springer 1983).

For an axially symmetric interaction it is given by:

where \(f_\parallel\) and \(f_\perp\) are the frequencies that would be observed if the field is oriented paralell or perpendicular to the symmetry axis, respectively.

\(K(m)\) is the complete elliptic integral of the first kind.

#### Functions¶

The `libLineProfile`

library currently contains the following functions:

**Gaussian**

```
userFcn libLineProfile LineGauss 1 2
```

The parameters are:

- center of the line \(f_0\)
- FWHM of the line \(\sigma\)

**Lorentzian**

```
userFcn libLineProfile LineLorentzian 1 2
```

The parameters are:

- center of the line \(f_0\)
- FWHM of the line \(w\)

**Laplacian**

```
userFcn libLineProfile LineLaplace 1 2
```

The parameters are:

- center of the line \(f_0\)
- FWHM of the line \(w\)

**Skewed Lorentzian**

```
userFcn libLineProfile LineSkewLorentzian 1 2 3
```

The parameters are:

- center of the line \(f_0\)
- width of the line \(w\)
- skewness parameter \(a\)

**Skewed Lorentzian 2**

```
userFcn libLineProfile LineSkewLorentzian2 1 2 3
```

The parameters are:

- center of the line \(f_0\)
- width left of the center \(w_1\)
- width right of the center \(w_2\)

**Powder average of an axially symmetric interaction convoluted with a Lorentzian**

```
userFcn libLineProfile PowderLineAxialLor 1 2 3
```

The parameters are:

- frequency for the field oriented paralell to the symmetry axis \(f_\parallel\)
- frequency for the field oriented perpendicular to the symmetry axis \(f_\parallel\)
- FWHM of the Lorentzian \(w\)

with \(I_{\mathrm ax}(f)\) defined above.

**Powder average of an axially symmetric interaction convoluted with a Gaussian**

```
userFcn libLineProfile PowderLineAxialGss 1 2 3
```

The parameters are:

- frequency for the field oriented paralell to the symmetry axis \(f_\parallel\)
- frequency for the field oriented perpendicular to the symmetry axis \(f_\parallel\)
- FWHM of the Gaussian \(\sigma\)

with \(I_{\mathrm ax}(f)\) defined above.

**Powder average of an anisotropic interaction convoluted with a Lorentzian**

```
userFcn libLineProfile PowderLineAsymLor 1 2 3 4
```

The parameters are:

- \(f_1\)
- \(f_1\)
- \(f_3\) frequencies along the principal axes
- FWHM of the Lorentzian \(w\)

with \(I(f)\) defined above. Note that \(f_1<f_2<f_3\) is not required by the code.

**Powder average of an anisotropic interaction convoluted with a Gaussian**

```
userFcn libLineProfile PowderLineAsymGss 1 2 3 4
```

The parameters are:

- \(f_1\)
- \(f_1\)
- \(f_3\) frequencies along the principal axes
- FWHM of the Gaussian \(\sigma\)

with \(I(f)\) defined above. Note that \(f_1<f_2<f_3\) is not required by the code.