Peapods
- All plots should be performed using
ggplot2
. - Load the libraries
tidyverse
andbroom
and set the globalggplot2
theme totheme_bw()
.
A bit of context
Don’t worry, you don’t need to know anything related to it to do the exercise!
In this exercise, we’re going to determine the activation energy of the rotation of C60 fullerene molecules in carbon nanopeapods (Figure 1), i.e. C60@SWNT. For this, we’ve performed Inelastic Neutron Scattering spectroscopy at the Institute Laue Langevin in Grenoble. The signal we’ll be working on is a quasi-elastic signal arising from the rotational motion of the fullerenes, and you’ll see that the signal is evolving with temperature on a certain range of temperatures, while it’s constant below a critical temperature.
This is due to the fact that the rotation of the molecules is an activated process: below a certain temperature the thermal fluctuations are not enough to overcome the energy barrier, and the molecules rotations are locked. Above the critical temperature, the rotations are allowed, and the molecules show a diffusive rotation with a statistics following an Arrhenius law.
The width of the quasi-elastic signal is directly related to the amplitude of the rotations. In the following, we want to determine:
(1) the evolution of the signal’s width with temperature, and then
(2) determine the activation energy of the process by fitting an Arrhenius law to this evolution.
Data wrangling
Using
list.files()
, find allxxK.csv
files in the folderData/
, wherexx
is the temperature. You’ll store the result in a vector calledflist
.These files all contain 2 columns,
w
andint
. Usingread_csv()
, load all these files into a tidy tibble calleddf
, with the columnsT
,w
andint
. Using a combination ofas.numeric()
,basename()
andstr_replace()
, make sure the columnT
contains the temperatures as numerical values.
In case you didn’t manage to get there, you can continue by running:
df <- read_csv("Data/alldata.csv")
Plotting and fitting the data
- Now we have loaded our data, let’s take a look at it. Try to make a plot looking like this:
colors <- colorRampPalette(c("black","royalblue","seagreen","orange","red"))
df |>
ggplot(aes(x = w, y = int + as.numeric(factor(T))*.1, color=T)) +
geom_point(alpha=0.5, size=.5)+
scale_color_gradientn(colours = colors(50))+
labs(x="Energy Transfer [meV]",
y="Intensity [arb. units]",
color="T [K]")
Now we see that all signals are Gaussian peaks centered around 0 meV with a varying width. A Gaussian is defined using the function
dnorm(w, mean=w0, sd=FW)
. Modify the following code to fit all the peaks using thenls()
function.Now let’s check that our fit is good by adding a red line to the previous plot, the red line being the result of the fit. For this, we will use the
.fitted
column of the unnestedaugmented
column.Let’s simplify our
df_fit
tibble so that it only contains 3 columns,T
,FW
anddFW
,FW
anddFW
being the result of the fit and the corresponding standard error.
Fitting the Arrhenius law
In case you didn’t manage to get there, you can continue by running:
df_fit_sorted <- read_csv("Data/FW_fit_results.csv")
- Now let’s plot our results to see the evolution of the width with temperature. Add vertical errorbars corresponding to the standard error on the fit.
df_fit_sorted |>
ggplot(aes(x = T, y = FW, ymin=FW-dFW, ymax=FW+dFW)) +
geom_point(size=1)+
geom_errorbar(width=0)+
labs(x = "Temperature [K]",
y = "Width [meV]")
You see that below a certain temperature, there is no evolution of the width, as discussed at the beginning. Create a subset of the
df_fit_sorted
tibble only containing data for which the width evolves with temperature.Now let’s perform the fit of the data using an Arrhenius law like below, where
FW
is the width of the signal. You can either consider it a nonlinear model (and fit it withnls()
) or a linear one (and fit it withlm()
. In that case, you’ll need to add a column containing the1/T
values to perform your fit).
\[ FW = FW_0 \times e^{-E_a/k_BT} \]
- Plot the result of the fit to make sure it’s good, like so:
- What is the value of the activation energy, in Kelvins (with standard error)? Does it make sense to you when seeing the width evolution with temperature?