A little while ago (while avoiding my thesis), I wrote a small R package for the calculation of the optical response of multilayer thin films. It’s called mlfilms and is avaliable on github.

As a quick example, here is how you’d calculate and plot the reflection from a thin silver film through a prism. This is a standard experiment in our lab which results in a reflectivity minima associated with a surface plasmon excitation.

Firstly, load up the package.

library(mlfilms)

I’ll also load up ggplot and photonMonkey for plotting.

library(ggplot2)
library(photonMonkey)

Then we simply construct a stack with an appropriate refractive index and thickness (45 nm), and calculate the reflection (the default covers an angle between 0 and 90 degrees), with incident medium set to glass.

Plotting the result using ggplot shows a critical edge related to the onset of total internal reflection in the prism, and the reflectivity minima resulting from a surface plasmon excitation on the silver/air interface.

This package uses the transfer matrix method for this calculation, as outlined in Pedrotti, Pedrotti and Pedrotti. Currently it only does reflection, not trasnmission.