# Specular

Specular scattering from a multilayered sample with surface roughness.

The sample is composed of a substrate on which is sitting a stack of layers (similar to Correlated Roughness). These layers consist in a repetition of 10 times two different superimposed layers (from bottom to top):

•  layer A: 5 nm thick with a real refractive index n = 1-5e-6.
•  layer B: 10 nm thick with a real refractive index n = 1-1e-5.

There is no added particle.

All layers present the same type of roughness on the top surface, which is characterized by (see Correlated Roughness for a definition of the "roughness" parameters) :

• a rms roughness of the interfaces σ =1 nm,
• a Hurst parameter H equal to 0.3,
• a lateral correlation length ξ of 500 nm,
• a cross correlation length ξ equal to 0 nm.

The incident beam is characterized by a wavelength of 1.54 Å.

The incident angle αi varies between 0 and 2°.

The numerical results are plots of the Fresnel coefficients |R| and |T| for different layers as functions of the incident angle αi. The layers are numbered starting from the top layer (air). Therefore

• Layer 0 is the air layer, for which |T|=1,
• Layer 1 is the first material layer (layer A),
• Layer 20 is the last material layer (layer B),
• Layre 21 is the substrate, for which |R|=0.
Real-space model:
Intensity Image:
Python Script:
"""
R and T coefficients in multilayer, ba.Specular simulation.
"""
import numpy
import bornagain as ba
from bornagain import deg, angstrom, nm

alpha_i_min, alpha_i_max = 0.0, 2.0  # incoming beam

def get_sample():
"""
Returns a sample with two layers on a substrate, with correlated roughnesses.
"""
m_ambience = ba.HomogeneousMaterial("ambience", 0.0, 0.0)
m_part_a = ba.HomogeneousMaterial("PartA", 5e-6, 0.0)
m_part_b = ba.HomogeneousMaterial("PartB", 10e-6, 0.0)
m_substrate = ba.HomogeneousMaterial("substrate", 15e-6, 0.0)

l_ambience = ba.Layer(m_ambience)
l_part_a = ba.Layer(m_part_a, 5.0*nm)
l_part_b = ba.Layer(m_part_b, 10.0*nm)
l_substrate = ba.Layer(m_substrate)

roughness = ba.LayerRoughness()
roughness.setSigma(1.0*nm)
roughness.setHurstParameter(0.3)
roughness.setLatteralCorrLength(500.0*nm)

my_sample = ba.MultiLayer()

# adding layers
my_sample.addLayer(l_ambience)

n_repetitions = 10
for i in range(n_repetitions):
my_sample.addLayerWithTopRoughness(l_part_a, roughness)
my_sample.addLayerWithTopRoughness(l_part_b, roughness)

my_sample.addLayerWithTopRoughness(l_substrate, roughness)

return my_sample

def get_simulation():
"""
Returns a specular simulation with beam and detector defined.
"""
simulation = ba.SpecularSimulation()
simulation.setBeamParameters(
1.54*angstrom, 500, alpha_i_min*deg, alpha_i_max*deg)
return simulation

def run_simulation():
"""
Runs simulation and returns it.
"""
sample = get_sample()
simulation = get_simulation()
simulation.setSample(sample)
simulation.runSimulation()
return simulation

def coefficientsRT(simulation):
"""
Returns coefficients
"""
R = [ [ abs(c) for c in simulation.getScalarR(i) ] for i in range(22) ]
T = [ [ abs(c) for c in simulation.getScalarT(i) ] for i in range(22) ]
return R, T

def plot(simulation):
"""
Plots results for several selected layers
"""
from matplotlib import pyplot as plt
fig = plt.figure(figsize=(12.80, 10.24))

alpha_angles = simulation.getAlphaAxis().getBinCenters()
R, T = coefficientsRT(simulation)

selected_layers = [0, 1, 20, 21]
nplot = 1
for layer_index in selected_layers:
plt.subplot(2, 2, nplot)
plt.ylim(ymax=50.0, ymin=1e-06)
plt.xlabel(r'$\alpha_f$ (rad)', fontsize=16)
plt.semilogy(alpha_angles, [ numpy.abs(coeff) for coeff in R[layer_index] ])
plt.semilogy(alpha_angles, [ numpy.abs(coeff) for coeff in T[layer_index] ])
plt.legend(['|R| layer #'+str(layer_index),
'|T| layer #'+str(layer_index)],
loc='upper right')
nplot += 1

plt.show()

if __name__ == '__main__':
results = run_simulation()
plot(results)