### Use tabulated dielectric constant for real materials

In this tutorial, we will calculate the absorption spectrum of a uniform Silicon slab. The refractive index of Si is based on the Handbook of Optical Constants of Solids, Edward D. Palik. Academic Press, Boston, 1985. The wavelength range is from 400nm – 700nm.

Figure 1. Structure of the 1 micrometer uniform Silicon slab surrounded by air. Light is normally incident. The wavelength range is from 400 nm to 700 nm.

The simulated result is shown below.

Figure 2. Absorption spectrum of the uniform Silicon slab shown in Figure 1.

The Lua script for this case is shown below and can be downloaded here.

```S = S4.NewSimulation()
S:SetLattice({1,0}, {0,1})
S:SetNumG(1)
--can be set to be 1 since it is just a simple slab.
--define materials, we will replace Si’s index with real index later
--tabulated data for Si’s dielectric constant
--the first column is wavelength in micro
--the 2nd and 3rd are the real and imaginary part of the dielectric constant
indices_Si = S4.NewInterpolator('cubic spline', {
{0.3899,{35.064,6.6737}},
{0.3924,{33.8739,5.9004}},
{0.3949,{32.7856,5.2385}},
{0.3974,{31.7947,4.7041}},
{0.4,{30.8751,4.3112}},
{0.4025,{30.047,3.9}},
{0.4052,{29.2682,3.5664}},
{0.4078,{28.5138,3.3485}},
{0.4105,{27.836,3.0753}},
{0.4133,{27.1969,2.8094}},
{0.4161,{26.6019,2.6336}},
{0.4189,{26.0423,2.4932}},
{0.4217,{25.5314,2.3064}},
{0.4246,{25.0456,2.1138}},
{0.4275,{24.5703,2.0142}},
{0.4305,{24.1294,1.9074}},
{0.4335,{23.7022,1.8026}},
{0.4366,{23.3043,1.7875}},
{0.4397,{22.9248,1.6289}},
{0.4428,{22.5644,1.5495}},
{0.446,{22.2373,1.406}},
{0.4492,{21.8989,1.3952}},
{0.4525,{21.5862,1.2364}},
{0.4558,{21.2811,1.2091}},
{0.4592,{20.987,1.1916}},
{0.4626,{20.7126,1.1929}},
{0.4661,{20.4305,1.2119}},
{0.4696,{20.1906,1.0788}},
{0.4732,{19.9308,1.0718}},
{0.4769,{19.7233,0.79956}},
{0.4806,{19.4922,0.83021}},
{0.4843,{19.274,0.72891}},
{0.4881,{19.0644,0.68999}},
{0.492,{18.8557,0.66882}},
{0.4959,{18.6571,0.63072}},
{0.4999,{18.4675,0.62751}},
{0.504,{18.2884,0.56456}},
{0.5081,{18.0998,0.61272}},
{0.5123,{17.9316,0.5082}},
{0.5166,{17.7626,0.5058}},
{0.5209,{17.6033,0.46995}},
{0.5254,{17.4445,0.44276}},
{0.5299,{17.2954,0.35767}},
{0.5344,{17.1376,0.3726}},
{0.5391,{16.9968,0.39581}},
{0.5438,{16.8573,0.36133}},
{0.5486,{16.718,0.35983}},
{0.5535,{16.5883,0.26067}},
{0.5585,{16.4578,0.30833}},
{0.5636,{16.3367,0.25869}},
{0.5687,{16.2075,0.27377}},
{0.574,{16.0952,0.24072}},
{0.5794,{15.9753,0.21584}},
{0.5848,{15.8634,0.23898}},
{0.5904,{15.7521,0.23814}},
{0.5961,{15.6492,0.21362}},
{0.6019,{15.5466,0.19715}},
{0.6078,{15.4521,0.19655}},
{0.6138,{15.3501,0.18806}},
{0.6199,{15.2564,0.17186}},
{0.6262,{15.155,0.17129}},
{0.6326,{15.0696,0.14752}},
{0.6391,{14.9766,0.13932}},
{0.6458,{14.8839,0.13117}},
{0.6526,{14.7992,0.1231}},
{0.6595,{14.7223,0.12278}},
{0.6666,{14.6381,0.11478}},
{0.6738,{14.554,0.10682}},
{0.6812,{14.4779,0.09893}},
{0.6888,{14.4094,0.098696}},
{0.6965,{14.3412,0.098462}},
{0.7045,{14.2731,0.090672}},
{0.7126,{14.1977,0.082896}},
{0.7208,{14.145,0.082742}},
{0.7293,{14.0774,0.07504}},
{0.738,{14.0249,0.0749}},
{0.7469,{13.9576,0.067248}},
{0.756,{13.8979,0.067104}},
{0.7653,{13.8458,0.059536}},
{0.7749,{13.7937,0.059424}},
{0.7847,{13.727,0.05187}},
{0.7948,{13.6678,0.051758}},
{0.8051,{13.6013,0.044256}},
{0.8157,{13.5497,0.044172}},
{0.8266,{13.4908,0.07346}},
})
--set incident wave
S:SetExcitationPlanewave({0,0},{0,0},{1,0})
for lda = 0.4,0.7,0.001 do
--since the simulation is really fast, we do not need to use high throughput loop (parfor)
freq = 1/lda
S:SetFrequency(freq)
--get dielectric constant of Si for a particular frequency
eps_real_Si,eps_imag_Si = indices_Si:Get(lda)
--reset the material’s dielectric constant
S:SetMaterial('Si',{eps_real_Si,eps_imag_Si})
forward,backward = S:GetPowerFlux('AirAbove')
transmission = S:GetPowerFlux('Bottom')
ref = -backward
--calculate absorption
print(lda, (forward -ref - transmission))
end
```