Update Activity 7

This commit is contained in:
Sylvain Tricot 2025-07-11 16:46:14 +02:00
parent 0466a6f164
commit 303114ad53
34 changed files with 667 additions and 47 deletions

View File

@ -11,6 +11,7 @@
"tags": [] "tags": []
}, },
"source": [ "source": [
"(forward-scattering)=\n",
"# Activity 5: Multiple scattering in the forward scattering regime" "# Activity 5: Multiple scattering in the forward scattering regime"
] ]
}, },
@ -877,7 +878,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.13" "version": "3.11.3"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -133,7 +133,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.13" "version": "3.11.3"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -20,11 +20,112 @@
"tags": [] "tags": []
}, },
"source": [ "source": [
"So far you have seen that multiple scattering calculations with MsSpec can use two different algorithms: *matrix inversion* or *Rehr Albers series expansion*. When matrix inversion becomes impossible because the kinetic energy is too high and the number of atoms is too large, serial expansion is the alternative. This algorithm requires very little memory but it processes the scattering paths sequentially, which can lead to very long calculation times.\n",
"\n",
"In this activity, we will explore how to configure MsSpec to reduce this calculation time to compute the signal from a deep emitter in Si(001).\n",
"\n",
"\n",
"\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "2a2f7c01-3a7e-46d4-90aa-6ba2eada6337",
"metadata": {},
"source": [
"## The number of scattering paths\n",
"\n",
"To fix the idea, we will first evaluate how many scattering paths we need to compute for an emitter in the subsurface (2{sup}`nd` plane) or in the bulk (7{sup}`th` plane) of a Si(001) cluster."
]
},
{
"cell_type": "markdown",
"id": "0f78af28-335e-4f6b-9b98-929f9e6965f8",
"metadata": {},
"source": [
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"Create a cluster of Si(001) with the emitter in the subsurface, 40 Å diameter with 2 planes (since atoms below the emitter can be ignored at high kinetic energies).\n",
"\n",
"1. For an emitter in the subsurface, we can use single scattering (see {ref}`forward-scattering`). How many paths would be generated for this calculation ?\n",
"\n",
"2. Same question for an emitter in the 7{sup}`th` plane. If we were able to treat each scattering path within only 1 µs. How long would be such calculation ?\n",
"\n",
"```{note}\n",
"Remember that \n",
"1. for an emitter in plane $p$, the scattering order has to be at least the number of planes `above` the emitter\n",
"2. The number of scattering paths of order $n$ corresponds to the number of possibilities of arranging up to $n$ atoms (taking order into account).\n",
"```\n",
"\n",
"\n",
"::::"
]
},
{
"cell_type": "markdown",
"id": "a83ee1b8-dc25-4db9-a3bd-c5ba8443f758",
"metadata": {},
"source": [
":::{toggle}\n",
"\n",
"To get the total number of paths generated by a cluster of $N$ atoms up to order $M$, use the following formula:\n",
"\n",
"```{math}\n",
":label: eq-nbpaths\n",
"\\sum_{i=0}^{i=M} (N-1)^i\n",
"```\n",
"\n",
":::{figure-md} nbpaths-fig\n",
"<img src=\"fig1.jpg\" alt=\"path filtering\" width=\"600px\" align=\"center\">\n",
"\n",
"The time for computing all scattering path for increasing cluster size and scattering order (up to 6{sup}`th` order with 739 atoms. (One path is assumed to be calculated within 1 µs)\n",
":::\n",
"\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "5de975f5-8f3d-432e-bfcc-8455bc50a862",
"metadata": {},
"source": [
"## Paths filtering in MsSpec\n",
"\n",
"As you may expect, not all paths contribute significantly to the total intensity. This is why we can filter out some scattering paths and drastically reduce the computation time. MsSpec offers several filters for this. The 3 most common filters are:\n",
"1. the `forward_scattering` filter which allows all paths where each scattering angle is within a cone of defined aperture\n",
"2. the `backward_scattering` filter which is similar to the previous one but for backscattering direction\n",
"3. the `distance` filter which rejects all paths longer than a threshold distance\n",
"\n",
"The following figure illustrate the effect of theses filters on scattering paths\n",
"\n",
":::{figure-md} filters-fig\n", ":::{figure-md} filters-fig\n",
"<img src=\"filters.jpg\" alt=\"path filtering\" width=\"600px\" align=\"center\">\n", "<img src=\"filters.jpg\" alt=\"path filtering\" width=\"600px\" align=\"center\">\n",
"\n", "\n",
"Some examples of scattering paths with `forward_scattering`, `backward_scattering` and `distance` filters selected. The accepted forward angle is 45°, the accepted backscattering angle is 20° and the threshold distance is $6a_0$ where $a_0$ is the lattice parameter. Note that the yellow path is rejected but if the `off_cone_events` option is set to a value > 1, then it could have been accepted.\n", "Some examples of scattering paths with `forward_scattering`, `backward_scattering` and `distance` filters selected. The accepted forward angle is 45°, the accepted backscattering angle is 20° and the threshold distance is $6a_0$ where $a_0$ is the lattice parameter. Note that the yellow path is rejected but if the `off_cone_events` option is set to a value > 1, then it could have been accepted."
":::" ]
},
{
"cell_type": "markdown",
"id": "28aae2f7-2af9-4630-b89d-ab634725ad79",
"metadata": {},
"source": [
"## Application to a deep plane in a Si(001) sample\n",
"\n",
"The following script will compute contribution of all the planes of a Si(001) substrate to get the total photoelectron intensity of a Si(2s) polar scan. \n",
"\n",
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"\n",
"The script is almost completed, try to define path filtering options and compare results with and without filtering for emitter in plane n° 3 at scattering order 2.\n",
"\n",
"Compute the contribution of plane n° 7\n",
"\n",
":::\n",
"\n",
"::::"
] ]
} }
], ],
@ -44,7 +145,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.13" "version": "3.11.3"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -0,0 +1,165 @@
# coding: utf8
import logging
import numpy as np
import os
import sys
from ase.build import bulk, diamond111
from msspec.calculator import MSSPEC, XRaySource
from msspec.iodata import Data
from msspec.utils import hemispherical_cluster, get_atom_index, cut_sphere, cut_plane
logging.basicConfig(level=logging.INFO)
def create_clusters(nplanes=6, direction='100', a=5.43, c=5.43, radius=30):
clusters = []
Si = bulk('Si', a=a, cubic=True)
# Get scaled positions and cell
p = Si.get_scaled_positions()
cell = Si.get_cell()
# Resize
covera = c / a
cell[2,:] *= covera
p[:,2] *= covera
Si.set_scaled_positions(p)
Si.set_cell(cell)
if direction in ('001', '010', '100'):
pass
elif direction in ('111'):
Si.rotate([1,1,1], [1,1,0], rotate_cell=True)
Si.rotate([1,1,0], [1,0,0], rotate_cell=True)
Si.rotate([1,0,0], [0,0,1], rotate_cell=True)
for iplane in range(nplanes):
#for iplane in (nplanes-1,):
logging.info(f'Building cluster #{iplane:d}/{nplanes-1:d}')
cluster = hemispherical_cluster(Si, #planes=max(iplane+1, 4),
diameter=70,
emitter_plane=iplane,
shape = 'cylindrical',
)
cluster = cut_sphere(cluster, radius = radius)
cluster = cut_plane(cluster, z = -a/4)
for atom in cluster:
atom.set('mean_square_vibration', 0.006)
atom.set('mt_radius', 1.1)
cluster.absorber = get_atom_index(cluster, 0, 0, 0)
cluster.info.update(emitter_plane=iplane)
clusters.append(cluster)
return clusters
def compute_polar_scan(cluster, data=None, phi=0, folder='calc', RA_cutoff=2,
max_ndif=6, level='2p', kinetic_energy=1382.28):
emitter_plane = cluster.info['emitter_plane']
calc = MSSPEC(spectroscopy='PED', algorithm='expansion',
folder=folder)
calc.muffintin_parameters.interstitial_potential = 0.
#calc.tmatrix_parameters.exchange_correlation = 'x_alpha_real'
calc.tmatrix_parameters.exchange_correlation = 'hedin_lundqvist_complex'
calc.source_parameters.energy = XRaySource.AL_KALPHA
calc.source_parameters.theta = -54.7
calc.source_parameters.phi = 90
calc.spectroscopy_parameters.final_state = 1
calc.detector_parameters.angular_acceptance = 1.0
calc.detector_parameters.average_sampling = 'high'
calc.calculation_parameters.scattering_order = min(max_ndif,
max(1, emitter_plane))
#calc.tmatrix_parameters.lmax_mode ='imposed'
#calc.tmatrix_parameters.lmaxt = 10
calc.tmatrix_parameters.tl_threshold = 1e-4
#calc.calculation_parameters.scattering_order = 6
#calc.calculation_parameters.mean_free_path = 10.
calc.calculation_parameters.vibrational_damping = 'averaged_tl'
calc.calculation_parameters.RA_cutoff = RA_cutoff
my_filters = ('forward_scattering', 'distance_cutoff')
calc.calculation_parameters.path_filtering = my_filters
#calc.calculation_parameters.path_filtering = 'forward_scattering'
calc.calculation_parameters.distance = 30
calc.calculation_parameters.off_cone_events = 0
calc.calculation_parameters.RA_cutoff_damping = 1
[a.set('forward_angle', 40) for a in cluster]
calc.phagen_parameters.noproto = '.false.'
calc.set_atoms(cluster)
data = calc.get_theta_scan(level=level,
theta=np.arange(-30., 80., 0.5),
kinetic_energy = kinetic_energy,
phi=phi, data=data)
return data
def sum_planes(data):
cs = None
ds = None
for dset in data:
theta = dset.theta
phi = dset.phi
try:
cs += dset.cross_section
ds += dset.direct_signal
except:
cs = dset.cross_section.copy()
ds = dset.direct_signal.copy()
dset = data.add_dset('Substrate signal')
dset.add_columns(theta=theta, phi=phi, cross_section=cs,
direct_signal=ds, chi=(cs-ds)/ds)
phi_values = np.unique(phi)
view = dset.add_view('Substrate signal',
title=r'Si(2p)',
xlabel=r'$\Theta (\degree$)',
ylabel='Signal (a.u.)')
for phi_value in phi_values:
condition = f'phi == {phi_value:.1f}'
legend = '$\Phi = $' + f'{phi_value:.1f}' + '$^\circ$'
view.select('theta', 'cross_section', where=condition, legend=legend)
view.set_plot_options(autoscale=True)
# Create the list of clusters
RA = 2 #int(sys.argv[1])
NDIF = 5 #int(sys.argv[2])
RAD = 20. #float(sys.argv[3])
PHI = float(sys.argv[1])
KE = float(sys.argv[2])
#basename = f'RA{RA:d}_NDIF{NDIF:d}_RAD{RAD:.1f}_PHI{PHI:.1f}'
basename = f'PHI{PHI:.1f}_KE{KE:.2f}'
data = Data(basename)
clusters = create_clusters(nplanes=15, radius=RAD)
if 'view' in sys.argv:
for cluster in clusters:
cluster.edit()
exit(0)
for cluster in clusters:
#for cluster in (clusters[-1],):
data = compute_polar_scan(cluster, data, phi=PHI,
folder='calc_' + basename,
RA_cutoff=RA,
max_ndif=NDIF,
kinetic_energy=KE
)
sum_planes(data)
data.save('simulation_' + basename + '.hdf5', append=False)
data.export('simulation_' + basename)
#data.view()

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 KiB

View File

@ -0,0 +1,57 @@
from ase.build import bulk
from msspec.utils import hemispherical_cluster, get_atom_index
from ase.visualize import view
from datetime import timedelta as td
import numpy as np
from matplotlib import pyplot as plt
Si = bulk('Si', cubic=True)
planes = range(1,10)
natoms = []
allt = []
for emitter_plane in planes:
cluster = hemispherical_cluster(Si, diameter=40, emitter_plane=emitter_plane, planes=emitter_plane+1)
N = len(cluster)
npaths = np.sum([(N-1)**i for i in range(emitter_plane + 1)])
t = npaths * 1e-6
natoms.append(len(cluster))
allt.append(t)
values=np.array([])
conversion = [31557600, 86400, 3600, 60, 1, 1e-3, 1e-6]
units = np.array([" years", " days", "H", "M", "s", "ms", "µs"])
for f in conversion:
values = np.append(values, t // f)
t -= values[-1] * f
s = ' '.join(["{:.0f}{}".format(*_) for _ in zip(values[values>0][:3], units[values>0][:3])])
print("Emitter in plane {:d}".format(emitter_plane))
print("Number of atoms in the cluster: {:d}".format(len(cluster)))
print("{:d} scattering paths".format(npaths))
print("{} to compute".format(s))
print("*"*80)
colibri = 1/60
one_day = 86400
one_year = 365.25 * 86400
roman_era = 1200 * one_year
jurassic_period = 55e6 * one_year
universe_age = 13.8e9 * one_year
fig, ax = plt.subplots()
for _ in [colibri, one_day, roman_era, jurassic_period, universe_age]:
ax.axhline(_, linestyle="--", color="black", lw=1)
ax.semilogy(natoms, allt, color="red", lw=2)
ax.scatter([natoms[0], natoms[6]], [allt[0],allt[6]], marker="o", color="red", lw=3)
plt.ylim(1e-6, 1e20)
plt.xlabel("Number of atoms for emitter in plane 1 to 9")
plt.ylabel("Computation time (s)")
plt.savefig('my_plot.png', transparent=True)
plt.show()

View File

@ -1,4 +1,4 @@
# Sphinx build info version 1 # Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 0b896abf2c995b3493312dcbe0e8b47f config: d64285b76259d47aa1d35d9bc7e7829a
tags: 645f666f9bcd5a90fca523b33c5a78b7 tags: 645f666f9bcd5a90fca523b33c5a78b7

View File

@ -32,7 +32,7 @@
<link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" /> <link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" />
<link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" /> <link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" /> <link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" /> <link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" />

View File

@ -32,7 +32,7 @@
<link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" /> <link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" />
<link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" /> <link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" /> <link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" /> <link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" />

View File

@ -32,7 +32,7 @@
<link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" /> <link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" />
<link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" /> <link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" /> <link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" /> <link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" />

View File

@ -32,7 +32,7 @@
<link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" /> <link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" />
<link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" /> <link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" /> <link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" /> <link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" />

View File

@ -32,7 +32,7 @@
<link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" /> <link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" />
<link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" /> <link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" /> <link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" /> <link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" />
@ -359,7 +359,7 @@ document.write(`
<article class="bd-article"> <article class="bd-article">
<section class="tex2jax_ignore mathjax_ignore" id="activity-5-multiple-scattering-in-the-forward-scattering-regime"> <section class="tex2jax_ignore mathjax_ignore" id="activity-5-multiple-scattering-in-the-forward-scattering-regime">
<h1>Activity 5: Multiple scattering in the forward scattering regime<a class="headerlink" href="#activity-5-multiple-scattering-in-the-forward-scattering-regime" title="Link to this heading">#</a></h1> <span id="forward-scattering"></span><h1>Activity 5: Multiple scattering in the forward scattering regime<a class="headerlink" href="#activity-5-multiple-scattering-in-the-forward-scattering-regime" title="Link to this heading">#</a></h1>
<p>In photoelectron diffraction, it is well known that for high photoelectron kinetic energy (typically &gt; 900 eV), the scattering factor is strongly peaked in the forward direction. It means that photoelectrons are almost not deviated after a scattering event.</p> <p>In photoelectron diffraction, it is well known that for high photoelectron kinetic energy (typically &gt; 900 eV), the scattering factor is strongly peaked in the forward direction. It means that photoelectrons are almost not deviated after a scattering event.</p>
<p>Peaks of intentisity are then usually observed for dense atomic directions of the sample. This is the <strong>forward scattering approximation</strong>.</p> <p>Peaks of intentisity are then usually observed for dense atomic directions of the sample. This is the <strong>forward scattering approximation</strong>.</p>
<p>For such high kinetic energy, multiple scattering is needed to accurately describe the measured intensity, but the matrix inversion algorithm cannot be used since the memory needed for storing the matrix itself would be generally too large. The matrix will contain <p>For such high kinetic energy, multiple scattering is needed to accurately describe the measured intensity, but the matrix inversion algorithm cannot be used since the memory needed for storing the matrix itself would be generally too large. The matrix will contain
@ -516,7 +516,7 @@ document.write(`
<!--Inserting Generated X3D Scene--> <!--Inserting Generated X3D Scene-->
<scene> <scene>
<viewpoint position="0 0 28.28"> <viewpoint position="0 0 28.28000000000003">
<group/> <group/>
</viewpoint> </viewpoint>
<transform translation="-0.8837500000000003 -2.220446049250313e-16 -3.002"> <transform translation="-0.8837500000000003 -2.220446049250313e-16 -3.002">
@ -884,7 +884,7 @@ document.write(`
<sphere radius="1.2"/> <sphere radius="1.2"/>
</shape> </shape>
</transform> </transform>
<transform translation="-7.070000000000007 0.0 4.6629367034256575e-15"> <transform translation="-7.070000000000022 0.0 4.6629367034256575e-15">
<shape> <shape>
<appearance> <appearance>
<material diffuseColor="0.749 0.761 0.78"/> <material diffuseColor="0.749 0.761 0.78"/>
@ -892,7 +892,7 @@ document.write(`
<sphere radius="1.6"/> <sphere radius="1.6"/>
</shape> </shape>
</transform> </transform>
<transform translation="-7.070000000000007 2.040933201585325 1.724999999999999"> <transform translation="-7.070000000000022 2.040933201585325 1.724999999999999">
<shape> <shape>
<appearance> <appearance>
<material diffuseColor="1.0 0.631 0.0"/> <material diffuseColor="1.0 0.631 0.0"/>
@ -948,7 +948,7 @@ document.write(`
<sphere radius="1.2"/> <sphere radius="1.2"/>
</shape> </shape>
</transform> </transform>
<transform translation="-1.7675000000000125 3.0613998023779985 4.6629367034256575e-15"> <transform translation="-1.7674999999999983 3.0613998023779985 4.6629367034256575e-15">
<shape> <shape>
<appearance> <appearance>
<material diffuseColor="0.749 0.761 0.78"/> <material diffuseColor="0.749 0.761 0.78"/>
@ -956,7 +956,7 @@ document.write(`
<sphere radius="1.6"/> <sphere radius="1.6"/>
</shape> </shape>
</transform> </transform>
<transform translation="-1.7675000000000125 5.102333003963331 1.724999999999999"> <transform translation="-1.7674999999999983 5.102333003963331 1.724999999999999">
<shape> <shape>
<appearance> <appearance>
<material diffuseColor="1.0 0.631 0.0"/> <material diffuseColor="1.0 0.631 0.0"/>
@ -1004,7 +1004,7 @@ document.write(`
<sphere radius="1.6"/> <sphere radius="1.6"/>
</shape> </shape>
</transform> </transform>
<transform translation="-3.5349999999999966 6.12279960475599 4.6629367034256575e-15"> <transform translation="-3.535000000000011 6.12279960475599 4.6629367034256575e-15">
<shape> <shape>
<appearance> <appearance>
<material diffuseColor="0.749 0.761 0.78"/> <material diffuseColor="0.749 0.761 0.78"/>

View File

@ -32,7 +32,7 @@
<link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" /> <link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" />
<link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" /> <link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" /> <link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" /> <link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" />

View File

@ -319,7 +319,9 @@ document.write(`
</button> </button>
`); `);
</script> </script>
<button class="sidebar-toggle secondary-toggle btn btn-sm" title="Toggle secondary sidebar" data-bs-placement="bottom" data-bs-toggle="tooltip">
<span class="fa-solid fa-list"></span>
</button>
</div></div> </div></div>
</div> </div>
@ -335,6 +337,16 @@ document.write(`
<div id="print-main-content"> <div id="print-main-content">
<div id="jb-print-toc"> <div id="jb-print-toc">
<div>
<h2> Contents </h2>
</div>
<nav aria-label="Page">
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#the-number-of-scattering-paths">The number of scattering paths</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#paths-filtering-in-msspec">Paths filtering in MsSpec</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#application-to-a-deep-plane-in-a-si-001-sample">Application to a deep plane in a Si(001) sample</a></li>
</ul>
</nav>
</div> </div>
</div> </div>
</div> </div>
@ -346,13 +358,76 @@ document.write(`
<section class="tex2jax_ignore mathjax_ignore" id="activity-7-large-clusters-and-path-filtering"> <section class="tex2jax_ignore mathjax_ignore" id="activity-7-large-clusters-and-path-filtering">
<span id="path-filtering"></span><h1>Activity 7: Large clusters and path filtering<a class="headerlink" href="#activity-7-large-clusters-and-path-filtering" title="Link to this heading">#</a></h1> <span id="path-filtering"></span><h1>Activity 7: Large clusters and path filtering<a class="headerlink" href="#activity-7-large-clusters-and-path-filtering" title="Link to this heading">#</a></h1>
<p>So far you have seen that multiple scattering calculations with MsSpec can use two different algorithms: <em>matrix inversion</em> or <em>Rehr Albers series expansion</em>. When matrix inversion becomes impossible because the kinetic energy is too high and the number of atoms is too large, serial expansion is the alternative. This algorithm requires very little memory but it processes the scattering paths sequentially, which can lead to very long calculation times.</p>
<p>In this activity, we will explore how to configure MsSpec to reduce this calculation time to compute the signal from a deep emitter in Si(001).</p>
<div class="docutils">
</div>
<section id="the-number-of-scattering-paths">
<h2>The number of scattering paths<a class="headerlink" href="#the-number-of-scattering-paths" title="Link to this heading">#</a></h2>
<p>To fix the idea, we will first evaluate how many scattering paths we need to compute for an emitter in the subsurface (2<sup>nd</sup> plane) or in the bulk (7<sup>th</sup> plane) of a Si(001) cluster.</p>
<div class="sd-tab-set docutils">
<input checked="checked" id="sd-tab-item-0" name="sd-tab-set-0" type="radio">
<label class="sd-tab-label" for="sd-tab-item-0">
<i class="fa-solid fa-circle-question"></i> Quiz</label><div class="sd-tab-content docutils">
<p>Create a cluster of Si(001) with the emitter in the subsurface, 40 Å diameter with 2 planes (since atoms below the emitter can be ignored at high kinetic energies).</p>
<ol class="arabic simple">
<li><p>For an emitter in the subsurface, we can use single scattering (see <a class="reference internal" href="../Activity05/Activity05.html#forward-scattering"><span class="std std-ref">Activity 5: Multiple scattering in the forward scattering regime</span></a>). How many paths would be generated for this calculation ?</p></li>
<li><p>Same question for an emitter in the 7<sup>th</sup> plane. If we were able to treat each scattering path within only 1 µs. How long would be such calculation ?</p></li>
</ol>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Remember that</p>
<ol class="arabic simple">
<li><p>for an emitter in plane <span class="math notranslate nohighlight">\(p\)</span>, the scattering order has to be at least the number of planes <code class="docutils literal notranslate"><span class="pre">above</span></code> the emitter</p></li>
<li><p>The number of scattering paths of order <span class="math notranslate nohighlight">\(n\)</span> corresponds to the number of possibilities of arranging up to <span class="math notranslate nohighlight">\(n\)</span> atoms (taking order into account).</p></li>
</ol>
</div>
</div>
</div>
<div class="toggle docutils container">
<p>To get the total number of paths generated by a cluster of <span class="math notranslate nohighlight">\(N\)</span> atoms up to order <span class="math notranslate nohighlight">\(M\)</span>, use the following formula:</p>
<div class="math notranslate nohighlight" id="equation-eq-nbpaths">
<span class="eqno">(3)<a class="headerlink" href="#equation-eq-nbpaths" title="Link to this equation">#</a></span>\[\sum_{i=0}^{i=M} (N-1)^i\]</div>
<figure class="align-default" id="nbpaths-fig">
<a class="reference internal image-reference" href="../_images/fig1.jpg"><img alt="path filtering" class="align-center" src="../_images/fig1.jpg" style="width: 600px;" />
</a>
<figcaption>
<p><span class="caption-number">Fig. 16 </span><span class="caption-text">The time for computing all scattering path for increasing cluster size and scattering order (up to 6<sup>th</sup> order with 739 atoms. (One path is assumed to be calculated within 1 µs)</span><a class="headerlink" href="#nbpaths-fig" title="Link to this image">#</a></p>
</figcaption>
</figure>
</div>
<div class="docutils">
</div>
</section>
<section id="paths-filtering-in-msspec">
<h2>Paths filtering in MsSpec<a class="headerlink" href="#paths-filtering-in-msspec" title="Link to this heading">#</a></h2>
<p>As you may expect, not all paths contribute significantly to the total intensity. This is why we can filter out some scattering paths and drastically reduce the computation time. MsSpec offers several filters for this. The 3 most common filters are:</p>
<ol class="arabic simple">
<li><p>the <code class="docutils literal notranslate"><span class="pre">forward_scattering</span></code> filter which allows all paths where each scattering angle is within a cone of defined aperture</p></li>
<li><p>the <code class="docutils literal notranslate"><span class="pre">backward_scattering</span></code> filter which is similar to the previous one but for backscattering direction</p></li>
<li><p>the <code class="docutils literal notranslate"><span class="pre">distance</span></code> filter which rejects all paths longer than a threshold distance</p></li>
</ol>
<p>The following figure illustrate the effect of theses filters on scattering paths</p>
<figure class="align-default" id="filters-fig"> <figure class="align-default" id="filters-fig">
<a class="reference internal image-reference" href="../_images/filters.jpg"><img alt="path filtering" class="align-center" src="../_images/filters.jpg" style="width: 600px;" /> <a class="reference internal image-reference" href="../_images/filters.jpg"><img alt="path filtering" class="align-center" src="../_images/filters.jpg" style="width: 600px;" />
</a> </a>
<figcaption> <figcaption>
<p><span class="caption-number">Fig. 16 </span><span class="caption-text">Some examples of scattering paths with <code class="docutils literal notranslate"><span class="pre">forward_scattering</span></code>, <code class="docutils literal notranslate"><span class="pre">backward_scattering</span></code> and <code class="docutils literal notranslate"><span class="pre">distance</span></code> filters selected. The accepted forward angle is 45°, the accepted backscattering angle is 20° and the threshold distance is <span class="math notranslate nohighlight">\(6a_0\)</span> where <span class="math notranslate nohighlight">\(a_0\)</span> is the lattice parameter. Note that the yellow path is rejected but if the <code class="docutils literal notranslate"><span class="pre">off_cone_events</span></code> option is set to a value &gt; 1, then it could have been accepted.</span><a class="headerlink" href="#filters-fig" title="Link to this image">#</a></p> <p><span class="caption-number">Fig. 17 </span><span class="caption-text">Some examples of scattering paths with <code class="docutils literal notranslate"><span class="pre">forward_scattering</span></code>, <code class="docutils literal notranslate"><span class="pre">backward_scattering</span></code> and <code class="docutils literal notranslate"><span class="pre">distance</span></code> filters selected. The accepted forward angle is 45°, the accepted backscattering angle is 20° and the threshold distance is <span class="math notranslate nohighlight">\(6a_0\)</span> where <span class="math notranslate nohighlight">\(a_0\)</span> is the lattice parameter. Note that the yellow path is rejected but if the <code class="docutils literal notranslate"><span class="pre">off_cone_events</span></code> option is set to a value &gt; 1, then it could have been accepted.</span><a class="headerlink" href="#filters-fig" title="Link to this image">#</a></p>
</figcaption> </figcaption>
</figure> </figure>
</section>
<section id="application-to-a-deep-plane-in-a-si-001-sample">
<h2>Application to a deep plane in a Si(001) sample<a class="headerlink" href="#application-to-a-deep-plane-in-a-si-001-sample" title="Link to this heading">#</a></h2>
<p>The following script will compute contribution of all the planes of a Si(001) substrate to get the total photoelectron intensity of a Si(2s) polar scan.</p>
<div class="sd-tab-set docutils">
<input checked="checked" id="sd-tab-item-1" name="sd-tab-set-1" type="radio">
<label class="sd-tab-label" for="sd-tab-item-1">
<i class="fa-solid fa-circle-question"></i> Quiz</label><div class="sd-tab-content docutils">
<p>The script is almost completed, try to define path filtering options and compare results with and without filtering for emitter in plane n° 3 at scattering order 2.</p>
<p>Compute the contribution of plane n° 7</p>
</div>
</div>
</section>
</section> </section>
<script type="text/x-thebe-config"> <script type="text/x-thebe-config">
@ -410,6 +485,23 @@ document.write(`
<div class="bd-sidebar-secondary bd-toc"><div class="sidebar-secondary-items sidebar-secondary__inner">
<div class="sidebar-secondary-item">
<div class="page-toc tocsection onthispage">
<i class="fa-solid fa-list"></i> Contents
</div>
<nav class="bd-toc-nav page-toc">
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#the-number-of-scattering-paths">The number of scattering paths</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#paths-filtering-in-msspec">Paths filtering in MsSpec</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#application-to-a-deep-plane-in-a-si-001-sample">Application to a deep plane in a Si(001) sample</a></li>
</ul>
</nav></div>
</div></div>
</div> </div>
<footer class="bd-footer-content"> <footer class="bd-footer-content">

View File

@ -32,7 +32,7 @@
<link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" /> <link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" />
<link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" /> <link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" /> <link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" /> <link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" />

View File

@ -32,7 +32,7 @@
<link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" /> <link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" />
<link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" /> <link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" /> <link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" /> <link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" />

View File

@ -32,7 +32,7 @@
<link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" /> <link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" />
<link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" /> <link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" /> <link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" /> <link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" />

View File

@ -32,7 +32,7 @@
<link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" /> <link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=eba8b062" />
<link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" /> <link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" /> <link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" /> <link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 KiB

View File

@ -11,6 +11,7 @@
"tags": [] "tags": []
}, },
"source": [ "source": [
"(forward-scattering)=\n",
"# Activity 5: Multiple scattering in the forward scattering regime" "# Activity 5: Multiple scattering in the forward scattering regime"
] ]
}, },
@ -877,7 +878,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.13" "version": "3.11.3"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -133,7 +133,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.13" "version": "3.11.3"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -20,11 +20,112 @@
"tags": [] "tags": []
}, },
"source": [ "source": [
"So far you have seen that multiple scattering calculations with MsSpec can use two different algorithms: *matrix inversion* or *Rehr Albers series expansion*. When matrix inversion becomes impossible because the kinetic energy is too high and the number of atoms is too large, serial expansion is the alternative. This algorithm requires very little memory but it processes the scattering paths sequentially, which can lead to very long calculation times.\n",
"\n",
"In this activity, we will explore how to configure MsSpec to reduce this calculation time to compute the signal from a deep emitter in Si(001).\n",
"\n",
"\n",
"\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "2a2f7c01-3a7e-46d4-90aa-6ba2eada6337",
"metadata": {},
"source": [
"## The number of scattering paths\n",
"\n",
"To fix the idea, we will first evaluate how many scattering paths we need to compute for an emitter in the subsurface (2{sup}`nd` plane) or in the bulk (7{sup}`th` plane) of a Si(001) cluster."
]
},
{
"cell_type": "markdown",
"id": "0f78af28-335e-4f6b-9b98-929f9e6965f8",
"metadata": {},
"source": [
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"Create a cluster of Si(001) with the emitter in the subsurface, 40 Å diameter with 2 planes (since atoms below the emitter can be ignored at high kinetic energies).\n",
"\n",
"1. For an emitter in the subsurface, we can use single scattering (see {ref}`forward-scattering`). How many paths would be generated for this calculation ?\n",
"\n",
"2. Same question for an emitter in the 7{sup}`th` plane. If we were able to treat each scattering path within only 1 µs. How long would be such calculation ?\n",
"\n",
"```{note}\n",
"Remember that \n",
"1. for an emitter in plane $p$, the scattering order has to be at least the number of planes `above` the emitter\n",
"2. The number of scattering paths of order $n$ corresponds to the number of possibilities of arranging up to $n$ atoms (taking order into account).\n",
"```\n",
"\n",
"\n",
"::::"
]
},
{
"cell_type": "markdown",
"id": "a83ee1b8-dc25-4db9-a3bd-c5ba8443f758",
"metadata": {},
"source": [
":::{toggle}\n",
"\n",
"To get the total number of paths generated by a cluster of $N$ atoms up to order $M$, use the following formula:\n",
"\n",
"```{math}\n",
":label: eq-nbpaths\n",
"\\sum_{i=0}^{i=M} (N-1)^i\n",
"```\n",
"\n",
":::{figure-md} nbpaths-fig\n",
"<img src=\"fig1.jpg\" alt=\"path filtering\" width=\"600px\" align=\"center\">\n",
"\n",
"The time for computing all scattering path for increasing cluster size and scattering order (up to 6{sup}`th` order with 739 atoms. (One path is assumed to be calculated within 1 µs)\n",
":::\n",
"\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "5de975f5-8f3d-432e-bfcc-8455bc50a862",
"metadata": {},
"source": [
"## Paths filtering in MsSpec\n",
"\n",
"As you may expect, not all paths contribute significantly to the total intensity. This is why we can filter out some scattering paths and drastically reduce the computation time. MsSpec offers several filters for this. The 3 most common filters are:\n",
"1. the `forward_scattering` filter which allows all paths where each scattering angle is within a cone of defined aperture\n",
"2. the `backward_scattering` filter which is similar to the previous one but for backscattering direction\n",
"3. the `distance` filter which rejects all paths longer than a threshold distance\n",
"\n",
"The following figure illustrate the effect of theses filters on scattering paths\n",
"\n",
":::{figure-md} filters-fig\n", ":::{figure-md} filters-fig\n",
"<img src=\"filters.jpg\" alt=\"path filtering\" width=\"600px\" align=\"center\">\n", "<img src=\"filters.jpg\" alt=\"path filtering\" width=\"600px\" align=\"center\">\n",
"\n", "\n",
"Some examples of scattering paths with `forward_scattering`, `backward_scattering` and `distance` filters selected. The accepted forward angle is 45°, the accepted backscattering angle is 20° and the threshold distance is $6a_0$ where $a_0$ is the lattice parameter. Note that the yellow path is rejected but if the `off_cone_events` option is set to a value > 1, then it could have been accepted.\n", "Some examples of scattering paths with `forward_scattering`, `backward_scattering` and `distance` filters selected. The accepted forward angle is 45°, the accepted backscattering angle is 20° and the threshold distance is $6a_0$ where $a_0$ is the lattice parameter. Note that the yellow path is rejected but if the `off_cone_events` option is set to a value > 1, then it could have been accepted."
":::" ]
},
{
"cell_type": "markdown",
"id": "28aae2f7-2af9-4630-b89d-ab634725ad79",
"metadata": {},
"source": [
"## Application to a deep plane in a Si(001) sample\n",
"\n",
"The following script will compute contribution of all the planes of a Si(001) substrate to get the total photoelectron intensity of a Si(2s) polar scan. \n",
"\n",
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"\n",
"The script is almost completed, try to define path filtering options and compare results with and without filtering for emitter in plane n° 3 at scattering order 2.\n",
"\n",
"Compute the contribution of plane n° 7\n",
"\n",
":::\n",
"\n",
"::::"
] ]
} }
], ],
@ -44,7 +145,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.13" "version": "3.11.3"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -32,7 +32,7 @@
<link rel="stylesheet" type="text/css" href="_static/styles/sphinx-book-theme.css?v=eba8b062" /> <link rel="stylesheet" type="text/css" href="_static/styles/sphinx-book-theme.css?v=eba8b062" />
<link rel="stylesheet" type="text/css" href="_static/togglebutton.css?v=13237357" /> <link rel="stylesheet" type="text/css" href="_static/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" /> <link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" /> <link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="_static/sphinx-thebe.css?v=4fa983c6" /> <link rel="stylesheet" type="text/css" href="_static/sphinx-thebe.css?v=4fa983c6" />
<link rel="stylesheet" type="text/css" href="_static/sphinx-design.min.css?v=95c83b7e" /> <link rel="stylesheet" type="text/css" href="_static/sphinx-design.min.css?v=95c83b7e" />

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -43,7 +43,7 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"<Popen: returncode: None args: ['/home/stricot/msspec_py3.11.13/bin/python',...>" "<Popen: returncode: None args: ['/opt/msspec/msspec_venv/bin/python', '-m', ...>"
] ]
}, },
"execution_count": 1, "execution_count": 1,
@ -663,7 +663,7 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"<Popen: returncode: None args: ['/home/stricot/msspec_py3.11.13/bin/python',...>" "<Popen: returncode: None args: ['/opt/msspec/msspec_venv/bin/python', '-m', ...>"
] ]
}, },
"execution_count": 4, "execution_count": 4,
@ -945,7 +945,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.13" "version": "3.11.3"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -84,7 +84,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.13" "version": "3.11.3"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -11,6 +11,7 @@
"tags": [] "tags": []
}, },
"source": [ "source": [
"(forward-scattering)=\n",
"# Activity 5: Multiple scattering in the forward scattering regime" "# Activity 5: Multiple scattering in the forward scattering regime"
] ]
}, },
@ -265,7 +266,7 @@
"\n", "\n",
"<!--Inserting Generated X3D Scene-->\n", "<!--Inserting Generated X3D Scene-->\n",
"<scene>\n", "<scene>\n",
" <viewpoint position=\"0 0 28.28\">\n", " <viewpoint position=\"0 0 28.28000000000003\">\n",
" <group/>\n", " <group/>\n",
" </viewpoint>\n", " </viewpoint>\n",
" <transform translation=\"-0.8837500000000003 -2.220446049250313e-16 -3.002\">\n", " <transform translation=\"-0.8837500000000003 -2.220446049250313e-16 -3.002\">\n",
@ -633,7 +634,7 @@
" <sphere radius=\"1.2\"/>\n", " <sphere radius=\"1.2\"/>\n",
" </shape>\n", " </shape>\n",
" </transform>\n", " </transform>\n",
" <transform translation=\"-7.070000000000007 0.0 4.6629367034256575e-15\">\n", " <transform translation=\"-7.070000000000022 0.0 4.6629367034256575e-15\">\n",
" <shape>\n", " <shape>\n",
" <appearance>\n", " <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n", " <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
@ -641,7 +642,7 @@
" <sphere radius=\"1.6\"/>\n", " <sphere radius=\"1.6\"/>\n",
" </shape>\n", " </shape>\n",
" </transform>\n", " </transform>\n",
" <transform translation=\"-7.070000000000007 2.040933201585325 1.724999999999999\">\n", " <transform translation=\"-7.070000000000022 2.040933201585325 1.724999999999999\">\n",
" <shape>\n", " <shape>\n",
" <appearance>\n", " <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n", " <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
@ -697,7 +698,7 @@
" <sphere radius=\"1.2\"/>\n", " <sphere radius=\"1.2\"/>\n",
" </shape>\n", " </shape>\n",
" </transform>\n", " </transform>\n",
" <transform translation=\"-1.7675000000000125 3.0613998023779985 4.6629367034256575e-15\">\n", " <transform translation=\"-1.7674999999999983 3.0613998023779985 4.6629367034256575e-15\">\n",
" <shape>\n", " <shape>\n",
" <appearance>\n", " <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n", " <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
@ -705,7 +706,7 @@
" <sphere radius=\"1.6\"/>\n", " <sphere radius=\"1.6\"/>\n",
" </shape>\n", " </shape>\n",
" </transform>\n", " </transform>\n",
" <transform translation=\"-1.7675000000000125 5.102333003963331 1.724999999999999\">\n", " <transform translation=\"-1.7674999999999983 5.102333003963331 1.724999999999999\">\n",
" <shape>\n", " <shape>\n",
" <appearance>\n", " <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n", " <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
@ -753,7 +754,7 @@
" <sphere radius=\"1.6\"/>\n", " <sphere radius=\"1.6\"/>\n",
" </shape>\n", " </shape>\n",
" </transform>\n", " </transform>\n",
" <transform translation=\"-3.5349999999999966 6.12279960475599 4.6629367034256575e-15\">\n", " <transform translation=\"-3.535000000000011 6.12279960475599 4.6629367034256575e-15\">\n",
" <shape>\n", " <shape>\n",
" <appearance>\n", " <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n", " <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
@ -877,7 +878,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.13" "version": "3.11.3"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -133,7 +133,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.13" "version": "3.11.3"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -20,11 +20,112 @@
"tags": [] "tags": []
}, },
"source": [ "source": [
"So far you have seen that multiple scattering calculations with MsSpec can use two different algorithms: *matrix inversion* or *Rehr Albers series expansion*. When matrix inversion becomes impossible because the kinetic energy is too high and the number of atoms is too large, serial expansion is the alternative. This algorithm requires very little memory but it processes the scattering paths sequentially, which can lead to very long calculation times.\n",
"\n",
"In this activity, we will explore how to configure MsSpec to reduce this calculation time to compute the signal from a deep emitter in Si(001).\n",
"\n",
"\n",
"\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "2a2f7c01-3a7e-46d4-90aa-6ba2eada6337",
"metadata": {},
"source": [
"## The number of scattering paths\n",
"\n",
"To fix the idea, we will first evaluate how many scattering paths we need to compute for an emitter in the subsurface (2{sup}`nd` plane) or in the bulk (7{sup}`th` plane) of a Si(001) cluster."
]
},
{
"cell_type": "markdown",
"id": "0f78af28-335e-4f6b-9b98-929f9e6965f8",
"metadata": {},
"source": [
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"Create a cluster of Si(001) with the emitter in the subsurface, 40 Å diameter with 2 planes (since atoms below the emitter can be ignored at high kinetic energies).\n",
"\n",
"1. For an emitter in the subsurface, we can use single scattering (see {ref}`forward-scattering`). How many paths would be generated for this calculation ?\n",
"\n",
"2. Same question for an emitter in the 7{sup}`th` plane. If we were able to treat each scattering path within only 1 µs. How long would be such calculation ?\n",
"\n",
"```{note}\n",
"Remember that \n",
"1. for an emitter in plane $p$, the scattering order has to be at least the number of planes `above` the emitter\n",
"2. The number of scattering paths of order $n$ corresponds to the number of possibilities of arranging up to $n$ atoms (taking order into account).\n",
"```\n",
"\n",
"\n",
"::::"
]
},
{
"cell_type": "markdown",
"id": "a83ee1b8-dc25-4db9-a3bd-c5ba8443f758",
"metadata": {},
"source": [
":::{toggle}\n",
"\n",
"To get the total number of paths generated by a cluster of $N$ atoms up to order $M$, use the following formula:\n",
"\n",
"```{math}\n",
":label: eq-nbpaths\n",
"\\sum_{i=0}^{i=M} (N-1)^i\n",
"```\n",
"\n",
":::{figure-md} nbpaths-fig\n",
"<img src=\"fig1.jpg\" alt=\"path filtering\" width=\"600px\" align=\"center\">\n",
"\n",
"The time for computing all scattering path for increasing cluster size and scattering order (up to 6{sup}`th` order with 739 atoms. (One path is assumed to be calculated within 1 µs)\n",
":::\n",
"\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "5de975f5-8f3d-432e-bfcc-8455bc50a862",
"metadata": {},
"source": [
"## Paths filtering in MsSpec\n",
"\n",
"As you may expect, not all paths contribute significantly to the total intensity. This is why we can filter out some scattering paths and drastically reduce the computation time. MsSpec offers several filters for this. The 3 most common filters are:\n",
"1. the `forward_scattering` filter which allows all paths where each scattering angle is within a cone of defined aperture\n",
"2. the `backward_scattering` filter which is similar to the previous one but for backscattering direction\n",
"3. the `distance` filter which rejects all paths longer than a threshold distance\n",
"\n",
"The following figure illustrate the effect of theses filters on scattering paths\n",
"\n",
":::{figure-md} filters-fig\n", ":::{figure-md} filters-fig\n",
"<img src=\"filters.jpg\" alt=\"path filtering\" width=\"600px\" align=\"center\">\n", "<img src=\"filters.jpg\" alt=\"path filtering\" width=\"600px\" align=\"center\">\n",
"\n", "\n",
"Some examples of scattering paths with `forward_scattering`, `backward_scattering` and `distance` filters selected. The accepted forward angle is 45°, the accepted backscattering angle is 20° and the threshold distance is $6a_0$ where $a_0$ is the lattice parameter. Note that the yellow path is rejected but if the `off_cone_events` option is set to a value > 1, then it could have been accepted.\n", "Some examples of scattering paths with `forward_scattering`, `backward_scattering` and `distance` filters selected. The accepted forward angle is 45°, the accepted backscattering angle is 20° and the threshold distance is $6a_0$ where $a_0$ is the lattice parameter. Note that the yellow path is rejected but if the `off_cone_events` option is set to a value > 1, then it could have been accepted."
":::" ]
},
{
"cell_type": "markdown",
"id": "28aae2f7-2af9-4630-b89d-ab634725ad79",
"metadata": {},
"source": [
"## Application to a deep plane in a Si(001) sample\n",
"\n",
"The following script will compute contribution of all the planes of a Si(001) substrate to get the total photoelectron intensity of a Si(2s) polar scan. \n",
"\n",
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"\n",
"The script is almost completed, try to define path filtering options and compare results with and without filtering for emitter in plane n° 3 at scattering order 2.\n",
"\n",
"Compute the contribution of plane n° 7\n",
"\n",
":::\n",
"\n",
"::::"
] ]
} }
], ],
@ -44,7 +145,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.13" "version": "3.11.3"
} }
}, },
"nbformat": 4, "nbformat": 4,