This example use case also exists in a jupyter notebook form titled ATR-SEIRAS_example.ipynb
from opticalc_330 import *
We can use the testImport() function to see if the file has been imported correctly:testImport()
If the program was imported correctly, it should print Import successful. to standard output.mat = materials("frequency", 60, 1200, 1300, 101)
mat.setFixed("Si", 3.4)
Next, we'll model the test molecule as a Lorentz oscillator with B = 30000 cm-2, γ = 20 cmmat.setLorentz("LO", [30000], [20], 1.8, [1250])
Next, we can define the permittivity of the conductive ITO underlayer using the Drude model:mat.setDrude("ITOc", 17000, 900, 3.8)
Finally, we will read in the permittivity values of gold and water from the csv file. This function can import multiple files in one go, so it expects an array of strings:mat.importMat(["Au", "Water"])
We have now defined the permittivity values of our bulk materials. However, the interface of the working electrode is a rough surface made up of nanoparticles, coated with the test molecule, and immersed in the electrolyte. This type of inhomogeneous system is not properly modelled by a uniform slab of a single material. Rather than fully model this complex system, we can use an effective medium approximation (EMA), provided that the structure of the nanoparticles is significantly smaller than the wavelength of light.mat.setMultiBruggeman("Samp_multiDroplet", ["Au", "org", "H2O"], [f1, f2samp, 1.0-f1-f2samp])
We also need a reference case where the "org" particles are absent:mat.setMultiBruggeman("Ref_multiDroplet", ["Au", "H2O"], [f1, 1.0-f1])
Note that permittivity, ε, and complex refractive index, η, are two different ways of representing the same information. All of the above methods that we used to calculate ε also automatically calculate η and both are stored as entries in a dictionary. The ε value can be accessed with the key ["eps"] and the η value can be accessed with the key ["eta"]. Each of ε and η are stored as the numpy data type complex. For example, this is how one would access the ε of Au:mat.matDict["Au"]["eps"]
Let's plot up the permittivities to check that they are reasonable.plt.plot(mat.nu, mat.matDict["BR"]["eta"].real, mat.nu, mat.matDict["BR"]["eta"].imag)
plt.legend("n", "k")
plt.xlabel("Wavenumber")
plt.title("Complex refractive index of Bruggeman layer")
plt.show()
samp = PhaseSys(4, mat)
samp.setLayers(["Si", "ITOc", "Samp_multiDroplet", "Water"])
samp.setThicknesses([25, 20])
Finally, we can specify the type of calculation. Here we will calculate the p-polarized reflectivity:Rp_samp = samp.calcR("p")
The same calculations can be repeated for the "reference" reflectivity spectrum: ref = PhaseSys(4, mat)
ref.setLayers(["Si", "ITOc", "Ref_multiDroplet", "Water"])
ref.setThicknesses([25, 20])
Rp_ref = ref.calcR("p")
Finally, the absorptivity spectrum can be calculated from: A = -log10(Rp_samp / Rp_ref), and this result can be plotted.