{
"cells": [
{
"cell_type": "markdown",
"id": "51bd01e1-a35b-4370-be91-9cf4bce19005",
"metadata": {},
"source": [
"# NiTi multilayer example\n",
"\n",
"For our first example, we will consider a simple hard matter system, where there is a **repeating multilayer** of nickel and titanium that has been deposited on a piece of silicon. \n",
"The process by which these systems are prepared typically involves the disposition of a layer of titanium, followed by a layer of nickel, followed by titanium, this process is repeated until the desired number of layers is reached. \n",
"Below we show, graphically, a model that we may use for the simulation of reflectometry data from such a system. \n",
"\n",
"```{figure} ../figures/multilayer.png\n",
"---\n",
"height: 400px\n",
"align: center\n",
"name: multilayer\n",
"---\n",
"A graphical example of the NiTi multilayer system consisting of three repeats. \n",
"```\n",
"\n",
"A common assumption that is made in the analysis of reflectometry data from such a sample include that the structure of each repeat is the same.\n",
"Therefore the model can be defined such that there are only a **limited number of variables**.\n",
"However, this can still be unclear, as three of these parameters will be the scattering length densities of nickel, titanium, and silicon. \n",
"While these values can be obtained from [online databases](https://slddb.esss.dk/slddb/), we can also reparameterise these in terms of the mass density of the material. \n",
"\n",
"## Scattering length density → Mass density\n",
"\n",
"The scattering length density, $\\textrm{SLD}$, for a material is directly related to its mass density, $\\rho$, \n",
"\n",
"```{math}\n",
":label: density\n",
"\\\textrm{SLD} = \\frac{\\rho N_a \\sum_{i=1}^{N}b_i}{M_w}, \n",
"```\n",
"\n",
"where, $N_a$ is Avogadro's constant, $b_i$ are the neutron scattering lengths for each of the $N$ elements in the material, and $M_w$ is the molecular mass of the material.\n",
"Therefore, if we consider nickel, which has a density of $8.908$ gcm^{-3} at room temperature and a [scattering length](https://www.ncnr.nist.gov/resources/n-lengths/elements/ni.html) of $10.3$ fm, the scattering length density is found as follows, \n",
"\n",
"```{math}\n",
":label: calc\n",
"\\\textrm{SLD}_{\\mathrm{Ni}} = \\frac{\\rho_{\\mathrm{Ni}} N_a b_{\\mathrm{Ni}}}{M_{w, \\mathrm{Ni}}} = \\frac{8.91 [\\mathrm{g cm}^{-3}] \\cdot 6.022\\times 10^{23} [\\mathrm{mol}^{-1}] \\cdot 10.3 [\\mathrm{fm}]}{58.69 [\\mathrm{g mol}^{-1}]} = 9.417\\times 10^{-6} [\\mathrm{Å}^{-2}].\n",
"```\n",
"\n",
"We evaluate this in the code below. "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "eb17ed02-7f6e-4f9e-a9b7-c8206aa4fc7d",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import pint\n",
"from scipy.constants import N_A\n",
"u = pint.UnitRegistry()\n",
"\n",
"N_A /= u.mol\n",
"\n",
"def rho_to_SLD(rho: float, b: np.ndarray, m_w: float) -> float:\n",
" \"\"\"\n",
" :param rho: mass density\n",
" :param b: neutron scattering length for individual atoms\n",
" :param m_w: molecular weight\n",
" \"\"\"\n",
" return rho * N_A * np.sum(b) / (m_w)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "22ede2f4-9371-44c2-b401-ee5f8d9a36b4",
"metadata": {},
"outputs": [],
"source": [
"rho_Ni = 8.91 * u.g / (u.cm ** 3)\n",
"b_Ni = np.array([10.3]) * u.fm\n",
"m_w_Ni = 58.69 * u.g / u.mol\n",
"SLD_Ni = rho_to_SLD(rho_Ni, b_Ni, m_w_Ni)\n",
"print(f'SLD_Ni = {SLD_Ni.to(1 / (u.angstrom ** 2)):.3e}')"
]
},
{
"cell_type": "markdown",
"id": "1d0e7a69-ffcb-4b1d-9c52-2c2d3939a1ab",
"metadata": {},
"source": [
"Using this approach, the parameter that we vary in the [model-dependent analysis approach](../model_dependent_analysis/what_is_model_dependent_analysis.md) can be the mass density rather than the more abstract scattering length density. \n",
"Additionally, this means that we can more easily **constrain** our fitting process, by assigning a set of bounds on our parameter (more on this [later](../fitting_processes_and_problems/how_to_leverage_our_prior_knowledge.md)) based on **reasonable** values for the density of the material.\n",
"The majority of fitting packages can allow the reflectometry analysis model to be defined in terms of the parameters such as mass density, instead of the more traditional scattering length density. \n",
"\n",
"We can also find the scattering length density of titanium by the same approach as above. "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "043914e6-d8bc-4bf7-a1c2-4947ab7fa1fa",
"metadata": {},
"outputs": [],
"source": [
"rho_Ti = 4.51 * u.g / (u.cm ** 3)\n",
"b_Ti = np.array([-3.438]) * u.fm\n",
"m_w_Ti = 47.867 * u.g / u.mol\n",
"SLD_Ti = rho_to_SLD(rho_Ti, b_Ti, m_w_Ti)\n",
"print(f'SLD_Ti = {SLD_Ti.to(1 / (u.angstrom ** 2)):.3e}')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}