+++
title = "Materials"
weight = 30
+++

## Materials

The refractive properties of a homogeneous `Material` can be specified
through two different constructors:

* `RefractiveMaterial`, based on the refractive index,
* `SLDMaterial`, based on the scattering length density (SLD).

Both constructors take a material name and an RGB color tuple. The color is
used only for visualization.

`RefractiveMaterial` is equally suitable for X-rays or neutrons. However, it
does not account for the wavelength dependence of the refractive index. This
leads to incorrect results if there is too much spread in the incoming
wavelength, as is regularly the case in neutron time-of-flight experiments.

`SLDMaterial` is intended for neutron experiments with significant wavelength
spread. Refractive indices as function of wavelength are computed internally
from constant SLDs.

##### Material by refractive index

A `Material` can be created through

```python
color = (0.8, 0.2, 0.2)
material = ba.RefractiveMaterial("name", color, delta, beta)
```

where `name` is the arbitrary name of the material associated with its complex
refractive index $n = 1 - \delta + i\beta$.

Optionally, the constructor takes an additional
[magnetization](/ref/sample/material/magnetization) argument.

##### Material by scattering length density

A `Material` can also be created through

```python
color = (0.8, 0.2, 0.2)
material = ba.SLDMaterial("name", color, sld_real, sld_imag)
```

Here `sld_real` and `sld_imag` are the real and imaginary parts of the material
scattering length density (SLD) according to the following convention
([Sears, Neutron News 3, 26 (1992)](https://doi.org/10.1080/10448639208218770)):

$$SLD = sld\_\{real\} - i \cdot sld\_\{imag\}$$

In this convention, the imaginary part of the SLD must be nonnegative.

SLD units are inverse square angstroms: $ \overset{\circ}{A^{-2}} $.

Optionally, the constructor takes an additional
[magnetization](/ref/sample/material/magnetization) argument.

Magnetization units are ampere per meter: $ A/m $.

SLD values for a wide variety of materials can be calculated with numerous
online SLD-calculators, e.g. these ones:

* [sld-calculator.appspot.com](https://sld-calculator.appspot.com/)
* [SLD calculator by NIST](https://www.ncnr.nist.gov/resources/activation/)

The first of these returns values in inverse square angstroms, which are also
the input units for `SLDMaterial`. Thus the SLD values found with the
calculator can be directly copied and pasted into a BornAgain script.

##### Vacuum

Use the dedicated `Vacuum` material for ambient layers:

```python
material = ba.Vacuum()
```

##### Restrictions and limitations

`SLDMaterial` and `RefractiveMaterial` can be used in the same sample. If
material averaging combines both representations, BornAgain converts the
average to an `SLDMaterial`.

`SLDMaterial` does not account for causes of damping other than nuclear
absorption. In particular, incoherent and inelastic scattering are neglected.
Usually, such extra damping would change the imaginary part of the refractive
index only little compared with the real part; neglecting it therefore should
have no big effect upon simulation results.
