knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Introduction

The rindex package is designed to follow the same conventions as the mlfilms package for ease of interoperability. The mlfilms package calculates the optical response of a material fora stack of thin films.

As an example, here we import silver's wavelength-dependant refractive index to get the expected reflection from a thin silver film on a prism

A Thin Silver Film

First, we search for a silver refractive index set in the database, and in this example choose the reported values of silver from Johnson & Christy to create a refractive index function,

library(rindex)
head(rindex.search("Ag")) # using head() here just to keep vignette neat.
silver <- rindex.function(1)

This creates a refractive index function silver(). This function accepts one parameter, the wavelength(s) in meters, and returns the complex refractive index. For example, at the HeNe wavelength of 633 nm, the refractive index of silver is:

silver(633e-9)

Angular Optical Response

Here we define the stack to contain a single layer of silver, with a thickness of 40 nm. We then calculate the optical response at a fixed wavelength (defaults to 633 nm) using the mlfilms package.

library(mlfilms)

stack <- list(index = silver, thickness = 40e-9)

angle_response <- angle_scan(stack, incident_medium.index = 1.5)

Plotting the result, we see the characteristic reflection minima of a surface plasmon resonance.

plot(angle_response$angle, angle_response$Reflection, type='l')

Full Optical Response

To see the dispersive nature of the surface plasmon (due to the wavelegth-dependant refractive index of silver), we can calculate the full response using mlfilms::dispersion_scan() of the same stack.

optical_response <- dispersion_scan(stack, incident_medium.index = 1.5, show.progress = F)

image(x = unique(optical_response$angle),
      y = unique(optical_response$wavelength),
      z = matrix(optical_response$Reflection, ncol = 100),
      xlab = "angle (degrees)", ylab = "wavelength(m)", col = topo.colors(128))


tjconstant/rindex documentation built on May 31, 2019, 3:39 p.m.