Sample - multilayer 1
[1]:
import nexus as nx
[2]:
# function to create a Ta and SiC layer
# the function returns two new layers each time it is called
def create_layers(number):
# for each material and layer we use number for indexing the id
# this helps to find the layers in the outputs from Nexus
# the instances mat_ta, layer_ta, mat_sic and layer_sic cannot be referenced outside the function as the names only exist in the function
mat_ta = nx.Material.Template(nx.lib.material.Ta)
mat_ta.id = "mat Ta "+ str(number)
layer_ta = nx.Layer(id = "lay Ta "+str(number),
thickness = nx.Var(2, min = 1, max = 3, fit = True, id = "ta thickness "+str(i)), # nm
material = mat_ta,
roughness = 0.2)
mat_sic = nx.Material.Template(nx.lib.material.SiC)
mat_sic.id = "mat SiC "+ str(number)
layer_sic = nx.Layer(id = "lay SiC "+str(number),
thickness = nx.Var(3, min = 2, max = 4, fit = True, id = "sic thickness "+str(i)), # nm
material = mat_sic,
roughness = 0.1)
return [layer_ta, layer_sic]
# we have to pass the complete list of objects to the Sample
# so we create an empty list called multilayer
multilayer = []
# and add the two layers 10 times
# index starts with 1
for i in range(1, 11, 1):
# use list.extend function and not .append here because the create function returns a list of layer objects
multilayer.extend(create_layers(i))
# define the substrate
substrate = nx.Layer(id = "substrate",
material = nx.Material.Template(nx.lib.material.Si),
thickness = nx.inf,
roughness = 0.1)
# add the substrate
# append a single layer object
multilayer.append(substrate)
# define the sample
sample = nx.Sample(id = "my multilayer",
layers = multilayer)
print(sample)
# you get an index for each layer use can use to reference tha layers in the sample
# now we can access the layers in the sample like this
# change the thickness and density of the second Ta layer "lay Ta 2"
sample.layers[2].thickness = 7
sample.layers[2].material.density = 13
print(sample)
# only the thickness and density of the second Ta layer has changed.
Sample
.id: my multilayer
.geometry: f
.angle (deg) = 0.0
.divergence (deg) = 0.0
.length (mm) = 10.0
.roughness (model): a
-------|------------------------|---------------|-------------|-------------|--------|-----------|----------|-------------|
index | Layer id | dens. (g/cm3) | thick. (nm) | rough. (nm) | abund. | LM factor | HI sites | dist points |
-------|------------------------|---------------|-------------|-------------|--------|-----------|----------|-------------|
0 | lay Ta 1 | 16.69 | 2.0 | 0.2 |0.99988 | 0.0 | | |
1 | lay SiC 1 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
2 | lay Ta 2 | 16.69 | 2.0 | 0.2 |0.99988 | 0.0 | | |
3 | lay SiC 2 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
4 | lay Ta 3 | 16.69 | 2.0 | 0.2 |0.99988 | 0.0 | | |
5 | lay SiC 3 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
6 | lay Ta 4 | 16.69 | 2.0 | 0.2 |0.99988 | 0.0 | | |
7 | lay SiC 4 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
8 | lay Ta 5 | 16.69 | 2.0 | 0.2 |0.99988 | 0.0 | | |
9 | lay SiC 5 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
10 | lay Ta 6 | 16.69 | 2.0 | 0.2 |0.99988 | 0.0 | | |
11 | lay SiC 6 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
12 | lay Ta 7 | 16.69 | 2.0 | 0.2 |0.99988 | 0.0 | | |
13 | lay SiC 7 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
14 | lay Ta 8 | 16.69 | 2.0 | 0.2 |0.99988 | 0.0 | | |
15 | lay SiC 8 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
16 | lay Ta 9 | 16.69 | 2.0 | 0.2 |0.99988 | 0.0 | | |
17 | lay SiC 9 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
18 | lay Ta 10 | 16.69 | 2.0 | 0.2 |0.99988 | 0.0 | | |
19 | lay SiC 10 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
20 | substrate | 2.336 | inf | 0.1 | 0.0 | 0.0 | | |
-------|------------------------|---------------|-------------|-------------|--------|-----------|----------|-------------|
Sample
.id: my multilayer
.geometry: f
.angle (deg) = 0.0
.divergence (deg) = 0.0
.length (mm) = 10.0
.roughness (model): a
-------|------------------------|---------------|-------------|-------------|--------|-----------|----------|-------------|
index | Layer id | dens. (g/cm3) | thick. (nm) | rough. (nm) | abund. | LM factor | HI sites | dist points |
-------|------------------------|---------------|-------------|-------------|--------|-----------|----------|-------------|
0 | lay Ta 1 | 16.69 | 2.0 | 0.2 |0.99988 | 0.0 | | |
1 | lay SiC 1 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
2 | lay Ta 2 | 13.0 | 7.0 | 0.2 |0.99988 | 0.0 | | |
3 | lay SiC 2 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
4 | lay Ta 3 | 16.69 | 2.0 | 0.2 |0.99988 | 0.0 | | |
5 | lay SiC 3 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
6 | lay Ta 4 | 16.69 | 2.0 | 0.2 |0.99988 | 0.0 | | |
7 | lay SiC 4 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
8 | lay Ta 5 | 16.69 | 2.0 | 0.2 |0.99988 | 0.0 | | |
9 | lay SiC 5 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
10 | lay Ta 6 | 16.69 | 2.0 | 0.2 |0.99988 | 0.0 | | |
11 | lay SiC 6 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
12 | lay Ta 7 | 16.69 | 2.0 | 0.2 |0.99988 | 0.0 | | |
13 | lay SiC 7 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
14 | lay Ta 8 | 16.69 | 2.0 | 0.2 |0.99988 | 0.0 | | |
15 | lay SiC 8 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
16 | lay Ta 9 | 16.69 | 2.0 | 0.2 |0.99988 | 0.0 | | |
17 | lay SiC 9 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
18 | lay Ta 10 | 16.69 | 2.0 | 0.2 |0.99988 | 0.0 | | |
19 | lay SiC 10 | 3.16 | 3.0 | 0.1 | 0.0 | 0.0 | | |
20 | substrate | 2.336 | inf | 0.1 | 0.0 | 0.0 | | |
-------|------------------------|---------------|-------------|-------------|--------|-----------|----------|-------------|