---
title: "Surface plasmon-polaritons in the Kretschmann configuration"
date: "`r format(Sys.time(), '%d %B, %Y')`"
author: "baptiste Auguié"
output:
  rmarkdown::html_vignette:
    toc: true
    toc_depth: 2
    fig_width: 7
    fig_height: 4
    fig_caption: true
vignette: >
  %\VignetteIndexEntry{kretschamnn reflectivity}
  %\VignetteEngine{knitr::rmarkdown}
  \usepackage[utf8]{inputenc}
---

```{r demo, message=FALSE, echo=FALSE}
knitr::read_demo("kretschmann_reflectivity", package="planar")
```
The Kretschmann configuration consists of a thin metal film, typically 50nm of gold or silver, deposited on top of a high-index prism (n=1.5 for glass). Light incident from the prism side undergoes total internal reflection (TIR) above ~45 degrees (internal angle). The evanescent field associated with TIR penetrates the metal and may couple to surface plasmon-polaritons supported at the air/metal interface.

Here we model the optical properties of such a system, starting with the angular variation of the reflectivity.

### Reflectivity against internal incident angle for the Kretschmann configuration, at fixed wavelength

```{r load, echo=FALSE,results='hide'}
```

#### Setting up

```{r setup, results='hide'}
```

#### Modelling the reflectivity

```{r simulation}
```

#### Plotting the results

```{r reflectivity,fig.width=10}
```

#### Variation of the parameters, and effect on the resonance

We now look at the effect of changing the thickness of the metal layer, from non-existent (single air/glass interface), to an opaque metal film. First, we wrap the calculation in a function, and loop over this function with a vector of film thicknesses.

```{r loop}
```


```{r variation}
```
