Update html

This commit is contained in:
Sylvain Tricot 2025-07-22 18:30:57 +02:00
parent 76a0fa1a4e
commit 139001029b
58 changed files with 12742 additions and 278 deletions

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/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />
@ -489,6 +489,11 @@ Building atomic systems, structures… is pretty straightforward:</p>
</ol>
<section id="ped-polar-scan-for-cu-001">
<h3>PED polar scan for Cu(001)<a class="headerlink" href="#ped-polar-scan-for-cu-001" title="Link to this heading">#</a></h3>
<p>download the <a class="reference download internal" download="" href="../_downloads/a4639febc8162e65b41b0e03dfeeaa17/cu.py"><span class="xref download myst">cu.py</span></a> python script and the <a class="reference download internal" download="" href="../_downloads/54a8452b27a8c6284cf1a8a05665f3a4/copper.cif"><span class="xref download myst">copper.cif</span></a> file. Put those files in the same folder. You can run your first MsSpec calculation by typing in a terminal:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>python<span class="w"> </span>cu.py
</pre></div>
</div>
<p>Here is the content of the script file:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="linenos">1</span><span class="kn">from</span><span class="w"> </span><span class="nn">ase.io</span><span class="w"> </span><span class="kn">import</span> <span class="n">read</span>
<span class="linenos">2</span><span class="kn">from</span><span class="w"> </span><span class="nn">msspec.calculator</span><span class="w"> </span><span class="kn">import</span> <span class="n">MSSPEC</span>
<span class="linenos">3</span>
@ -816,12 +821,14 @@ Building atomic systems, structures… is pretty straightforward:</p>
<p>Based on the previous *.cif file, create a new cluster without the deepest plane and run the same calculation for the same emitter</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Use the <code class="docutils literal notranslate"><span class="pre">cluster.edit()</span></code> method to interactively remove atoms…</p>
<p>As the cluster will contain fewer atoms, the emitter index will be different</p>
</div>
<p>What do you conclude ?</p>
</div>
</div>
<div class="toggle docutils container">
<div class="dropdown admonition">
<p class="admonition-title"><em>Solution…</em></p>
<figure class="align-default" id="cu-4planes3planes">
<a class="reference internal image-reference" href="../_images/fig2.png"><img alt="../_images/fig2.png" class="align-center" src="../_images/fig2.png" style="width: 600px;" />
</a>

File diff suppressed because it is too large Load Diff

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/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />
@ -381,7 +381,7 @@ The idea is to use low energy photoelectron diffraction to see the substitution
</div>
<section id="building-the-cluster">
<h3>Building the cluster<a class="headerlink" href="#building-the-cluster" title="Link to this heading">#</a></h3>
<p>Lets start by building the cluster</p>
<p>Lets start by building the cluster. You can copy/paste directly the code from this page to your text editor or you can download the script <a class="reference download internal" download="" href="../_downloads/1294d44b079d2ab82b330376a2530741/SbAg.py"><span class="xref download myst">SbAg.py</span></a>. You will also need the <a class="reference download internal" download="" href="../_downloads/aa51bfc01de3fe879c2507956d0a2b8c/data.txt"><span class="xref download myst">data.txt</span></a> file.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="linenos"> 1</span><span class="kn">from</span><span class="w"> </span><span class="nn">ase.build</span><span class="w"> </span><span class="kn">import</span> <span class="n">bulk</span>
<span class="linenos"> 2</span><span class="kn">from</span><span class="w"> </span><span class="nn">ase.visualize</span><span class="w"> </span><span class="kn">import</span> <span class="n">view</span>
<span class="linenos"> 3</span>
@ -1409,7 +1409,8 @@ The idea is to use low energy photoelectron diffraction to see the substitution
</div>
</div>
</div>
<div class="toggle docutils container">
<div class="dropdown admonition">
<p class="admonition-title"><em>Solution…</em></p>
<figure class="align-default" id="sbag-fig2">
<a class="reference internal image-reference" href="../_images/fig21.png"><img alt="../_images/fig21.png" class="align-center" src="../_images/fig21.png" style="width: 600px;" />
</a>

File diff suppressed because it is too large Load Diff

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/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />
@ -511,7 +511,8 @@ document.write(`
<p>How large is the backscattering factor of Rhodium with respect to that of Oxygen ?</p>
</div>
</div>
<div class="toggle docutils container">
<div class="dropdown admonition">
<p class="admonition-title"><em>Solution…</em></p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># Compute the scattering factor</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">calc</span><span class="o">.</span><span class="n">get_scattering_factors</span><span class="p">(</span><span class="n">kinetic_energy</span><span class="o">=</span><span class="mi">723</span><span class="p">)</span>
@ -543,7 +544,7 @@ document.write(`
<input checked="checked" id="sd-tab-item-2" name="sd-tab-set-2" type="radio">
<label class="sd-tab-label" for="sd-tab-item-2">
<i class="fa-solid fa-circle-question"></i> Quiz</label><div class="sd-tab-content docutils">
<p>Complete the script below to compute the (<span class="math notranslate nohighlight">\(\theta,\phi\)</span>) scan of the photodiffraction of O(1s) adsorbed on a <em>fcc</em> site on Rh(111) surface.</p>
<p>Complete the <a class="reference download internal" download="" href="../_downloads/79fef44b9d7fb8ae298952070d9ba3ce/RhO_tofill.py"><span class="xref download myst">script below</span></a> to compute the (<span class="math notranslate nohighlight">\(\theta,\phi\)</span>) scan of the photodiffraction of O(1s) adsorbed on a <em>fcc</em> site on Rh(111) surface.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="linenos"> 1</span><span class="kn">from</span><span class="w"> </span><span class="nn">msspec.calculator</span><span class="w"> </span><span class="kn">import</span> <span class="n">MSSPEC</span>
<span class="linenos"> 2</span><span class="kn">from</span><span class="w"> </span><span class="nn">ase.build</span><span class="w"> </span><span class="kn">import</span> <span class="n">fcc111</span><span class="p">,</span> <span class="n">add_adsorbate</span>
<span class="linenos"> 3</span><span class="kn">import</span><span class="w"> </span><span class="nn">numpy</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nn">np</span>
@ -573,7 +574,8 @@ document.write(`
What is the bond length difference between to intensity maxima ?</p>
</div>
</div>
<div class="toggle docutils container">
<div class="dropdown admonition">
<p class="admonition-title"><em>Solution…</em></p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="linenos"> 1</span><span class="kn">from</span><span class="w"> </span><span class="nn">msspec.calculator</span><span class="w"> </span><span class="kn">import</span> <span class="n">MSSPEC</span>
<span class="linenos"> 2</span><span class="kn">from</span><span class="w"> </span><span class="nn">ase.build</span><span class="w"> </span><span class="kn">import</span> <span class="n">fcc111</span><span class="p">,</span> <span class="n">add_adsorbate</span>
<span class="linenos"> 3</span><span class="kn">import</span><span class="w"> </span><span class="nn">numpy</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nn">np</span>

View File

@ -0,0 +1,654 @@
<!DOCTYPE html>
<html lang="en" data-content_root="../" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Activity 3: Adsorbates and the single scattering approach &#8212; MsSpec Tour</title>
<script data-cfasync="false">
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "";
</script>
<!-- Loaded before other Sphinx assets -->
<link href="../_static/styles/theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/styles/bootstrap.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/styles/pydata-sphinx-theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/vendor/fontawesome/6.5.2/css/all.min.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-solid-900.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-brands-400.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-regular-400.woff2" />
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=03e43079" />
<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/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />
<!-- Pre-loaded scripts that we'll load fully later -->
<link rel="preload" as="script" href="../_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b" />
<link rel="preload" as="script" href="../_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b" />
<script src="../_static/vendor/fontawesome/6.5.2/js/all.min.js?digest=dfe6caa3a7d634c4db9b"></script>
<script src="../_static/documentation_options.js?v=9eb32ce0"></script>
<script src="../_static/doctools.js?v=9a2dae69"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../_static/copybutton.js?v=f281be69"></script>
<script src="../_static/scripts/sphinx-book-theme.js?v=887ef09a"></script>
<script>let toggleHintShow = 'Click to show';</script>
<script>let toggleHintHide = 'Click to hide';</script>
<script>let toggleOpenOnPrint = 'true';</script>
<script src="../_static/togglebutton.js?v=4a39c7ea"></script>
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
<script src="../_static/design-tabs.js?v=f930bc37"></script>
<script>const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"; const thebe_selector = ".thebe,.cell"; const thebe_selector_input = "pre"; const thebe_selector_output = ".output, .cell_output"</script>
<script async="async" src="../_static/sphinx-thebe.js?v=c100c467"></script>
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
<script>const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"; const thebe_selector = ".thebe,.cell"; const thebe_selector_input = "pre"; const thebe_selector_output = ".output, .cell_output"</script>
<script>window.MathJax = {"options": {"processHtmlClass": "tex2jax_process|mathjax_process|math|output_area"}}</script>
<script defer="defer" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script>DOCUMENTATION_OPTIONS.pagename = 'Activity03/Activity03_light';</script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="docsearch:language" content="en"/>
</head>
<body data-bs-spy="scroll" data-bs-target=".bd-toc-nav" data-offset="180" data-bs-root-margin="0px 0px -60%" data-default-mode="">
<div id="pst-skip-link" class="skip-link d-print-none"><a href="#main-content">Skip to main content</a></div>
<div id="pst-scroll-pixel-helper"></div>
<button type="button" class="btn rounded-pill" id="pst-back-to-top">
<i class="fa-solid fa-arrow-up"></i>Back to top</button>
<input type="checkbox"
class="sidebar-toggle"
id="pst-primary-sidebar-checkbox"/>
<label class="overlay overlay-primary" for="pst-primary-sidebar-checkbox"></label>
<input type="checkbox"
class="sidebar-toggle"
id="pst-secondary-sidebar-checkbox"/>
<label class="overlay overlay-secondary" for="pst-secondary-sidebar-checkbox"></label>
<div class="search-button__wrapper">
<div class="search-button__overlay"></div>
<div class="search-button__search-container">
<form class="bd-search d-flex align-items-center"
action="../search.html"
method="get">
<i class="fa-solid fa-magnifying-glass"></i>
<input type="search"
class="form-control"
name="q"
id="search-input"
placeholder="Search this book..."
aria-label="Search this book..."
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"/>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span>
</form></div>
</div>
<div class="pst-async-banner-revealer d-none">
<aside id="bd-header-version-warning" class="d-none d-print-none" aria-label="Version warning"></aside>
</div>
<header class="bd-header navbar navbar-expand-lg bd-navbar d-print-none">
</header>
<div class="bd-container">
<div class="bd-container__inner bd-page-width">
<div class="bd-sidebar-primary bd-sidebar">
<div class="sidebar-header-items sidebar-primary__section">
</div>
<div class="sidebar-primary-items__start sidebar-primary__section">
<div class="sidebar-primary-item">
<a class="navbar-brand logo" href="../intro.html">
<img src="../_static/logo.jpg" class="logo__image only-light" alt="MsSpec Tour - Home"/>
<script>document.write(`<img src="../_static/logo.jpg" class="logo__image only-dark" alt="MsSpec Tour - Home"/>`);</script>
</a></div>
<div class="sidebar-primary-item">
<script>
document.write(`
<button class="btn search-button-field search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass"></i>
<span class="search-button__default-text">Search</span>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
</button>
`);
</script></div>
<div class="sidebar-primary-item"><nav class="bd-links bd-docs-nav" aria-label="Main">
<div class="bd-toc-item navbar-nav active">
<ul class="nav bd-sidenav bd-sidenav__home-link">
<li class="toctree-l1">
<a class="reference internal" href="../intro.html">
Welcome to this small MsSpec tour
</a>
</li>
</ul>
<ul class="nav bd-sidenav">
<li class="toctree-l1"><a class="reference internal" href="../Activity01/Activity01.html">Activity 1: Getting started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity02/Activity02.html">Activity 2: Setting up the “experiment”</a></li>
<li class="toctree-l1"><a class="reference internal" href="Activity03.html">Activity 3: Adsorbates and the single scattering approach</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity04/Activity04.html">Activity 4: From single scattering to multiple scattering</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity05/Activity05.html">Activity 5: Multiple scattering in the forward scattering regime</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity06/Activity06.html">Activity 6: Effect of the temperature</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity07/Activity07.html">Activity 7: Large clusters and path filtering</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity08/Activity08.html">Activity 8: Inequivalent emitters and the XPD of a substrate</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity09/Activity09.html">Activity 9: Comparing simulation and experiment with R-factors</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity10/Activity10.html">Activity 10: Parallelization and multi-processing in MsSpec</a></li>
</ul>
</div>
</nav></div>
</div>
<div class="sidebar-primary-items__end sidebar-primary__section">
</div>
<div id="rtd-footer-container"></div>
</div>
<main id="main-content" class="bd-main" role="main">
<div class="sbt-scroll-pixel-helper"></div>
<div class="bd-content">
<div class="bd-article-container">
<div class="bd-header-article d-print-none">
<div class="header-article-items header-article__inner">
<div class="header-article-items__start">
<div class="header-article-item"><button class="sidebar-toggle primary-toggle btn btn-sm" title="Toggle primary sidebar" data-bs-placement="bottom" data-bs-toggle="tooltip">
<span class="fa-solid fa-bars"></span>
</button></div>
</div>
<div class="header-article-items__end">
<div class="header-article-item">
<div class="article-header-buttons">
<div class="dropdown dropdown-download-buttons">
<button class="btn dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Download this page">
<i class="fas fa-download"></i>
</button>
<ul class="dropdown-menu">
<li><a href="../_sources/Activity03/Activity03_light.ipynb" target="_blank"
class="btn btn-sm btn-download-source-button dropdown-item"
title="Download source file"
data-bs-placement="left" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-file"></i>
</span>
<span class="btn__text-container">.ipynb</span>
</a>
</li>
<li>
<button onclick="window.print()"
class="btn btn-sm btn-download-pdf-button dropdown-item"
title="Print to PDF"
data-bs-placement="left" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-file-pdf"></i>
</span>
<span class="btn__text-container">.pdf</span>
</button>
</li>
</ul>
</div>
<button onclick="toggleFullScreen()"
class="btn btn-sm btn-fullscreen-button"
title="Fullscreen mode"
data-bs-placement="bottom" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-expand"></i>
</span>
</button>
<script>
document.write(`
<button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light"></i>
<i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark"></i>
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto"></i>
</button>
`);
</script>
<script>
document.write(`
<button class="btn btn-sm pst-navbar-icon search-button search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass fa-lg"></i>
</button>
`);
</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 id="jb-print-docs-body" class="onlyprint">
<h1>Activity 3: Adsorbates and the single scattering approach</h1>
<!-- Table of contents -->
<div id="print-main-content">
<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="#oxygen-on-rh-001">Oxygen on Rh(001)</a><ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#computing-the-scattering-factor">Computing the scattering factor</a></li>
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#interferences-due-to-backscattering">Interferences due to backscattering</a></li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div id="searchbox"></div>
<article class="bd-article">
<section class="tex2jax_ignore mathjax_ignore" id="activity-3-adsorbates-and-the-single-scattering-approach">
<span id="ssc"></span><h1>Activity 3: Adsorbates and the single scattering approach<a class="headerlink" href="#activity-3-adsorbates-and-the-single-scattering-approach" title="Link to this heading">#</a></h1>
<p>Photoelectron diffraction is widely used to study the adsorption of atoms or molecules on a crystalline surface. Photoelectrons from adsorbates are scattered by the underlying surface, carrying information about the adsorption site, bond length and/or molecule orientation…. Thanks to a simulation, such information becomes quantitative with a high degree of accuracy.</p>
<p>Calculations of the multiple scattering using matrix inversion have the great advantage of being exact, including all scattering paths. On the other hand, memory consumption soon becomes a problem as the kinetic energy and number of atoms to be considered increase. As an approximation, it is possible to only consider a single scattering from the emitter to any atom in the cluster. This approximation is extremely computationally fast and can give satisfactory results for adsorbates. Well see later that this approach is rather too simplistic for most cases.</p>
<section id="oxygen-on-rh-001">
<h2>Oxygen on Rh(001)<a class="headerlink" href="#oxygen-on-rh-001" title="Link to this heading">#</a></h2>
<p>In a paper published in 1998, T. Gerber <em>et al.</em> used the quite high backscattering factor of Rhodium atoms to probe the distance of Oxygen atoms adsorbed on a Rhodium surface. Some electrons coming from Oxygen atoms are ejected toward the Rhodium surface. They are then backscattered and interfere with the direct signal comming from Oxygen atoms (see the figure below). They demonstrated both experimentally and numerically with a sinle scattering computation that this lead to a very accurate probe of adsorbed species that can be sensitive to bond length changes of the order of <span class="math notranslate nohighlight">\(\pm 0.02 \mathring{A}\)</span>.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p>based on this paper from T. Greber <em>et al.</em> <a class="reference external" href="https://doi.org/10.1103/PhysRevLett.81.1654">Phys. Rev. Lett. <strong>81</strong>(8) p1654 (1998)</a></p>
</div>
<figure class="align-default" id="rho-fig">
<a class="reference internal image-reference" href="../_images/RhO_fig0.jpg"><img alt="RhO" class="align-center" src="../_images/RhO_fig0.jpg" style="width: 300px;" />
</a>
<figcaption>
<p><span class="caption-text">Interferences produced by the backscattering effect</span><a class="headerlink" href="#rho-fig" title="Link to this image">#</a></p>
</figcaption>
</figure>
<section id="computing-the-scattering-factor">
<h3>Computing the scattering factor<a class="headerlink" href="#computing-the-scattering-factor" title="Link to this heading">#</a></h3>
<p>To illustrate that photoelectrons emitted by Oxygen adsorbates towards the Rhodium surface can be backscattered, we will start by computing the scattering factor for both O and Rh atoms.</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>By using the <a class="reference external" href="https://wiki.fysik.dtu.dk/ase/ase/atoms.html#ase.Atoms"><code class="docutils literal notranslate"><span class="pre">Atoms</span></code></a> class of the <code class="docutils literal notranslate"><span class="pre">ase</span></code> package, try to build a O-Rh chain where atoms are 4 Å apart. Here is the begining of the script. Try to complete the line of code and view your two-atoms chain.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">ase</span><span class="w"> </span><span class="kn">import</span> <span class="n">Atoms</span>
<span class="kn">from</span><span class="w"> </span><span class="nn">ase.visualize</span><span class="w"> </span><span class="kn">import</span> <span class="n">view</span>
<span class="c1"># Create an atomic chain O-Rh</span>
<span class="n">cluster</span> <span class="o">=</span> <span class="n">Atoms</span><span class="p">(</span><span class="o">...</span> <span class="c1"># Fill this line</span>
</pre></div>
</div>
</div>
</div>
<div class="cell tag_remove-input docutils container">
</div>
<div class="cell tag_remove-input docutils container">
<div class="cell_output docutils container">
<div class="output text_html"><html>
<head>
<title>ASE atomic visualization</title>
<link rel="stylesheet" type="text/css" href="https://www.x3dom.org/release/x3dom.css"></link>
<script type="text/javascript" src="https://www.x3dom.org/release/x3dom.js"></script>
</head>
<body>
<X3D width="400px"; height="300px";>
<!--Inserting Generated X3D Scene-->
<scene>
<viewpoint position="0 0 8.0">
<group/>
</viewpoint>
<transform translation="-0.0 -0.0 -0.0">
<group>
<group>
<transform translation="0 0 0">
<shape>
<appearance>
<material diffuseColor="0 0 0"/>
</appearance>
<lineset vertexCount="5">
<coordinate point="0 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0"/>
</lineset>
</shape>
</transform>
<transform translation="0.0 0.0 0.0">
<shape>
<appearance>
<material diffuseColor="0 0 0"/>
</appearance>
<lineset vertexCount="5">
<coordinate point="0 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0"/>
</lineset>
</shape>
</transform>
<transform translation="0 0 0">
<shape>
<appearance>
<material diffuseColor="0 0 0"/>
</appearance>
<lineset vertexCount="5">
<coordinate point="0 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0"/>
</lineset>
</shape>
</transform>
<transform translation="0.0 0.0 0.0">
<shape>
<appearance>
<material diffuseColor="0 0 0"/>
</appearance>
<lineset vertexCount="5">
<coordinate point="0 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0"/>
</lineset>
</shape>
</transform>
</group>
<group>
<transform translation="0.0 0.0 0.0">
<shape>
<appearance>
<material diffuseColor="1.0 0.051 0.051"/>
</appearance>
<sphere radius="0.66"/>
</shape>
</transform>
<transform translation="0.0 0.0 4.0">
<shape>
<appearance>
<material diffuseColor="0.039 0.49 0.549"/>
</appearance>
<sphere radius="1.42"/>
</shape>
</transform>
</group>
</group>
</transform>
</scene>
<!--End of Inserted Scene-->
</X3D>
</body>
</html>
</div></div>
</div>
<p>As previously, we create a calculator, we attach our 2 atoms cluster to this calculator and we define the first atom in the chain as the emitter</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">calc</span> <span class="o">=</span> <span class="n">MSSPEC</span><span class="p">(</span><span class="n">spectroscopy</span><span class="o">=</span><span class="s1">&#39;PED&#39;</span><span class="p">)</span>
<span class="n">calc</span><span class="o">.</span><span class="n">set_atoms</span><span class="p">(</span><span class="n">cluster</span><span class="p">)</span>
<span class="n">cluster</span><span class="o">.</span><span class="n">emitter</span> <span class="o">=</span> <span class="mi">0</span>
</pre></div>
</div>
<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>We use the <code class="docutils literal notranslate"><span class="pre">get_scattering_factors</span></code> method <a class="reference external" href="https://msspec.cnrs.fr/modules/calculator.html#calculator._PED.get_scattering_factors">(see its documentation)</a> to compute the scattering factors at 723 eV.</p>
<p>How large is the backscattering factor of Rhodium with respect to that of Oxygen ?</p>
</div>
</div>
</section>
<section id="interferences-due-to-backscattering">
<h3>Interferences due to backscattering<a class="headerlink" href="#interferences-due-to-backscattering" title="Link to this heading">#</a></h3>
<p>Let an Oxygen atom (in red) being adsorbed at a distance <span class="math notranslate nohighlight">\(z_0\)</span> of an <em>fcc</em> site of the Rh(111) surface.</p>
<figure class="align-default" id="rho-fig2a">
<a class="reference internal image-reference" href="../_images/RhO_fig2a.jpg"><img alt="../_images/RhO_fig2a.jpg" class="align-center" src="../_images/RhO_fig2a.jpg" style="width: 600px;" />
</a>
<figcaption>
<p><span class="caption-text">Small cluster used for the calculation.</span><a class="headerlink" href="#rho-fig2a" title="Link to this image">#</a></p>
</figcaption>
</figure>
<p>We will compute for different values of the adsorption height <span class="math notranslate nohighlight">\(z_0\)</span>.</p>
<div class="sd-tab-set docutils">
<input checked="checked" id="sd-tab-item-2" name="sd-tab-set-2" type="radio">
<label class="sd-tab-label" for="sd-tab-item-2">
<i class="fa-solid fa-circle-question"></i> Quiz</label><div class="sd-tab-content docutils">
<p>Complete the <a class="reference download internal" download="" href="../_downloads/79fef44b9d7fb8ae298952070d9ba3ce/RhO_tofill.py"><span class="xref download myst">script below</span></a> to compute the (<span class="math notranslate nohighlight">\(\theta,\phi\)</span>) scan of the photodiffraction of O(1s) adsorbed on a <em>fcc</em> site on Rh(111) surface.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="linenos"> 1</span><span class="kn">from</span><span class="w"> </span><span class="nn">msspec.calculator</span><span class="w"> </span><span class="kn">import</span> <span class="n">MSSPEC</span>
<span class="linenos"> 2</span><span class="kn">from</span><span class="w"> </span><span class="nn">ase.build</span><span class="w"> </span><span class="kn">import</span> <span class="n">fcc111</span><span class="p">,</span> <span class="n">add_adsorbate</span>
<span class="linenos"> 3</span><span class="kn">import</span><span class="w"> </span><span class="nn">numpy</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nn">np</span>
<span class="linenos"> 4</span>
<span class="linenos"> 5</span><span class="n">data</span> <span class="o">=</span> <span class="kc">None</span>
<span class="hll"><span class="linenos"> 6</span><span class="n">all_z</span> <span class="o">=</span> <span class="o">...</span> <span class="c1"># -&gt; Define a list of z values for the adsorbate</span>
</span><span class="linenos"> 7</span>
<span class="hll"><span class="linenos"> 8</span><span class="k">for</span> <span class="o">...</span> <span class="c1"># -&gt; Complete this for-loop over z values</span>
</span><span class="linenos"> 9</span> <span class="c1"># construct the cluster</span>
<span class="linenos">10</span> <span class="n">cluster</span> <span class="o">=</span> <span class="n">fcc111</span><span class="p">(</span><span class="s1">&#39;Rh&#39;</span><span class="p">,</span> <span class="n">size</span> <span class="o">=</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span>
<span class="linenos">11</span> <span class="n">cluster</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
<span class="hll"><span class="linenos">12</span> <span class="n">add_adsorbate</span><span class="p">(</span><span class="o">...</span> <span class="c1"># -&gt; Put the oxygen atom on the fcc site</span>
</span><span class="hll"><span class="linenos">13</span> <span class="n">cluster</span><span class="o">.</span><span class="n">emitter</span> <span class="o">=</span> <span class="o">...</span> <span class="c1"># -&gt; Oxygen is the last atom we added, so the indice is...</span>
</span><span class="linenos">14</span>
<span class="linenos">15</span> <span class="c1"># Define a calculator for single scattering calculations</span>
<span class="linenos">16</span> <span class="n">calc</span> <span class="o">=</span> <span class="n">MSSPEC</span><span class="p">(</span><span class="n">spectroscopy</span><span class="o">=</span><span class="s1">&#39;PED&#39;</span><span class="p">,</span> <span class="n">algorithm</span><span class="o">=</span><span class="s1">&#39;expansion&#39;</span><span class="p">)</span>
<span class="linenos">17</span> <span class="n">calc</span><span class="o">.</span><span class="n">calculation_parameters</span><span class="o">.</span><span class="n">scattering_order</span> <span class="o">=</span> <span class="mi">1</span>
<span class="linenos">18</span> <span class="n">calc</span><span class="o">.</span><span class="n">set_atoms</span><span class="p">(</span><span class="n">cluster</span><span class="p">)</span>
<span class="linenos">19</span>
<span class="linenos">20</span> <span class="c1"># Compute</span>
<span class="linenos">21</span> <span class="n">data</span> <span class="o">=</span> <span class="n">calc</span><span class="o">.</span><span class="n">get_theta_phi_scan</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="s1">&#39;1s&#39;</span><span class="p">,</span> <span class="n">kinetic_energy</span><span class="o">=</span><span class="mi">723</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">)</span>
<span class="linenos">22</span>
<span class="linenos">23</span><span class="n">data</span><span class="o">.</span><span class="n">view</span><span class="p">()</span>
</pre></div>
</div>
<p>As proposed in the comments, add a loop to vary the adsorption height of Oxygen between 1.10 and 1.65 Å.
What is the bond length difference between to intensity maxima ?</p>
</div>
</div>
</section>
</section>
</section>
<script type="text/x-thebe-config">
{
requestKernel: true,
binderOptions: {
repo: "binder-examples/jupyter-stacks-datascience",
ref: "master",
},
codeMirrorConfig: {
theme: "abcdef",
mode: "python"
},
kernelOptions: {
name: "python3",
path: "./Activity03"
},
predefinedOutput: true
}
</script>
<script>kernelName = 'python3'</script>
</article>
<footer class="prev-next-footer d-print-none">
<div class="prev-next-area">
</div>
</footer>
</div>
<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="#oxygen-on-rh-001">Oxygen on Rh(001)</a><ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#computing-the-scattering-factor">Computing the scattering factor</a></li>
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#interferences-due-to-backscattering">Interferences due to backscattering</a></li>
</ul>
</li>
</ul>
</nav></div>
</div></div>
</div>
<footer class="bd-footer-content">
<div class="bd-footer-content__inner container">
<div class="footer-item">
<p class="component-author">
By Sylvain Tricot
</p>
</div>
<div class="footer-item">
<p class="copyright">
© Copyright 2023.
<br/>
</p>
</div>
<div class="footer-item">
</div>
<div class="footer-item">
</div>
</div>
</footer>
</main>
</div>
</div>
<!-- Scripts loaded after <body> so the DOM is not blocked -->
<script src="../_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b"></script>
<script src="../_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b"></script>
<footer class="bd-footer">
</footer>
</body>
</html>

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/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />
@ -357,9 +357,9 @@ document.write(`
<section class="tex2jax_ignore mathjax_ignore" id="activity-4-from-single-scattering-to-multiple-scattering">
<span id="ssc2ms"></span><h1>Activity 4: From single scattering to multiple scattering<a class="headerlink" href="#activity-4-from-single-scattering-to-multiple-scattering" title="Link to this heading">#</a></h1>
<p>In the <a class="reference internal" href="../Activity03/Activity03.html#ssc"><span class="std std-ref">previous activity</span></a>, we saw that simple single scattering calculations (SSC) can be used to simulate photodiffraction diagrams with good accuracy. The approximation works fine when the emitting atom is very close to the surface.
<p>In the <a class="reference internal" href="../Activity03/Activity03_light.html#ssc"><span class="std std-ref">previous activity</span></a>, we saw that simple single scattering calculations (SSC) can be used to simulate photodiffraction diagrams with good accuracy. The approximation works fine when the emitting atom is very close to the surface.
However, the SSC approach is no longer suitable for deeper emitter atoms, where multiple scattering effects come into play. In this activity, we will focus on a major consequence of multiple scattering: <em>the defocusing effect</em>.</p>
<p>The defocusing effect is presented in the <a class="reference internal" href="#ni-fig1"><span class="std std-ref">figure below</span></a> for a chain of nickel atoms. Although purely illustrative, understanding multiple scattering in atomic chains is fundamental because they are found in many situations, such as in particular directions of a crystal or in molecules of various lengths.</p>
<p>The defocusing effect is presented in the <a class="reference internal" href="Activity04_light.html#ni-fig1"><span class="std std-ref">figure below</span></a> for a chain of nickel atoms. Although purely illustrative, understanding multiple scattering in atomic chains is fundamental because they are found in many situations, such as in particular directions of a crystal or in molecules of various lengths.</p>
<figure class="align-default" id="ni-fig1">
<a class="reference internal image-reference" href="../_images/defocusing_animation.gif"><img alt="defocusing effect" class="align-center" src="../_images/defocusing_animation.gif" style="width: 600px;" />
</a>
@ -367,7 +367,7 @@ However, the SSC approach is no longer suitable for deeper emitter atoms, where
<p><span class="caption-number">Fig. 10 </span><span class="caption-text">The defocusing effect dur to multiple scattering in an atomic chain of Ni atoms.</span><a class="headerlink" href="#ni-fig1" title="Link to this image">#</a></p>
</figcaption>
</figure>
<p>In 1989, M.-L Xu, J.J. Barton and M.A. Van Hove studied these multiple scattering effects on atomic chains (<a class="reference internal" href="#defocusing-paper"><span class="std std-ref">see their paper below</span></a>).
<p>In 1989, M.-L Xu, J.J. Barton and M.A. Van Hove studied these multiple scattering effects on atomic chains (<a class="reference internal" href="Activity04_light.html#defocusing-paper"><span class="std std-ref">see their paper below</span></a>).
In the spirit of figure 3 of their paper, we will create 3 atomic chains of Ni atoms (2, 3 and 5 atoms) tilted by 45° and we will compare the intensity of the forward scattering peak for single scattering and for full multiple scattering.</p>
<div class="admonition seealso" id="defocusing-paper">
<p class="admonition-title">See also</p>
@ -381,7 +381,7 @@ In the spirit of figure 3 of their paper, we will create 3 atomic chains of Ni a
<p>Start by creating a simple chain of 2 Ni atoms: an emitter and a scatterer in the [101] direction.</p>
<div class="admonition tip">
<p class="admonition-title">Tip</p>
<p>Nickel is <em>fcc</em> with lattice parameter <span class="math notranslate nohighlight">\(a\)</span>=3.499 Å. Use the <a class="reference external" href="https://wiki.fysik.dtu.dk/ase/ase/atoms.html#ase.Atoms"><code class="docutils literal notranslate"><span class="pre">Atoms</span></code></a> class of <code class="docutils literal notranslate"><span class="pre">ase</span></code> like in the <a class="reference internal" href="../Activity03/Activity03.html#ssc"><span class="std std-ref">previous activity</span></a></p>
<p>Nickel is <em>fcc</em> with lattice parameter <span class="math notranslate nohighlight">\(a\)</span>=3.499 Å. Use the <a class="reference external" href="https://wiki.fysik.dtu.dk/ase/ase/atoms.html#ase.Atoms"><code class="docutils literal notranslate"><span class="pre">Atoms</span></code></a> class of <code class="docutils literal notranslate"><span class="pre">ase</span></code> like in the <a class="reference internal" href="../Activity03/Activity03_light.html#ssc"><span class="std std-ref">previous activity</span></a></p>
<div class="dropdown admonition">
<p class="admonition-title">if you need help to start…</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">msspec.calculator</span><span class="w"> </span><span class="kn">import</span> <span class="n">MSSPEC</span>
@ -441,6 +441,32 @@ In the spirit of figure 3 of their paper, we will create 3 atomic chains of Ni a
<p><span class="caption-number">Fig. 12 </span><span class="caption-text">Polar scan of a Ni chain of 2-5 atoms for single and full mutliple scattering.</span><a class="headerlink" href="#ni-figx" title="Link to this image">#</a></p>
</figcaption>
</figure>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="linenos"> 1</span><span class="kn">from</span><span class="w"> </span><span class="nn">msspec.calculator</span><span class="w"> </span><span class="kn">import</span> <span class="n">MSSPEC</span>
<span class="linenos"> 2</span><span class="kn">from</span><span class="w"> </span><span class="nn">ase</span><span class="w"> </span><span class="kn">import</span> <span class="n">Atoms</span>
<span class="linenos"> 3</span><span class="kn">import</span><span class="w"> </span><span class="nn">numpy</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nn">np</span>
<span class="linenos"> 4</span>
<span class="linenos"> 5</span><span class="n">symbol</span> <span class="o">=</span> <span class="s1">&#39;Ni&#39;</span> <span class="c1"># The kind of atom for the chain</span>
<span class="linenos"> 6</span><span class="n">a</span> <span class="o">=</span> <span class="mf">3.499</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span> <span class="c1"># The distance bewteen 2 atoms</span>
<span class="linenos"> 7</span> <span class="c1"># in [101] direction</span>
<span class="linenos"> 8</span>
<span class="linenos"> 9</span><span class="n">chain</span> <span class="o">=</span> <span class="n">Atoms</span><span class="p">(</span><span class="n">symbol</span><span class="p">)</span>
<span class="linenos">10</span><span class="n">data</span> <span class="o">=</span> <span class="kc">None</span>
<span class="linenos">11</span><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">5</span><span class="p">):</span>
<span class="linenos">12</span> <span class="n">atom</span> <span class="o">=</span> <span class="n">Atoms</span><span class="p">(</span><span class="n">symbol</span><span class="p">,</span> <span class="p">[[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="n">i</span><span class="o">*</span><span class="n">a</span><span class="p">]])</span>
<span class="linenos">13</span> <span class="n">atom</span><span class="o">.</span><span class="n">rotate</span><span class="p">(</span><span class="s1">&#39;y&#39;</span><span class="p">,</span> <span class="mi">45</span><span class="p">)</span>
<span class="linenos">14</span> <span class="n">chain</span> <span class="o">+=</span> <span class="n">atom</span>
<span class="linenos">15</span>
<span class="linenos">16</span> <span class="n">calc</span> <span class="o">=</span> <span class="n">MSSPEC</span><span class="p">(</span><span class="n">spectroscopy</span><span class="o">=</span><span class="s1">&#39;PED&#39;</span><span class="p">,</span> <span class="n">algorithm</span><span class="o">=</span><span class="s1">&#39;inversion&#39;</span><span class="p">)</span>
<span class="linenos">17</span> <span class="n">calc</span><span class="o">.</span><span class="n">calculation_parameters</span><span class="o">.</span><span class="n">scattering_order</span> <span class="o">=</span> <span class="mi">1</span>
<span class="linenos">18</span>
<span class="linenos">19</span> <span class="n">chain</span><span class="o">.</span><span class="n">emitter</span> <span class="o">=</span> <span class="mi">0</span>
<span class="linenos">20</span> <span class="n">calc</span><span class="o">.</span><span class="n">set_atoms</span><span class="p">(</span><span class="n">chain</span><span class="p">)</span>
<span class="linenos">21</span>
<span class="linenos">22</span> <span class="n">data</span> <span class="o">=</span> <span class="n">calc</span><span class="o">.</span><span class="n">get_theta_scan</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="s1">&#39;3s&#39;</span><span class="p">,</span> <span class="n">theta</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">80</span><span class="p">,</span><span class="mf">0.5</span><span class="p">),</span> <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">)</span>
<span class="linenos">23</span> <span class="n">data</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">views</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">set_plot_options</span><span class="p">(</span><span class="n">ylim</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mf">0.045</span><span class="p">])</span>
<span class="linenos">24</span><span class="n">data</span><span class="o">.</span><span class="n">view</span><span class="p">()</span>
</pre></div>
</div>
</div>
</section>
</section>

View File

@ -0,0 +1,519 @@
<!DOCTYPE html>
<html lang="en" data-content_root="../" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Activity 4: From single scattering to multiple scattering &#8212; MsSpec Tour</title>
<script data-cfasync="false">
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "";
</script>
<!-- Loaded before other Sphinx assets -->
<link href="../_static/styles/theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/styles/bootstrap.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/styles/pydata-sphinx-theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/vendor/fontawesome/6.5.2/css/all.min.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-solid-900.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-brands-400.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-regular-400.woff2" />
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=03e43079" />
<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/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />
<!-- Pre-loaded scripts that we'll load fully later -->
<link rel="preload" as="script" href="../_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b" />
<link rel="preload" as="script" href="../_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b" />
<script src="../_static/vendor/fontawesome/6.5.2/js/all.min.js?digest=dfe6caa3a7d634c4db9b"></script>
<script src="../_static/documentation_options.js?v=9eb32ce0"></script>
<script src="../_static/doctools.js?v=9a2dae69"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../_static/copybutton.js?v=f281be69"></script>
<script src="../_static/scripts/sphinx-book-theme.js?v=887ef09a"></script>
<script>let toggleHintShow = 'Click to show';</script>
<script>let toggleHintHide = 'Click to hide';</script>
<script>let toggleOpenOnPrint = 'true';</script>
<script src="../_static/togglebutton.js?v=4a39c7ea"></script>
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
<script src="../_static/design-tabs.js?v=f930bc37"></script>
<script>const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"; const thebe_selector = ".thebe,.cell"; const thebe_selector_input = "pre"; const thebe_selector_output = ".output, .cell_output"</script>
<script async="async" src="../_static/sphinx-thebe.js?v=c100c467"></script>
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
<script>const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"; const thebe_selector = ".thebe,.cell"; const thebe_selector_input = "pre"; const thebe_selector_output = ".output, .cell_output"</script>
<script>window.MathJax = {"options": {"processHtmlClass": "tex2jax_process|mathjax_process|math|output_area"}}</script>
<script defer="defer" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script>DOCUMENTATION_OPTIONS.pagename = 'Activity04/Activity04_light';</script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="docsearch:language" content="en"/>
</head>
<body data-bs-spy="scroll" data-bs-target=".bd-toc-nav" data-offset="180" data-bs-root-margin="0px 0px -60%" data-default-mode="">
<div id="pst-skip-link" class="skip-link d-print-none"><a href="#main-content">Skip to main content</a></div>
<div id="pst-scroll-pixel-helper"></div>
<button type="button" class="btn rounded-pill" id="pst-back-to-top">
<i class="fa-solid fa-arrow-up"></i>Back to top</button>
<input type="checkbox"
class="sidebar-toggle"
id="pst-primary-sidebar-checkbox"/>
<label class="overlay overlay-primary" for="pst-primary-sidebar-checkbox"></label>
<input type="checkbox"
class="sidebar-toggle"
id="pst-secondary-sidebar-checkbox"/>
<label class="overlay overlay-secondary" for="pst-secondary-sidebar-checkbox"></label>
<div class="search-button__wrapper">
<div class="search-button__overlay"></div>
<div class="search-button__search-container">
<form class="bd-search d-flex align-items-center"
action="../search.html"
method="get">
<i class="fa-solid fa-magnifying-glass"></i>
<input type="search"
class="form-control"
name="q"
id="search-input"
placeholder="Search this book..."
aria-label="Search this book..."
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"/>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span>
</form></div>
</div>
<div class="pst-async-banner-revealer d-none">
<aside id="bd-header-version-warning" class="d-none d-print-none" aria-label="Version warning"></aside>
</div>
<header class="bd-header navbar navbar-expand-lg bd-navbar d-print-none">
</header>
<div class="bd-container">
<div class="bd-container__inner bd-page-width">
<div class="bd-sidebar-primary bd-sidebar">
<div class="sidebar-header-items sidebar-primary__section">
</div>
<div class="sidebar-primary-items__start sidebar-primary__section">
<div class="sidebar-primary-item">
<a class="navbar-brand logo" href="../intro.html">
<img src="../_static/logo.jpg" class="logo__image only-light" alt="MsSpec Tour - Home"/>
<script>document.write(`<img src="../_static/logo.jpg" class="logo__image only-dark" alt="MsSpec Tour - Home"/>`);</script>
</a></div>
<div class="sidebar-primary-item">
<script>
document.write(`
<button class="btn search-button-field search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass"></i>
<span class="search-button__default-text">Search</span>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
</button>
`);
</script></div>
<div class="sidebar-primary-item"><nav class="bd-links bd-docs-nav" aria-label="Main">
<div class="bd-toc-item navbar-nav active">
<ul class="nav bd-sidenav bd-sidenav__home-link">
<li class="toctree-l1">
<a class="reference internal" href="../intro.html">
Welcome to this small MsSpec tour
</a>
</li>
</ul>
<ul class="nav bd-sidenav">
<li class="toctree-l1"><a class="reference internal" href="../Activity01/Activity01.html">Activity 1: Getting started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity02/Activity02.html">Activity 2: Setting up the “experiment”</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity03/Activity03.html">Activity 3: Adsorbates and the single scattering approach</a></li>
<li class="toctree-l1"><a class="reference internal" href="Activity04.html">Activity 4: From single scattering to multiple scattering</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity05/Activity05.html">Activity 5: Multiple scattering in the forward scattering regime</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity06/Activity06.html">Activity 6: Effect of the temperature</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity07/Activity07.html">Activity 7: Large clusters and path filtering</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity08/Activity08.html">Activity 8: Inequivalent emitters and the XPD of a substrate</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity09/Activity09.html">Activity 9: Comparing simulation and experiment with R-factors</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity10/Activity10.html">Activity 10: Parallelization and multi-processing in MsSpec</a></li>
</ul>
</div>
</nav></div>
</div>
<div class="sidebar-primary-items__end sidebar-primary__section">
</div>
<div id="rtd-footer-container"></div>
</div>
<main id="main-content" class="bd-main" role="main">
<div class="sbt-scroll-pixel-helper"></div>
<div class="bd-content">
<div class="bd-article-container">
<div class="bd-header-article d-print-none">
<div class="header-article-items header-article__inner">
<div class="header-article-items__start">
<div class="header-article-item"><button class="sidebar-toggle primary-toggle btn btn-sm" title="Toggle primary sidebar" data-bs-placement="bottom" data-bs-toggle="tooltip">
<span class="fa-solid fa-bars"></span>
</button></div>
</div>
<div class="header-article-items__end">
<div class="header-article-item">
<div class="article-header-buttons">
<div class="dropdown dropdown-download-buttons">
<button class="btn dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Download this page">
<i class="fas fa-download"></i>
</button>
<ul class="dropdown-menu">
<li><a href="../_sources/Activity04/Activity04_light.ipynb" target="_blank"
class="btn btn-sm btn-download-source-button dropdown-item"
title="Download source file"
data-bs-placement="left" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-file"></i>
</span>
<span class="btn__text-container">.ipynb</span>
</a>
</li>
<li>
<button onclick="window.print()"
class="btn btn-sm btn-download-pdf-button dropdown-item"
title="Print to PDF"
data-bs-placement="left" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-file-pdf"></i>
</span>
<span class="btn__text-container">.pdf</span>
</button>
</li>
</ul>
</div>
<button onclick="toggleFullScreen()"
class="btn btn-sm btn-fullscreen-button"
title="Fullscreen mode"
data-bs-placement="bottom" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-expand"></i>
</span>
</button>
<script>
document.write(`
<button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light"></i>
<i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark"></i>
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto"></i>
</button>
`);
</script>
<script>
document.write(`
<button class="btn btn-sm pst-navbar-icon search-button search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass fa-lg"></i>
</button>
`);
</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 id="jb-print-docs-body" class="onlyprint">
<h1>Activity 4: From single scattering to multiple scattering</h1>
<!-- Table of contents -->
<div id="print-main-content">
<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="#polar-scans-of-ni-atomic-chains">Polar scans of Ni atomic chains</a><ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#building-a-chain-of-atoms">Building a chain of atoms</a></li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div id="searchbox"></div>
<article class="bd-article">
<section class="tex2jax_ignore mathjax_ignore" id="activity-4-from-single-scattering-to-multiple-scattering">
<span id="ssc2ms"></span><h1>Activity 4: From single scattering to multiple scattering<a class="headerlink" href="#activity-4-from-single-scattering-to-multiple-scattering" title="Link to this heading">#</a></h1>
<p>In the <a class="reference internal" href="../Activity03/Activity03_light.html#ssc"><span class="std std-ref">previous activity</span></a>, we saw that simple single scattering calculations (SSC) can be used to simulate photodiffraction diagrams with good accuracy. The approximation works fine when the emitting atom is very close to the surface.
However, the SSC approach is no longer suitable for deeper emitter atoms, where multiple scattering effects come into play. In this activity, we will focus on a major consequence of multiple scattering: <em>the defocusing effect</em>.</p>
<p>The defocusing effect is presented in the <a class="reference internal" href="#ni-fig1"><span class="std std-ref">figure below</span></a> for a chain of nickel atoms. Although purely illustrative, understanding multiple scattering in atomic chains is fundamental because they are found in many situations, such as in particular directions of a crystal or in molecules of various lengths.</p>
<figure class="align-default" id="ni-fig1">
<a class="reference internal image-reference" href="../_images/defocusing_animation.gif"><img alt="defocusing effect" class="align-center" src="../_images/defocusing_animation.gif" style="width: 600px;" />
</a>
<figcaption>
<p><span class="caption-text">The defocusing effect dur to multiple scattering in an atomic chain of Ni atoms.</span><a class="headerlink" href="#ni-fig1" title="Link to this image">#</a></p>
</figcaption>
</figure>
<p>In 1989, M.-L Xu, J.J. Barton and M.A. Van Hove studied these multiple scattering effects on atomic chains (<a class="reference internal" href="#defocusing-paper"><span class="std std-ref">see their paper below</span></a>).
In the spirit of figure 3 of their paper, we will create 3 atomic chains of Ni atoms (2, 3 and 5 atoms) tilted by 45° and we will compare the intensity of the forward scattering peak for single scattering and for full multiple scattering.</p>
<div class="admonition seealso" id="defocusing-paper">
<p class="admonition-title">See also</p>
<p>based on this paper from M.-L. Xu <em>et al.</em>
<a class="reference external" href="https://doi.org/10.1103/PhysRevB.39.8275">Phys. Rev. B <strong>39</strong> p8275 (1989)</a></p>
</div>
<section id="polar-scans-of-ni-atomic-chains">
<h2>Polar scans of Ni atomic chains<a class="headerlink" href="#polar-scans-of-ni-atomic-chains" title="Link to this heading">#</a></h2>
<section id="building-a-chain-of-atoms">
<h3>Building a chain of atoms<a class="headerlink" href="#building-a-chain-of-atoms" title="Link to this heading">#</a></h3>
<p>Start by creating a simple chain of 2 Ni atoms: an emitter and a scatterer in the [101] direction.</p>
<div class="admonition tip">
<p class="admonition-title">Tip</p>
<p>Nickel is <em>fcc</em> with lattice parameter <span class="math notranslate nohighlight">\(a\)</span>=3.499 Å. Use the <a class="reference external" href="https://wiki.fysik.dtu.dk/ase/ase/atoms.html#ase.Atoms"><code class="docutils literal notranslate"><span class="pre">Atoms</span></code></a> class of <code class="docutils literal notranslate"><span class="pre">ase</span></code> like in the <a class="reference internal" href="../Activity03/Activity03_light.html#ssc"><span class="std std-ref">previous activity</span></a></p>
<div class="dropdown admonition">
<p class="admonition-title">if you need help to start…</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">msspec.calculator</span><span class="w"> </span><span class="kn">import</span> <span class="n">MSSPEC</span>
<span class="kn">from</span><span class="w"> </span><span class="nn">ase</span><span class="w"> </span><span class="kn">import</span> <span class="n">Atoms</span>
<span class="n">symbol</span> <span class="o">=</span> <span class="o">...</span> <span class="c1"># The kind of atom for the chain</span>
<span class="n">a</span> <span class="o">=</span> <span class="o">...</span> <span class="c1"># The distance bewteen 2 atoms</span>
<span class="c1"># in [101] direction</span>
<span class="n">chain</span> <span class="o">=</span> <span class="n">Atoms</span><span class="p">(</span><span class="o">...</span><span class="p">,</span> <span class="n">positions</span><span class="o">=</span><span class="p">[</span><span class="o">...</span><span class="p">])</span>
<span class="n">chain</span><span class="o">.</span><span class="n">rotate</span><span class="p">(</span><span class="o">...</span><span class="p">)</span>
<span class="n">chain</span><span class="o">.</span><span class="n">edit</span><span class="p">()</span>
</pre></div>
</div>
</div>
</div>
<div class="docutils">
</div>
<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 an <code class="docutils literal notranslate"><span class="pre">MSSPEC</span></code> calculator with <code class="docutils literal notranslate"><span class="pre">expansion</span></code> algortithm and set the <code class="docutils literal notranslate"><span class="pre">scattering_order</span></code>=1 to compute a polar scan of the Ni(3s) in single scattering. How is varying the height of the peak at 45° (along the chain) if you increase the number of atoms in the chain ?</p>
<p>Repeat the same experiment with <code class="docutils literal notranslate"><span class="pre">inversion</span></code> algorithm for having the full multiple scattering result. What do you observe ?</p>
</div>
</div>
</section>
</section>
</section>
<script type="text/x-thebe-config">
{
requestKernel: true,
binderOptions: {
repo: "binder-examples/jupyter-stacks-datascience",
ref: "master",
},
codeMirrorConfig: {
theme: "abcdef",
mode: "python"
},
kernelOptions: {
name: "python3",
path: "./Activity04"
},
predefinedOutput: true
}
</script>
<script>kernelName = 'python3'</script>
</article>
<footer class="prev-next-footer d-print-none">
<div class="prev-next-area">
</div>
</footer>
</div>
<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="#polar-scans-of-ni-atomic-chains">Polar scans of Ni atomic chains</a><ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#building-a-chain-of-atoms">Building a chain of atoms</a></li>
</ul>
</li>
</ul>
</nav></div>
</div></div>
</div>
<footer class="bd-footer-content">
<div class="bd-footer-content__inner container">
<div class="footer-item">
<p class="component-author">
By Sylvain Tricot
</p>
</div>
<div class="footer-item">
<p class="copyright">
© Copyright 2023.
<br/>
</p>
</div>
<div class="footer-item">
</div>
<div class="footer-item">
</div>
</div>
</footer>
</main>
</div>
</div>
<!-- Scripts loaded after <body> so the DOM is not blocked -->
<script src="../_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b"></script>
<script src="../_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b"></script>
<footer class="bd-footer">
</footer>
</body>
</html>

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/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />
@ -427,23 +427,23 @@ document.write(`
<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>Complete the code snipet provided below to create a small TiSe<sub>2</sub> cluster with Ti emitter in the 2<sup>nd</sup> plane:</p>
<p>Complete the code snipet provided below (or <a class="reference download internal" download="" href="../_downloads/7cc7f59f1ea682f79421b71b98d87b23/TiSe2_1_tofill.py"><span class="xref download myst">here</span></a>) to create a small TiSe<sub>2</sub> cluster with Ti emitter in the 2<sup>nd</sup> plane:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="linenos"> 1</span><span class="kn">from</span><span class="w"> </span><span class="nn">ase.build</span><span class="w"> </span><span class="kn">import</span> <span class="n">mx2</span>
<span class="linenos"> 2</span><span class="kn">from</span><span class="w"> </span><span class="nn">ase.visualize</span><span class="w"> </span><span class="kn">import</span> <span class="n">view</span>
<span class="linenos"> 3</span><span class="kn">from</span><span class="w"> </span><span class="nn">msspec.calculator</span><span class="w"> </span><span class="kn">import</span> <span class="n">MSSPEC</span>
<span class="linenos"> 4</span><span class="kn">from</span><span class="w"> </span><span class="nn">msspec.utils</span><span class="w"> </span><span class="kn">import</span> <span class="n">hemispherical_cluster</span><span class="p">,</span> <span class="n">get_atom_index</span>
<span class="linenos"> 5</span>
<span class="linenos"> 6</span><span class="c1"># Some usefull constants (a, c, d, D) for defining the structure</span>
<span class="linenos"> 7</span><span class="n">a</span><span class="o">=...</span>
<span class="linenos"> 8</span>
<span class="hll"><span class="linenos"> 7</span><span class="n">a</span><span class="o">=...</span>
</span><span class="linenos"> 8</span>
<span class="linenos"> 9</span><span class="c1"># Create the TiSe2 trilayer</span>
<span class="linenos">10</span><span class="c1"># use ase help for this function</span>
<span class="linenos">11</span><span class="n">TiSe2</span> <span class="o">=</span> <span class="n">mx2</span><span class="p">(</span><span class="n">formula</span><span class="o">=...</span><span class="p">)</span>
<span class="linenos">12</span>
<span class="hll"><span class="linenos">11</span><span class="n">TiSe2</span> <span class="o">=</span> <span class="n">mx2</span><span class="p">(</span><span class="n">formula</span><span class="o">=...</span><span class="p">)</span>
</span><span class="linenos">12</span>
<span class="linenos">13</span><span class="c1"># The preious cell is 2D, let&#39;s define the c-axis to take into account </span>
<span class="linenos">14</span><span class="c1"># the Van der Waals gap between trilayers</span>
<span class="linenos">15</span><span class="n">TiSe2</span><span class="o">.</span><span class="n">cell</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">...</span><span class="p">]</span>
<span class="linenos">16</span>
<span class="hll"><span class="linenos">15</span><span class="n">TiSe2</span><span class="o">.</span><span class="n">cell</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">...</span><span class="p">]</span>
</span><span class="linenos">16</span>
<span class="linenos">17</span><span class="c1"># To be aligned like in the paper</span>
<span class="linenos">18</span><span class="n">TiSe2</span><span class="o">.</span><span class="n">rotate</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span> <span class="s1">&#39;z&#39;</span><span class="p">,</span> <span class="n">rotate_cell</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="linenos">19</span>
@ -453,54 +453,37 @@ document.write(`
<span class="linenos">23</span><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">):</span>
<span class="linenos">24</span> <span class="n">TiSe2</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">tag</span> <span class="o">=</span> <span class="n">i</span>
<span class="linenos">25</span>
<span class="linenos">26</span><span class="n">cluster</span> <span class="o">=</span> <span class="n">hemispherical_cluster</span><span class="p">(</span><span class="n">TiSe2</span><span class="p">,</span> <span class="n">emitter_tag</span><span class="o">=...</span><span class="p">,</span> <span class="n">emitter_plane</span><span class="o">=...</span><span class="p">,</span> <span class="n">planes</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
<span class="linenos">27</span><span class="n">cluster</span><span class="o">.</span><span class="n">emitter</span> <span class="o">=</span> <span class="n">get_atom_index</span><span class="p">(</span><span class="n">cluster</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="hll"><span class="linenos">26</span><span class="n">cluster</span> <span class="o">=</span> <span class="n">hemispherical_cluster</span><span class="p">(</span><span class="n">TiSe2</span><span class="p">,</span> <span class="n">emitter_tag</span><span class="o">=...</span><span class="p">,</span> <span class="n">emitter_plane</span><span class="o">=...</span><span class="p">,</span> <span class="n">planes</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
</span><span class="linenos">27</span><span class="n">cluster</span><span class="o">.</span><span class="n">emitter</span> <span class="o">=</span> <span class="n">get_atom_index</span><span class="p">(</span><span class="n">cluster</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="linenos">28</span>
<span class="linenos">29</span><span class="n">view</span><span class="p">(</span><span class="n">cluster</span><span class="p">)</span>
<span class="linenos">30</span>
</pre></div>
</div>
</div>
</div>
<div class="cell tag_hide-cell docutils container">
<details class="hide above-input">
<summary aria-label="Toggle hidden content">
<span class="collapsed">Show code cell content</span>
<span class="expanded">Hide code cell content</span>
</summary>
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">ase.build</span><span class="w"> </span><span class="kn">import</span> <span class="n">mx2</span>
<span class="kn">from</span><span class="w"> </span><span class="nn">ase.visualize</span><span class="w"> </span><span class="kn">import</span> <span class="n">view</span>
<span class="kn">from</span><span class="w"> </span><span class="nn">msspec.calculator</span><span class="w"> </span><span class="kn">import</span> <span class="n">MSSPEC</span>
<span class="kn">from</span><span class="w"> </span><span class="nn">msspec.utils</span><span class="w"> </span><span class="kn">import</span> <span class="n">hemispherical_cluster</span><span class="p">,</span> <span class="n">get_atom_index</span>
<span class="c1"># Some usefull constants (a, c, d, D) for defining the structure</span>
<span class="n">a</span><span class="o">=</span><span class="mf">3.535</span><span class="p">;</span><span class="n">c</span><span class="o">=</span><span class="mf">6.004</span><span class="p">;</span><span class="n">d</span><span class="o">=</span><span class="mf">3.450</span><span class="p">;</span><span class="n">D</span><span class="o">=</span><span class="mf">2.554</span>
<span class="c1"># Create the TiSe2 trilayer</span>
<span class="c1"># use ase help for this function</span>
<span class="n">TiSe2</span> <span class="o">=</span> <span class="n">mx2</span><span class="p">(</span><span class="n">formula</span><span class="o">=</span><span class="s1">&#39;TiSe2&#39;</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="s1">&#39;1T&#39;</span><span class="p">,</span> <span class="n">a</span><span class="o">=</span><span class="n">a</span><span class="p">,</span> <span class="n">thickness</span><span class="o">=</span><span class="n">d</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">vacuum</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span>
<span class="c1"># The preious cell is 2D, let&#39;s define the c-axis to take into account </span>
<span class="c1"># the Van der Waals gap between trilayers</span>
<span class="n">TiSe2</span><span class="o">.</span><span class="n">cell</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">c</span><span class="p">]</span>
<span class="c1"># To be aligned like in the paper</span>
<span class="n">TiSe2</span><span class="o">.</span><span class="n">rotate</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span> <span class="s1">&#39;z&#39;</span><span class="p">,</span> <span class="n">rotate_cell</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="c1"># Since the material is multi-elements, &quot;tag&quot; each inequivalent atom </span>
<span class="c1"># of the unit cell with a number. The &quot;Ti&quot; atom is tagged 0 and &quot;Se&quot; </span>
<span class="c1"># atoms are 1 and 2.</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">):</span>
<span class="n">TiSe2</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">tag</span> <span class="o">=</span> <span class="n">i</span>
<span class="n">cluster</span> <span class="o">=</span> <span class="n">hemispherical_cluster</span><span class="p">(</span><span class="n">TiSe2</span><span class="p">,</span> <span class="n">emitter_tag</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">emitter_plane</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">planes</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
<span class="n">cluster</span><span class="o">.</span><span class="n">emitter</span> <span class="o">=</span> <span class="n">get_atom_index</span><span class="p">(</span><span class="n">cluster</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<div class="dropdown admonition">
<p class="admonition-title"><em>Solution…</em></p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="linenos"> 1</span><span class="kn">from</span><span class="w"> </span><span class="nn">ase.build</span><span class="w"> </span><span class="kn">import</span> <span class="n">mx2</span>
<span class="linenos"> 2</span><span class="kn">from</span><span class="w"> </span><span class="nn">ase.visualize</span><span class="w"> </span><span class="kn">import</span> <span class="n">view</span>
<span class="linenos"> 3</span><span class="kn">from</span><span class="w"> </span><span class="nn">msspec.calculator</span><span class="w"> </span><span class="kn">import</span> <span class="n">MSSPEC</span>
<span class="linenos"> 4</span><span class="kn">from</span><span class="w"> </span><span class="nn">msspec.utils</span><span class="w"> </span><span class="kn">import</span> <span class="n">hemispherical_cluster</span><span class="p">,</span> <span class="n">get_atom_index</span>
<span class="linenos"> 5</span>
<span class="linenos"> 6</span><span class="c1"># some constants</span>
<span class="linenos"> 7</span><span class="n">a</span><span class="o">=</span><span class="mf">3.535</span><span class="p">;</span><span class="n">c</span><span class="o">=</span><span class="mf">6.004</span><span class="p">;</span><span class="n">d</span><span class="o">=</span><span class="mf">3.450</span><span class="p">;</span><span class="n">D</span><span class="o">=</span><span class="mf">2.554</span>
<span class="linenos"> 8</span>
<span class="linenos"> 9</span><span class="n">TiSe2</span> <span class="o">=</span> <span class="n">mx2</span><span class="p">(</span><span class="n">formula</span><span class="o">=</span><span class="s1">&#39;TiSe2&#39;</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="s1">&#39;1T&#39;</span><span class="p">,</span> <span class="n">a</span><span class="o">=</span><span class="n">a</span><span class="p">,</span> <span class="n">thickness</span><span class="o">=</span><span class="n">d</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">vacuum</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span>
<span class="linenos">10</span><span class="n">TiSe2</span><span class="o">.</span><span class="n">cell</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mf">6.004</span><span class="p">]</span>
<span class="linenos">11</span><span class="n">TiSe2</span><span class="o">.</span><span class="n">rotate</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span> <span class="s1">&#39;z&#39;</span><span class="p">,</span> <span class="n">rotate_cell</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="linenos">12</span>
<span class="linenos">13</span><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">):</span>
<span class="linenos">14</span> <span class="n">TiSe2</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">tag</span><span class="o">=</span><span class="n">i</span>
<span class="linenos">15</span>
<span class="linenos">16</span><span class="n">data</span> <span class="o">=</span> <span class="kc">None</span>
<span class="linenos">17</span><span class="n">cluster</span> <span class="o">=</span> <span class="n">hemispherical_cluster</span><span class="p">(</span><span class="n">TiSe2</span><span class="p">,</span> <span class="n">emitter_tag</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">emitter_plane</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">planes</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
<span class="linenos">18</span><span class="n">cluster</span><span class="o">.</span><span class="n">emitter</span> <span class="o">=</span> <span class="n">get_atom_index</span><span class="p">(</span><span class="n">cluster</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
</pre></div>
</div>
</div>
</details>
</div>
<div class="cell tag_remove-input docutils container">
<div class="cell_output docutils container">
<div class="output text_html"><html>
@ -1053,7 +1036,8 @@ What do you conclude about the value of the <code class="docutils literal notran
</figure>
</div>
</div>
<div class="toggle docutils container">
<div class="dropdown admonition">
<p class="admonition-title"><em>Solution…</em></p>
<figure class="align-default" id="results-completed-fig">
<a class="reference internal image-reference" href="../_images/results_completed.jpg"><img alt="../_images/results_completed.jpg" class="align-center" src="../_images/results_completed.jpg" style="width: 400px;" />
</a>

File diff suppressed because it is too large Load Diff

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/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />
@ -377,7 +377,7 @@ document.write(`
<ol class="arabic simple">
<li><p>The <code class="docutils literal notranslate"><span class="pre">create_clusters</span></code> function will build clusters with increasing number of planes, with the emitter being in the deepest plane for each cluster.</p></li>
<li><p>The function <code class="docutils literal notranslate"><span class="pre">compute</span></code> will compute the azimuthal scan for a given cluster.</p></li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">analysis</span></code> function will sum the intensity from each plane for a given temperature. This will be the <em>substrate total signal</em> (more on this in the <a class="reference internal" href="../Activity07/Activity07.html#path-filtering"><span class="std std-ref">Activity 7: Large clusters and path filtering</span></a> section). The function will also compute the anisotropy (equation <a class="reference internal" href="#equation-eq-anisotropy">(1)</a>).</p></li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">analysis</span></code> function will sum the intensity from each plane for a given temperature. This will be the <em>substrate total signal</em> (more on this in the <a class="reference internal" href="../Activity07/Activity07_light.html#path-filtering"><span class="std std-ref">Activity 7: Large clusters and path filtering</span></a> section). The function will also compute the anisotropy (equation <a class="reference internal" href="Activity06_light.html#equation-eq-anisotropy">()</a>).</p></li>
</ol>
<p>MsSpec can introduce temperature effects in two ways: either by using the Debye Waller model or by doing an average over the phase shifts. We will explore the latter in this example.</p>
<p>Regardless of the option chosen to model temperature effects, we need to define mean square displacement (MSD) values of the atoms in our cluster. We will use the Debye model for this. The MSD is defined as follows:</p>
@ -389,7 +389,7 @@ document.write(`
<a class="reference internal image-reference" href="../_images/msd.jpg"><img alt="Cu MSD" class="align-center" src="../_images/msd.jpg" style="width: 600px;" />
</a>
<figcaption>
<p><span class="caption-number">Fig. 16 </span><span class="caption-text">Variation of MSD for copper versus temperature using equation <a class="reference internal" href="#equation-eq-debye">(2)</a></span><a class="headerlink" href="#msd-fig" title="Link to this image">#</a></p>
<p><span class="caption-number">Fig. 16 </span><span class="caption-text">Variation of MSD for copper versus temperature using equation <a class="reference internal" href="Activity06_light.html#equation-eq-debye">()</a></span><a class="headerlink" href="#msd-fig" title="Link to this image">#</a></p>
</figcaption>
</figure>
<div class="sd-tab-set docutils">
@ -397,7 +397,7 @@ document.write(`
<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>With the help of the <a class="reference external" href="https://msspec.cnrs.fr/parameters.html">MsSpec documentation</a> and the second paragraph p6791 of the <a class="reference internal" href="#msd-paper">article cited above</a>,
complete the hilighted lines in the following script to compute the anisotropy of Cu(2p) <span class="math notranslate nohighlight">\(\phi\)</span>-scans for polar angle <span class="math notranslate nohighlight">\(\theta\)</span>=45° and 83°.</p>
complete the hilighted lines in the <a class="reference download internal" download="" href="../_downloads/3fdd553b457dd9aab1086c697e8ad08e/Cu_temperature.py"><span class="xref download myst">following script</span></a> to compute the anisotropy of Cu(2p) <span class="math notranslate nohighlight">\(\phi\)</span>-scans for polar angle <span class="math notranslate nohighlight">\(\theta\)</span>=45° and 83°.</p>
<p>How is varying the anisotropy versus the temperature. How can you qualitatively explain this variation ?</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="linenos"> 1</span><span class="kn">from</span><span class="w"> </span><span class="nn">ase.build</span><span class="w"> </span><span class="kn">import</span> <span class="n">bulk</span>
<span class="linenos"> 2</span><span class="kn">import</span><span class="w"> </span><span class="nn">numpy</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nn">np</span>
@ -529,7 +529,8 @@ complete the hilighted lines in the following script to compute the anisotropy o
</div>
</div>
</div>
<div class="toggle docutils container">
<div class="dropdown admonition">
<p class="admonition-title"><em>Solution…</em></p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="linenos"> 1</span><span class="kn">from</span><span class="w"> </span><span class="nn">ase.build</span><span class="w"> </span><span class="kn">import</span> <span class="n">bulk</span>
<span class="linenos"> 2</span><span class="kn">import</span><span class="w"> </span><span class="nn">numpy</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nn">np</span>
<span class="linenos"> 3</span>

View File

@ -0,0 +1,640 @@
<!DOCTYPE html>
<html lang="en" data-content_root="../" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Activity 6: Effect of the temperature &#8212; MsSpec Tour</title>
<script data-cfasync="false">
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "";
</script>
<!-- Loaded before other Sphinx assets -->
<link href="../_static/styles/theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/styles/bootstrap.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/styles/pydata-sphinx-theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/vendor/fontawesome/6.5.2/css/all.min.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-solid-900.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-brands-400.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-regular-400.woff2" />
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=03e43079" />
<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/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />
<!-- Pre-loaded scripts that we'll load fully later -->
<link rel="preload" as="script" href="../_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b" />
<link rel="preload" as="script" href="../_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b" />
<script src="../_static/vendor/fontawesome/6.5.2/js/all.min.js?digest=dfe6caa3a7d634c4db9b"></script>
<script src="../_static/documentation_options.js?v=9eb32ce0"></script>
<script src="../_static/doctools.js?v=9a2dae69"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../_static/copybutton.js?v=f281be69"></script>
<script src="../_static/scripts/sphinx-book-theme.js?v=887ef09a"></script>
<script>let toggleHintShow = 'Click to show';</script>
<script>let toggleHintHide = 'Click to hide';</script>
<script>let toggleOpenOnPrint = 'true';</script>
<script src="../_static/togglebutton.js?v=4a39c7ea"></script>
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
<script src="../_static/design-tabs.js?v=f930bc37"></script>
<script>const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"; const thebe_selector = ".thebe,.cell"; const thebe_selector_input = "pre"; const thebe_selector_output = ".output, .cell_output"</script>
<script async="async" src="../_static/sphinx-thebe.js?v=c100c467"></script>
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
<script>const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"; const thebe_selector = ".thebe,.cell"; const thebe_selector_input = "pre"; const thebe_selector_output = ".output, .cell_output"</script>
<script>window.MathJax = {"options": {"processHtmlClass": "tex2jax_process|mathjax_process|math|output_area"}}</script>
<script defer="defer" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script>DOCUMENTATION_OPTIONS.pagename = 'Activity06/Activity06_light';</script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="docsearch:language" content="en"/>
</head>
<body data-bs-spy="scroll" data-bs-target=".bd-toc-nav" data-offset="180" data-bs-root-margin="0px 0px -60%" data-default-mode="">
<div id="pst-skip-link" class="skip-link d-print-none"><a href="#main-content">Skip to main content</a></div>
<div id="pst-scroll-pixel-helper"></div>
<button type="button" class="btn rounded-pill" id="pst-back-to-top">
<i class="fa-solid fa-arrow-up"></i>Back to top</button>
<input type="checkbox"
class="sidebar-toggle"
id="pst-primary-sidebar-checkbox"/>
<label class="overlay overlay-primary" for="pst-primary-sidebar-checkbox"></label>
<input type="checkbox"
class="sidebar-toggle"
id="pst-secondary-sidebar-checkbox"/>
<label class="overlay overlay-secondary" for="pst-secondary-sidebar-checkbox"></label>
<div class="search-button__wrapper">
<div class="search-button__overlay"></div>
<div class="search-button__search-container">
<form class="bd-search d-flex align-items-center"
action="../search.html"
method="get">
<i class="fa-solid fa-magnifying-glass"></i>
<input type="search"
class="form-control"
name="q"
id="search-input"
placeholder="Search this book..."
aria-label="Search this book..."
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"/>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span>
</form></div>
</div>
<div class="pst-async-banner-revealer d-none">
<aside id="bd-header-version-warning" class="d-none d-print-none" aria-label="Version warning"></aside>
</div>
<header class="bd-header navbar navbar-expand-lg bd-navbar d-print-none">
</header>
<div class="bd-container">
<div class="bd-container__inner bd-page-width">
<div class="bd-sidebar-primary bd-sidebar">
<div class="sidebar-header-items sidebar-primary__section">
</div>
<div class="sidebar-primary-items__start sidebar-primary__section">
<div class="sidebar-primary-item">
<a class="navbar-brand logo" href="../intro.html">
<img src="../_static/logo.jpg" class="logo__image only-light" alt="MsSpec Tour - Home"/>
<script>document.write(`<img src="../_static/logo.jpg" class="logo__image only-dark" alt="MsSpec Tour - Home"/>`);</script>
</a></div>
<div class="sidebar-primary-item">
<script>
document.write(`
<button class="btn search-button-field search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass"></i>
<span class="search-button__default-text">Search</span>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
</button>
`);
</script></div>
<div class="sidebar-primary-item"><nav class="bd-links bd-docs-nav" aria-label="Main">
<div class="bd-toc-item navbar-nav active">
<ul class="nav bd-sidenav bd-sidenav__home-link">
<li class="toctree-l1">
<a class="reference internal" href="../intro.html">
Welcome to this small MsSpec tour
</a>
</li>
</ul>
<ul class="nav bd-sidenav">
<li class="toctree-l1"><a class="reference internal" href="../Activity01/Activity01.html">Activity 1: Getting started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity02/Activity02.html">Activity 2: Setting up the “experiment”</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity03/Activity03.html">Activity 3: Adsorbates and the single scattering approach</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity04/Activity04.html">Activity 4: From single scattering to multiple scattering</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity05/Activity05.html">Activity 5: Multiple scattering in the forward scattering regime</a></li>
<li class="toctree-l1"><a class="reference internal" href="Activity06.html">Activity 6: Effect of the temperature</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity07/Activity07.html">Activity 7: Large clusters and path filtering</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity08/Activity08.html">Activity 8: Inequivalent emitters and the XPD of a substrate</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity09/Activity09.html">Activity 9: Comparing simulation and experiment with R-factors</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity10/Activity10.html">Activity 10: Parallelization and multi-processing in MsSpec</a></li>
</ul>
</div>
</nav></div>
</div>
<div class="sidebar-primary-items__end sidebar-primary__section">
</div>
<div id="rtd-footer-container"></div>
</div>
<main id="main-content" class="bd-main" role="main">
<div class="sbt-scroll-pixel-helper"></div>
<div class="bd-content">
<div class="bd-article-container">
<div class="bd-header-article d-print-none">
<div class="header-article-items header-article__inner">
<div class="header-article-items__start">
<div class="header-article-item"><button class="sidebar-toggle primary-toggle btn btn-sm" title="Toggle primary sidebar" data-bs-placement="bottom" data-bs-toggle="tooltip">
<span class="fa-solid fa-bars"></span>
</button></div>
</div>
<div class="header-article-items__end">
<div class="header-article-item">
<div class="article-header-buttons">
<div class="dropdown dropdown-download-buttons">
<button class="btn dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Download this page">
<i class="fas fa-download"></i>
</button>
<ul class="dropdown-menu">
<li><a href="../_sources/Activity06/Activity06_light.ipynb" target="_blank"
class="btn btn-sm btn-download-source-button dropdown-item"
title="Download source file"
data-bs-placement="left" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-file"></i>
</span>
<span class="btn__text-container">.ipynb</span>
</a>
</li>
<li>
<button onclick="window.print()"
class="btn btn-sm btn-download-pdf-button dropdown-item"
title="Print to PDF"
data-bs-placement="left" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-file-pdf"></i>
</span>
<span class="btn__text-container">.pdf</span>
</button>
</li>
</ul>
</div>
<button onclick="toggleFullScreen()"
class="btn btn-sm btn-fullscreen-button"
title="Fullscreen mode"
data-bs-placement="bottom" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-expand"></i>
</span>
</button>
<script>
document.write(`
<button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light"></i>
<i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark"></i>
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto"></i>
</button>
`);
</script>
<script>
document.write(`
<button class="btn btn-sm pst-navbar-icon search-button search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass fa-lg"></i>
</button>
`);
</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 id="jb-print-docs-body" class="onlyprint">
<h1>Activity 6: Effect of the temperature</h1>
<!-- Table of contents -->
<div id="print-main-content">
<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="#surface-and-bulk-effects-of-the-temperature">Surface and bulk effects of the temperature</a><ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#the-script">The script</a></li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div id="searchbox"></div>
<article class="bd-article">
<section class="tex2jax_ignore mathjax_ignore" id="activity-6-effect-of-the-temperature">
<h1>Activity 6: Effect of the temperature<a class="headerlink" href="#activity-6-effect-of-the-temperature" title="Link to this heading">#</a></h1>
<section id="surface-and-bulk-effects-of-the-temperature">
<h2>Surface and bulk effects of the temperature<a class="headerlink" href="#surface-and-bulk-effects-of-the-temperature" title="Link to this heading">#</a></h2>
<p>In this example, we will look at the effects of the temperature on the X-Ray photoelectron diffraction from a copper substrate. We will base our python script on a paper published in 1986 by R. Trehan and S. Fadley. In their work, they performed azimutal scans of a copper(001) surface at 2 different polar angles: one at grazing incidence and one at 45° for incresing temperatures from 298K to roughly 1000K.</p>
<p>For each azimutal scan, they looked at the anisotropy of the signal, that is:</p>
<div class="math notranslate nohighlight" id="equation-eq-anisotropy">
<span class="eqno">()<a class="headerlink" href="#equation-eq-anisotropy" title="Link to this equation">#</a></span>\[\frac{I_{max} - I_{min}}{I_{max}}=\frac{\Delta I}{I_{max}}\]</div>
<p>This value is representative of how clear are the <em>modulations</em> of the signal. They also proposed single scattering calculations that reproduced well these results.</p>
<p>We will reproduce this kind of calculations to introduce the parameters that control the vibrational damping.</p>
<div class="admonition seealso" id="msd-paper">
<p class="admonition-title">See also</p>
<p>based on this paper from R. Trehan and C.S. Fadley
<a class="reference external" href="https://doi.org/10.1103/PhysRevB.34.6784">Phys. Rev. B <strong>34</strong> p678498 (2012)</a></p>
</div>
<section id="the-script">
<h3>The script<a class="headerlink" href="#the-script" title="Link to this heading">#</a></h3>
<p>Since we want to distinguish between bulk (low polar angles, <span class="math notranslate nohighlight">\(\theta = 45°\)</span> in the paper) and surface effects (large polar angles, <span class="math notranslate nohighlight">\(\theta = 83°\)</span> in the paper), we need to compute scans for different emitters and different depths in the cluster.</p>
<p>The script contains 3 functions:</p>
<ol class="arabic simple">
<li><p>The <code class="docutils literal notranslate"><span class="pre">create_clusters</span></code> function will build clusters with increasing number of planes, with the emitter being in the deepest plane for each cluster.</p></li>
<li><p>The function <code class="docutils literal notranslate"><span class="pre">compute</span></code> will compute the azimuthal scan for a given cluster.</p></li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">analysis</span></code> function will sum the intensity from each plane for a given temperature. This will be the <em>substrate total signal</em> (more on this in the <a class="reference internal" href="../Activity07/Activity07_light.html#path-filtering"><span class="std std-ref">Activity 7: Large clusters and path filtering</span></a> section). The function will also compute the anisotropy (equation <a class="reference internal" href="#equation-eq-anisotropy">()</a>).</p></li>
</ol>
<p>MsSpec can introduce temperature effects in two ways: either by using the Debye Waller model or by doing an average over the phase shifts. We will explore the latter in this example.</p>
<p>Regardless of the option chosen to model temperature effects, we need to define mean square displacement (MSD) values of the atoms in our cluster. We will use the Debye model for this. The MSD is defined as follows:</p>
<div class="math notranslate nohighlight" id="equation-eq-debye">
<span class="eqno">()<a class="headerlink" href="#equation-eq-debye" title="Link to this equation">#</a></span>\[&lt;U_j^2(T)&gt; = \frac{3\hbar^2 T}{M K_B \Theta_D^2}\]</div>
<p>where <span class="math notranslate nohighlight">\(\hbar\)</span> is the reduce Plancks constant, <span class="math notranslate nohighlight">\(T\)</span> is the temperature, <span class="math notranslate nohighlight">\(M\)</span> is the mass of the atom, <span class="math notranslate nohighlight">\(k_B\)</span> is the Boltzmanns constant and <span class="math notranslate nohighlight">\(\Theta_D\)</span> is the Debye temperature of the sample.</p>
<p>To get an idea of the typical order of magnitude for MSD, the figure below plots the values of MSD for copper for temperatures ranging from 300 K to 1000 K.</p>
<figure class="align-default" id="msd-fig">
<a class="reference internal image-reference" href="../_images/msd.jpg"><img alt="Cu MSD" class="align-center" src="../_images/msd.jpg" style="width: 600px;" />
</a>
<figcaption>
<p><span class="caption-text">Variation of MSD for copper versus temperature using equation <a class="reference internal" href="#equation-eq-debye">()</a></span><a class="headerlink" href="#msd-fig" title="Link to this image">#</a></p>
</figcaption>
</figure>
<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>With the help of the <a class="reference external" href="https://msspec.cnrs.fr/parameters.html">MsSpec documentation</a> and the second paragraph p6791 of the <a class="reference internal" href="#msd-paper">article cited above</a>,
complete the hilighted lines in the <a class="reference download internal" download="" href="../_downloads/3fdd553b457dd9aab1086c697e8ad08e/Cu_temperature.py"><span class="xref download myst">following script</span></a> to compute the anisotropy of Cu(2p) <span class="math notranslate nohighlight">\(\phi\)</span>-scans for polar angle <span class="math notranslate nohighlight">\(\theta\)</span>=45° and 83°.</p>
<p>How is varying the anisotropy versus the temperature. How can you qualitatively explain this variation ?</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="linenos"> 1</span><span class="kn">from</span><span class="w"> </span><span class="nn">ase.build</span><span class="w"> </span><span class="kn">import</span> <span class="n">bulk</span>
<span class="linenos"> 2</span><span class="kn">import</span><span class="w"> </span><span class="nn">numpy</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nn">np</span>
<span class="linenos"> 3</span>
<span class="linenos"> 4</span><span class="kn">from</span><span class="w"> </span><span class="nn">msspec.calculator</span><span class="w"> </span><span class="kn">import</span> <span class="n">MSSPEC</span><span class="p">,</span> <span class="n">XRaySource</span>
<span class="linenos"> 5</span><span class="kn">from</span><span class="w"> </span><span class="nn">msspec.utils</span><span class="w"> </span><span class="kn">import</span> <span class="n">hemispherical_cluster</span><span class="p">,</span> <span class="n">get_atom_index</span>
<span class="linenos"> 6</span>
<span class="linenos"> 7</span><span class="k">def</span><span class="w"> </span><span class="nf">create_clusters</span><span class="p">(</span><span class="n">nplanes</span><span class="o">=</span><span class="mi">3</span><span class="p">):</span>
<span class="linenos"> 8</span> <span class="n">copper</span> <span class="o">=</span> <span class="n">bulk</span><span class="p">(</span><span class="s1">&#39;Cu&#39;</span><span class="p">,</span> <span class="n">a</span><span class="o">=</span><span class="mf">3.6</span><span class="p">,</span> <span class="n">cubic</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="linenos"> 9</span> <span class="n">clusters</span> <span class="o">=</span> <span class="p">[]</span>
<span class="linenos"> 10</span> <span class="k">for</span> <span class="n">emitter_plane</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">nplanes</span><span class="p">):</span>
<span class="linenos"> 11</span> <span class="n">cluster</span> <span class="o">=</span> <span class="n">hemispherical_cluster</span><span class="p">(</span><span class="n">copper</span><span class="p">,</span>
<span class="linenos"> 12</span> <span class="n">emitter_plane</span><span class="o">=</span><span class="n">emitter_plane</span><span class="p">,</span>
<span class="linenos"> 13</span> <span class="n">planes</span><span class="o">=</span><span class="n">emitter_plane</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span>
<span class="linenos"> 14</span> <span class="n">diameter</span><span class="o">=</span><span class="mi">27</span><span class="p">,</span>
<span class="linenos"> 15</span> <span class="n">shape</span><span class="o">=</span><span class="s1">&#39;cylindrical&#39;</span><span class="p">)</span>
<span class="linenos"> 16</span> <span class="n">cluster</span><span class="o">.</span><span class="n">absorber</span> <span class="o">=</span> <span class="n">get_atom_index</span><span class="p">(</span><span class="n">cluster</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="linenos"> 17</span> <span class="c1"># This is how to store extra information with your cluster</span>
<span class="linenos"> 18</span> <span class="n">cluster</span><span class="o">.</span><span class="n">info</span><span class="o">.</span><span class="n">update</span><span class="p">({</span>
<span class="linenos"> 19</span> <span class="s1">&#39;emitter_plane&#39;</span><span class="p">:</span> <span class="n">emitter_plane</span><span class="p">,</span>
<span class="linenos"> 20</span> <span class="p">})</span>
<span class="linenos"> 21</span> <span class="n">clusters</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cluster</span><span class="p">)</span>
<span class="linenos"> 22</span> <span class="k">return</span> <span class="n">clusters</span>
<span class="linenos"> 23</span>
<span class="linenos"> 24</span>
<span class="linenos"> 25</span><span class="k">def</span><span class="w"> </span><span class="nf">compute</span><span class="p">(</span><span class="n">clusters</span><span class="p">,</span> <span class="n">all_theta</span><span class="o">=</span><span class="p">[</span><span class="mf">45.</span><span class="p">,</span> <span class="mf">83.</span><span class="p">],</span>
<span class="linenos"> 26</span> <span class="n">all_T</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mf">300.</span><span class="p">,</span> <span class="mf">1000.</span><span class="p">,</span> <span class="mf">400.</span><span class="p">)):</span>
<span class="linenos"> 27</span> <span class="n">data</span> <span class="o">=</span> <span class="kc">None</span>
<span class="linenos"> 28</span> <span class="k">for</span> <span class="n">cluster</span> <span class="ow">in</span> <span class="n">clusters</span><span class="p">:</span>
<span class="linenos"> 29</span> <span class="c1"># Retrieve emitter&#39;s plane from cluster object</span>
<span class="linenos"> 30</span> <span class="n">plane</span> <span class="o">=</span> <span class="n">cluster</span><span class="o">.</span><span class="n">info</span><span class="p">[</span><span class="s1">&#39;emitter_plane&#39;</span><span class="p">]</span>
<span class="linenos"> 31</span>
<span class="linenos"> 32</span> <span class="n">calc</span> <span class="o">=</span> <span class="n">MSSPEC</span><span class="p">(</span><span class="n">spectroscopy</span><span class="o">=</span><span class="s1">&#39;PED&#39;</span><span class="p">,</span> <span class="n">algorithm</span><span class="o">=</span><span class="s1">&#39;expansion&#39;</span><span class="p">)</span>
<span class="linenos"> 33</span> <span class="n">calc</span><span class="o">.</span><span class="n">source_parameters</span><span class="o">.</span><span class="n">energy</span> <span class="o">=</span> <span class="n">XRaySource</span><span class="o">.</span><span class="n">AL_KALPHA</span>
<span class="linenos"> 34</span> <span class="n">calc</span><span class="o">.</span><span class="n">muffintin_parameters</span><span class="o">.</span><span class="n">interstitial_potential</span> <span class="o">=</span> <span class="mf">14.1</span>
<span class="linenos"> 35</span>
<span class="linenos"> 36</span> <span class="c1"># In simple scattering, it is common practice to use a real potential and</span>
<span class="linenos"> 37</span> <span class="c1"># manually define a mean free path arbitrarily lower than the actual physical</span>
<span class="linenos"> 38</span> <span class="c1"># value in an attempt to reproduce multiple scattering effects.</span>
<span class="linenos"> 39</span> <span class="n">calc</span><span class="o">.</span><span class="n">tmatrix_parameters</span><span class="o">.</span><span class="n">exchange_correlation</span> <span class="o">=</span> <span class="s1">&#39;x_alpha_real&#39;</span>
<span class="hll"><span class="linenos"> 40</span> <span class="n">calc</span><span class="o">.</span><span class="n">calculation_parameters</span><span class="o">.</span><span class="n">mean_free_path</span> <span class="o">=</span> <span class="o">...</span> <span class="c1"># -&gt; half of the mean free</span>
</span><span class="hll"><span class="linenos"> 41</span> <span class="c1"># path (see p6785)</span>
</span><span class="linenos"> 42</span> <span class="c1"># Parameters for temperature effects</span>
<span class="linenos"> 43</span> <span class="n">calc</span><span class="o">.</span><span class="n">calculation_parameters</span><span class="o">.</span><span class="n">vibrational_damping</span> <span class="o">=</span> <span class="s1">&#39;averaged_tl&#39;</span>
<span class="hll"><span class="linenos"> 44</span> <span class="n">calc</span><span class="o">.</span><span class="n">calculation_parameters</span><span class="o">.</span><span class="n">use_debye_model</span> <span class="o">=</span> <span class="o">.....</span> <span class="c1"># Use the MsSpec help</span>
</span><span class="hll"><span class="linenos"> 45</span> <span class="n">calc</span><span class="o">.</span><span class="n">calculation_parameters</span><span class="o">.</span><span class="n">debye_temperature</span> <span class="o">=</span> <span class="o">...</span> <span class="c1"># and p6791 of the paper</span>
</span><span class="hll"><span class="linenos"> 46</span> <span class="n">calc</span><span class="o">.</span><span class="n">calculation_parameters</span><span class="o">.</span><span class="n">vibration_scaling</span> <span class="o">=</span> <span class="o">...</span> <span class="c1"># -&gt; How much more do </span>
</span><span class="hll"><span class="linenos"> 47</span> <span class="c1"># surface atoms vibrate </span>
</span><span class="hll"><span class="linenos"> 48</span> <span class="c1"># than bulk atoms?</span>
</span><span class="linenos"> 49</span> <span class="n">calc</span><span class="o">.</span><span class="n">detector_parameters</span><span class="o">.</span><span class="n">average_sampling</span> <span class="o">=</span> <span class="s1">&#39;low&#39;</span>
<span class="linenos"> 50</span> <span class="n">calc</span><span class="o">.</span><span class="n">detector_parameters</span><span class="o">.</span><span class="n">angular_acceptance</span> <span class="o">=</span> <span class="mf">5.7</span>
<span class="linenos"> 51</span>
<span class="linenos"> 52</span> <span class="n">calc</span><span class="o">.</span><span class="n">calculation_parameters</span><span class="o">.</span><span class="n">scattering_order</span> <span class="o">=</span> <span class="mi">1</span>
<span class="linenos"> 53</span>
<span class="linenos"> 54</span>
<span class="linenos"> 55</span> <span class="k">for</span> <span class="n">T</span> <span class="ow">in</span> <span class="n">all_T</span><span class="p">:</span>
<span class="linenos"> 56</span> <span class="c1"># Define the sample temperature</span>
<span class="linenos"> 57</span> <span class="n">calc</span><span class="o">.</span><span class="n">calculation_parameters</span><span class="o">.</span><span class="n">temperature</span> <span class="o">=</span> <span class="n">T</span>
<span class="linenos"> 58</span> <span class="c1"># Set the atoms and compute an azimuthal scan</span>
<span class="linenos"> 59</span> <span class="n">calc</span><span class="o">.</span><span class="n">set_atoms</span><span class="p">(</span><span class="n">cluster</span><span class="p">)</span>
<span class="linenos"> 60</span> <span class="n">data</span> <span class="o">=</span> <span class="n">calc</span><span class="o">.</span><span class="n">get_phi_scan</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="s1">&#39;2p&#39;</span><span class="p">,</span> <span class="n">theta</span><span class="o">=</span><span class="n">all_theta</span><span class="p">,</span>
<span class="linenos"> 61</span> <span class="n">phi</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">51</span><span class="p">),</span>
<span class="linenos"> 62</span> <span class="n">kinetic_energy</span><span class="o">=</span><span class="mi">560</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">)</span>
<span class="linenos"> 63</span> <span class="c1"># Small changes to add some details in both the title of the dataset</span>
<span class="linenos"> 64</span> <span class="c1"># and the figure</span>
<span class="linenos"> 65</span> <span class="n">view</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">views</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
<span class="linenos"> 66</span> <span class="n">t</span> <span class="o">=</span> <span class="n">view</span><span class="o">.</span><span class="n">_plotopts</span><span class="p">[</span><span class="s1">&#39;title&#39;</span><span class="p">]</span> <span class="o">+</span> <span class="sa">f</span><span class="s2">&quot; (plane #</span><span class="si">{</span><span class="n">plane</span><span class="si">:</span><span class="s2">d</span><span class="si">}</span><span class="s2">, T=</span><span class="si">{</span><span class="n">T</span><span class="si">:</span><span class="s2">.0f</span><span class="si">}</span><span class="s2"> K)&quot;</span>
<span class="linenos"> 67</span> <span class="n">data</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="n">t</span>
<span class="linenos"> 68</span> <span class="n">view</span><span class="o">.</span><span class="n">set_plot_options</span><span class="p">(</span><span class="n">autoscale</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="n">t</span><span class="p">)</span>
<span class="linenos"> 69</span> <span class="n">calc</span><span class="o">.</span><span class="n">shutdown</span><span class="p">()</span>
<span class="linenos"> 70</span> <span class="k">return</span> <span class="n">data</span>
<span class="linenos"> 71</span>
<span class="linenos"> 72</span>
<span class="linenos"> 73</span><span class="k">def</span><span class="w"> </span><span class="nf">analysis</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">all_theta</span><span class="p">,</span> <span class="n">all_T</span><span class="p">,</span> <span class="n">nplanes</span><span class="p">):</span>
<span class="linenos"> 74</span> <span class="c1"># Sum cross_section for all emitter&#39;s plane at a given T</span>
<span class="linenos"> 75</span> <span class="c1"># Compute the anisotropy</span>
<span class="linenos"> 76</span> <span class="n">results</span> <span class="o">=</span> <span class="nb">dict</span><span class="o">.</span><span class="n">fromkeys</span><span class="p">(</span><span class="n">all_T</span><span class="p">,</span> <span class="p">[])</span>
<span class="linenos"> 77</span> <span class="n">anisotropy</span> <span class="o">=</span> <span class="p">[]</span>
<span class="linenos"> 78</span> <span class="k">for</span> <span class="n">dset</span> <span class="ow">in</span> <span class="n">data</span><span class="p">:</span>
<span class="linenos"> 79</span> <span class="c1"># Retrieve temperature</span>
<span class="linenos"> 80</span> <span class="n">T</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">dset</span><span class="o">.</span><span class="n">get_parameter</span><span class="p">(</span><span class="s1">&#39;CalculationParameters&#39;</span><span class="p">,</span> <span class="s1">&#39;temperature&#39;</span><span class="p">)[</span><span class="s1">&#39;value&#39;</span><span class="p">])</span>
<span class="linenos"> 81</span> <span class="c1"># Update the sum in results</span>
<span class="linenos"> 82</span> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">results</span><span class="p">[</span><span class="n">T</span><span class="p">])</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
<span class="linenos"> 83</span> <span class="n">results</span><span class="p">[</span><span class="n">T</span><span class="p">]</span> <span class="o">=</span> <span class="n">dset</span><span class="o">.</span><span class="n">cross_section</span>
<span class="linenos"> 84</span> <span class="k">else</span><span class="p">:</span>
<span class="linenos"> 85</span> <span class="n">results</span><span class="p">[</span><span class="n">T</span><span class="p">]</span> <span class="o">+=</span> <span class="n">dset</span><span class="o">.</span><span class="n">cross_section</span>
<span class="linenos"> 86</span>
<span class="linenos"> 87</span> <span class="n">anisotropy_dset</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">add_dset</span><span class="p">(</span><span class="s2">&quot;Anisotropies&quot;</span><span class="p">)</span>
<span class="linenos"> 88</span> <span class="n">anisotropy_dset</span><span class="o">.</span><span class="n">add_columns</span><span class="p">(</span><span class="n">temperature</span><span class="o">=</span><span class="n">all_T</span><span class="p">)</span>
<span class="linenos"> 89</span> <span class="k">for</span> <span class="n">theta</span> <span class="ow">in</span> <span class="n">all_theta</span><span class="p">:</span>
<span class="linenos"> 90</span> <span class="n">col_name</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot;theta</span><span class="si">{</span><span class="n">theta</span><span class="si">:</span><span class="s2">.0f</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="linenos"> 91</span> <span class="n">col_values</span> <span class="o">=</span> <span class="p">[]</span>
<span class="linenos"> 92</span> <span class="n">i</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">dset</span><span class="o">.</span><span class="n">theta</span> <span class="o">==</span> <span class="n">theta</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
<span class="linenos"> 93</span> <span class="k">for</span> <span class="n">T</span> <span class="ow">in</span> <span class="n">all_T</span><span class="p">:</span>
<span class="linenos"> 94</span> <span class="n">cs</span> <span class="o">=</span> <span class="n">results</span><span class="p">[</span><span class="n">T</span><span class="p">][</span><span class="n">i</span><span class="p">]</span>
<span class="linenos"> 95</span> <span class="n">Imax</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">max</span><span class="p">(</span><span class="n">cs</span><span class="p">)</span>
<span class="linenos"> 96</span> <span class="n">Imin</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">min</span><span class="p">(</span><span class="n">cs</span><span class="p">)</span>
<span class="linenos"> 97</span> <span class="n">A</span> <span class="o">=</span> <span class="p">(</span><span class="n">Imax</span> <span class="o">-</span> <span class="n">Imin</span><span class="p">)</span><span class="o">/</span><span class="n">Imax</span>
<span class="linenos"> 98</span> <span class="n">col_values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">A</span><span class="p">)</span>
<span class="linenos"> 99</span> <span class="n">anisotropy_dset</span><span class="o">.</span><span class="n">add_columns</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="n">col_name</span><span class="p">:</span><span class="n">col_values</span><span class="o">/</span><span class="n">np</span><span class="o">.</span><span class="n">max</span><span class="p">(</span><span class="n">col_values</span><span class="p">)})</span>
<span class="linenos">100</span>
<span class="linenos">101</span>
<span class="linenos">102</span> <span class="n">anisotropy_view</span> <span class="o">=</span> <span class="n">anisotropy_dset</span><span class="o">.</span><span class="n">add_view</span><span class="p">(</span><span class="s1">&#39;Anisotropies&#39;</span><span class="p">,</span>
<span class="linenos">103</span> <span class="n">title</span><span class="o">=</span><span class="s1">&#39;Relative anisotropies for Cu(2p)&#39;</span><span class="p">,</span>
<span class="linenos">104</span> <span class="n">marker</span><span class="o">=</span><span class="s1">&#39;o&#39;</span><span class="p">,</span>
<span class="linenos">105</span> <span class="n">xlabel</span><span class="o">=</span><span class="s1">&#39;T (K)&#39;</span><span class="p">,</span>
<span class="linenos">106</span> <span class="n">ylabel</span><span class="o">=</span><span class="sa">r</span><span class="s1">&#39;$\frac{\Delta I / I_</span><span class="si">{max}</span><span class="s1">(T)}{\Delta I_</span><span class="si">{300}</span><span class="s1">&#39;</span>
<span class="linenos">107</span> <span class="sa">r</span><span class="s1">&#39;/ I_</span><span class="si">{max}</span><span class="s1">(300)} (\%)$&#39;</span><span class="p">,</span>
<span class="linenos">108</span> <span class="n">autoscale</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="linenos">109</span> <span class="k">for</span> <span class="n">theta</span> <span class="ow">in</span> <span class="n">all_theta</span><span class="p">:</span>
<span class="linenos">110</span> <span class="n">col_name</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot;theta</span><span class="si">{</span><span class="n">theta</span><span class="si">:</span><span class="s2">.0f</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="linenos">111</span> <span class="n">anisotropy_view</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s1">&#39;temperature&#39;</span><span class="p">,</span> <span class="n">col_name</span><span class="p">,</span>
<span class="linenos">112</span> <span class="n">legend</span><span class="o">=</span><span class="sa">r</span><span class="s1">&#39;$\theta = </span><span class="si">{:.0f}</span><span class="s1"> \degree$&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">theta</span><span class="p">))</span>
<span class="linenos">113</span>
<span class="linenos">114</span> <span class="k">return</span> <span class="n">data</span>
<span class="linenos">115</span>
<span class="linenos">116</span>
<span class="linenos">117</span>
<span class="linenos">118</span><span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">&quot;__main__&quot;</span><span class="p">:</span>
<span class="linenos">119</span> <span class="n">nplanes</span> <span class="o">=</span> <span class="mi">4</span>
<span class="linenos">120</span> <span class="n">all_theta</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">45</span><span class="p">,</span> <span class="mi">83</span><span class="p">])</span>
<span class="linenos">121</span> <span class="n">all_theta</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">300.</span><span class="p">,</span> <span class="mf">1000.</span><span class="p">])</span>
<span class="linenos">122</span>
<span class="linenos">123</span> <span class="n">clusters</span> <span class="o">=</span> <span class="n">create_clusters</span><span class="p">(</span><span class="n">nplanes</span><span class="o">=</span><span class="n">nplanes</span><span class="p">)</span>
<span class="linenos">124</span> <span class="n">data</span> <span class="o">=</span> <span class="n">compute</span><span class="p">(</span><span class="n">clusters</span><span class="p">,</span> <span class="n">all_T</span><span class="o">=</span><span class="n">all_T</span><span class="p">,</span> <span class="n">all_theta</span><span class="o">=</span><span class="n">all_theta</span><span class="p">)</span>
<span class="linenos">125</span> <span class="n">data</span> <span class="o">=</span> <span class="n">analysis</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">all_T</span><span class="o">=</span><span class="n">all_T</span><span class="p">,</span> <span class="n">all_theta</span><span class="o">=</span><span class="n">all_theta</span><span class="p">,</span> <span class="n">nplanes</span><span class="o">=</span><span class="n">nplanes</span><span class="p">)</span>
<span class="linenos">126</span> <span class="n">data</span><span class="o">.</span><span class="n">view</span><span class="p">()</span>
</pre></div>
</div>
</div>
</div>
</section>
</section>
</section>
<script type="text/x-thebe-config">
{
requestKernel: true,
binderOptions: {
repo: "binder-examples/jupyter-stacks-datascience",
ref: "master",
},
codeMirrorConfig: {
theme: "abcdef",
mode: "python"
},
kernelOptions: {
name: "python3",
path: "./Activity06"
},
predefinedOutput: true
}
</script>
<script>kernelName = 'python3'</script>
</article>
<footer class="prev-next-footer d-print-none">
<div class="prev-next-area">
</div>
</footer>
</div>
<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="#surface-and-bulk-effects-of-the-temperature">Surface and bulk effects of the temperature</a><ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#the-script">The script</a></li>
</ul>
</li>
</ul>
</nav></div>
</div></div>
</div>
<footer class="bd-footer-content">
<div class="bd-footer-content__inner container">
<div class="footer-item">
<p class="component-author">
By Sylvain Tricot
</p>
</div>
<div class="footer-item">
<p class="copyright">
© Copyright 2023.
<br/>
</p>
</div>
<div class="footer-item">
</div>
<div class="footer-item">
</div>
</div>
</footer>
</main>
</div>
</div>
<!-- Scripts loaded after <body> so the DOM is not blocked -->
<script src="../_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b"></script>
<script src="../_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b"></script>
<footer class="bd-footer">
</footer>
</body>
</html>

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/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />
@ -369,7 +369,7 @@ document.write(`
<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>For an emitter in the subsurface, we can use single scattering (see <a class="reference internal" href="../Activity05/Activity05_light.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">
@ -382,7 +382,8 @@ document.write(`
</div>
</div>
</div>
<div class="toggle docutils container">
<div class="dropdown admonition">
<p class="admonition-title"><em>Solution…</em></p>
<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>
@ -394,8 +395,6 @@ document.write(`
</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>
@ -427,7 +426,7 @@ document.write(`
<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 following script is almost completed, try to define path filtering options (no backscattering, accept all paths with forward angles &lt; 40° and reject paths longer than the diameter of the cluster).</p>
<p>The <a class="reference download internal" download="" href="../_downloads/b820873b74a9711a6b5f02470505cc1a/Si001.py"><span class="xref download myst">following script</span></a> is almost completed, try to define path filtering options (no backscattering, accept all paths with forward angles &lt; 40° and reject paths longer than the diameter of the cluster).</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="linenos"> 1</span><span class="c1"># coding: utf8</span>
<span class="linenos"> 2</span>
<span class="linenos"> 3</span><span class="kn">import</span><span class="w"> </span><span class="nn">numpy</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nn">np</span>
@ -493,7 +492,8 @@ document.write(`
</ol>
</div>
</div>
<div class="toggle docutils container">
<div class="dropdown admonition">
<p class="admonition-title"><em>Solution…</em></p>
<p>The calculation took few seconds and the result is very close to the calculation with all scattering paths.</p>
<p>Only 0.01% of 3<sup>rd</sup> order paths were actually taken into account</p>
<figure class="align-default" id="si-fig">

View File

@ -0,0 +1,588 @@
<!DOCTYPE html>
<html lang="en" data-content_root="../" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Activity 7: Large clusters and path filtering &#8212; MsSpec Tour</title>
<script data-cfasync="false">
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "";
</script>
<!-- Loaded before other Sphinx assets -->
<link href="../_static/styles/theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/styles/bootstrap.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/styles/pydata-sphinx-theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/vendor/fontawesome/6.5.2/css/all.min.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-solid-900.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-brands-400.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-regular-400.woff2" />
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=03e43079" />
<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/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />
<!-- Pre-loaded scripts that we'll load fully later -->
<link rel="preload" as="script" href="../_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b" />
<link rel="preload" as="script" href="../_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b" />
<script src="../_static/vendor/fontawesome/6.5.2/js/all.min.js?digest=dfe6caa3a7d634c4db9b"></script>
<script src="../_static/documentation_options.js?v=9eb32ce0"></script>
<script src="../_static/doctools.js?v=9a2dae69"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../_static/copybutton.js?v=f281be69"></script>
<script src="../_static/scripts/sphinx-book-theme.js?v=887ef09a"></script>
<script>let toggleHintShow = 'Click to show';</script>
<script>let toggleHintHide = 'Click to hide';</script>
<script>let toggleOpenOnPrint = 'true';</script>
<script src="../_static/togglebutton.js?v=4a39c7ea"></script>
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
<script src="../_static/design-tabs.js?v=f930bc37"></script>
<script>const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"; const thebe_selector = ".thebe,.cell"; const thebe_selector_input = "pre"; const thebe_selector_output = ".output, .cell_output"</script>
<script async="async" src="../_static/sphinx-thebe.js?v=c100c467"></script>
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
<script>const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"; const thebe_selector = ".thebe,.cell"; const thebe_selector_input = "pre"; const thebe_selector_output = ".output, .cell_output"</script>
<script>window.MathJax = {"options": {"processHtmlClass": "tex2jax_process|mathjax_process|math|output_area"}}</script>
<script defer="defer" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script>DOCUMENTATION_OPTIONS.pagename = 'Activity07/Activity07_light';</script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="docsearch:language" content="en"/>
</head>
<body data-bs-spy="scroll" data-bs-target=".bd-toc-nav" data-offset="180" data-bs-root-margin="0px 0px -60%" data-default-mode="">
<div id="pst-skip-link" class="skip-link d-print-none"><a href="#main-content">Skip to main content</a></div>
<div id="pst-scroll-pixel-helper"></div>
<button type="button" class="btn rounded-pill" id="pst-back-to-top">
<i class="fa-solid fa-arrow-up"></i>Back to top</button>
<input type="checkbox"
class="sidebar-toggle"
id="pst-primary-sidebar-checkbox"/>
<label class="overlay overlay-primary" for="pst-primary-sidebar-checkbox"></label>
<input type="checkbox"
class="sidebar-toggle"
id="pst-secondary-sidebar-checkbox"/>
<label class="overlay overlay-secondary" for="pst-secondary-sidebar-checkbox"></label>
<div class="search-button__wrapper">
<div class="search-button__overlay"></div>
<div class="search-button__search-container">
<form class="bd-search d-flex align-items-center"
action="../search.html"
method="get">
<i class="fa-solid fa-magnifying-glass"></i>
<input type="search"
class="form-control"
name="q"
id="search-input"
placeholder="Search this book..."
aria-label="Search this book..."
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"/>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span>
</form></div>
</div>
<div class="pst-async-banner-revealer d-none">
<aside id="bd-header-version-warning" class="d-none d-print-none" aria-label="Version warning"></aside>
</div>
<header class="bd-header navbar navbar-expand-lg bd-navbar d-print-none">
</header>
<div class="bd-container">
<div class="bd-container__inner bd-page-width">
<div class="bd-sidebar-primary bd-sidebar">
<div class="sidebar-header-items sidebar-primary__section">
</div>
<div class="sidebar-primary-items__start sidebar-primary__section">
<div class="sidebar-primary-item">
<a class="navbar-brand logo" href="../intro.html">
<img src="../_static/logo.jpg" class="logo__image only-light" alt="MsSpec Tour - Home"/>
<script>document.write(`<img src="../_static/logo.jpg" class="logo__image only-dark" alt="MsSpec Tour - Home"/>`);</script>
</a></div>
<div class="sidebar-primary-item">
<script>
document.write(`
<button class="btn search-button-field search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass"></i>
<span class="search-button__default-text">Search</span>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
</button>
`);
</script></div>
<div class="sidebar-primary-item"><nav class="bd-links bd-docs-nav" aria-label="Main">
<div class="bd-toc-item navbar-nav active">
<ul class="nav bd-sidenav bd-sidenav__home-link">
<li class="toctree-l1">
<a class="reference internal" href="../intro.html">
Welcome to this small MsSpec tour
</a>
</li>
</ul>
<ul class="nav bd-sidenav">
<li class="toctree-l1"><a class="reference internal" href="../Activity01/Activity01.html">Activity 1: Getting started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity02/Activity02.html">Activity 2: Setting up the “experiment”</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity03/Activity03.html">Activity 3: Adsorbates and the single scattering approach</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity04/Activity04.html">Activity 4: From single scattering to multiple scattering</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity05/Activity05.html">Activity 5: Multiple scattering in the forward scattering regime</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity06/Activity06.html">Activity 6: Effect of the temperature</a></li>
<li class="toctree-l1"><a class="reference internal" href="Activity07.html">Activity 7: Large clusters and path filtering</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity08/Activity08.html">Activity 8: Inequivalent emitters and the XPD of a substrate</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity09/Activity09.html">Activity 9: Comparing simulation and experiment with R-factors</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity10/Activity10.html">Activity 10: Parallelization and multi-processing in MsSpec</a></li>
</ul>
</div>
</nav></div>
</div>
<div class="sidebar-primary-items__end sidebar-primary__section">
</div>
<div id="rtd-footer-container"></div>
</div>
<main id="main-content" class="bd-main" role="main">
<div class="sbt-scroll-pixel-helper"></div>
<div class="bd-content">
<div class="bd-article-container">
<div class="bd-header-article d-print-none">
<div class="header-article-items header-article__inner">
<div class="header-article-items__start">
<div class="header-article-item"><button class="sidebar-toggle primary-toggle btn btn-sm" title="Toggle primary sidebar" data-bs-placement="bottom" data-bs-toggle="tooltip">
<span class="fa-solid fa-bars"></span>
</button></div>
</div>
<div class="header-article-items__end">
<div class="header-article-item">
<div class="article-header-buttons">
<div class="dropdown dropdown-download-buttons">
<button class="btn dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Download this page">
<i class="fas fa-download"></i>
</button>
<ul class="dropdown-menu">
<li><a href="../_sources/Activity07/Activity07_light.ipynb" target="_blank"
class="btn btn-sm btn-download-source-button dropdown-item"
title="Download source file"
data-bs-placement="left" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-file"></i>
</span>
<span class="btn__text-container">.ipynb</span>
</a>
</li>
<li>
<button onclick="window.print()"
class="btn btn-sm btn-download-pdf-button dropdown-item"
title="Print to PDF"
data-bs-placement="left" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-file-pdf"></i>
</span>
<span class="btn__text-container">.pdf</span>
</button>
</li>
</ul>
</div>
<button onclick="toggleFullScreen()"
class="btn btn-sm btn-fullscreen-button"
title="Fullscreen mode"
data-bs-placement="bottom" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-expand"></i>
</span>
</button>
<script>
document.write(`
<button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light"></i>
<i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark"></i>
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto"></i>
</button>
`);
</script>
<script>
document.write(`
<button class="btn btn-sm pst-navbar-icon search-button search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass fa-lg"></i>
</button>
`);
</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 id="jb-print-docs-body" class="onlyprint">
<h1>Activity 7: Large clusters and path filtering</h1>
<!-- Table of contents -->
<div id="print-main-content">
<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 id="searchbox"></div>
<article class="bd-article">
<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>
<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_light.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>
</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">
<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>
<figcaption>
<p><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>
</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 the contribution of a Si(2p) atom in the 4<sup>th</sup> plane of a Si(001) cluster at scattering order 3.</p>
<p>Taking into account all scattering paths took 15 minutes to compute.</p>
<div class="admonition seealso" id="msd-paper">
<p class="admonition-title">See also</p>
<p>based on this paper from S. Tricot <em>et al.</em>
<a class="reference external" href="https://doi.org/10.1016/j.elspec.2022.147176">J. Electron. Spectrosc. Relat. Phenom. <strong>256</strong> 147176 (2022)</a></p>
</div>
<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 <a class="reference download internal" download="" href="../_downloads/b820873b74a9711a6b5f02470505cc1a/Si001.py"><span class="xref download myst">following script</span></a> is almost completed, try to define path filtering options (no backscattering, accept all paths with forward angles &lt; 40° and reject paths longer than the diameter of the cluster).</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="linenos"> 1</span><span class="c1"># coding: utf8</span>
<span class="linenos"> 2</span>
<span class="linenos"> 3</span><span class="kn">import</span><span class="w"> </span><span class="nn">numpy</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nn">np</span>
<span class="linenos"> 4</span><span class="kn">from</span><span class="w"> </span><span class="nn">ase.build</span><span class="w"> </span><span class="kn">import</span> <span class="n">bulk</span>
<span class="linenos"> 5</span>
<span class="linenos"> 6</span><span class="kn">from</span><span class="w"> </span><span class="nn">msspec.calculator</span><span class="w"> </span><span class="kn">import</span> <span class="n">MSSPEC</span><span class="p">,</span> <span class="n">XRaySource</span>
<span class="linenos"> 7</span><span class="kn">from</span><span class="w"> </span><span class="nn">msspec.iodata</span><span class="w"> </span><span class="kn">import</span> <span class="n">Data</span>
<span class="linenos"> 8</span><span class="kn">from</span><span class="w"> </span><span class="nn">msspec.utils</span><span class="w"> </span><span class="kn">import</span> <span class="n">hemispherical_cluster</span><span class="p">,</span> <span class="n">get_atom_index</span>
<span class="linenos"> 9</span>
<span class="linenos">10</span>
<span class="linenos">11</span><span class="c1"># Create the cluster</span>
<span class="linenos">12</span><span class="n">a</span> <span class="o">=</span> <span class="mf">5.43</span>
<span class="linenos">13</span><span class="n">Si</span> <span class="o">=</span> <span class="n">bulk</span><span class="p">(</span><span class="s1">&#39;Si&#39;</span><span class="p">,</span> <span class="n">a</span><span class="o">=</span><span class="n">a</span><span class="p">,</span> <span class="n">cubic</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="linenos">14</span><span class="n">cluster</span> <span class="o">=</span> <span class="n">hemispherical_cluster</span><span class="p">(</span><span class="n">Si</span><span class="p">,</span>
<span class="linenos">15</span> <span class="n">diameter</span><span class="o">=</span><span class="mi">30</span><span class="p">,</span> <span class="n">planes</span><span class="o">=</span><span class="mi">4</span><span class="p">,</span>
<span class="linenos">16</span> <span class="n">emitter_plane</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span>
<span class="linenos">17</span> <span class="n">shape</span> <span class="o">=</span> <span class="s1">&#39;cylindrical&#39;</span><span class="p">,</span>
<span class="linenos">18</span> <span class="p">)</span>
<span class="linenos">19</span><span class="k">for</span> <span class="n">atom</span> <span class="ow">in</span> <span class="n">cluster</span><span class="p">:</span>
<span class="linenos">20</span> <span class="n">atom</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s1">&#39;mean_square_vibration&#39;</span><span class="p">,</span> <span class="mf">0.006</span><span class="p">)</span>
<span class="linenos">21</span> <span class="n">atom</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s1">&#39;mt_radius&#39;</span><span class="p">,</span> <span class="mf">1.1</span><span class="p">)</span>
<span class="linenos">22</span><span class="n">cluster</span><span class="o">.</span><span class="n">emitter</span> <span class="o">=</span> <span class="n">get_atom_index</span><span class="p">(</span><span class="n">cluster</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="linenos">23</span>
<span class="linenos">24</span><span class="c1"># Create a calculator and set parameters</span>
<span class="linenos">25</span><span class="n">calc</span> <span class="o">=</span> <span class="n">MSSPEC</span><span class="p">(</span><span class="n">spectroscopy</span><span class="o">=</span><span class="s1">&#39;PED&#39;</span><span class="p">,</span> <span class="n">algorithm</span><span class="o">=</span><span class="s1">&#39;expansion&#39;</span><span class="p">)</span>
<span class="linenos">26</span>
<span class="linenos">27</span><span class="n">calc</span><span class="o">.</span><span class="n">source_parameters</span><span class="o">.</span><span class="n">energy</span> <span class="o">=</span> <span class="n">XRaySource</span><span class="o">.</span><span class="n">AL_KALPHA</span>
<span class="linenos">28</span><span class="n">calc</span><span class="o">.</span><span class="n">source_parameters</span><span class="o">.</span><span class="n">theta</span> <span class="o">=</span> <span class="o">-</span><span class="mf">54.7</span>
<span class="linenos">29</span><span class="n">calc</span><span class="o">.</span><span class="n">source_parameters</span><span class="o">.</span><span class="n">phi</span> <span class="o">=</span> <span class="mi">90</span>
<span class="linenos">30</span><span class="n">calc</span><span class="o">.</span><span class="n">spectroscopy_parameters</span><span class="o">.</span><span class="n">final_state</span> <span class="o">=</span> <span class="mi">1</span>
<span class="linenos">31</span>
<span class="linenos">32</span><span class="n">calc</span><span class="o">.</span><span class="n">calculation_parameters</span><span class="o">.</span><span class="n">scattering_order</span> <span class="o">=</span> <span class="mi">3</span>
<span class="linenos">33</span><span class="n">calc</span><span class="o">.</span><span class="n">tmatrix_parameters</span><span class="o">.</span><span class="n">tl_threshold</span> <span class="o">=</span> <span class="mf">1e-4</span>
<span class="linenos">34</span><span class="n">calc</span><span class="o">.</span><span class="n">calculation_parameters</span><span class="o">.</span><span class="n">vibrational_damping</span> <span class="o">=</span> <span class="s1">&#39;averaged_tl&#39;</span>
<span class="linenos">35</span><span class="n">calc</span><span class="o">.</span><span class="n">calculation_parameters</span><span class="o">.</span><span class="n">RA_cutoff</span> <span class="o">=</span> <span class="mi">2</span>
<span class="linenos">36</span>
<span class="hll"><span class="linenos">37</span><span class="c1"># Define path filtering options such that you only</span>
</span><span class="hll"><span class="linenos">38</span><span class="c1"># accept scattering paths with a forward cone &lt;= 40°</span>
</span><span class="hll"><span class="linenos">39</span><span class="c1"># and whose length are &lt;= cluster diameter</span>
</span><span class="hll"><span class="linenos">40</span><span class="c1">#</span>
</span><span class="hll"><span class="linenos">41</span><span class="c1">#</span>
</span><span class="linenos">42</span>
<span class="linenos">43</span><span class="n">calc</span><span class="o">.</span><span class="n">set_atoms</span><span class="p">(</span><span class="n">cluster</span><span class="p">)</span>
<span class="linenos">44</span>
<span class="linenos">45</span><span class="c1"># Compute and add previous data for comparison</span>
<span class="linenos">46</span><span class="n">data</span> <span class="o">=</span> <span class="n">calc</span><span class="o">.</span><span class="n">get_theta_scan</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="s1">&#39;2p&#39;</span><span class="p">,</span>
<span class="linenos">47</span> <span class="n">theta</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="o">-</span><span class="mf">30.</span><span class="p">,</span> <span class="mf">80.</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">),</span>
<span class="linenos">48</span> <span class="n">phi</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
<span class="linenos">49</span> <span class="n">kinetic_energy</span><span class="o">=</span><span class="mf">1382.28</span><span class="p">)</span>
<span class="linenos">50</span><span class="n">no_filters</span> <span class="o">=</span> <span class="n">Data</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="s1">&#39;path_filtering.hdf5&#39;</span><span class="p">)</span>
<span class="linenos">51</span><span class="n">data</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">add_columns</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="s1">&#39;no_filters&#39;</span><span class="p">:</span> <span class="n">no_filters</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">cross_section</span><span class="p">})</span>
<span class="linenos">52</span><span class="n">view</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">views</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="linenos">53</span><span class="n">view</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s1">&#39;theta&#39;</span><span class="p">,</span> <span class="s1">&#39;cross_section&#39;</span><span class="p">,</span> <span class="n">index</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">legend</span><span class="o">=</span><span class="s2">&quot;With path filtering&quot;</span><span class="p">)</span>
<span class="linenos">54</span><span class="n">view</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s1">&#39;theta&#39;</span><span class="p">,</span> <span class="s1">&#39;no_filters&#39;</span><span class="p">,</span> <span class="n">legend</span><span class="o">=</span><span class="s2">&quot;Without path filtering&quot;</span><span class="p">)</span>
<span class="linenos">55</span>
<span class="linenos">56</span><span class="n">data</span><span class="o">.</span><span class="n">view</span><span class="p">()</span>
</pre></div>
</div>
<ol class="arabic simple">
<li><p>How long was your calculation ?</p></li>
<li><p>How does it compare to the calculation with <strong>all</strong> scattering paths up to order 3 ?</p></li>
<li><p>What is the proportion of scattering paths of order 3 that were actually taken into account ?</p></li>
</ol>
</div>
</div>
</section>
</section>
<script type="text/x-thebe-config">
{
requestKernel: true,
binderOptions: {
repo: "binder-examples/jupyter-stacks-datascience",
ref: "master",
},
codeMirrorConfig: {
theme: "abcdef",
mode: "python"
},
kernelOptions: {
name: "python3",
path: "./Activity07"
},
predefinedOutput: true
}
</script>
<script>kernelName = 'python3'</script>
</article>
<footer class="prev-next-footer d-print-none">
<div class="prev-next-area">
</div>
</footer>
</div>
<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>
<footer class="bd-footer-content">
<div class="bd-footer-content__inner container">
<div class="footer-item">
<p class="component-author">
By Sylvain Tricot
</p>
</div>
<div class="footer-item">
<p class="copyright">
© Copyright 2023.
<br/>
</p>
</div>
<div class="footer-item">
</div>
<div class="footer-item">
</div>
</div>
</footer>
</main>
</div>
</div>
<!-- Scripts loaded after <body> so the DOM is not blocked -->
<script src="../_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b"></script>
<script src="../_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b"></script>
<footer class="bd-footer">
</footer>
</body>
</html>

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/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />
@ -354,14 +354,14 @@ document.write(`
<section class="tex2jax_ignore mathjax_ignore" id="activity-8-inequivalent-emitters-and-the-xpd-of-a-substrate">
<h1>Activity 8: Inequivalent emitters and the XPD of a substrate<a class="headerlink" href="#activity-8-inequivalent-emitters-and-the-xpd-of-a-substrate" title="Link to this heading">#</a></h1>
<p>XPD can be used to study the adsorption of atoms or molecules on surfaces (<a class="reference internal" href="../Activity03/Activity03.html#ssc"><span class="std std-ref">Activity 3</span></a>), or atomic substitutions on surfaces (<a class="reference internal" href="../Activity02/Activity02.html#exp-setup"><span class="std std-ref">Activity 2</span></a>). In this case, modeling is relatively straightforward, since only one emitter atom is involved.</p>
<p>We have seen from previous examples that, for kinetic energies <span class="math notranslate nohighlight">\(\gtrsim\)</span> 500 eV, the use of Rehr-Albers series expansion and scattering path filtering give access to the intensity of deeper emitter atoms (<a class="reference internal" href="../Activity07/Activity07.html#path-filtering"><span class="std std-ref">Activity 7</span></a>).
<p>XPD can be used to study the adsorption of atoms or molecules on surfaces (<a class="reference internal" href="../Activity03/Activity03_light.html#ssc"><span class="std std-ref">Activity 3</span></a>), or atomic substitutions on surfaces (<a class="reference internal" href="../Activity02/Activity02_light.html#exp-setup"><span class="std std-ref">Activity 2</span></a>). In this case, modeling is relatively straightforward, since only one emitter atom is involved.</p>
<p>We have seen from previous examples that, for kinetic energies <span class="math notranslate nohighlight">\(\gtrsim\)</span> 500 eV, the use of Rehr-Albers series expansion and scattering path filtering give access to the intensity of deeper emitter atoms (<a class="reference internal" href="../Activity07/Activity07_light.html#path-filtering"><span class="std std-ref">Activity 7</span></a>).
This is the key to computing the total photodiffraction signal of a <em>substrate</em>. As emitted photoelectrons originate from highly localized core levels around the atoms, the total signal corresponds to the (incoherent) sum of the intensities of all inequivalent emitters in the probed volume.</p>
<p>Lets take a look at how this is done on the following example.</p>
<section id="the-aluminium-nitride-aln-polarity">
<h2>The Aluminium Nitride (AlN) polarity<a class="headerlink" href="#the-aluminium-nitride-aln-polarity" title="Link to this heading">#</a></h2>
<p>In this example, we will compute polar diagrams of an aluminum nitride substrate.</p>
<p>In a work published in 1999, Lebedev <em>et al.</em> demonstrated that Photoelectron diffraction can be used as a non invasive tool to unambiguously state the polarity of an AlN surface. Aluminium nitride cristallizes in an hexagonal cell and the authors experimentally showed that the polarity of the surface can be controlled by the annealing temperature during the growth. Both polarities are sketched in the <a class="reference internal" href="#aln-fig1"><span class="std std-ref">figure</span></a> below.</p>
<p>In a work published in 1999, Lebedev <em>et al.</em> demonstrated that Photoelectron diffraction can be used as a non invasive tool to unambiguously state the polarity of an AlN surface. Aluminium nitride cristallizes in an hexagonal cell and the authors experimentally showed that the polarity of the surface can be controlled by the annealing temperature during the growth. Both polarities are sketched in the <a class="reference internal" href="Activity08_light.html#aln-fig1"><span class="std std-ref">figure</span></a> below.</p>
<div class="admonition seealso" id="aln-paper">
<p class="admonition-title">See also</p>
<p>based on this paper from V. Lebedev <em>et al.</em>
@ -374,7 +374,7 @@ This is the key to computing the total photodiffraction signal of a <em>substrat
<p><span class="caption-number">Fig. 21 </span><span class="caption-text">AlN hexagonal lattice. Left) N polarity with nitrogen terminated surface and AlN<sub>4</sub> tetrahedrons pointing downward. Right) Al polarity with aluminium terminated surface and AlN<sub>4</sub> tetrahedrons pointing upward</span><a class="headerlink" href="#aln-fig1" title="Link to this image">#</a></p>
</figcaption>
</figure>
<p>The AlN(0001) and (00.-1) faces share the same crystallograpphic symmetry and the Al and N atoms have the same geometrical surrounding differing only in the exchange of Al and N atoms (<a class="reference internal" href="#aln-fig2"><span class="std std-numref">Fig. 22</span></a>).</p>
<p>The AlN(0001) and (00.-1) faces share the same crystallograpphic symmetry and the Al and N atoms have the same geometrical surrounding differing only in the exchange of Al and N atoms (<code class="xref std std-numref docutils literal notranslate"><span class="pre">Fig.</span> <span class="pre">%s</span></code>).</p>
<p>It is thus expected that Al(2p) and N(1s) XPD patterns exhibit almost the same features with only small differences due to the contrast between Al and N scattering amplitudes.</p>
<figure class="align-default" id="aln-fig2">
<a class="reference internal image-reference" href="../_images/AlN-fig2.jpg"><img alt="AlN crystal direction" class="align-center" src="../_images/AlN-fig2.jpg" style="width: 600px;" />
@ -383,16 +383,17 @@ This is the key to computing the total photodiffraction signal of a <em>substrat
<p><span class="caption-number">Fig. 22 </span><span class="caption-text">Side views of N- or Al- terminated surfaces showing nearest neighbours main polar crystallographic directions. The inset shows the experimental Al(2p)/N(1s) ratio versus polar angle for both AlN polarities (taken from <a class="reference internal" href="#aln-paper">Lebedev <em>et al.</em></a>).</span><a class="headerlink" href="#aln-fig2" title="Link to this image">#</a></p>
</figcaption>
</figure>
<p>The strongest differences in photoemission intensities suitable for a quick and unambiguous determination of polarity were found in the (10-10) azimuthal plane at <strong>32°</strong> and <strong>59°</strong> (polar scans in the inset of <a class="reference internal" href="#aln-fig2"><span class="std std-numref">Fig. 22</span></a>).</p>
<p>The strongest differences in photoemission intensities suitable for a quick and unambiguous determination of polarity were found in the (10-10) azimuthal plane at <strong>32°</strong> and <strong>59°</strong> (polar scans in the inset of <code class="xref std std-numref docutils literal notranslate"><span class="pre">Fig.</span> <span class="pre">%s</span></code>).</p>
<p>These are the directions of short neighbor distances between the atoms of the same element (32°) and between Al and N atoms (58.5°), respectively.</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>Using the crystal view in <a class="reference internal" href="#aln-fig1"><span class="std std-numref">Fig. 21</span></a> and assuming that we want to compute Al(2p) and N(1s) intensities for emitters located in 3 different planes to get a <em>substrate</em> signal. How many clusters do we need to build ?</p>
<p>Using the crystal view in <code class="xref std std-numref docutils literal notranslate"><span class="pre">Fig.</span> <span class="pre">%s</span></code> and assuming that we want to compute Al(2p) and N(1s) intensities for emitters located in 3 different planes to get a <em>substrate</em> signal. How many clusters do we need to build ?</p>
</div>
</div>
<div class="toggle docutils container">
<div class="dropdown admonition">
<p class="admonition-title"><em>Solution…</em></p>
<figure class="align-default" id="aln-fig3">
<a class="reference internal image-reference" href="../_images/AlN-fig3.jpg"><img alt="AlN number of clusters" class="align-center" src="../_images/AlN-fig3.jpg" style="width: 600px;" />
</a>
@ -401,16 +402,15 @@ This is the key to computing the total photodiffraction signal of a <em>substrat
</figcaption>
</figure>
</div>
<div class="docutils">
</div>
<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>Download <a class="reference download internal" download="" href="../_downloads/0e4320262cbcdc4d473d0b9d43e0f7e9/AlN.py"><span class="xref download myst">this script</span></a> and fill in the lines indicated by the comments “FILL HERE”. Run the calculation and check that you are reproducing polar scan of <a class="reference internal" href="#aln-fig2"><span class="std std-numref">Fig. 22</span></a>.</p>
<p>Download <a class="reference download internal" download="" href="../_downloads/0e4320262cbcdc4d473d0b9d43e0f7e9/AlN.py"><span class="xref download myst">this script</span></a> and fill in the lines indicated by the comments “FILL HERE”. Run the calculation and check that you are reproducing polar scan of <code class="xref std std-numref docutils literal notranslate"><span class="pre">Fig.</span> <span class="pre">%s</span></code>.</p>
</div>
</div>
<div class="toggle docutils container">
<div class="dropdown admonition">
<p class="admonition-title"><em>Solution…</em></p>
<figure class="align-default" id="aln-fig4">
<a class="reference internal image-reference" href="../_images/AlN-fig4.png"><img alt="AlN results" class="align-center" src="../_images/AlN-fig4.png" style="width: 600px;" />
</a>

View File

@ -0,0 +1,506 @@
<!DOCTYPE html>
<html lang="en" data-content_root="../" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Activity 8: Inequivalent emitters and the XPD of a substrate &#8212; MsSpec Tour</title>
<script data-cfasync="false">
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "";
</script>
<!-- Loaded before other Sphinx assets -->
<link href="../_static/styles/theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/styles/bootstrap.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/styles/pydata-sphinx-theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/vendor/fontawesome/6.5.2/css/all.min.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-solid-900.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-brands-400.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-regular-400.woff2" />
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=03e43079" />
<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/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />
<!-- Pre-loaded scripts that we'll load fully later -->
<link rel="preload" as="script" href="../_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b" />
<link rel="preload" as="script" href="../_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b" />
<script src="../_static/vendor/fontawesome/6.5.2/js/all.min.js?digest=dfe6caa3a7d634c4db9b"></script>
<script src="../_static/documentation_options.js?v=9eb32ce0"></script>
<script src="../_static/doctools.js?v=9a2dae69"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../_static/copybutton.js?v=f281be69"></script>
<script src="../_static/scripts/sphinx-book-theme.js?v=887ef09a"></script>
<script>let toggleHintShow = 'Click to show';</script>
<script>let toggleHintHide = 'Click to hide';</script>
<script>let toggleOpenOnPrint = 'true';</script>
<script src="../_static/togglebutton.js?v=4a39c7ea"></script>
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
<script src="../_static/design-tabs.js?v=f930bc37"></script>
<script>const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"; const thebe_selector = ".thebe,.cell"; const thebe_selector_input = "pre"; const thebe_selector_output = ".output, .cell_output"</script>
<script async="async" src="../_static/sphinx-thebe.js?v=c100c467"></script>
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
<script>const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"; const thebe_selector = ".thebe,.cell"; const thebe_selector_input = "pre"; const thebe_selector_output = ".output, .cell_output"</script>
<script>window.MathJax = {"options": {"processHtmlClass": "tex2jax_process|mathjax_process|math|output_area"}}</script>
<script defer="defer" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script>DOCUMENTATION_OPTIONS.pagename = 'Activity08/Activity08_light';</script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="docsearch:language" content="en"/>
</head>
<body data-bs-spy="scroll" data-bs-target=".bd-toc-nav" data-offset="180" data-bs-root-margin="0px 0px -60%" data-default-mode="">
<div id="pst-skip-link" class="skip-link d-print-none"><a href="#main-content">Skip to main content</a></div>
<div id="pst-scroll-pixel-helper"></div>
<button type="button" class="btn rounded-pill" id="pst-back-to-top">
<i class="fa-solid fa-arrow-up"></i>Back to top</button>
<input type="checkbox"
class="sidebar-toggle"
id="pst-primary-sidebar-checkbox"/>
<label class="overlay overlay-primary" for="pst-primary-sidebar-checkbox"></label>
<input type="checkbox"
class="sidebar-toggle"
id="pst-secondary-sidebar-checkbox"/>
<label class="overlay overlay-secondary" for="pst-secondary-sidebar-checkbox"></label>
<div class="search-button__wrapper">
<div class="search-button__overlay"></div>
<div class="search-button__search-container">
<form class="bd-search d-flex align-items-center"
action="../search.html"
method="get">
<i class="fa-solid fa-magnifying-glass"></i>
<input type="search"
class="form-control"
name="q"
id="search-input"
placeholder="Search this book..."
aria-label="Search this book..."
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"/>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span>
</form></div>
</div>
<div class="pst-async-banner-revealer d-none">
<aside id="bd-header-version-warning" class="d-none d-print-none" aria-label="Version warning"></aside>
</div>
<header class="bd-header navbar navbar-expand-lg bd-navbar d-print-none">
</header>
<div class="bd-container">
<div class="bd-container__inner bd-page-width">
<div class="bd-sidebar-primary bd-sidebar">
<div class="sidebar-header-items sidebar-primary__section">
</div>
<div class="sidebar-primary-items__start sidebar-primary__section">
<div class="sidebar-primary-item">
<a class="navbar-brand logo" href="../intro.html">
<img src="../_static/logo.jpg" class="logo__image only-light" alt="MsSpec Tour - Home"/>
<script>document.write(`<img src="../_static/logo.jpg" class="logo__image only-dark" alt="MsSpec Tour - Home"/>`);</script>
</a></div>
<div class="sidebar-primary-item">
<script>
document.write(`
<button class="btn search-button-field search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass"></i>
<span class="search-button__default-text">Search</span>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
</button>
`);
</script></div>
<div class="sidebar-primary-item"><nav class="bd-links bd-docs-nav" aria-label="Main">
<div class="bd-toc-item navbar-nav active">
<ul class="nav bd-sidenav bd-sidenav__home-link">
<li class="toctree-l1">
<a class="reference internal" href="../intro.html">
Welcome to this small MsSpec tour
</a>
</li>
</ul>
<ul class="nav bd-sidenav">
<li class="toctree-l1"><a class="reference internal" href="../Activity01/Activity01.html">Activity 1: Getting started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity02/Activity02.html">Activity 2: Setting up the “experiment”</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity03/Activity03.html">Activity 3: Adsorbates and the single scattering approach</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity04/Activity04.html">Activity 4: From single scattering to multiple scattering</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity05/Activity05.html">Activity 5: Multiple scattering in the forward scattering regime</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity06/Activity06.html">Activity 6: Effect of the temperature</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity07/Activity07.html">Activity 7: Large clusters and path filtering</a></li>
<li class="toctree-l1"><a class="reference internal" href="Activity08.html">Activity 8: Inequivalent emitters and the XPD of a substrate</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity09/Activity09.html">Activity 9: Comparing simulation and experiment with R-factors</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity10/Activity10.html">Activity 10: Parallelization and multi-processing in MsSpec</a></li>
</ul>
</div>
</nav></div>
</div>
<div class="sidebar-primary-items__end sidebar-primary__section">
</div>
<div id="rtd-footer-container"></div>
</div>
<main id="main-content" class="bd-main" role="main">
<div class="sbt-scroll-pixel-helper"></div>
<div class="bd-content">
<div class="bd-article-container">
<div class="bd-header-article d-print-none">
<div class="header-article-items header-article__inner">
<div class="header-article-items__start">
<div class="header-article-item"><button class="sidebar-toggle primary-toggle btn btn-sm" title="Toggle primary sidebar" data-bs-placement="bottom" data-bs-toggle="tooltip">
<span class="fa-solid fa-bars"></span>
</button></div>
</div>
<div class="header-article-items__end">
<div class="header-article-item">
<div class="article-header-buttons">
<div class="dropdown dropdown-download-buttons">
<button class="btn dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Download this page">
<i class="fas fa-download"></i>
</button>
<ul class="dropdown-menu">
<li><a href="../_sources/Activity08/Activity08_light.ipynb" target="_blank"
class="btn btn-sm btn-download-source-button dropdown-item"
title="Download source file"
data-bs-placement="left" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-file"></i>
</span>
<span class="btn__text-container">.ipynb</span>
</a>
</li>
<li>
<button onclick="window.print()"
class="btn btn-sm btn-download-pdf-button dropdown-item"
title="Print to PDF"
data-bs-placement="left" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-file-pdf"></i>
</span>
<span class="btn__text-container">.pdf</span>
</button>
</li>
</ul>
</div>
<button onclick="toggleFullScreen()"
class="btn btn-sm btn-fullscreen-button"
title="Fullscreen mode"
data-bs-placement="bottom" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-expand"></i>
</span>
</button>
<script>
document.write(`
<button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light"></i>
<i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark"></i>
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto"></i>
</button>
`);
</script>
<script>
document.write(`
<button class="btn btn-sm pst-navbar-icon search-button search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass fa-lg"></i>
</button>
`);
</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 id="jb-print-docs-body" class="onlyprint">
<h1>Activity 8: Inequivalent emitters and the XPD of a substrate</h1>
<!-- Table of contents -->
<div id="print-main-content">
<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-aluminium-nitride-aln-polarity">The Aluminium Nitride (AlN) polarity</a></li>
</ul>
</nav>
</div>
</div>
</div>
<div id="searchbox"></div>
<article class="bd-article">
<section class="tex2jax_ignore mathjax_ignore" id="activity-8-inequivalent-emitters-and-the-xpd-of-a-substrate">
<h1>Activity 8: Inequivalent emitters and the XPD of a substrate<a class="headerlink" href="#activity-8-inequivalent-emitters-and-the-xpd-of-a-substrate" title="Link to this heading">#</a></h1>
<p>XPD can be used to study the adsorption of atoms or molecules on surfaces (<a class="reference internal" href="../Activity03/Activity03_light.html#ssc"><span class="std std-ref">Activity 3</span></a>), or atomic substitutions on surfaces (<a class="reference internal" href="../Activity02/Activity02_light.html#exp-setup"><span class="std std-ref">Activity 2</span></a>). In this case, modeling is relatively straightforward, since only one emitter atom is involved.</p>
<p>We have seen from previous examples that, for kinetic energies <span class="math notranslate nohighlight">\(\gtrsim\)</span> 500 eV, the use of Rehr-Albers series expansion and scattering path filtering give access to the intensity of deeper emitter atoms (<a class="reference internal" href="../Activity07/Activity07_light.html#path-filtering"><span class="std std-ref">Activity 7</span></a>).
This is the key to computing the total photodiffraction signal of a <em>substrate</em>. As emitted photoelectrons originate from highly localized core levels around the atoms, the total signal corresponds to the (incoherent) sum of the intensities of all inequivalent emitters in the probed volume.</p>
<p>Lets take a look at how this is done on the following example.</p>
<section id="the-aluminium-nitride-aln-polarity">
<h2>The Aluminium Nitride (AlN) polarity<a class="headerlink" href="#the-aluminium-nitride-aln-polarity" title="Link to this heading">#</a></h2>
<p>In this example, we will compute polar diagrams of an aluminum nitride substrate.</p>
<p>In a work published in 1999, Lebedev <em>et al.</em> demonstrated that Photoelectron diffraction can be used as a non invasive tool to unambiguously state the polarity of an AlN surface. Aluminium nitride cristallizes in an hexagonal cell and the authors experimentally showed that the polarity of the surface can be controlled by the annealing temperature during the growth. Both polarities are sketched in the <a class="reference internal" href="#aln-fig1"><span class="std std-ref">figure</span></a> below.</p>
<div class="admonition seealso" id="aln-paper">
<p class="admonition-title">See also</p>
<p>based on this paper from V. Lebedev <em>et al.</em>
<a class="reference external" href="https://doi.org/10.1016/S0022-0248(99)00375-9">J. Cryst. Growth. <strong>207(4)</strong> p266-72 (1999)</a></p>
</div>
<figure class="align-default" id="aln-fig1">
<a class="reference internal image-reference" href="../_images/AlN-fig1.jpg"><img alt="AlN crystal direction" class="align-center" src="../_images/AlN-fig1.jpg" style="width: 600px;" />
</a>
<figcaption>
<p><span class="caption-text">AlN hexagonal lattice. Left) N polarity with nitrogen terminated surface and AlN<sub>4</sub> tetrahedrons pointing downward. Right) Al polarity with aluminium terminated surface and AlN<sub>4</sub> tetrahedrons pointing upward</span><a class="headerlink" href="#aln-fig1" title="Link to this image">#</a></p>
</figcaption>
</figure>
<p>The AlN(0001) and (00.-1) faces share the same crystallograpphic symmetry and the Al and N atoms have the same geometrical surrounding differing only in the exchange of Al and N atoms (<code class="xref std std-numref docutils literal notranslate"><span class="pre">Fig.</span> <span class="pre">%s</span></code>).</p>
<p>It is thus expected that Al(2p) and N(1s) XPD patterns exhibit almost the same features with only small differences due to the contrast between Al and N scattering amplitudes.</p>
<figure class="align-default" id="aln-fig2">
<a class="reference internal image-reference" href="../_images/AlN-fig2.jpg"><img alt="AlN crystal direction" class="align-center" src="../_images/AlN-fig2.jpg" style="width: 600px;" />
</a>
<figcaption>
<p><span class="caption-text">Side views of N- or Al- terminated surfaces showing nearest neighbours main polar crystallographic directions. The inset shows the experimental Al(2p)/N(1s) ratio versus polar angle for both AlN polarities (taken from <a class="reference internal" href="#aln-paper">Lebedev <em>et al.</em></a>).</span><a class="headerlink" href="#aln-fig2" title="Link to this image">#</a></p>
</figcaption>
</figure>
<p>The strongest differences in photoemission intensities suitable for a quick and unambiguous determination of polarity were found in the (10-10) azimuthal plane at <strong>32°</strong> and <strong>59°</strong> (polar scans in the inset of <code class="xref std std-numref docutils literal notranslate"><span class="pre">Fig.</span> <span class="pre">%s</span></code>).</p>
<p>These are the directions of short neighbor distances between the atoms of the same element (32°) and between Al and N atoms (58.5°), respectively.</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>Using the crystal view in <code class="xref std std-numref docutils literal notranslate"><span class="pre">Fig.</span> <span class="pre">%s</span></code> and assuming that we want to compute Al(2p) and N(1s) intensities for emitters located in 3 different planes to get a <em>substrate</em> signal. How many clusters do we need to build ?</p>
</div>
</div>
<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>Download <a class="reference download internal" download="" href="../_downloads/0e4320262cbcdc4d473d0b9d43e0f7e9/AlN.py"><span class="xref download myst">this script</span></a> and fill in the lines indicated by the comments “FILL HERE”. Run the calculation and check that you are reproducing polar scan of <code class="xref std std-numref docutils literal notranslate"><span class="pre">Fig.</span> <span class="pre">%s</span></code>.</p>
</div>
</div>
</section>
</section>
<script type="text/x-thebe-config">
{
requestKernel: true,
binderOptions: {
repo: "binder-examples/jupyter-stacks-datascience",
ref: "master",
},
codeMirrorConfig: {
theme: "abcdef",
mode: "python"
},
kernelOptions: {
name: "python3",
path: "./Activity08"
},
predefinedOutput: true
}
</script>
<script>kernelName = 'python3'</script>
</article>
<footer class="prev-next-footer d-print-none">
<div class="prev-next-area">
</div>
</footer>
</div>
<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-aluminium-nitride-aln-polarity">The Aluminium Nitride (AlN) polarity</a></li>
</ul>
</nav></div>
</div></div>
</div>
<footer class="bd-footer-content">
<div class="bd-footer-content__inner container">
<div class="footer-item">
<p class="component-author">
By Sylvain Tricot
</p>
</div>
<div class="footer-item">
<p class="copyright">
© Copyright 2023.
<br/>
</p>
</div>
<div class="footer-item">
</div>
<div class="footer-item">
</div>
</div>
</footer>
</main>
</div>
</div>
<!-- Scripts loaded after <body> so the DOM is not blocked -->
<script src="../_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b"></script>
<script src="../_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b"></script>
<footer class="bd-footer">
</footer>
</body>
</html>

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/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />
@ -377,7 +377,7 @@ document.write(`
<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>Download <a class="reference download internal" download="" href="../_downloads/179b010d01a3689041dba01413ac667b/COFe.py"><span class="xref download myst">this script</span></a> and write the body of the function <code class="docutils literal notranslate"><span class="pre">create_cluster</span></code>. The function should return a
small cluster of 5 Fe atoms with the CO molecule adsorbed like in figure <a class="reference internal" href="#cofe-fig2"><span class="std std-numref">Fig. 27</span></a> below. The function
small cluster of 5 Fe atoms with the CO molecule adsorbed like in figure <code class="xref std std-numref docutils literal notranslate"><span class="pre">Fig.</span> <span class="pre">%s</span></code> below. The function
will accept 4 keyword arguments to control the adsorption geometry.</p>
<figure class="align-default" id="cofe-fig2">
<a class="reference internal image-reference" href="../_images/COFe_fig2.jpg"><img alt="CO-Fe adsorption geometry" class="align-center" src="../_images/COFe_fig2.jpg" style="width: 600px;" />
@ -393,7 +393,8 @@ functions.</p>
</div>
</div>
</div>
<div class="toggle docutils container">
<div class="dropdown admonition">
<p class="admonition-title"><em>Solution…</em></p>
<p>Here is the code of the <code class="docutils literal notranslate"><span class="pre">create_cluster</span></code> function</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span><span class="w"> </span><span class="nf">create_cluster</span><span class="p">(</span><span class="n">height</span><span class="o">=</span><span class="mf">1.</span><span class="p">,</span> <span class="n">theta</span><span class="o">=</span><span class="mi">45</span><span class="p">,</span> <span class="n">phi</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">bond_length</span><span class="o">=</span><span class="mf">1.15</span><span class="p">):</span>
<span class="c1"># Fill the body of this function. The &#39;cluster&#39; object in built according to</span>
@ -440,7 +441,8 @@ Finally there is the <em>Main part</em> that is built in two sections:</p>
</ol>
</div>
</div>
<div class="toggle docutils container">
<div class="dropdown admonition">
<p class="admonition-title"><em>Solution…</em></p>
<p>Here are the code of the nested <em>for loops</em></p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">###############################################################################</span>
<span class="c1"># Main part</span>
@ -490,7 +492,8 @@ Finally there is the <em>Main part</em> that is built in two sections:</p>
<p>How many R-Factors do agree that <span class="math notranslate nohighlight">\((\theta,\phi)=(55,0)\)</span> gives the best agreement ?</p>
</div>
</div>
<div class="toggle docutils container">
<div class="dropdown admonition">
<p class="admonition-title"><em>Solution…</em></p>
<p>6 R-factors out of 12 do agree that <em>variable set n°30</em> gives the best agreement. The set n°30 corresponds to
<span class="math notranslate nohighlight">\(\theta=55°\)</span> and <span class="math notranslate nohighlight">\(\phi=0°\)</span>.</p>
<figure class="align-default" id="results">

View File

@ -0,0 +1,531 @@
<!DOCTYPE html>
<html lang="en" data-content_root="../" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Activity 9: Comparing simulation and experiment with R-factors &#8212; MsSpec Tour</title>
<script data-cfasync="false">
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "";
</script>
<!-- Loaded before other Sphinx assets -->
<link href="../_static/styles/theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/styles/bootstrap.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/styles/pydata-sphinx-theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/vendor/fontawesome/6.5.2/css/all.min.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-solid-900.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-brands-400.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-regular-400.woff2" />
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=03e43079" />
<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/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />
<!-- Pre-loaded scripts that we'll load fully later -->
<link rel="preload" as="script" href="../_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b" />
<link rel="preload" as="script" href="../_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b" />
<script src="../_static/vendor/fontawesome/6.5.2/js/all.min.js?digest=dfe6caa3a7d634c4db9b"></script>
<script src="../_static/documentation_options.js?v=9eb32ce0"></script>
<script src="../_static/doctools.js?v=9a2dae69"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../_static/copybutton.js?v=f281be69"></script>
<script src="../_static/scripts/sphinx-book-theme.js?v=887ef09a"></script>
<script>let toggleHintShow = 'Click to show';</script>
<script>let toggleHintHide = 'Click to hide';</script>
<script>let toggleOpenOnPrint = 'true';</script>
<script src="../_static/togglebutton.js?v=4a39c7ea"></script>
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
<script src="../_static/design-tabs.js?v=f930bc37"></script>
<script>const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"; const thebe_selector = ".thebe,.cell"; const thebe_selector_input = "pre"; const thebe_selector_output = ".output, .cell_output"</script>
<script async="async" src="../_static/sphinx-thebe.js?v=c100c467"></script>
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
<script>const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"; const thebe_selector = ".thebe,.cell"; const thebe_selector_input = "pre"; const thebe_selector_output = ".output, .cell_output"</script>
<script>window.MathJax = {"options": {"processHtmlClass": "tex2jax_process|mathjax_process|math|output_area"}}</script>
<script defer="defer" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script>DOCUMENTATION_OPTIONS.pagename = 'Activity09/Activity09_light';</script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="docsearch:language" content="en"/>
</head>
<body data-bs-spy="scroll" data-bs-target=".bd-toc-nav" data-offset="180" data-bs-root-margin="0px 0px -60%" data-default-mode="">
<div id="pst-skip-link" class="skip-link d-print-none"><a href="#main-content">Skip to main content</a></div>
<div id="pst-scroll-pixel-helper"></div>
<button type="button" class="btn rounded-pill" id="pst-back-to-top">
<i class="fa-solid fa-arrow-up"></i>Back to top</button>
<input type="checkbox"
class="sidebar-toggle"
id="pst-primary-sidebar-checkbox"/>
<label class="overlay overlay-primary" for="pst-primary-sidebar-checkbox"></label>
<input type="checkbox"
class="sidebar-toggle"
id="pst-secondary-sidebar-checkbox"/>
<label class="overlay overlay-secondary" for="pst-secondary-sidebar-checkbox"></label>
<div class="search-button__wrapper">
<div class="search-button__overlay"></div>
<div class="search-button__search-container">
<form class="bd-search d-flex align-items-center"
action="../search.html"
method="get">
<i class="fa-solid fa-magnifying-glass"></i>
<input type="search"
class="form-control"
name="q"
id="search-input"
placeholder="Search this book..."
aria-label="Search this book..."
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"/>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span>
</form></div>
</div>
<div class="pst-async-banner-revealer d-none">
<aside id="bd-header-version-warning" class="d-none d-print-none" aria-label="Version warning"></aside>
</div>
<header class="bd-header navbar navbar-expand-lg bd-navbar d-print-none">
</header>
<div class="bd-container">
<div class="bd-container__inner bd-page-width">
<div class="bd-sidebar-primary bd-sidebar">
<div class="sidebar-header-items sidebar-primary__section">
</div>
<div class="sidebar-primary-items__start sidebar-primary__section">
<div class="sidebar-primary-item">
<a class="navbar-brand logo" href="../intro.html">
<img src="../_static/logo.jpg" class="logo__image only-light" alt="MsSpec Tour - Home"/>
<script>document.write(`<img src="../_static/logo.jpg" class="logo__image only-dark" alt="MsSpec Tour - Home"/>`);</script>
</a></div>
<div class="sidebar-primary-item">
<script>
document.write(`
<button class="btn search-button-field search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass"></i>
<span class="search-button__default-text">Search</span>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
</button>
`);
</script></div>
<div class="sidebar-primary-item"><nav class="bd-links bd-docs-nav" aria-label="Main">
<div class="bd-toc-item navbar-nav active">
<ul class="nav bd-sidenav bd-sidenav__home-link">
<li class="toctree-l1">
<a class="reference internal" href="../intro.html">
Welcome to this small MsSpec tour
</a>
</li>
</ul>
<ul class="nav bd-sidenav">
<li class="toctree-l1"><a class="reference internal" href="../Activity01/Activity01.html">Activity 1: Getting started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity02/Activity02.html">Activity 2: Setting up the “experiment”</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity03/Activity03.html">Activity 3: Adsorbates and the single scattering approach</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity04/Activity04.html">Activity 4: From single scattering to multiple scattering</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity05/Activity05.html">Activity 5: Multiple scattering in the forward scattering regime</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity06/Activity06.html">Activity 6: Effect of the temperature</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity07/Activity07.html">Activity 7: Large clusters and path filtering</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity08/Activity08.html">Activity 8: Inequivalent emitters and the XPD of a substrate</a></li>
<li class="toctree-l1"><a class="reference internal" href="Activity09.html">Activity 9: Comparing simulation and experiment with R-factors</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity10/Activity10.html">Activity 10: Parallelization and multi-processing in MsSpec</a></li>
</ul>
</div>
</nav></div>
</div>
<div class="sidebar-primary-items__end sidebar-primary__section">
</div>
<div id="rtd-footer-container"></div>
</div>
<main id="main-content" class="bd-main" role="main">
<div class="sbt-scroll-pixel-helper"></div>
<div class="bd-content">
<div class="bd-article-container">
<div class="bd-header-article d-print-none">
<div class="header-article-items header-article__inner">
<div class="header-article-items__start">
<div class="header-article-item"><button class="sidebar-toggle primary-toggle btn btn-sm" title="Toggle primary sidebar" data-bs-placement="bottom" data-bs-toggle="tooltip">
<span class="fa-solid fa-bars"></span>
</button></div>
</div>
<div class="header-article-items__end">
<div class="header-article-item">
<div class="article-header-buttons">
<div class="dropdown dropdown-download-buttons">
<button class="btn dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Download this page">
<i class="fas fa-download"></i>
</button>
<ul class="dropdown-menu">
<li><a href="../_sources/Activity09/Activity09_light.ipynb" target="_blank"
class="btn btn-sm btn-download-source-button dropdown-item"
title="Download source file"
data-bs-placement="left" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-file"></i>
</span>
<span class="btn__text-container">.ipynb</span>
</a>
</li>
<li>
<button onclick="window.print()"
class="btn btn-sm btn-download-pdf-button dropdown-item"
title="Print to PDF"
data-bs-placement="left" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-file-pdf"></i>
</span>
<span class="btn__text-container">.pdf</span>
</button>
</li>
</ul>
</div>
<button onclick="toggleFullScreen()"
class="btn btn-sm btn-fullscreen-button"
title="Fullscreen mode"
data-bs-placement="bottom" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-expand"></i>
</span>
</button>
<script>
document.write(`
<button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light"></i>
<i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark"></i>
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto"></i>
</button>
`);
</script>
<script>
document.write(`
<button class="btn btn-sm pst-navbar-icon search-button search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass fa-lg"></i>
</button>
`);
</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 id="jb-print-docs-body" class="onlyprint">
<h1>Activity 9: Comparing simulation and experiment with R-factors</h1>
<!-- Table of contents -->
<div id="print-main-content">
<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-unusual-tilt-of-co-molecule-on-fe-001">The unusual tilt of CO molecule on Fe(001)</a></li>
</ul>
</nav>
</div>
</div>
</div>
<div id="searchbox"></div>
<article class="bd-article">
<section class="tex2jax_ignore mathjax_ignore" id="activity-9-comparing-simulation-and-experiment-with-r-factors">
<span id="rfactor"></span><h1>Activity 9: Comparing simulation and experiment with R-factors<a class="headerlink" href="#activity-9-comparing-simulation-and-experiment-with-r-factors" title="Link to this heading">#</a></h1>
<p>In order to extract precise crystallographic information from electronic spectroscopy, we need to compare MsSpec calculations with experimental results and adjust the modelling parameters to simulate the experiment as accurately as possible.</p>
<p><em>R-factors</em> (reliability factors) are commonly used for this task. In the following example, we will see how MsSpec can extract the adsorption geometry of a molecule.</p>
<section id="the-unusual-tilt-of-co-molecule-on-fe-001">
<h2>The unusual tilt of CO molecule on Fe(001)<a class="headerlink" href="#the-unusual-tilt-of-co-molecule-on-fe-001" title="Link to this heading">#</a></h2>
<p>The carbon monoxide molecule can be adsorbed onto a Fe(001) surface in the hollow site. It was experimentally demonstrated that the CO molecule is tilted by 55<span class="math notranslate nohighlight">\(\pm\)</span>2° in &lt;100&gt; azimuthal directions. The molecule is bonded to the Fe surface by the carbon atom and the adsorption height was estimated to be <span class="math notranslate nohighlight">\(\sim\)</span> 0.6 Å.</p>
<div class="admonition seealso" id="cofe-paper">
<p class="admonition-title">See also</p>
<p>based on this paper from R. S. Saiki <em>et al.</em>
<a class="reference external" href="https://doi.org/10.1103/PhysRevLett.63.283">Phys. Rev. Lett. <strong>63(3)</strong> p283-6 (1989)</a></p>
</div>
<p>We will try to reproduce the polar scan of the figure below of CO adsorbed in the hollow site of the Fe(001) surface with simple single scattering calculations with MsSpec and by using R-Factors to find the best adsorption geometry. We will use the simple cluster displayed on the left hand side of the figure.</p>
<figure class="align-default" id="cofe-fig1">
<a class="reference internal image-reference" href="../_images/COFe_fig1.jpg"><img alt="" class="align-center" src="../_images/COFe_fig1.jpg" style="width: 600px;" />
</a>
<figcaption>
<p><span class="caption-text">Small cluster used for SSC calculations (left) and (right) Normalized polar scan of the C(1s) at 1202 eV for [100] and [1-10] azimths.</span><a class="headerlink" href="#cofe-fig1" title="Link to this image">#</a></p>
</figcaption>
</figure>
<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>Download <a class="reference download internal" download="" href="../_downloads/179b010d01a3689041dba01413ac667b/COFe.py"><span class="xref download myst">this script</span></a> and write the body of the function <code class="docutils literal notranslate"><span class="pre">create_cluster</span></code>. The function should return a
small cluster of 5 Fe atoms with the CO molecule adsorbed like in figure <code class="xref std std-numref docutils literal notranslate"><span class="pre">Fig.</span> <span class="pre">%s</span></code> below. The function
will accept 4 keyword arguments to control the adsorption geometry.</p>
<figure class="align-default" id="cofe-fig2">
<a class="reference internal image-reference" href="../_images/COFe_fig2.jpg"><img alt="CO-Fe adsorption geometry" class="align-center" src="../_images/COFe_fig2.jpg" style="width: 600px;" />
</a>
<figcaption>
<p><span class="caption-text">Adsorption geometry of carbon monoxide on Fe(001).</span><a class="headerlink" href="#cofe-fig2" title="Link to this image">#</a></p>
</figcaption>
</figure>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Remember to use the <a class="reference external" href="https://wiki.fysik.dtu.dk/ase/ase/build/build.html#ase.build.bulk"><code class="docutils literal notranslate"><span class="pre">ase.build.bulk</span></code></a>, the <a class="reference external" href="https://msspec.cnrs.fr/faq/hemispherical_cluster/hemispherical_cluster.html#hemispherical-cluster-faq"><code class="docutils literal notranslate"><span class="pre">msspec.utils.hemispherical_cluster</span></code></a> and the <a class="reference external" href="https://wiki.fysik.dtu.dk/ase/ase/build/surface.html#ase.build.add_adsorbate"><code class="docutils literal notranslate"><span class="pre">ase.build.add_adsorbate</span></code></a>
functions.</p>
</div>
</div>
</div>
<p>Now that the <code class="docutils literal notranslate"><span class="pre">create_cluster</span></code> function is done, look at the rest of the script. The next function is called <code class="docutils literal notranslate"><span class="pre">compute_polar_scan</span></code> and will obviously be used to compute the <span class="math notranslate nohighlight">\(\theta\)</span>-scan of the C1s for a given cluster geometry.
Finally there is the <em>Main part</em> that is built in two sections:</p>
<ol class="arabic simple">
<li><p>A section containing nested <em>for loops</em></p></li>
<li><p>A final section for <em>R-Factor analysis</em></p></li>
</ol>
<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">
<ol class="arabic simple">
<li><p>Complete the nested for loops in section 1) in order to compute polar scans for CO molecule tilted from 45° to 60° with a 1° step and aligned either along the [100] direction of Fe, 30° from this direction or along [110]. The adsorption height is 0.6 Å and the bond length is 1.157 Å.</p></li>
<li><p>What is the best <span class="math notranslate nohighlight">\((\theta, \phi)\)</span> according to the R-Factor analysis</p></li>
</ol>
</div>
</div>
<p>MsSpec uses 12 different R-Factors formula to compare the calculted curve to the experimental data. The set of parameters giving the best agreement according to the majority of those 12 R-factors is assumed to be the best solution. Here are the R-factors formula used in MsSpec</p>
<figure class="align-default" id="rfactors-formula">
<a class="reference internal image-reference" href="../_images/formula.jpg"><img alt="R-Factor result" class="align-center" src="../_images/formula.jpg" style="width: 800px;" />
</a>
<figcaption>
<p><span class="caption-text">The 12 R-Factors used in MsSpec. The Pendrys R-Factor is n°11.</span><a class="headerlink" href="#rfactors-formula" title="Link to this image">#</a></p>
</figcaption>
</figure>
<div class="sd-tab-set docutils">
<input checked="checked" id="sd-tab-item-2" name="sd-tab-set-2" type="radio">
<label class="sd-tab-label" for="sd-tab-item-2">
<i class="fa-solid fa-circle-question"></i> Quiz</label><div class="sd-tab-content docutils">
<p>How many R-Factors do agree that <span class="math notranslate nohighlight">\((\theta,\phi)=(55,0)\)</span> gives the best agreement ?</p>
</div>
</div>
</section>
</section>
<script type="text/x-thebe-config">
{
requestKernel: true,
binderOptions: {
repo: "binder-examples/jupyter-stacks-datascience",
ref: "master",
},
codeMirrorConfig: {
theme: "abcdef",
mode: "python"
},
kernelOptions: {
name: "python3",
path: "./Activity09"
},
predefinedOutput: true
}
</script>
<script>kernelName = 'python3'</script>
</article>
<footer class="prev-next-footer d-print-none">
<div class="prev-next-area">
</div>
</footer>
</div>
<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-unusual-tilt-of-co-molecule-on-fe-001">The unusual tilt of CO molecule on Fe(001)</a></li>
</ul>
</nav></div>
</div></div>
</div>
<footer class="bd-footer-content">
<div class="bd-footer-content__inner container">
<div class="footer-item">
<p class="component-author">
By Sylvain Tricot
</p>
</div>
<div class="footer-item">
<p class="copyright">
© Copyright 2023.
<br/>
</p>
</div>
<div class="footer-item">
</div>
<div class="footer-item">
</div>
</div>
</footer>
</main>
</div>
</div>
<!-- Scripts loaded after <body> so the DOM is not blocked -->
<script src="../_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b"></script>
<script src="../_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b"></script>
<footer class="bd-footer">
</footer>
</body>
</html>

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/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />
@ -405,9 +405,11 @@ can be changed).</p>
<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>In the paper discussed in <a class="reference internal" href="../Activity09/Activity09.html#rfactor"><span class="std std-ref">Activity 9: Comparing simulation and experiment with R-factors</span></a>, experimental values of the anisotropy suggest an adsorption height between 0.2 and 0.6 Å. Modify the script to add another sweep for variying the adsorption height of the CO molecule.</p>
<p>In the paper discussed in <a class="reference internal" href="../Activity09/Activity09_light.html#rfactor"><span class="std std-ref">Activity 9: Comparing simulation and experiment with R-factors</span></a>, experimental values of the anisotropy suggest an adsorption height between 0.2 and 0.6 Å. Modify the script to add another sweep for variying the adsorption height of the CO molecule.</p>
</div>
</div>
<div class="dropdown admonition">
<p class="admonition-title"><em>Solution…</em></p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="linenos">63</span><span class="c1"># 1) Multiprocess calculations </span>
<span class="linenos">64</span><span class="n">theta</span> <span class="o">=</span> <span class="n">Sweep</span><span class="p">(</span><span class="n">key</span><span class="o">=</span><span class="s1">&#39;theta&#39;</span><span class="p">,</span> <span class="n">comments</span><span class="o">=</span><span class="s2">&quot;The molecule tilt angle&quot;</span><span class="p">,</span>
<span class="linenos">65</span> <span class="n">start</span><span class="o">=</span><span class="mi">50</span><span class="p">,</span> <span class="n">stop</span><span class="o">=</span><span class="mi">60</span><span class="p">,</span> <span class="n">step</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit</span><span class="o">=</span><span class="s1">&#39;degree&#39;</span><span class="p">)</span>
@ -434,21 +436,6 @@ can be changed).</p>
<span class="linenos">86</span><span class="n">results</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="n">parameters</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s1">&#39;output&#39;</span><span class="p">),</span> <span class="p">(</span><span class="n">df</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">*</span><span class="mi">2</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
</pre></div>
</div>
<div class="cell tag_answer tag_hide docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">IPython.display</span><span class="w"> </span><span class="kn">import</span> <span class="n">Markdown</span>
<span class="n">Markdown</span><span class="p">(</span><span class="s2">&quot;&quot;&quot;</span>
<span class="s2">Hello world</span>
<span class="s2">&quot;&quot;&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<p>Hello world</p>
</div>
</div>
</section>
</section>

View File

@ -0,0 +1,517 @@
<!DOCTYPE html>
<html lang="en" data-content_root="../" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Activity 10: Parallelization and multi-processing in MsSpec &#8212; MsSpec Tour</title>
<script data-cfasync="false">
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "";
</script>
<!-- Loaded before other Sphinx assets -->
<link href="../_static/styles/theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/styles/bootstrap.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/styles/pydata-sphinx-theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/vendor/fontawesome/6.5.2/css/all.min.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-solid-900.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-brands-400.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-regular-400.woff2" />
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=03e43079" />
<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/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />
<!-- Pre-loaded scripts that we'll load fully later -->
<link rel="preload" as="script" href="../_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b" />
<link rel="preload" as="script" href="../_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b" />
<script src="../_static/vendor/fontawesome/6.5.2/js/all.min.js?digest=dfe6caa3a7d634c4db9b"></script>
<script src="../_static/documentation_options.js?v=9eb32ce0"></script>
<script src="../_static/doctools.js?v=9a2dae69"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../_static/copybutton.js?v=f281be69"></script>
<script src="../_static/scripts/sphinx-book-theme.js?v=887ef09a"></script>
<script>let toggleHintShow = 'Click to show';</script>
<script>let toggleHintHide = 'Click to hide';</script>
<script>let toggleOpenOnPrint = 'true';</script>
<script src="../_static/togglebutton.js?v=4a39c7ea"></script>
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
<script src="../_static/design-tabs.js?v=f930bc37"></script>
<script>const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"; const thebe_selector = ".thebe,.cell"; const thebe_selector_input = "pre"; const thebe_selector_output = ".output, .cell_output"</script>
<script async="async" src="../_static/sphinx-thebe.js?v=c100c467"></script>
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
<script>const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"; const thebe_selector = ".thebe,.cell"; const thebe_selector_input = "pre"; const thebe_selector_output = ".output, .cell_output"</script>
<script>DOCUMENTATION_OPTIONS.pagename = 'Activity10/Activity10_light';</script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="docsearch:language" content="en"/>
</head>
<body data-bs-spy="scroll" data-bs-target=".bd-toc-nav" data-offset="180" data-bs-root-margin="0px 0px -60%" data-default-mode="">
<div id="pst-skip-link" class="skip-link d-print-none"><a href="#main-content">Skip to main content</a></div>
<div id="pst-scroll-pixel-helper"></div>
<button type="button" class="btn rounded-pill" id="pst-back-to-top">
<i class="fa-solid fa-arrow-up"></i>Back to top</button>
<input type="checkbox"
class="sidebar-toggle"
id="pst-primary-sidebar-checkbox"/>
<label class="overlay overlay-primary" for="pst-primary-sidebar-checkbox"></label>
<input type="checkbox"
class="sidebar-toggle"
id="pst-secondary-sidebar-checkbox"/>
<label class="overlay overlay-secondary" for="pst-secondary-sidebar-checkbox"></label>
<div class="search-button__wrapper">
<div class="search-button__overlay"></div>
<div class="search-button__search-container">
<form class="bd-search d-flex align-items-center"
action="../search.html"
method="get">
<i class="fa-solid fa-magnifying-glass"></i>
<input type="search"
class="form-control"
name="q"
id="search-input"
placeholder="Search this book..."
aria-label="Search this book..."
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"/>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span>
</form></div>
</div>
<div class="pst-async-banner-revealer d-none">
<aside id="bd-header-version-warning" class="d-none d-print-none" aria-label="Version warning"></aside>
</div>
<header class="bd-header navbar navbar-expand-lg bd-navbar d-print-none">
</header>
<div class="bd-container">
<div class="bd-container__inner bd-page-width">
<div class="bd-sidebar-primary bd-sidebar">
<div class="sidebar-header-items sidebar-primary__section">
</div>
<div class="sidebar-primary-items__start sidebar-primary__section">
<div class="sidebar-primary-item">
<a class="navbar-brand logo" href="../intro.html">
<img src="../_static/logo.jpg" class="logo__image only-light" alt="MsSpec Tour - Home"/>
<script>document.write(`<img src="../_static/logo.jpg" class="logo__image only-dark" alt="MsSpec Tour - Home"/>`);</script>
</a></div>
<div class="sidebar-primary-item">
<script>
document.write(`
<button class="btn search-button-field search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass"></i>
<span class="search-button__default-text">Search</span>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
</button>
`);
</script></div>
<div class="sidebar-primary-item"><nav class="bd-links bd-docs-nav" aria-label="Main">
<div class="bd-toc-item navbar-nav active">
<ul class="nav bd-sidenav bd-sidenav__home-link">
<li class="toctree-l1">
<a class="reference internal" href="../intro.html">
Welcome to this small MsSpec tour
</a>
</li>
</ul>
<ul class="nav bd-sidenav">
<li class="toctree-l1"><a class="reference internal" href="../Activity01/Activity01.html">Activity 1: Getting started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity02/Activity02.html">Activity 2: Setting up the “experiment”</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity03/Activity03.html">Activity 3: Adsorbates and the single scattering approach</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity04/Activity04.html">Activity 4: From single scattering to multiple scattering</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity05/Activity05.html">Activity 5: Multiple scattering in the forward scattering regime</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity06/Activity06.html">Activity 6: Effect of the temperature</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity07/Activity07.html">Activity 7: Large clusters and path filtering</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity08/Activity08.html">Activity 8: Inequivalent emitters and the XPD of a substrate</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Activity09/Activity09.html">Activity 9: Comparing simulation and experiment with R-factors</a></li>
<li class="toctree-l1"><a class="reference internal" href="Activity10.html">Activity 10: Parallelization and multi-processing in MsSpec</a></li>
</ul>
</div>
</nav></div>
</div>
<div class="sidebar-primary-items__end sidebar-primary__section">
</div>
<div id="rtd-footer-container"></div>
</div>
<main id="main-content" class="bd-main" role="main">
<div class="sbt-scroll-pixel-helper"></div>
<div class="bd-content">
<div class="bd-article-container">
<div class="bd-header-article d-print-none">
<div class="header-article-items header-article__inner">
<div class="header-article-items__start">
<div class="header-article-item"><button class="sidebar-toggle primary-toggle btn btn-sm" title="Toggle primary sidebar" data-bs-placement="bottom" data-bs-toggle="tooltip">
<span class="fa-solid fa-bars"></span>
</button></div>
</div>
<div class="header-article-items__end">
<div class="header-article-item">
<div class="article-header-buttons">
<div class="dropdown dropdown-download-buttons">
<button class="btn dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Download this page">
<i class="fas fa-download"></i>
</button>
<ul class="dropdown-menu">
<li><a href="../_sources/Activity10/Activity10_light.ipynb" target="_blank"
class="btn btn-sm btn-download-source-button dropdown-item"
title="Download source file"
data-bs-placement="left" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-file"></i>
</span>
<span class="btn__text-container">.ipynb</span>
</a>
</li>
<li>
<button onclick="window.print()"
class="btn btn-sm btn-download-pdf-button dropdown-item"
title="Print to PDF"
data-bs-placement="left" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-file-pdf"></i>
</span>
<span class="btn__text-container">.pdf</span>
</button>
</li>
</ul>
</div>
<button onclick="toggleFullScreen()"
class="btn btn-sm btn-fullscreen-button"
title="Fullscreen mode"
data-bs-placement="bottom" data-bs-toggle="tooltip"
>
<span class="btn__icon-container">
<i class="fas fa-expand"></i>
</span>
</button>
<script>
document.write(`
<button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light"></i>
<i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark"></i>
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto"></i>
</button>
`);
</script>
<script>
document.write(`
<button class="btn btn-sm pst-navbar-icon search-button search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass fa-lg"></i>
</button>
`);
</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 id="jb-print-docs-body" class="onlyprint">
<h1>Activity 10: Parallelization and multi-processing in MsSpec</h1>
<!-- Table of contents -->
<div id="print-main-content">
<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="#matrix-inversion-parallelization">Matrix inversion parallelization</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#process-based-parallelism">Process-based parallelism</a></li>
</ul>
</nav>
</div>
</div>
</div>
<div id="searchbox"></div>
<article class="bd-article">
<section class="tex2jax_ignore mathjax_ignore" id="activity-10-parallelization-and-multi-processing-in-msspec">
<h1>Activity 10: Parallelization and multi-processing in MsSpec<a class="headerlink" href="#activity-10-parallelization-and-multi-processing-in-msspec" title="Link to this heading">#</a></h1>
<p>As you can see from the previous examples, a complete simulation may require several multiple scattering calculations, for instance to calculate the total intensity of a substrate or to optimize the geometry of a system. As the calculations are often time consuming, it can be useful to distribute these tasks over several processors to make the most of hardware resources.
Although MsSpec is not fully parallelized, the code does offer a number of features, which we will explore here.</p>
<section id="matrix-inversion-parallelization">
<h2>Matrix inversion parallelization<a class="headerlink" href="#matrix-inversion-parallelization" title="Link to this heading">#</a></h2>
<p>When available during installation, MsSpec will link with the system lapack library. It will be used to invert the matrix in the <code class="docutils literal notranslate"><span class="pre">inversion</span></code> option of the MsSpec <code class="docutils literal notranslate"><span class="pre">calculator</span></code>. To allow MsSpec to use this shared memory parallelism, you need to set the number of cores to be used in the <code class="docutils literal notranslate"><span class="pre">OMP_NUM_THREADS</span></code> environment variable.</p>
<p>You can set this variable just for the execution of your script. For example:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span><span class="nv">OMP_NUM_THREADS</span><span class="o">=</span><span class="m">12</span><span class="w"> </span>python<span class="w"> </span>my_script.py
</pre></div>
</div>
<p>will use 12 cores for inverting the matrix in your script.</p>
<p>It is also possible to set environment variable inside your python script.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span><span class="w"> </span><span class="nn">os</span>
<span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s1">&#39;OMP_NUM_THREADS&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">12</span>
</pre></div>
</div>
<p>It may be useful for technical reasons or to use different number of cores in some parts of your script.</p>
</section>
<section id="process-based-parallelism">
<h2>Process-based parallelism<a class="headerlink" href="#process-based-parallelism" title="Link to this heading">#</a></h2>
<p>Another kind of parallelization used in MsSpec is multiprocessing. Quite often, you need to run different <em>independent</em> calculations. MsSpec provides a simple <em>looper</em> that can be useful for multiprocessing. Lets demonstrate it with the previous example CO/Fe(001).</p>
<p><a class="reference download internal" download="" href="../_downloads/cd5e8362249e8155dffd698f9d924327/COFe_mp.py"><span class="xref download myst">This script</span></a> is the multiprocessed version of the previous one. You can see that the previous nested for loops are now replaced by some declarative content (lines 63-67) and the definition of a <code class="docutils literal notranslate"><span class="pre">process</span></code> function (whose name
can be changed).</p>
<p>With the <code class="docutils literal notranslate"><span class="pre">msspec.looper</span></code> package, the user define <code class="docutils literal notranslate"><span class="pre">Sweep</span></code> objects that are parameters of the calculation or of the cluster. The <code class="docutils literal notranslate"><span class="pre">process</span></code> function must accept as many arguments as parameters to sweep (+ the <code class="docutils literal notranslate"><span class="pre">**kwargs</span></code>).</p>
<p>A <code class="docutils literal notranslate"><span class="pre">Looper</span></code> object is created (line 76) and the <code class="docutils literal notranslate"><span class="pre">process</span></code> function is set to its <code class="docutils literal notranslate"><span class="pre">pipeline</span></code> attribute (line 77). When MsSpec will run the <code class="docutils literal notranslate"><span class="pre">looper</span></code>, it will combine all parameters values to unique individual sets and MsSpec will distribute the calculations over the number of processors specified in the <code class="docutils literal notranslate"><span class="pre">ncpu</span></code> option.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="linenos">63</span><span class="c1"># 1) Multiprocess calculations </span>
<span class="linenos">64</span><span class="n">theta</span> <span class="o">=</span> <span class="n">Sweep</span><span class="p">(</span><span class="n">key</span><span class="o">=</span><span class="s1">&#39;theta&#39;</span><span class="p">,</span> <span class="n">comments</span><span class="o">=</span><span class="s2">&quot;The molecule tilt angle&quot;</span><span class="p">,</span>
<span class="linenos">65</span> <span class="n">start</span><span class="o">=</span><span class="mi">50</span><span class="p">,</span> <span class="n">stop</span><span class="o">=</span><span class="mi">60</span><span class="p">,</span> <span class="n">step</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit</span><span class="o">=</span><span class="s1">&#39;degree&#39;</span><span class="p">)</span>
<span class="linenos">66</span><span class="n">phi</span> <span class="o">=</span> <span class="n">Sweep</span><span class="p">(</span><span class="n">key</span><span class="o">=</span><span class="s1">&#39;phi&#39;</span><span class="p">,</span> <span class="n">comments</span><span class="o">=</span><span class="s2">&quot;The molecule azimuthal angle&quot;</span><span class="p">,</span>
<span class="linenos">67</span> <span class="n">values</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">45</span><span class="p">],</span> <span class="n">unit</span><span class="o">=</span><span class="s1">&#39;degree&#39;</span><span class="p">)</span>
<span class="linenos">68</span>
<span class="linenos">69</span><span class="k">def</span><span class="w"> </span><span class="nf">process</span><span class="p">(</span><span class="n">theta</span><span class="p">,</span> <span class="n">phi</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="linenos">70</span> <span class="n">cluster</span> <span class="o">=</span> <span class="n">create_cluster</span><span class="p">(</span><span class="n">theta</span><span class="o">=</span><span class="n">theta</span><span class="p">,</span> <span class="n">phi</span><span class="o">=</span><span class="n">phi</span><span class="p">,</span> <span class="n">height</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span> <span class="n">bond_length</span><span class="o">=</span><span class="mf">1.157</span><span class="p">)</span>
<span class="linenos">71</span> <span class="n">i</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;sweep_index&#39;</span><span class="p">)</span>
<span class="linenos">72</span> <span class="n">data</span> <span class="o">=</span> <span class="n">compute_polar_scan</span><span class="p">(</span><span class="n">cluster</span><span class="p">,</span> <span class="n">folder</span><span class="o">=</span><span class="sa">f</span><span class="s1">&#39;calc_</span><span class="si">{</span><span class="n">i</span><span class="si">:</span><span class="s1">d</span><span class="si">}</span><span class="s1">&#39;</span><span class="p">)</span>
<span class="linenos">73</span> <span class="n">dset</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
<span class="linenos">74</span> <span class="k">return</span> <span class="n">dset</span><span class="o">.</span><span class="n">theta</span><span class="p">,</span> <span class="n">dset</span><span class="o">.</span><span class="n">cross_section</span>
<span class="linenos">75</span>
<span class="linenos">76</span><span class="n">looper</span> <span class="o">=</span> <span class="n">Looper</span><span class="p">()</span>
<span class="linenos">77</span><span class="n">looper</span><span class="o">.</span><span class="n">pipeline</span> <span class="o">=</span> <span class="n">process</span>
<span class="linenos">78</span><span class="n">df</span> <span class="o">=</span> <span class="n">looper</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">theta</span><span class="p">,</span> <span class="n">phi</span><span class="p">,</span> <span class="n">ncpu</span><span class="o">=</span><span class="mi">4</span><span class="p">)</span>
<span class="linenos">79</span>
<span class="linenos">80</span><span class="c1"># Black magic to convert the pandas dataframe object &#39;df&#39; to the </span>
<span class="linenos">81</span><span class="c1"># parameters dict and the resulst list (will be easier in a future</span>
<span class="linenos">82</span><span class="c1"># version ;-) ).</span>
<span class="linenos">83</span><span class="n">parameters</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">to_dict</span><span class="p">(</span><span class="s1">&#39;list&#39;</span><span class="p">)</span>
<span class="linenos">84</span><span class="n">results</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="n">parameters</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s1">&#39;output&#39;</span><span class="p">),</span> <span class="p">(</span><span class="n">df</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">*</span><span class="mi">2</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
</pre></div>
</div>
<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>In the paper discussed in <a class="reference internal" href="../Activity09/Activity09_light.html#rfactor"><span class="std std-ref">Activity 9: Comparing simulation and experiment with R-factors</span></a>, experimental values of the anisotropy suggest an adsorption height between 0.2 and 0.6 Å. Modify the script to add another sweep for variying the adsorption height of the CO molecule.</p>
</div>
</div>
</section>
</section>
<script type="text/x-thebe-config">
{
requestKernel: true,
binderOptions: {
repo: "binder-examples/jupyter-stacks-datascience",
ref: "master",
},
codeMirrorConfig: {
theme: "abcdef",
mode: "python"
},
kernelOptions: {
name: "python3",
path: "./Activity10"
},
predefinedOutput: true
}
</script>
<script>kernelName = 'python3'</script>
</article>
<footer class="prev-next-footer d-print-none">
<div class="prev-next-area">
</div>
</footer>
</div>
<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="#matrix-inversion-parallelization">Matrix inversion parallelization</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#process-based-parallelism">Process-based parallelism</a></li>
</ul>
</nav></div>
</div></div>
</div>
<footer class="bd-footer-content">
<div class="bd-footer-content__inner container">
<div class="footer-item">
<p class="component-author">
By Sylvain Tricot
</p>
</div>
<div class="footer-item">
<p class="copyright">
© Copyright 2023.
<br/>
</p>
</div>
<div class="footer-item">
</div>
<div class="footer-item">
</div>
</div>
</footer>
</main>
</div>
</div>
<!-- Scripts loaded after <body> so the DOM is not blocked -->
<script src="../_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b"></script>
<script src="../_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b"></script>
<footer class="bd-footer">
</footer>
</body>
</html>

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/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />

View File

@ -0,0 +1,55 @@
from ase.build import bulk
from ase.visualize import view
from msspec.calculator import MSSPEC
from msspec.utils import hemispherical_cluster, get_atom_index, cut_plane
import numpy as np
from matplotlib import pyplot as plt
# Create the silver cell
Ag = bulk('Ag', cubic=True)
# Orientate the cell in the [111] direction
Ag.rotate((1,1,1), (0,0,1), rotate_cell=True)
# Align the azimuth to match experimental reference
Ag.rotate(15, 'z', rotate_cell=True)
# Create a cluster
cluster = hemispherical_cluster(Ag, diameter=20, emitter_plane=0)
cluster = cut_plane(cluster, z=-4.8)
cluster.emitter = get_atom_index(cluster, 0,0,0)
cluster[cluster.emitter].symbol = 'Sb'
# Create a calculator
calc = MSSPEC(spectroscopy='PED', algorithm='inversion')
calc.set_atoms(cluster)
# Define parameters
calc.source_parameters.theta = 0
calc.source_parameters.phi = 0
calc.detector_parameters.angular_acceptance = 1
calc.detector_parameters.average_sampling = 'low'
calc.muffintin_parameters.interstitial_potential = 0
# Compute an azimuthal scan
data = calc.get_phi_scan(level='4d', theta=40, phi=np.linspace(0,240,121), kinetic_energy=45)
# Normalize data between [0,1] (to ease comparison with experimental data)
dset = data[0]
dset.cross_section -= dset.cross_section.min()
dset.cross_section /= dset.cross_section.max()
# Add experimental data points in the dataset
x, y = np.loadtxt('data.txt').T
dset.add_columns(experiment=y)
# Add points to view
view = dset.views[0]
view.select('phi', 'experiment', legend='Exp. data')
# Popup GUI
data.view()
# Remove temp. files
calc.shutdown()

View File

@ -0,0 +1,126 @@
from ase.build import bulk
import numpy as np
from msspec.calculator import MSSPEC, XRaySource
from msspec.utils import hemispherical_cluster, get_atom_index
def create_clusters(nplanes=3):
copper = bulk('Cu', a=3.6, cubic=True)
clusters = []
for emitter_plane in range(nplanes):
cluster = hemispherical_cluster(copper,
emitter_plane=emitter_plane,
planes=emitter_plane+1,
diameter=27,
shape='cylindrical')
cluster.absorber = get_atom_index(cluster, 0, 0, 0)
# This is how to store extra information with your cluster
cluster.info.update({
'emitter_plane': emitter_plane,
})
clusters.append(cluster)
return clusters
def compute(clusters, all_theta=[45., 83.],
all_T=np.arange(300., 1000., 400.)):
data = None
for cluster in clusters:
# Retrieve emitter's plane from cluster object
plane = cluster.info['emitter_plane']
calc = MSSPEC(spectroscopy='PED', algorithm='expansion')
calc.source_parameters.energy = XRaySource.AL_KALPHA
calc.muffintin_parameters.interstitial_potential = 14.1
# In simple scattering, it is common practice to use a real potential and
# manually define a mean free path arbitrarily lower than the actual physical
# value in an attempt to reproduce multiple scattering effects.
calc.tmatrix_parameters.exchange_correlation = 'x_alpha_real'
calc.calculation_parameters.mean_free_path = ... # -> half of the mean free
# path (see p6785)
# Parameters for temperature effects
calc.calculation_parameters.vibrational_damping = 'averaged_tl'
calc.calculation_parameters.use_debye_model = ..... # Use the MsSpec help
calc.calculation_parameters.debye_temperature = ... # and p6791 of the paper
calc.calculation_parameters.vibration_scaling = ... # -> How much more do
# surface atoms vibrate
# than bulk atoms?
calc.detector_parameters.average_sampling = 'low'
calc.detector_parameters.angular_acceptance = 5.7
calc.calculation_parameters.scattering_order = 1
for T in all_T:
# Define the sample temperature
calc.calculation_parameters.temperature = T
# Set the atoms and compute an azimuthal scan
calc.set_atoms(cluster)
data = calc.get_phi_scan(level='2p', theta=all_theta,
phi=np.linspace(0, 100, 51),
kinetic_energy=560, data=data)
# Small changes to add some details in both the title of the dataset
# and the figure
view = data[-1].views[-1]
t = view._plotopts['title'] + f" (plane #{plane:d}, T={T:.0f} K)"
data[-1].title = t
view.set_plot_options(autoscale=True, title=t)
calc.shutdown()
return data
def analysis(data, all_theta, all_T, nplanes):
# Sum cross_section for all emitter's plane at a given T
# Compute the anisotropy
results = dict.fromkeys(all_T, [])
anisotropy = []
for dset in data:
# Retrieve temperature
T = float(dset.get_parameter('CalculationParameters', 'temperature')['value'])
# Update the sum in results
if len(results[T]) == 0:
results[T] = dset.cross_section
else:
results[T] += dset.cross_section
anisotropy_dset = data.add_dset("Anisotropies")
anisotropy_dset.add_columns(temperature=all_T)
for theta in all_theta:
col_name = f"theta{theta:.0f}"
col_values = []
i = np.where(dset.theta == theta)[0]
for T in all_T:
cs = results[T][i]
Imax = np.max(cs)
Imin = np.min(cs)
A = (Imax - Imin)/Imax
col_values.append(A)
anisotropy_dset.add_columns(**{col_name:col_values/np.max(col_values)})
anisotropy_view = anisotropy_dset.add_view('Anisotropies',
title='Relative anisotropies for Cu(2p)',
marker='o',
xlabel='T (K)',
ylabel=r'$\frac{\Delta I / I_{max}(T)}{\Delta I_{300}'
r'/ I_{max}(300)} (\%)$',
autoscale=True)
for theta in all_theta:
col_name = f"theta{theta:.0f}"
anisotropy_view.select('temperature', col_name,
legend=r'$\theta = {:.0f} \degree$'.format(theta))
return data
if __name__ == "__main__":
nplanes = 4
all_theta = np.array([45, 83])
all_theta = np.array([300., 1000.])
clusters = create_clusters(nplanes=nplanes)
data = compute(clusters, all_T=all_T, all_theta=all_theta)
data = analysis(data, all_T=all_T, all_theta=all_theta, nplanes=nplanes)
data.view()

View File

@ -0,0 +1,51 @@
data_image0
_chemical_formula_structural Cu26
_chemical_formula_sum "Cu26"
_cell_length_a 14.4
_cell_length_b 14.4
_cell_length_c 7.2
_cell_angle_alpha 90.0
_cell_angle_beta 90.0
_cell_angle_gamma 90.0
_space_group_name_H-M_alt "P 1"
_space_group_IT_number 1
loop_
_space_group_symop_operation_xyz
'x, y, z'
loop_
_atom_site_type_symbol
_atom_site_label
_atom_site_symmetry_multiplicity
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
_atom_site_occupancy
Cu Cu1 1.0 0.25 0.5 0.37500000000000017 1.0000
Cu Cu2 1.0 0.25 0.5 0.8750000000000001 1.0000
Cu Cu3 1.0 0.3750000000000001 0.37500000000000017 0.37500000000000017 1.0000
Cu Cu4 1.0 0.5 0.24999999999999992 0.37500000000000017 1.0000
Cu Cu5 1.0 0.5 0.37500000000000017 0.12499999999999996 1.0000
Cu Cu6 1.0 0.3750000000000001 0.37500000000000017 0.8750000000000001 1.0000
Cu Cu7 1.0 0.5 0.24999999999999992 0.8750000000000001 1.0000
Cu Cu8 1.0 0.5 0.37500000000000017 0.625 1.0000
Cu Cu9 1.0 0.3750000000000001 0.5 0.12499999999999996 1.0000
Cu Cu10 1.0 0.3750000000000001 0.6249999999999999 0.37500000000000017 1.0000
Cu Cu11 1.0 0.5 0.5 0.37500000000000017 1.0000
Cu Cu12 1.0 0.5 0.6249999999999999 0.12499999999999996 1.0000
Cu Cu13 1.0 0.3750000000000001 0.5 0.625 1.0000
Cu Cu14 1.0 0.3750000000000001 0.6249999999999999 0.8750000000000001 1.0000
Cu Cu15 1.0 0.5 0.5 0.8750000000000001 1.0000
Cu Cu16 1.0 0.5 0.6249999999999999 0.625 1.0000
Cu Cu17 1.0 0.5 0.7500000000000003 0.37500000000000017 1.0000
Cu Cu18 1.0 0.5 0.7500000000000003 0.8750000000000001 1.0000
Cu Cu19 1.0 0.6249999999999999 0.37500000000000017 0.37500000000000017 1.0000
Cu Cu20 1.0 0.6249999999999999 0.37500000000000017 0.8750000000000001 1.0000
Cu Cu21 1.0 0.6249999999999999 0.5 0.12499999999999996 1.0000
Cu Cu22 1.0 0.6249999999999999 0.6249999999999999 0.37500000000000017 1.0000
Cu Cu23 1.0 0.7500000000000003 0.5 0.37500000000000017 1.0000
Cu Cu24 1.0 0.6249999999999999 0.5 0.625 1.0000
Cu Cu25 1.0 0.6249999999999999 0.6249999999999999 0.8750000000000001 1.0000
Cu Cu26 1.0 0.7500000000000003 0.5 0.8750000000000001 1.0000

View File

@ -0,0 +1,23 @@
from msspec.calculator import MSSPEC
from ase.build import fcc111, add_adsorbate
import numpy as np
data = None
all_z = ... # -> Define a list of z values for the adsorbate
for ... # -> Complete this for-loop over z values
# construct the cluster
cluster = fcc111('Rh', size = (2,2,1))
cluster.pop(3)
add_adsorbate(... # -> Put the oxygen atom on the fcc site
cluster.emitter = ... # -> Oxygen is the last atom we added, so the indice is...
# Define a calculator for single scattering calculations
calc = MSSPEC(spectroscopy='PED', algorithm='expansion')
calc.calculation_parameters.scattering_order = 1
calc.set_atoms(cluster)
# Compute
data = calc.get_theta_phi_scan(level='1s', kinetic_energy=723, data=data)
data.view()

View File

@ -0,0 +1,40 @@
from ase.build import mx2
from ase.visualize import view
from msspec.calculator import MSSPEC
from msspec.utils import hemispherical_cluster, get_atom_index
# Some usefull constants (a, c, d, D) for defining the structure
a=...
# Create the TiSe2 trilayer
# use ase help for this function
TiSe2 = mx2(formula=...)
# The preious cell is 2D, let's define the c-axis to take into account
# the Van der Waals gap between trilayers
TiSe2.cell[2] = [0, 0, ...]
# To be aligned like in the paper
TiSe2.rotate(60, 'z', rotate_cell=True)
# Since the material is multi-elements, "tag" each inequivalent atom
# of the unit cell with a number. The "Ti" atom is tagged 0 and "Se"
# atoms are 1 and 2.
for i in range(3):
TiSe2[i].tag = i
cluster = hemispherical_cluster(TiSe2, emitter_tag=..., emitter_plane=..., planes=5)
cluster.emitter = get_atom_index(cluster, 0, 0, 0)
view(cluster)
# Create a calculator with Rehr-Albers series expansion algorithm
calc = MSSPEC(spectroscopy='PED', algorithm='expansion')
calc.set_atoms(cluster)
data = None
for ndif in range(1,4):
calc.calculation_parameters.scattering_order = ndif
data = calc.get_theta_phi_scan(level='2p', kinetic_energy=1030, data=data)
data.view()

View File

@ -0,0 +1,24 @@
from ase.io import read
from msspec.calculator import MSSPEC
cluster = read('copper.cif')
# view the cluster
cluster.edit()
# The "emitter" atom is located in the middle of the 3rd plane
cluster.emitter = 10
# Create a "calculator"
calc = MSSPEC(spectroscopy='PED', algorithm='inversion')
calc.set_atoms(cluster)
data = calc.get_theta_scan(level='2p3/2')
# Plot the result with the interactive GUI
data.view()
# Or plot using matplotlib directly
from matplotlib import pyplot as plt
data[0].views[0].plot()
plt.show()

View File

@ -0,0 +1,121 @@
0.000000000000000000e+00 2.273853352828327234e-01
2.000000000000000000e+00 2.135876322898652424e-01
4.000000000000000000e+00 1.925265592281927285e-01
6.000000000000000000e+00 1.852631891594877511e-01
8.000000000000000000e+00 1.852631891594877511e-01
1.000000000000000000e+01 1.831705825411805155e-01
1.200000000000000000e+01 1.636929472985219347e-01
1.400000000000000000e+01 1.279608696063064543e-01
1.600000000000000000e+01 1.040430509934481690e-01
1.800000000000000000e+01 3.015378633541379930e-02
2.000000000000000000e+01 4.106459224097607462e-03
2.200000000000000000e+01 1.971550450495464929e-02
2.400000000000000000e+01 7.007532033757153667e-02
2.600000000000000000e+01 1.904879553613253451e-01
2.800000000000000000e+01 3.101513022088481231e-01
3.000000000000000000e+01 4.052906495585950619e-01
3.200000000000000000e+01 3.678644926959027672e-01
3.400000000000000000e+01 3.036757937102613214e-01
3.600000000000000000e+01 2.214720340001324062e-01
3.800000000000000000e+01 2.247878029385593501e-01
4.000000000000000000e+01 2.837024903561691791e-01
4.200000000000000000e+01 3.445713059080361962e-01
4.400000000000000000e+01 4.114147115795538934e-01
4.600000000000000000e+01 5.600722856829548624e-01
4.800000000000000000e+01 6.969212581381016847e-01
5.000000000000000000e+01 8.189179738707677014e-01
5.200000000000000000e+01 9.080765164985155069e-01
5.400000000000000000e+01 9.562807225028111535e-01
5.600000000000000000e+01 9.888241305894533983e-01
5.800000000000000000e+01 9.881336668388966959e-01
6.000000000000000000e+01 9.873660563005683954e-01
6.200000000000000000e+01 9.916558998680982118e-01
6.400000000000000000e+01 9.856319679487668406e-01
6.600000000000000000e+01 9.620117644994009565e-01
6.800000000000000000e+01 8.930029985027734263e-01
7.000000000000000000e+01 8.002870246239043306e-01
7.200000000000000000e+01 6.744921153732785779e-01
7.400000000000000000e+01 5.336319385472689802e-01
7.600000000000000000e+01 3.958859203876436417e-01
7.800000000000000000e+01 3.306385960364682242e-01
8.000000000000000000e+01 2.830681723233798852e-01
8.200000000000000000e+01 2.157622815497834690e-01
8.400000000000000000e+01 2.239956241155102445e-01
8.600000000000000000e+01 3.126826811826061703e-01
8.800000000000000000e+01 3.836092948935748703e-01
9.000000000000000000e+01 3.974940023194180050e-01
9.200000000000000000e+01 2.890294760518045125e-01
9.400000000000000000e+01 1.681544424688440620e-01
9.600000000000000000e+01 5.857273428081174321e-02
9.800000000000000000e+01 1.843518927289370876e-02
1.000000000000000000e+02 3.948951199063644064e-03
1.020000000000000000e+02 5.411750728699640106e-02
1.040000000000000000e+02 1.168717046133502524e-01
1.060000000000000000e+02 1.428170265275016670e-01
1.080000000000000000e+02 1.770817723162995683e-01
1.100000000000000000e+02 1.852631891594877511e-01
1.120000000000000000e+02 1.827670619818080600e-01
1.140000000000000000e+02 1.840805289029476266e-01
1.160000000000000000e+02 2.023203439358092770e-01
1.180000000000000000e+02 2.289994175203227400e-01
1.200000000000000000e+02 2.320430725945487604e-01
1.220000000000000000e+02 2.174983315399919570e-01
1.240000000000000000e+02 1.903085890797567015e-01
1.260000000000000000e+02 1.848716692115463522e-01
1.280000000000000000e+02 1.870838533508997481e-01
1.300000000000000000e+02 1.808923414647976846e-01
1.320000000000000000e+02 1.656061876352601381e-01
1.340000000000000000e+02 1.324214968752658039e-01
1.360000000000000000e+02 8.695118016262873284e-02
1.380000000000000000e+02 1.854769500506061805e-02
1.400000000000000000e+02 0.000000000000000000e+00
1.420000000000000000e+02 2.910410785429527400e-02
1.440000000000000000e+02 1.010188969127969877e-01
1.460000000000000000e+02 2.301799776698615074e-01
1.480000000000000000e+02 3.527565800906127258e-01
1.500000000000000000e+02 3.915987019538648140e-01
1.520000000000000000e+02 3.464073994570029402e-01
1.540000000000000000e+02 2.694669793425982229e-01
1.560000000000000000e+02 2.158017450989128672e-01
1.580000000000000000e+02 2.275203421614326316e-01
1.600000000000000000e+02 3.068773854027863068e-01
1.620000000000000000e+02 3.571336959618095497e-01
1.640000000000000000e+02 4.706879815526597843e-01
1.660000000000000000e+02 6.409924085632153767e-01
1.680000000000000000e+02 7.767958277474236173e-01
1.700000000000000000e+02 8.699880758924664059e-01
1.720000000000000000e+02 9.465309757532142099e-01
1.740000000000000000e+02 9.812603702158622099e-01
1.760000000000000000e+02 9.992196602416892892e-01
1.780000000000000000e+02 9.917162779443612353e-01
1.800000000000000000e+02 9.978245891628175768e-01
1.820000000000000000e+02 1.000000000000000000e+00
1.840000000000000000e+02 9.875604662057533289e-01
1.860000000000000000e+02 9.483868703110428511e-01
1.880000000000000000e+02 8.713195437307523772e-01
1.900000000000000000e+02 7.743174871902573919e-01
1.920000000000000000e+02 6.499028625508473933e-01
1.940000000000000000e+02 5.133872820820232219e-01
1.960000000000000000e+02 3.854633893596886574e-01
1.980000000000000000e+02 3.197097892137605313e-01
2.000000000000000000e+02 2.625546271582531732e-01
2.020000000000000000e+02 2.180674059888806082e-01
2.040000000000000000e+02 2.313545375136863425e-01
2.060000000000000000e+02 3.256001393270981925e-01
2.080000000000000000e+02 3.901136262892592188e-01
2.100000000000000000e+02 4.105052902445402441e-01
2.120000000000000000e+02 3.039702372835895727e-01
2.140000000000000000e+02 1.592176621398869174e-01
2.160000000000000000e+02 6.314946746536785616e-02
2.180000000000000000e+02 1.766902523683577114e-02
2.200000000000000000e+02 1.012551589503468512e-02
2.220000000000000000e+02 5.641599939516841328e-02
2.240000000000000000e+02 1.259411667024434578e-01
2.260000000000000000e+02 1.520177453041229865e-01
2.280000000000000000e+02 1.775272950156810414e-01
2.300000000000000000e+02 1.829980737518577261e-01
2.320000000000000000e+02 1.838471170106117103e-01
2.340000000000000000e+02 1.827520612175190795e-01
2.360000000000000000e+02 2.068282879012685871e-01
2.380000000000000000e+02 2.265482926355094906e-01
2.400000000000000000e+02 2.403459956284773325e-01

View File

@ -0,0 +1,56 @@
# coding: utf8
import numpy as np
from ase.build import bulk
from msspec.calculator import MSSPEC, XRaySource
from msspec.iodata import Data
from msspec.utils import hemispherical_cluster, get_atom_index
# Create the cluster
a = 5.43
Si = bulk('Si', a=a, cubic=True)
cluster = hemispherical_cluster(Si,
diameter=30, planes=4,
emitter_plane=3,
shape = 'cylindrical',
)
for atom in cluster:
atom.set('mean_square_vibration', 0.006)
atom.set('mt_radius', 1.1)
cluster.emitter = get_atom_index(cluster, 0, 0, 0)
# Create a calculator and set parameters
calc = MSSPEC(spectroscopy='PED', algorithm='expansion')
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.calculation_parameters.scattering_order = 3
calc.tmatrix_parameters.tl_threshold = 1e-4
calc.calculation_parameters.vibrational_damping = 'averaged_tl'
calc.calculation_parameters.RA_cutoff = 2
# Define path filtering options such that you only
# accept scattering paths with a forward cone <= 40°
# and whose length are <= cluster diameter
#
#
calc.set_atoms(cluster)
# Compute and add previous data for comparison
data = calc.get_theta_scan(level='2p',
theta=np.arange(-30., 80., 0.5),
phi=0,
kinetic_energy=1382.28)
no_filters = Data.load('path_filtering.hdf5')
data[0].add_columns(**{'no_filters': no_filters[0].cross_section})
view = data[0].views[0]
view.select('theta', 'cross_section', index=0, legend="With path filtering")
view.select('theta', 'no_filters', legend="Without path filtering")
data.view()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 702 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

View File

@ -208,7 +208,15 @@
"2. Create an ASE *calculator*\n",
"3. Run the simulation\n",
"\n",
"### PED polar scan for Cu(001)"
"### PED polar scan for Cu(001)\n",
"\n",
"download the [cu.py](cu.py \"download\") python script and the [copper.cif](copper.cif \"download\") file. Put those files in the same folder. You can run your first MsSpec calculation by typing in a terminal:\n",
"\n",
"```shell\n",
"$ python cu.py\n",
"```\n",
"\n",
"Here is the content of the script file:"
]
},
{
@ -597,6 +605,8 @@
"Based on the previous *.cif file, create a new cluster without the deepest plane and run the same calculation for the same emitter\n",
"\n",
"```{note}\n",
"Use the `cluster.edit()` method to interactively remove atoms...\n",
"\n",
"As the cluster will contain fewer atoms, the emitter index will be different\n",
"```\n",
"\n",
@ -617,7 +627,9 @@
"tags": []
},
"source": [
"```{toggle}\n",
"```{admonition} *Solution...*\n",
":class: tip\n",
":class: dropdown\n",
"\n",
":::{figure-md} Cu-4planes3planes\n",
"<img src=\"fig2.png\" width=\"600px\" align=\"center\">\n",
@ -913,20 +925,6 @@
"Cu(2p) polar scan for the hemispherical cluster.\n",
":::"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e86ab1b3-fcf3-46e7-9cc7-f5e80becea9d",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": []
}
],
"metadata": {
@ -945,7 +943,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.13"
"version": "3.11.3"
}
},
"nbformat": 4,

View File

@ -0,0 +1,926 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "7e31b322-df55-44ed-9f29-6f6efa71eafe",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"# Activity 1: Getting started\n",
"\n",
"MsSpec is a Fortran code with two components: Phagen (Written by R. Natoli) and Spec (written by D. Sébilleau). Phagen computes the phase shifts of the electronic wave propagating in the matter on a spherical harmonics basis. Spec uses those phase shifts to compute the multiple scattering process and simulate the intensity of different electronic spectroscopies.\n",
"\n",
"In the most recent version of MsSpec, the program is interfaced with python (https://msspec.cnrs.fr/), allowing for much more flexibility and interplay with other simulation techniques.\n",
"\n",
"## Building atomic systems\n",
"\n",
"MsSpec works in the *cluster* approach. Building such a cluster for a calculation is a fundamental step.\n",
"We use the [python Atomic Simulation Environment (ASE)](https://wiki.fysik.dtu.dk/ase/) for this.\n",
"\n",
"ASE is a set of tools and Python modules for setting up, manipulating, running, visualizing and analyzing atomistic simulations.\n",
"Building atomic systems, structures... is pretty straightforward:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "07a04c8c-a268-481a-8f1b-14878ed771b5",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"remove-output"
]
},
"outputs": [
{
"data": {
"text/plain": [
"<Popen: returncode: None args: ['/home/stricot/msspec_py3.11.13/bin/python',...>"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# To build a molecule with ASE\n",
"from ase.build import molecule\n",
"# To view\n",
"from ase.visualize import view\n",
"\n",
"# Create a water molecule\n",
"water = molecule('H2O')\n",
"# Display it\n",
"view(water)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "e09c7d97-eb35-49a7-b74a-9fb21a9a3aaf",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"remove-input"
]
},
"outputs": [
{
"data": {
"text/html": [
"<html>\n",
" <head>\n",
" <title>ASE atomic visualization</title>\n",
" <link rel=\"stylesheet\" type=\"text/css\" href=\"https://www.x3dom.org/release/x3dom.css\"></link>\n",
" <script type=\"text/javascript\" src=\"https://www.x3dom.org/release/x3dom.js\"></script>\n",
" </head>\n",
" <body>\n",
" <X3D width=\"400px\"; height=\"300px\";>\n",
"\n",
"<!--Inserting Generated X3D Scene-->\n",
"<scene>\n",
" <viewpoint position=\"0 0 3.052956\">\n",
" <group/>\n",
" </viewpoint>\n",
" <transform translation=\"-0.0 -0.0 -0.0\">\n",
" <group>\n",
" <group>\n",
" <transform translation=\"0 0 0\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 0.0 0.0\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0 0 0\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 0.0 0.0\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" </group>\n",
" <group>\n",
" <transform translation=\"0.0 0.0 0.119262\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.051 0.051\"/>\n",
" </appearance>\n",
" <sphere radius=\"0.66\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 0.763239 -0.477047\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 1.0 1.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"0.31\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 -0.763239 -0.477047\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 1.0 1.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"0.31\"/>\n",
" </shape>\n",
" </transform>\n",
" </group>\n",
" </group>\n",
" </transform>\n",
"</scene>\n",
"<!--End of Inserted Scene-->\n",
"\n",
" </X3D>\n",
" </body>\n",
"</html>\n",
"\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"view(water, viewer='x3d')"
]
},
{
"cell_type": "markdown",
"id": "94b690a2-52f0-43e4-953d-6e7519ac4e9c",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"## Barebone script for MsSpec\n",
"\n",
"MsSpec can simulate different electronic spectroscopies like PED, AED, LEED, EXAFS, APECS and more will be included in the forthcoming version. However, it is really well-suited for PhotoElectron Diffraction simulation, and the python interface is only fully available for it at the moment. Since PED covers all the MsSpec features and concepts, we will focus on this technique.\n",
"\n",
"There are typically 3 steps to follow to get a result with MsSpec:\n",
"\n",
"1. Create a *cluster*\n",
"2. Create an ASE *calculator*\n",
"3. Run the simulation\n",
"\n",
"### PED polar scan for Cu(001)\n",
"\n",
"download the [cu.py](cu.py \"download\") python script and the [copper.cif](copper.cif \"download\") file. Put those files in the same folder. You can run your first MsSpec calculation by typing in a terminal:\n",
"\n",
"```shell\n",
"$ python cu.py\n",
"```\n",
"\n",
"Here is the content of the script file:"
]
},
{
"cell_type": "markdown",
"id": "da96a735-a028-4fe8-89ac-96f707323ae9",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"```{literalinclude} cu.py\n",
":end-before: The \"emitter\"\n",
":linenos:\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "6ddd72a9-8f32-484f-9a3e-9ab3a85945a4",
"metadata": {
"editable": true,
"scrolled": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"remove-input"
]
},
"outputs": [
{
"data": {
"text/html": [
"<html>\n",
" <head>\n",
" <title>ASE atomic visualization</title>\n",
" <link rel=\"stylesheet\" type=\"text/css\" href=\"https://www.x3dom.org/release/x3dom.css\"></link>\n",
" <script type=\"text/javascript\" src=\"https://www.x3dom.org/release/x3dom.js\"></script>\n",
" </head>\n",
" <body>\n",
" <X3D width=\"400px\"; height=\"300px\";>\n",
"\n",
"<!--Inserting Generated X3D Scene-->\n",
"<scene>\n",
" <viewpoint position=\"0 0 28.8\">\n",
" <group/>\n",
" </viewpoint>\n",
" <transform translation=\"-7.2 -7.2 -3.6\">\n",
" <group>\n",
" <group>\n",
" <transform translation=\"0 0 0\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 14.4 0.0 0.0 14.4 14.4 0.0 0.0 14.4 0.0 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 0.0 7.2\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 14.4 0.0 0.0 14.4 14.4 0.0 0.0 14.4 0.0 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0 0 0\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 14.4 0.0 0.0 14.4 0.0 7.2 0.0 0.0 7.2 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 14.4 0.0\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 14.4 0.0 0.0 14.4 0.0 7.2 0.0 0.0 7.2 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" </group>\n",
" <group>\n",
" <transform translation=\"3.6 7.2 2.700000000000001\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"3.6 7.2 6.300000000000001\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"5.400000000000002 5.400000000000002 2.700000000000001\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"7.2 3.5999999999999988 2.700000000000001\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"7.2 5.400000000000002 0.8999999999999997\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"5.400000000000002 5.400000000000002 6.300000000000001\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"7.2 3.5999999999999988 6.300000000000001\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"7.2 5.400000000000002 4.5\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"5.400000000000002 7.2 0.8999999999999997\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"5.400000000000002 8.999999999999998 2.700000000000001\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"7.2 7.2 2.700000000000001\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"7.2 8.999999999999998 0.8999999999999997\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"5.400000000000002 7.2 4.5\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"5.400000000000002 8.999999999999998 6.300000000000001\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"7.2 7.2 6.300000000000001\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"7.2 8.999999999999998 4.5\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"7.2 10.800000000000004 2.700000000000001\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"7.2 10.800000000000004 6.300000000000001\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"8.999999999999998 5.400000000000002 2.700000000000001\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"8.999999999999998 5.400000000000002 6.300000000000001\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"8.999999999999998 7.2 0.8999999999999997\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"8.999999999999998 8.999999999999998 2.700000000000001\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"10.800000000000004 7.2 2.700000000000001\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"8.999999999999998 7.2 4.5\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"8.999999999999998 8.999999999999998 6.300000000000001\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"10.800000000000004 7.2 6.300000000000001\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" </group>\n",
" </group>\n",
" </transform>\n",
"</scene>\n",
"<!--End of Inserted Scene-->\n",
"\n",
" </X3D>\n",
" </body>\n",
"</html>\n",
"\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from ase.io import read\n",
"from ase.visualize import view\n",
"from msspec.calculator import MSSPEC\n",
"\n",
"\n",
"cluster = read('copper.cif')\n",
"# view the cluster\n",
"view(cluster, viewer='x3d')"
]
},
{
"cell_type": "markdown",
"id": "a51b9284-ce53-48e2-bd4b-65fe3998cc33",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"```{literalinclude} cu.py\n",
":start-at: The \"emitter\"\n",
":lineno-match:\n",
"```\n",
":::{figure-md} Cu-XPD\n",
"<img src=\"fig1.png\" width=\"600px\" align=\"center\">\n",
"\n",
"Cu(2p) polar scan for the copper cluster above\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "85c7dcac-9f0e-4a56-8077-c96f89865dcb",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"## Shaping a cluster"
]
},
{
"cell_type": "markdown",
"id": "ff63b7cb-5e31-44f8-b81b-d05bf0c775c0",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"Based on the previous *.cif file, create a new cluster without the deepest plane and run the same calculation for the same emitter\n",
"\n",
"```{note}\n",
"Use the `cluster.edit()` method to interactively remove atoms...\n",
"\n",
"As the cluster will contain fewer atoms, the emitter index will be different\n",
"```\n",
"\n",
"What do you conclude ?\n",
":::\n",
"\n",
"::::"
]
},
{
"cell_type": "markdown",
"id": "102bfad0-f8ed-44ab-990f-9fb2eb5662b0",
"metadata": {
"editable": true,
"scrolled": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"hide-input"
]
},
"source": [
"The number of atoms used for the calculation greatly impact the calculation time and memory. Most of the time, a cluster is shaped as an hemisphere to minimize the number of atoms to take into account"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "f7ecc1d0-097d-4199-822a-c564e9e94337",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"remove-output"
]
},
"outputs": [
{
"data": {
"text/plain": [
"<Popen: returncode: None args: ['/home/stricot/msspec_py3.11.13/bin/python',...>"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from msspec.calculator import MSSPEC\n",
"from msspec.utils import hemispherical_cluster, get_atom_index\n",
"from ase.build import bulk\n",
"from ase.visualize import view\n",
"\n",
"copper = bulk('Cu', cubic=True)\n",
"cluster = hemispherical_cluster(copper, planes=3, emitter_plane=2)\n",
"cluster.emitter = get_atom_index(cluster, 0,0,0)\n",
"\n",
"view(cluster)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "076f617d-599f-483d-b22c-38cebf41b28a",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"remove-input"
]
},
"outputs": [
{
"data": {
"text/html": [
"<html>\n",
" <head>\n",
" <title>ASE atomic visualization</title>\n",
" <link rel=\"stylesheet\" type=\"text/css\" href=\"https://www.x3dom.org/release/x3dom.css\"></link>\n",
" <script type=\"text/javascript\" src=\"https://www.x3dom.org/release/x3dom.js\"></script>\n",
" </head>\n",
" <body>\n",
" <X3D width=\"400px\"; height=\"300px\";>\n",
"\n",
"<!--Inserting Generated X3D Scene-->\n",
"<scene>\n",
" <viewpoint position=\"0 0 14.440000000000001\">\n",
" <group/>\n",
" </viewpoint>\n",
" <transform translation=\"-1.805 -1.805 -1.805\">\n",
" <group>\n",
" <group>\n",
" <transform translation=\"0 0 0\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 3.61 0.0 0.0 3.61 3.61 0.0 0.0 3.61 0.0 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 0.0 3.61\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 3.61 0.0 0.0 3.61 3.61 0.0 0.0 3.61 0.0 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0 0 0\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 3.61 0.0 0.0 3.61 0.0 3.61 0.0 0.0 3.61 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 3.61 0.0\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 3.61 0.0 0.0 3.61 0.0 3.61 0.0 0.0 3.61 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" </group>\n",
" <group>\n",
" <transform translation=\"-3.610000000000001 0.0 3.61\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-1.8049999999999997 -1.8049999999999997 3.61\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-1.8049999999999997 0.0 1.8050000000000002\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-1.8049999999999997 1.8049999999999997 3.61\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 -3.6099999999999994 3.61\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 0.0 4.440892098500626e-16\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 -1.8049999999999997 1.8050000000000002\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 0.0 3.61\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"1.8049999999999997 -1.8049999999999997 3.61\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"1.8049999999999997 0.0 1.8050000000000002\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 1.8049999999999997 1.8050000000000002\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 3.6099999999999994 3.61\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"1.8049999999999997 1.8049999999999997 3.61\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"3.6099999999999994 0.0 3.61\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.784 0.502 0.2\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.32\"/>\n",
" </shape>\n",
" </transform>\n",
" </group>\n",
" </group>\n",
" </transform>\n",
"</scene>\n",
"<!--End of Inserted Scene-->\n",
"\n",
" </X3D>\n",
" </body>\n",
"</html>\n",
"\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"view(cluster, viewer='x3d')"
]
},
{
"cell_type": "markdown",
"id": "4a71c734-8c73-49a2-9f27-12157841405c",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
":::{figure-md} Cu-hemi\n",
"<img src=\"fig3.png\" width=\"600px\" align=\"center\">\n",
"\n",
"Cu(2p) polar scan for the hemispherical cluster.\n",
":::"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -42,7 +42,7 @@
"\n",
"### Building the cluster\n",
"\n",
"Let's start by building the cluster"
"Let's start by building the cluster. You can copy/paste directly the code from this page to your text editor or you can download the script [SbAg.py](SbAg.py \"download\"). You will also need the [data.txt](data.txt \"download\") file."
]
},
{
@ -1164,7 +1164,9 @@
"tags": []
},
"source": [
"```{toggle}\n",
"```{admonition} *Solution...*\n",
":class: tip\n",
":class: dropdown\n",
"\n",
":::{figure-md} SbAg-fig2\n",
"<img src=\"fig2.png\" width=\"600px\" align=\"center\">\n",
@ -1200,7 +1202,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.13"
"version": "3.11.3"
}
},
"nbformat": 4,

File diff suppressed because it is too large Load Diff

View File

@ -266,7 +266,9 @@
"tags": []
},
"source": [
"```{toggle}\n",
"```{admonition} *Solution...*\n",
":class: tip\n",
":class: dropdown\n",
"\n",
":::{literalinclude} RhO_sf.py\n",
":start-at: Compute\n",
@ -333,7 +335,7 @@
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"Complete the script below to compute the ($\\theta,\\phi$) scan of the photodiffraction of O(1s) adsorbed on a *fcc* site on Rh(111) surface.\n",
"Complete the [script below](RhO_tofill.py \"download\") to compute the ($\\theta,\\phi$) scan of the photodiffraction of O(1s) adsorbed on a *fcc* site on Rh(111) surface.\n",
"\n",
"```{literalinclude} RhO_tofill.py\n",
":lineno-match:\n",
@ -358,7 +360,9 @@
"tags": []
},
"source": [
"```{toggle}\n",
"```{admonition} *Solution...*\n",
":class: tip\n",
":class: dropdown\n",
"\n",
":::{literalinclude} RhO_completed.py\n",
":lineno-match:\n",

View File

@ -0,0 +1,346 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "2aebc88d-0bb4-4d56-b7f6-977a66814229",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"(ssc)=\n",
"# Activity 3: Adsorbates and the single scattering approach\n",
"\n",
"Photoelectron diffraction is widely used to study the adsorption of atoms or molecules on a crystalline surface. Photoelectrons from adsorbates are scattered by the underlying surface, carrying information about the adsorption site, bond length and/or molecule orientation…. Thanks to a simulation, such information becomes quantitative with a high degree of accuracy.\n",
"\n",
"Calculations of the multiple scattering using matrix inversion have the great advantage of being exact, including all scattering paths. On the other hand, memory consumption soon becomes a problem as the kinetic energy and number of atoms to be considered increase. As an approximation, it is possible to only consider a single scattering from the emitter to any atom in the cluster. This approximation is extremely computationally fast and can give satisfactory results for adsorbates. Well see later that this approach is rather too simplistic for most cases.\n",
"\n",
"## Oxygen on Rh(001)\n",
"In a paper published in 1998, T. Gerber *et al.* used the quite high backscattering factor of Rhodium atoms to probe the distance of Oxygen atoms adsorbed on a Rhodium surface. Some electrons coming from Oxygen atoms are ejected toward the Rhodium surface. They are then backscattered and interfere with the direct signal comming from Oxygen atoms (see the figure below). They demonstrated both experimentally and numerically with a sinle scattering computation that this lead to a very accurate probe of adsorbed species that can be sensitive to bond length changes of the order of {math}`\\pm 0.02 \\mathring{A}`.\n",
"\n",
":::{seealso}\n",
"based on this paper from T. Greber *et al.* [Phys. Rev. Lett. **81**(8) p1654 (1998)](https://doi.org/10.1103/PhysRevLett.81.1654)\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "a4cd32cd-b480-44b5-af38-b38e5979ce00",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
":::{figure-md} RhO-fig\n",
"<img src=\"RhO_fig0.jpg\" alt=\"RhO\" width=\"300px\" align=\"center\">\n",
"\n",
"Interferences produced by the backscattering effect\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "4f6bcc08-a54c-424a-a20c-cbdd0ce13ae2",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"### Computing the scattering factor\n",
"\n",
"To illustrate that photoelectrons emitted by Oxygen adsorbates towards the Rhodium surface can be backscattered, we will start by computing the scattering factor for both O and Rh atoms.\n",
"\n",
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"By using the [`Atoms`](https://wiki.fysik.dtu.dk/ase/ase/atoms.html#ase.Atoms) class of the `ase` package, try to build a O-Rh chain where atoms are 4 Å apart. Here is the begining of the script. Try to complete the line of code and view your two-atoms chain.\n",
"\n",
"```python\n",
"from ase import Atoms\n",
"from ase.visualize import view\n",
"\n",
"# Create an atomic chain O-Rh\n",
"cluster = Atoms(... # Fill this line\n",
"```\n",
":::\n",
"\n",
"::::"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "55929980-7394-4a60-b554-376adce57dbf",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"remove-input"
]
},
"outputs": [],
"source": [
"from ase import Atoms\n",
"from ase.visualize import view\n",
"\n",
"# Create an atomic chain O-Rh\n",
"cluster = Atoms(['O', 'Rh'], positions = [(0,0,0), (0,0,4.)])"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "2f296e2c-2a34-4266-98a8-362ede072659",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"remove-input"
]
},
"outputs": [
{
"data": {
"text/html": [
"<html>\n",
" <head>\n",
" <title>ASE atomic visualization</title>\n",
" <link rel=\"stylesheet\" type=\"text/css\" href=\"https://www.x3dom.org/release/x3dom.css\"></link>\n",
" <script type=\"text/javascript\" src=\"https://www.x3dom.org/release/x3dom.js\"></script>\n",
" </head>\n",
" <body>\n",
" <X3D width=\"400px\"; height=\"300px\";>\n",
"\n",
"<!--Inserting Generated X3D Scene-->\n",
"<scene>\n",
" <viewpoint position=\"0 0 8.0\">\n",
" <group/>\n",
" </viewpoint>\n",
" <transform translation=\"-0.0 -0.0 -0.0\">\n",
" <group>\n",
" <group>\n",
" <transform translation=\"0 0 0\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 0.0 0.0\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0 0 0\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 0.0 0.0\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" </group>\n",
" <group>\n",
" <transform translation=\"0.0 0.0 0.0\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.051 0.051\"/>\n",
" </appearance>\n",
" <sphere radius=\"0.66\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 0.0 4.0\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.039 0.49 0.549\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.42\"/>\n",
" </shape>\n",
" </transform>\n",
" </group>\n",
" </group>\n",
" </transform>\n",
"</scene>\n",
"<!--End of Inserted Scene-->\n",
"\n",
" </X3D>\n",
" </body>\n",
"</html>\n",
"\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"view(cluster, viewer='x3d')"
]
},
{
"cell_type": "markdown",
"id": "736d6d08-930e-4b4f-a3fd-599ef8463035",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"As previously, we create a calculator, we attach our 2 atoms cluster to this calculator and we define the first atom in the chain as the emitter\n",
"\n",
":::{literalinclude} RhO_sf.py\n",
":start-at: calc =\n",
":end-at: emitter =\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "21763c63-9bd1-4e80-944a-9cf313894b89",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"We use the `get_scattering_factors` method [(see its documentation)](https://msspec.cnrs.fr/modules/calculator.html#calculator._PED.get_scattering_factors) to compute the scattering factors at 723 eV.\n",
"\n",
"How large is the backscattering factor of Rhodium with respect to that of Oxygen ?\n",
":::\n",
"\n",
"::::"
]
},
{
"cell_type": "markdown",
"id": "e7da60a3-b4e3-45ec-9d0e-62cb592f0687",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"### Interferences due to backscattering\n",
"\n",
"Let an Oxygen atom (in red) being adsorbed at a distance $z_0$ of an *fcc* site of the Rh(111) surface."
]
},
{
"cell_type": "markdown",
"id": "68048f33-318d-400e-a815-769660f2b6c5",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"remove-input"
]
},
"source": [
":::{figure-md} Rho-fig2a\n",
"<img src=\"RhO_fig2a.jpg\" width=\"600px\" align=\"center\">\n",
"\n",
"Small cluster used for the calculation.\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "d6145250-5548-49a6-8b50-0bb7c5b454da",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"We will compute for different values of the adsorption height $z_0$.\n",
"\n",
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"Complete the [script below](RhO_tofill.py \"download\") to compute the ($\\theta,\\phi$) scan of the photodiffraction of O(1s) adsorbed on a *fcc* site on Rh(111) surface.\n",
"\n",
"```{literalinclude} RhO_tofill.py\n",
":lineno-match:\n",
":emphasize-lines: 6,8,12,13\n",
"```\n",
"\n",
"As proposed in the comments, add a loop to vary the adsorption height of Oxygen between 1.10 and 1.65 Å.\n",
"What is the bond length difference between to intensity maxima ?\n",
":::\n",
"\n",
"::::"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -97,7 +97,13 @@
{
"cell_type": "markdown",
"id": "3ed73f46-c12f-452f-a584-00d142f2e133",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"```{admonition} *Solution...*\n",
":class: tip\n",
@ -136,7 +142,13 @@
{
"cell_type": "markdown",
"id": "626708d9-c421-4bf0-bd70-f32113360f9c",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"```{admonition} *Solution...*\n",
":class: tip\n",
@ -150,6 +162,10 @@
"Polar scan of a Ni chain of 2-5 atoms for single and full mutliple scattering.\n",
":::\n",
"\n",
":::{literalinclude} Ni_chain2.py\n",
":linenos: true\n",
":::\n",
"\n",
"```"
]
}

View File

@ -0,0 +1,147 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "d053c16f-22ca-44ce-a58d-03e73c1a5554",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"(ssc2ms)=\n",
"# Activity 4: From single scattering to multiple scattering\n",
"\n",
"In the [previous activity](ssc), we saw that simple single scattering calculations (SSC) can be used to simulate photodiffraction diagrams with good accuracy. The approximation works fine when the emitting atom is very close to the surface.\n",
"However, the SSC approach is no longer suitable for deeper emitter atoms, where multiple scattering effects come into play. In this activity, we will focus on a major consequence of multiple scattering: *the defocusing effect*.\n",
"\n",
"The defocusing effect is presented in the [figure below](Ni-fig1) for a chain of nickel atoms. Although purely illustrative, understanding multiple scattering in atomic chains is fundamental because they are found in many situations, such as in particular directions of a crystal or in molecules of various lengths."
]
},
{
"cell_type": "markdown",
"id": "12b10290-0b9b-497a-baba-e7ecb6543788",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
":::{figure-md} Ni-fig1\n",
"<img src=\"defocusing_animation.gif\" alt=\"defocusing effect\" width=\"600px\" align=\"center\">\n",
"\n",
"The defocusing effect dur to multiple scattering in an atomic chain of Ni atoms.\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "b1b4c789-e62c-40cc-92a3-053e6a90d315",
"metadata": {},
"source": [
"In 1989, M.-L Xu, J.J. Barton and M.A. Van Hove studied these multiple scattering effects on atomic chains ([see their paper below](defocusing-paper)).\n",
"In the spirit of figure 3 of their paper, we will create 3 atomic chains of Ni atoms (2, 3 and 5 atoms) tilted by 45° and we will compare the intensity of the forward scattering peak for single scattering and for full multiple scattering."
]
},
{
"cell_type": "markdown",
"id": "4988e7d3-2ba3-470f-9676-8116348c30a1",
"metadata": {},
"source": [
"(defocusing-paper)=\n",
":::{seealso}\n",
"based on this paper from M.-L. Xu *et al.*\n",
"[Phys. Rev. B **39** p8275 (1989)](https://doi.org/10.1103/PhysRevB.39.8275) \n",
":::"
]
},
{
"cell_type": "markdown",
"id": "011ef23b-5a76-410d-8d44-1c4a899e2a23",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"## Polar scans of Ni atomic chains\n",
"\n",
"### Building a chain of atoms\n",
"\n",
"Start by creating a simple chain of 2 Ni atoms: an emitter and a scatterer in the [101] direction.\n",
"\n",
":::{tip}\n",
"Nickel is *fcc* with lattice parameter $a$=3.499 Å. Use the [`Atoms`](https://wiki.fysik.dtu.dk/ase/ase/atoms.html#ase.Atoms) class of `ase` like in the [previous activity](ssc)...\n",
"\n",
":::{admonition} if you need help to start...\n",
":class: dropdown\n",
"\n",
":::{code} python\n",
"from msspec.calculator import MSSPEC\n",
"from ase import Atoms\n",
"\n",
"symbol = ... # The kind of atom for the chain\n",
"a = ... # The distance bewteen 2 atoms\n",
" # in [101] direction\n",
"\n",
"chain = Atoms(..., positions=[...])\n",
"chain.rotate(...)\n",
"chain.edit()\n",
":::\n",
"\n",
":::\n",
"\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "5c57f951-bfa7-435e-8e74-b3de11909768",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"Create an `MSSPEC` calculator with `expansion` algortithm and set the `scattering_order`=1 to compute a polar scan of the Ni(3s) in single scattering. How is varying the height of the peak at 45° (along the chain) if you increase the number of atoms in the chain ?\n",
"\n",
"Repeat the same experiment with `inversion` algorithm for having the full multiple scattering result. What do you observe ?\n",
":::\n",
"\n",
"::::"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -181,12 +181,12 @@
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"Complete the code snipet provided below to create a small TiSe{sub}`2` cluster with Ti emitter in the 2{sup}`nd` plane:\n",
"Complete the code snipet provided below (or [here](TiSe2_1_tofill.py \"download\")) to create a small TiSe{sub}`2` cluster with Ti emitter in the 2{sup}`nd` plane:\n",
"\n",
"```{literalinclude} TiSe2_1_tofill.py\n",
":start-at: from\n",
":end-before: Create a calculator\n",
":lineno-match:\n",
":lines: 1-29\n",
":linenos:\n",
":emphasize-lines: 7,11,15,26 \n",
"```\n",
"\n",
":::\n",
@ -195,53 +195,32 @@
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "b65b569e-242b-4fe9-9c87-ea90d80d9b44",
"cell_type": "markdown",
"id": "1f2e014f-8963-4ae6-bbf5-7f4ebde3b16a",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"hide-cell"
]
"tags": []
},
"outputs": [],
"source": [
"from ase.build import mx2\n",
"from ase.visualize import view\n",
"from msspec.calculator import MSSPEC\n",
"from msspec.utils import hemispherical_cluster, get_atom_index\n",
"```{admonition} *Solution...*\n",
":class: tip\n",
":class: dropdown\n",
"\n",
"# Some usefull constants (a, c, d, D) for defining the structure\n",
"a=3.535;c=6.004;d=3.450;D=2.554\n",
":::{literalinclude} TiSe2_1_completed.py\n",
":linenos: true\n",
":lines: 1-18\n",
":::\n",
"\n",
"# Create the TiSe2 trilayer\n",
"# use ase help for this function\n",
"TiSe2 = mx2(formula='TiSe2', kind='1T', a=a, thickness=d, size=(1, 1, 1), vacuum=None)\n",
"\n",
"# The preious cell is 2D, let's define the c-axis to take into account \n",
"# the Van der Waals gap between trilayers\n",
"TiSe2.cell[2] = [0, 0, c]\n",
"\n",
"# To be aligned like in the paper\n",
"TiSe2.rotate(60, 'z', rotate_cell=True)\n",
"\n",
"# Since the material is multi-elements, \"tag\" each inequivalent atom \n",
"# of the unit cell with a number. The \"Ti\" atom is tagged 0 and \"Se\" \n",
"# atoms are 1 and 2.\n",
"for i in range(3): \n",
" TiSe2[i].tag = i\n",
"\n",
"cluster = hemispherical_cluster(TiSe2, emitter_tag=0, emitter_plane=1, planes=5)\n",
"cluster.emitter = get_atom_index(cluster, 0, 0, 0)"
"```"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "515064d0-3751-4fae-af0c-c4b15ea221b3",
"execution_count": 1,
"id": "b65b569e-242b-4fe9-9c87-ea90d80d9b44",
"metadata": {
"editable": true,
"slideshow": {
@ -777,12 +756,39 @@
"<IPython.core.display.HTML object>"
]
},
"execution_count": 15,
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from ase.build import mx2\n",
"from ase.visualize import view\n",
"from msspec.calculator import MSSPEC\n",
"from msspec.utils import hemispherical_cluster, get_atom_index\n",
"\n",
"# Some usefull constants (a, c, d, D) for defining the structure\n",
"a=3.535;c=6.004;d=3.450;D=2.554\n",
"\n",
"# Create the TiSe2 trilayer\n",
"# use ase help for this function\n",
"TiSe2 = mx2(formula='TiSe2', kind='1T', a=a, thickness=d, size=(1, 1, 1), vacuum=None)\n",
"\n",
"# The preious cell is 2D, let's define the c-axis to take into account \n",
"# the Van der Waals gap between trilayers\n",
"TiSe2.cell[2] = [0, 0, c]\n",
"\n",
"# To be aligned like in the paper\n",
"TiSe2.rotate(60, 'z', rotate_cell=True)\n",
"\n",
"# Since the material is multi-elements, \"tag\" each inequivalent atom \n",
"# of the unit cell with a number. The \"Ti\" atom is tagged 0 and \"Se\" \n",
"# atoms are 1 and 2.\n",
"for i in range(3): \n",
" TiSe2[i].tag = i\n",
"\n",
"cluster = hemispherical_cluster(TiSe2, emitter_tag=0, emitter_plane=1, planes=5)\n",
"cluster.emitter = get_atom_index(cluster, 0, 0, 0)\n",
"view(cluster, viewer='x3d')"
]
},
@ -847,7 +853,9 @@
]
},
"source": [
"```{toggle}\n",
"```{admonition} *Solution...*\n",
":class: tip\n",
":class: dropdown\n",
"\n",
":::{figure-md} results-completed-fig\n",
"<img src=\"results_completed.jpg\" width=\"400px\" align=\"center\">\n",

View File

@ -0,0 +1,842 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "ff0fc2d9-b53e-4d29-883b-6d6303d76eb2",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"(forward-scattering)=\n",
"# Activity 5: Multiple scattering in the forward scattering regime"
]
},
{
"cell_type": "markdown",
"id": "7f10b898-4fc8-40fd-a477-05e736a5a255",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"In photoelectron diffraction, it is well known that for high photoelectron kinetic energy (typically > 900 eV), the scattering factor is strongly peaked in the forward direction. It means that photoelectrons are almost not deviated after a scattering event.\n",
"\n",
"Peaks of intentisity are then usually observed for dense atomic directions of the sample. This is the **forward scattering approximation**.\n",
"\n",
"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\n",
"$(N \\times (L_{max}+1)^2)^2$ elements of complex type with double precision (64 bits) where $N$ is the number of atoms and $L_{max}$ is the number of spherical harmonics used to expand the electron wave around each atomic center. As the kinetic energy increases, the mean free path (MFP) of the photoelectron is larger and the number of atoms in the cluster has to be greater. Lmax also increases with the kinetic energy."
]
},
{
"cell_type": "markdown",
"id": "cc78443a-1d06-408a-91eb-33a56fe25ba3",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"Try to evaluate how much memory you would need for this matrix for a hemispherical cluster of copper 15 angströms thick (1 MFP) for $L_{max} = 25$ ?\n",
":::\n",
"\n",
"::::"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "e6f5b739-bcbf-4a2f-9c51-5e409079392a",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"hide-cell"
]
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"606 atoms, 2.685 TB\n"
]
}
],
"source": [
"import numpy as np\n",
"\n",
"# lattice constant of fcc copper\n",
"a = 3.6\n",
"# radius of the cluster\n",
"r = 15\n",
"# volume of the cluster\n",
"V = .5 * (4/3) * np.pi * r**3\n",
"# volume of the cell\n",
"v = a**3\n",
"# number of atoms in the unit cell\n",
"n = 4\n",
"# number of atoms in the cluster\n",
"N = int(V/v * n)\n",
"\n",
"Lmax = 25\n",
"M = (N * (Lmax+1)**2 )**2 * 2 * 64 / 8\n",
"print(f\"{N:d} atoms, {M/1e12:.3f} TB\")"
]
},
{
"cell_type": "markdown",
"id": "f53ecd7a-9202-40ec-a472-c5a2146587c9",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"This is too much memory. We will use another algorithm available in MsSpec: The *Rehr-Albers series expansion*. We already used that algorithm in activity 3 for the single scattering approach. But this time, we will explore a bit more the effect of the scattering order > 1"
]
},
{
"cell_type": "markdown",
"id": "f7e215cd-3468-4316-901d-27731ec3e61d",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"## PED of the 1T-TiSe<sub>2</sub> surface"
]
},
{
"cell_type": "markdown",
"id": "ed46b9b8-cd37-4531-9686-5c1d804e868e",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"Let us try to model the Ti2p XPD pattern of the transition metal dichalcogenide 1T-TiSe<sub>2</sub>.\n",
"\n",
":::{seealso}\n",
"based on this paper from M.V. Kuznetsov *et al.*\n",
"[Surf. Sci. **606** p176070 (2012)](https://doi.org/10.1016/j.susc.2012.06.008)\n",
":::\n",
"\n",
"### Creating the TiSe{sub}`2` cluster\n",
"\n",
"Start by creating a small cluster of 1T-TiSe<sub>2</sub> using the `mx2` function of `ase.build` and the `hemispherical_cluster` function of `msspec.utils`."
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "65562913-1336-476c-8dd7-0ade7a8a1b8b",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
":::{figure-md} TiSe2-fig\n",
"<img src=\"TiSe2_cell.jpg\" alt=\"TiSe2\" width=\"300px\" align=\"center\">\n",
"\n",
"Structure of 1T-TiSe<sub>2</sub> ($a_0=b_0=3.535$ Å, $c_0=6.004$ Å, $d=3.450$ Å, $D=2.554$ Å)\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "849041c9-513f-4593-a4dd-fb3a495094fa",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"Complete the code snipet provided below (or [here](TiSe2_1_tofill.py \"download\")) to create a small TiSe{sub}`2` cluster with Ti emitter in the 2{sup}`nd` plane:\n",
"\n",
"```{literalinclude} TiSe2_1_tofill.py\n",
":lines: 1-29\n",
":linenos:\n",
":emphasize-lines: 7,11,15,26 \n",
"```\n",
"\n",
":::\n",
"\n",
"::::"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "b65b569e-242b-4fe9-9c87-ea90d80d9b44",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"remove-input"
]
},
"outputs": [
{
"data": {
"text/html": [
"<html>\n",
" <head>\n",
" <title>ASE atomic visualization</title>\n",
" <link rel=\"stylesheet\" type=\"text/css\" href=\"https://www.x3dom.org/release/x3dom.css\"></link>\n",
" <script type=\"text/javascript\" src=\"https://www.x3dom.org/release/x3dom.js\"></script>\n",
" </head>\n",
" <body>\n",
" <X3D width=\"400px\"; height=\"300px\";>\n",
"\n",
"<!--Inserting Generated X3D Scene-->\n",
"<scene>\n",
" <viewpoint position=\"0 0 28.28000000000003\">\n",
" <group/>\n",
" </viewpoint>\n",
" <transform translation=\"-0.8837500000000003 -2.220446049250313e-16 -3.002\">\n",
" <group>\n",
" <group>\n",
" <transform translation=\"0 0 0\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 1.7675000000000005 3.0613998023779905 0.0 -1.7674999999999996 3.061399802377991 0.0 -3.535 4.440892098500626e-16 0.0 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 0.0 6.004\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 1.7675000000000005 3.0613998023779905 0.0 -1.7674999999999996 3.061399802377991 0.0 -3.535 4.440892098500626e-16 0.0 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0 0 0\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 1.7675000000000005 3.0613998023779905 0.0 1.7675000000000005 3.0613998023779905 6.004 0.0 0.0 6.004 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-3.535 4.440892098500626e-16 0.0\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0 0 0\"/>\n",
" </appearance>\n",
" <lineset vertexCount=\"5\">\n",
" <coordinate point=\"0 0 0 1.7675000000000005 3.0613998023779905 0.0 1.7675000000000005 3.0613998023779905 6.004 0.0 0.0 6.004 0 0 0\"/>\n",
" </lineset>\n",
" </shape>\n",
" </transform>\n",
" </group>\n",
" <group>\n",
" <transform translation=\"1.767499999999984 -7.143266205548649 1.724999999999999\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-1.7675000000000125 -7.143266205548649 1.724999999999999\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"3.5349999999999966 -6.122799604755983 4.6629367034256575e-15\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"3.5349999999999966 -4.0818664031706575 1.724999999999999\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"1.767499999999984 -5.102333003963317 -1.7249999999999894\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 -4.0818664031706575 -4.279000000000005\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 -6.122799604755983 4.6629367034256575e-15\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 -4.0818664031706575 1.724999999999999\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-1.7675000000000125 -5.102333003963317 -1.7249999999999894\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-3.5349999999999966 -6.122799604755983 4.6629367034256575e-15\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-3.5349999999999966 -4.0818664031706575 1.724999999999999\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"5.302499999999995 -3.0613998023779914 4.6629367034256575e-15\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"5.302499999999995 -1.0204666007926662 1.724999999999999\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"3.5349999999999966 -2.040933201585325 -1.7249999999999894\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"1.767499999999984 -1.0204666007926662 -4.279000000000005\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"1.767499999999984 -3.0613998023779914 4.6629367034256575e-15\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"1.767499999999984 -1.0204666007926662 1.724999999999999\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 -2.040933201585325 -1.7249999999999894\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-1.7675000000000125 -1.0204666007926662 -4.279000000000005\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-1.7675000000000125 -3.0613998023779914 4.6629367034256575e-15\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-1.7675000000000125 -1.0204666007926662 1.724999999999999\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-3.5349999999999966 -2.040933201585325 -1.7249999999999894\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-5.302500000000009 -3.0613998023779914 4.6629367034256575e-15\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-5.302500000000009 -1.0204666007926662 1.724999999999999\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"7.069999999999993 0.0 4.6629367034256575e-15\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"7.069999999999993 2.040933201585325 1.724999999999999\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"5.302499999999995 1.020466600792666 -1.7249999999999894\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"3.5349999999999966 2.040933201585325 -4.279000000000005\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"3.5349999999999966 0.0 4.6629367034256575e-15\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"3.5349999999999966 2.040933201585325 1.724999999999999\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"1.767499999999984 1.020466600792666 -1.7249999999999894\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 0.0 -6.004\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 2.040933201585325 -4.279000000000005\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 0.0 4.6629367034256575e-15\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 2.040933201585325 1.724999999999999\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-1.7675000000000125 1.020466600792666 -1.7249999999999894\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-3.5349999999999966 2.040933201585325 -4.279000000000005\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-3.5349999999999966 0.0 4.6629367034256575e-15\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-3.5349999999999966 2.040933201585325 1.724999999999999\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-5.302500000000009 1.020466600792666 -1.7249999999999894\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-7.070000000000022 0.0 4.6629367034256575e-15\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-7.070000000000022 2.040933201585325 1.724999999999999\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"5.302499999999995 3.0613998023779985 4.6629367034256575e-15\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"5.302499999999995 5.102333003963331 1.724999999999999\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"3.5349999999999966 4.0818664031706575 -1.7249999999999894\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"1.7674999999999983 3.0613998023779985 4.6629367034256575e-15\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"1.7674999999999983 5.102333003963331 1.724999999999999\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 4.0818664031706575 -1.7249999999999894\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-1.7674999999999983 3.0613998023779985 4.6629367034256575e-15\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-1.7674999999999983 5.102333003963331 1.724999999999999\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-3.5349999999999966 4.0818664031706575 -1.7249999999999894\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-5.302500000000009 3.0613998023779985 4.6629367034256575e-15\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-5.302500000000009 5.102333003963331 1.724999999999999\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"1.0 0.631 0.0\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.2\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"3.5349999999999966 6.12279960475599 4.6629367034256575e-15\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"0.0 6.12279960475599 4.6629367034256575e-15\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" <transform translation=\"-3.535000000000011 6.12279960475599 4.6629367034256575e-15\">\n",
" <shape>\n",
" <appearance>\n",
" <material diffuseColor=\"0.749 0.761 0.78\"/>\n",
" </appearance>\n",
" <sphere radius=\"1.6\"/>\n",
" </shape>\n",
" </transform>\n",
" </group>\n",
" </group>\n",
" </transform>\n",
"</scene>\n",
"<!--End of Inserted Scene-->\n",
"\n",
" </X3D>\n",
" </body>\n",
"</html>\n",
"\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from ase.build import mx2\n",
"from ase.visualize import view\n",
"from msspec.calculator import MSSPEC\n",
"from msspec.utils import hemispherical_cluster, get_atom_index\n",
"\n",
"# Some usefull constants (a, c, d, D) for defining the structure\n",
"a=3.535;c=6.004;d=3.450;D=2.554\n",
"\n",
"# Create the TiSe2 trilayer\n",
"# use ase help for this function\n",
"TiSe2 = mx2(formula='TiSe2', kind='1T', a=a, thickness=d, size=(1, 1, 1), vacuum=None)\n",
"\n",
"# The preious cell is 2D, let's define the c-axis to take into account \n",
"# the Van der Waals gap between trilayers\n",
"TiSe2.cell[2] = [0, 0, c]\n",
"\n",
"# To be aligned like in the paper\n",
"TiSe2.rotate(60, 'z', rotate_cell=True)\n",
"\n",
"# Since the material is multi-elements, \"tag\" each inequivalent atom \n",
"# of the unit cell with a number. The \"Ti\" atom is tagged 0 and \"Se\" \n",
"# atoms are 1 and 2.\n",
"for i in range(3): \n",
" TiSe2[i].tag = i\n",
"\n",
"cluster = hemispherical_cluster(TiSe2, emitter_tag=0, emitter_plane=1, planes=5)\n",
"cluster.emitter = get_atom_index(cluster, 0, 0, 0)\n",
"view(cluster, viewer='x3d')"
]
},
{
"cell_type": "markdown",
"id": "3b029e1b-6871-42ac-9cdd-65c583404e3d",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"### Effect of the scattering order\n",
"\n",
"Use the line belows to create a calculator and compute a $\\theta$-$\\phi$ scan of the Ti(2p)\n",
"\n",
"```{literalinclude} TiSe2_1_tofill.py\n",
" :start-at: Create a\n",
"```"
]
},
{
"cell_type": "markdown",
"id": "8169ad09-36b4-4f0a-b737-378e2f78b3df",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"Compute a scan for an emitter in the first trilayer and in the second trilayer for scattering orders from 1 (single scattering) to 3 in order to complete the figure below.\n",
"What do you conclude about the value of the `calc.calculation_parameters.scattering_order` ?\n",
"\n",
"```{figure-md} results-fig\n",
"<img src=\"results.jpg\" width=\"400px\" align=\"center\">\n",
"\n",
"$\\theta$-$\\phi$ scan of Ti(2p) at 1030 eV kinetic energy for an emitter in the first trilayer (left column) and in the second trilayer (right column). Each row correspond to a growing value for the `calc.calculation_parameters.scattering_order` parameter (from 1 to 5).\n",
"```\n",
"\n",
":::\n",
"\n",
"::::"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -3,7 +3,13 @@
{
"cell_type": "markdown",
"id": "c0a860db-0f72-4785-81f4-831e48b3a49f",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"# Activity 6: Effect of the temperature\n",
"\n",
@ -73,7 +79,7 @@
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"With the help of the [MsSpec documentation](https://msspec.cnrs.fr/parameters.html) and the second paragraph p6791 of the [article cited above](#msd-paper),\n",
"complete the hilighted lines in the following script to compute the anisotropy of Cu(2p) $\\phi$-scans for polar angle $\\theta$=45° and 83°.\n",
"complete the hilighted lines in the [following script](Cu_temperature.py \"download\") to compute the anisotropy of Cu(2p) $\\phi$-scans for polar angle $\\theta$=45° and 83°.\n",
"\n",
"How is varying the anisotropy versus the temperature. How can you qualitatively explain this variation ?\n",
"\n",
@ -98,7 +104,9 @@
"tags": []
},
"source": [
"```{toggle}\n",
"```{admonition} *Solution...*\n",
":class: tip\n",
":class: dropdown\n",
"\n",
":::{literalinclude} Cu_temperature_completed.py\n",
":lineno-match:\n",
@ -133,7 +141,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.13"
"version": "3.11.3"
}
},
"nbformat": 4,

View File

@ -0,0 +1,118 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "c0a860db-0f72-4785-81f4-831e48b3a49f",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"# Activity 6: Effect of the temperature\n",
"\n",
"\n",
"## Surface and bulk effects of the temperature\n",
"\n",
"In this example, we will look at the effects of the temperature on the X-Ray photoelectron diffraction from a copper substrate. We will base our python script on a paper published in 1986 by R. Trehan and S. Fadley. In their work, they performed azimutal scans of a copper(001) surface at 2 different polar angles: one at grazing incidence and one at 45° for incresing temperatures from 298K to roughly 1000K.\n",
"\n",
"For each azimutal scan, they looked at the anisotropy of the signal, that is:\n",
"\n",
"```{math}\n",
":label: eq-anisotropy\n",
"\\frac{I_{max} - I_{min}}{I_{max}}=\\frac{\\Delta I}{I_{max}}\n",
"```\n",
"\n",
"This value is representative of how clear are the *modulations* of the signal. They also proposed single scattering calculations that reproduced well these results.\n",
"\n",
"We will reproduce this kind of calculations to introduce the parameters that control the vibrational damping.\n",
"\n",
"(msd-paper)=\n",
":::{seealso}\n",
"based on this paper from R. Trehan and C.S. Fadley\n",
"[Phys. Rev. B **34** p678498 (2012)](https://doi.org/10.1103/PhysRevB.34.6784)\n",
":::\n",
"\n",
"### The script\n",
"\n",
"Since we want to distinguish between bulk (low polar angles, $\\theta = 45°$ in the paper) and surface effects (large polar angles, $\\theta = 83°$ in the paper), we need to compute scans for different emitters and different depths in the cluster.\n",
"\n",
"The script contains 3 functions:\n",
"1. The `create_clusters` function will build clusters with increasing number of planes, with the emitter being in the deepest plane for each cluster.\n",
"2. The function `compute` will compute the azimuthal scan for a given cluster.\n",
"3. The `analysis` function will sum the intensity from each plane for a given temperature. This will be the *substrate total signal* (more on this in the {ref}`path-filtering` section). The function will also compute the anisotropy (equation {eq}`eq-anisotropy`).\n",
"\n",
"MsSpec can introduce temperature effects in two ways: either by using the Debye Waller model or by doing an average over the phase shifts. We will explore the latter in this example.\n",
"\n",
"Regardless of the option chosen to model temperature effects, we need to define mean square displacement (MSD) values of the atoms in our cluster. We will use the Debye model for this. The MSD is defined as follows:\n",
"\n",
":::{math}\n",
":label: eq-debye\n",
"<U_j^2(T)> = \\frac{3\\hbar^2 T}{M K_B \\Theta_D^2}\n",
":::\n",
"\n",
"where $\\hbar$ is the reduce Planck's constant, $T$ is the temperature, $M$ is the mass of the atom, $k_B$ is the Boltzmann's constant and $\\Theta_D$ is the Debye temperature of the sample.\n",
"\n",
"To get an idea of the typical order of magnitude for MSD, the figure below plots the values of MSD for copper for temperatures ranging from 300 K to 1000 K.\n",
"\n",
":::{figure-md} msd-fig\n",
"<img src=\"msd.jpg\" alt=\"Cu MSD\" width=\"600px\" align=\"center\">\n",
"\n",
"Variation of MSD for copper versus temperature using equation {eq}`eq-debye`\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "69b8c17d-ab66-4092-a492-005f05d80495",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"With the help of the [MsSpec documentation](https://msspec.cnrs.fr/parameters.html) and the second paragraph p6791 of the [article cited above](#msd-paper),\n",
"complete the hilighted lines in the [following script](Cu_temperature.py \"download\") to compute the anisotropy of Cu(2p) $\\phi$-scans for polar angle $\\theta$=45° and 83°.\n",
"\n",
"How is varying the anisotropy versus the temperature. How can you qualitatively explain this variation ?\n",
"\n",
"```{literalinclude} Cu_temperature.py\n",
":lineno-match:\n",
":emphasize-lines: 40-41,44-48\n",
"```\n",
"\n",
":::\n",
"\n",
"::::"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -3,7 +3,13 @@
{
"cell_type": "markdown",
"id": "42cfa8b1-20d2-47e4-a1f0-161c4517df2c",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"(path-filtering)=\n",
"# Activity 7: Large clusters and path filtering"
@ -42,7 +48,13 @@
{
"cell_type": "markdown",
"id": "0f78af28-335e-4f6b-9b98-929f9e6965f8",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"::::{tab-set}\n",
"\n",
@ -66,16 +78,24 @@
{
"cell_type": "markdown",
"id": "a83ee1b8-dc25-4db9-a3bd-c5ba8443f758",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
":::{toggle}\n",
"```{admonition} *Solution...*\n",
":class: tip\n",
":class: dropdown\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",
":::{math}\n",
":label: eq-nbpaths\n",
"\\sum_{i=0}^{i=M} (N-1)^i\n",
"```\n",
":::\n",
"\n",
":::{figure-md} nbpaths-fig\n",
"<img src=\"fig1.jpg\" alt=\"path filtering\" width=\"600px\" align=\"center\">\n",
@ -83,7 +103,7 @@
"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",
":::"
"```"
]
},
{
@ -110,7 +130,13 @@
{
"cell_type": "markdown",
"id": "28aae2f7-2af9-4630-b89d-ab634725ad79",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"## Application to a deep plane in a Si(001) sample\n",
"\n",
@ -129,7 +155,7 @@
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"\n",
"The following script is almost completed, try to define path filtering options (no backscattering, accept all paths with forward angles < 40° and reject paths longer than the diameter of the cluster).\n",
"The [following script](Si001.py \"download\") is almost completed, try to define path filtering options (no backscattering, accept all paths with forward angles < 40° and reject paths longer than the diameter of the cluster).\n",
"\n",
"```{literalinclude} Si001.py\n",
":lineno-match:\n",
@ -148,9 +174,18 @@
{
"cell_type": "markdown",
"id": "19fbd486-b0c1-450c-a00d-79984945aefd",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"```{toggle}\n",
"```{admonition} *Solution...*\n",
":class: tip\n",
":class: dropdown\n",
"\n",
"The calculation took few seconds and the result is very close to the calculation with all scattering paths.\n",
"\n",
"Only 0.01% of 3{sup}`rd` order paths were actually taken into account\n",

View File

@ -0,0 +1,171 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "42cfa8b1-20d2-47e4-a1f0-161c4517df2c",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"(path-filtering)=\n",
"# Activity 7: Large clusters and path filtering"
]
},
{
"cell_type": "markdown",
"id": "2f802e59-3ebc-4c5d-a034-42a706044d87",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"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": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"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": "5de975f5-8f3d-432e-bfcc-8455bc50a862",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"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",
"<img src=\"filters.jpg\" alt=\"path filtering\" width=\"600px\" align=\"center\">\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",
":::"
]
},
{
"cell_type": "markdown",
"id": "28aae2f7-2af9-4630-b89d-ab634725ad79",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"## Application to a deep plane in a Si(001) sample\n",
"\n",
"The following script will compute the contribution of a Si(2p) atom in the 4{sup}`th` plane of a Si(001) cluster at scattering order 3.\n",
"\n",
"Taking into account all scattering paths took 15 minutes to compute.\n",
"\n",
"(msd-paper)=\n",
":::{seealso}\n",
"based on this paper from S. Tricot *et al.*\n",
"[J. Electron. Spectrosc. Relat. Phenom. **256** 147176 (2022)](https://doi.org/10.1016/j.elspec.2022.147176)\n",
":::\n",
"\n",
"\n",
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"\n",
"The [following script](Si001.py \"download\") is almost completed, try to define path filtering options (no backscattering, accept all paths with forward angles < 40° and reject paths longer than the diameter of the cluster).\n",
"\n",
"```{literalinclude} Si001.py\n",
":lineno-match:\n",
":emphasize-lines: 37-41\n",
"```\n",
"\n",
"1. How long was your calculation ?\n",
"2. How does it compare to the calculation with **all** scattering paths up to order 3 ?\n",
"3. What is the proportion of scattering paths of order 3 that were actually taken into account ?\n",
"\n",
":::\n",
"\n",
"::::"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -3,7 +3,13 @@
{
"cell_type": "markdown",
"id": "2ff5929f-c066-496f-b078-0bbc2ab49428",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"# Activity 8: Inequivalent emitters and the XPD of a substrate"
]
@ -92,9 +98,17 @@
{
"cell_type": "markdown",
"id": "8a3a48ef-196f-435a-b342-3a73e62160f8",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
":::{toggle}\n",
"```{admonition} *Solution...*\n",
":class: tip\n",
":class: dropdown\n",
"\n",
":::{figure-md} AlN-fig3\n",
"<img src=\"AlN-fig3.jpg\" alt=\"AlN number of clusters\" width=\"600px\" align=\"center\">\n",
@ -102,7 +116,7 @@
"Number of different clusters to build for Al(2p) and N(1s) in 3 planes\n",
":::\n",
"\n",
":::"
"```"
]
},
{
@ -123,9 +137,17 @@
{
"cell_type": "markdown",
"id": "abc64fdb-5895-4112-a987-66b3420d78eb",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"```{toggle}\n",
"```{admonition} *Solution...*\n",
":class: tip\n",
":class: dropdown\n",
"\n",
":::{figure-md} AlN-fig4\n",
"<img src=\"AlN-fig4.png\" alt=\"AlN results\" width=\"600px\" align=\"center\">\n",

View File

@ -0,0 +1,147 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "2ff5929f-c066-496f-b078-0bbc2ab49428",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"# Activity 8: Inequivalent emitters and the XPD of a substrate"
]
},
{
"cell_type": "markdown",
"id": "394b0c02-f28e-4074-86e5-9dfdf0447adb",
"metadata": {},
"source": [
"XPD can be used to study the adsorption of atoms or molecules on surfaces ([Activity 3](#ssc)), or atomic substitutions on surfaces ([Activity 2](#exp-setup)). In this case, modeling is relatively straightforward, since only one emitter atom is involved.\n",
"\n",
"We have seen from previous examples that, for kinetic energies $\\gtrsim$ 500 eV, the use of Rehr-Albers series expansion and scattering path filtering give access to the intensity of deeper emitter atoms ([Activity 7](#path-filtering)).\n",
"This is the key to computing the total photodiffraction signal of a *substrate*. As emitted photoelectrons originate from highly localized core levels around the atoms, the total signal corresponds to the (incoherent) sum of the intensities of all inequivalent emitters in the probed volume.\n",
"\n",
"Let's take a look at how this is done on the following example. \n",
"\n",
"\n",
"## The Aluminium Nitride (AlN) polarity\n",
"\n",
"In this example, we will compute polar diagrams of an aluminum nitride substrate.\n",
"\n",
"In a work published in 1999, Lebedev *et al.* demonstrated that Photoelectron diffraction can be used as a non invasive tool to unambiguously state the polarity of an AlN surface. Aluminium nitride cristallizes in an hexagonal cell and the authors experimentally showed that the polarity of the surface can be controlled by the annealing temperature during the growth. Both polarities are sketched in the [figure](#AlN-fig1) below.\n"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "5a4036dc-d087-419f-9a44-749a8b313d5c",
"metadata": {},
"source": [
"(aln-paper)=\n",
":::{seealso}\n",
"based on this paper from V. Lebedev *et al.*\n",
"[J. Cryst. Growth. **207(4)** p266-72 (1999)](https://doi.org/10.1016/S0022-0248(99)00375-9)\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "fc1cf08e-77ba-49ea-99a9-8a7bac7c98c7",
"metadata": {},
"source": [
":::{figure-md} AlN-fig1\n",
"<img src=\"AlN-fig1.jpg\" alt=\"AlN crystal direction\" width=\"600px\" align=\"center\">\n",
"\n",
"AlN hexagonal lattice. Left) N polarity with nitrogen terminated surface and AlN{sub}`4` tetrahedrons pointing downward. Right) Al polarity with aluminium terminated surface and AlN{sub}`4` tetrahedrons pointing upward\n",
":::"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "fc180c7b-eb23-47c6-8d18-e092bc777843",
"metadata": {},
"source": [
"The AlN(0001) and (00.-1) faces share the same crystallograpphic symmetry and the Al and N atoms have the same geometrical surrounding differing only in the exchange of Al and N atoms ({numref}`Fig. %s <AlN-fig2>`).\n",
"\n",
"It is thus expected that Al(2p) and N(1s) XPD patterns exhibit almost the same features with only small differences due to the contrast between Al and N scattering amplitudes.\n",
"\n",
":::{figure-md} AlN-fig2\n",
"<img src=\"AlN-fig2.jpg\" alt=\"AlN crystal direction\" width=\"600px\" align=\"center\">\n",
"\n",
"Side views of N- or Al- terminated surfaces showing nearest neighbours main polar crystallographic directions. The inset shows the experimental Al(2p)/N(1s) ratio versus polar angle for both AlN polarities (taken from [Lebedev *et al.*](#aln-paper)).\n",
":::\n",
"\n",
"The strongest differences in photoemission intensities suitable for a quick and unambiguous determination of polarity were found in the (10-10) azimuthal plane at **32°** and **59°** (polar scans in the inset of {numref}`Fig. %s <AlN-fig2>`).\n",
"\n",
"These are the directions of short neighbor distances between the atoms of the same element (32°) and between Al and N atoms (58.5°), respectively.\n"
]
},
{
"cell_type": "markdown",
"id": "86c20245-abca-4587-bccf-90e0fb09f73c",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"Using the crystal view in {numref}`Fig. %s <AlN-fig1>` and assuming that we want to compute Al(2p) and N(1s) intensities for emitters located in 3 different planes to get a *substrate* signal. How many clusters do we need to build ? \n",
"\n",
":::\n",
"\n",
"::::"
]
},
{
"cell_type": "markdown",
"id": "82973b9c-bf0c-462a-8114-17ac1e83b799",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"Download [this script](AlN.py) and fill in the lines indicated by the comments “FILL HERE”. Run the calculation and check that you are reproducing polar scan of {numref}`Fig. %s <AlN-fig2>`.\n",
"\n",
":::\n",
"\n",
"::::"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -4,7 +4,13 @@
"attachments": {},
"cell_type": "markdown",
"id": "aa43e0e7-0c18-4750-9e2b-3a48f106d2ca",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"(RFactor)=\n",
"# Activity 9: Comparing simulation and experiment with R-factors\n",
@ -33,7 +39,13 @@
{
"cell_type": "markdown",
"id": "91c03801-b46b-4844-8c89-655700419063",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"::::{tab-set}\n",
"\n",
@ -61,9 +73,18 @@
{
"cell_type": "markdown",
"id": "d1be5047-fb75-4e98-a6a2-fc6f678e68ff",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"```{toggle}\n",
"```{admonition} *Solution...*\n",
":class: tip\n",
":class: dropdown\n",
"\n",
"Here is the code of the `create_cluster` function\n",
"\n",
":::{literalinclude} COFe_completed.py\n",
@ -98,9 +119,18 @@
{
"cell_type": "markdown",
"id": "670cbd24-efd4-4c51-89e2-f1d96c53908d",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"```{toggle}\n",
"```{admonition} *Solution...*\n",
":class: tip\n",
":class: dropdown\n",
"\n",
"Here are the code of the nested *for loops*\n",
"\n",
":::{literalinclude} COFe_completed.py\n",
@ -144,9 +174,17 @@
{
"cell_type": "markdown",
"id": "aa8d2dc4-286a-441d-9c21-dab6bac8145c",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"```{toggle}\n",
"```{admonition} *Solution...*\n",
":class: tip\n",
":class: dropdown\n",
"\n",
"6 R-factors out of 12 do agree that *variable set n°30* gives the best agreement. The set n°30 corresponds to\n",
"$\\theta=55°$ and $\\phi=0°$.\n",

View File

@ -0,0 +1,150 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "aa43e0e7-0c18-4750-9e2b-3a48f106d2ca",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"(RFactor)=\n",
"# Activity 9: Comparing simulation and experiment with R-factors\n",
"In order to extract precise crystallographic information from electronic spectroscopy, we need to compare MsSpec calculations with experimental results and adjust the modelling parameters to simulate the experiment as accurately as possible.\n",
"\n",
"*R-factors* (reliability factors) are commonly used for this task. In the following example, we will see how MsSpec can extract the adsorption geometry of a molecule.\n",
"\n",
"## The unusual tilt of CO molecule on Fe(001)\n",
"The carbon monoxide molecule can be adsorbed onto a Fe(001) surface in the hollow site. It was experimentally demonstrated that the CO molecule is tilted by 55$\\pm$2° in <100> azimuthal directions. The molecule is bonded to the Fe surface by the carbon atom and the adsorption height was estimated to be $\\sim$ 0.6 Å.\n",
"\n",
"(COFe-paper)=\n",
":::{seealso}\n",
"based on this paper from R. S. Saiki *et al.*\n",
"[Phys. Rev. Lett. **63(3)** p283-6 (1989)](https://doi.org/10.1103/PhysRevLett.63.283)\n",
":::\n",
"\n",
"We will try to reproduce the polar scan of the figure below of CO adsorbed in the hollow site of the Fe(001) surface with simple single scattering calculations with MsSpec and by using R-Factors to find the best adsorption geometry. We will use the simple cluster displayed on the left hand side of the figure.\n",
"\n",
":::{figure-md} COFe-fig1\n",
"<img src=\"COFe_fig1.jpg\" alt=\"\" width=\"600px\" align=\"center\">\n",
"\n",
"Small cluster used for SSC calculations (left) and (right) Normalized polar scan of the C(1s) at 1202 eV for [100] and [1-10] azimths.\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "91c03801-b46b-4844-8c89-655700419063",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"Download [this script](./COFe.py) and write the body of the function `create_cluster`. The function should return a \n",
"small cluster of 5 Fe atoms with the CO molecule adsorbed like in figure {numref}`Fig. %s <COFe-fig2>` below. The function\n",
"will accept 4 keyword arguments to control the adsorption geometry.\n",
"\n",
"```{figure-md} COFe-fig2\n",
"<img src=\"COFe_fig2.jpg\" alt=\"CO-Fe adsorption geometry\" width=\"600px\" align=\"center\">\n",
"\n",
"Adsorption geometry of carbon monoxide on Fe(001).\n",
"```\n",
"\n",
"```{note}\n",
"Remember to use the [`ase.build.bulk`](https://wiki.fysik.dtu.dk/ase/ase/build/build.html#ase.build.bulk), the [`msspec.utils.hemispherical_cluster`](https://msspec.cnrs.fr/faq/hemispherical_cluster/hemispherical_cluster.html#hemispherical-cluster-faq) and the [`ase.build.add_adsorbate`](https://wiki.fysik.dtu.dk/ase/ase/build/surface.html#ase.build.add_adsorbate) \n",
"functions.\n",
"```\n",
"\n",
":::\n",
"\n",
"::::"
]
},
{
"cell_type": "markdown",
"id": "c7697c4f-949b-4261-abaf-96eefaa9a6ba",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"Now that the `create_cluster` function is done, look at the rest of the script. The next function is called `compute_polar_scan` and will obviously be used to compute the $\\theta$-scan of the C1s for a given cluster geometry.\n",
"Finally there is the *Main part* that is built in two sections:\n",
"\n",
"1. A section containing nested *for loops*\n",
"2. A final section for *R-Factor analysis*\n",
"\n",
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"1. Complete the nested for loops in section 1) in order to compute polar scans for CO molecule tilted from 45° to 60° with a 1° step and aligned either along the [100] direction of Fe, 30° from this direction or along [110]. The adsorption height is 0.6 Å and the bond length is 1.157 Å.\n",
"2. What is the best $(\\theta, \\phi)$ according to the R-Factor analysis\n",
":::\n",
"\n",
"::::"
]
},
{
"cell_type": "markdown",
"id": "f7827b3c-0cac-42e2-a587-8b30ee3632b4",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"MsSpec uses 12 different R-Factors formula to compare the calculted curve to the experimental data. The set of parameters giving the best agreement according to the majority of those 12 R-factors is assumed to be the best solution. Here are the R-factors formula used in MsSpec\n",
"\n",
":::{figure-md} rfactors-formula\n",
"<img src=\"formula.jpg\" alt=\"R-Factor result\" width=\"800px\" align=\"center\">\n",
"\n",
"The 12 R-Factors used in MsSpec. The Pendry's R-Factor is n°11.\n",
":::\n",
"\n",
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"How many R-Factors do agree that $(\\theta,\\phi)=(55,0)$ gives the best agreement ?\n",
":::\n",
"\n",
"::::"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -3,7 +3,13 @@
{
"cell_type": "markdown",
"id": "38d3e621-e866-43e1-9c92-f473d1e755c0",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"# Activity 10: Parallelization and multi-processing in MsSpec"
]
@ -11,7 +17,13 @@
{
"cell_type": "markdown",
"id": "1dccb5e3-1cd3-4732-a7ba-81a8a94c89dc",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"As you can see from the previous examples, a complete simulation may require several multiple scattering calculations, for instance to calculate the total intensity of a substrate or to optimize the geometry of a system. As the calculations are often time consuming, it can be useful to distribute these tasks over several processors to make the most of hardware resources.\n",
"Although MsSpec is not fully parallelized, the code does offer a number of features, which we will explore here.\n",
@ -76,37 +88,18 @@
"tags": []
},
"source": [
"```{admonition} *Solution...*\n",
":class: tip\n",
":class: dropdown\n",
"\n",
":::{literalinclude} COFe_mp_completed.py\n",
":lineno-start: 63\n",
":linenos: true\n",
":lines: 63-86\n",
":emphasize-lines: 6,7, 9,10, 18\n",
":::"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1b25de5e-4402-4746-8082-9f7d8362b3f6",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"answer",
"hide"
]
},
"outputs": [],
"source": [
"from IPython.display import Markdown\n",
":::\n",
"\n",
"Markdown(\"\"\"\n",
"\n",
"Hello world\n",
"\n",
"\"\"\")"
"```"
]
}
],

View File

@ -0,0 +1,102 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "38d3e621-e866-43e1-9c92-f473d1e755c0",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"# Activity 10: Parallelization and multi-processing in MsSpec"
]
},
{
"cell_type": "markdown",
"id": "1dccb5e3-1cd3-4732-a7ba-81a8a94c89dc",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"As you can see from the previous examples, a complete simulation may require several multiple scattering calculations, for instance to calculate the total intensity of a substrate or to optimize the geometry of a system. As the calculations are often time consuming, it can be useful to distribute these tasks over several processors to make the most of hardware resources.\n",
"Although MsSpec is not fully parallelized, the code does offer a number of features, which we will explore here.\n",
"\n",
"## Matrix inversion parallelization\n",
"\n",
"When available during installation, MsSpec will link with the system lapack library. It will be used to invert the matrix in the `inversion` option of the MsSpec `calculator`. To allow MsSpec to use this shared memory parallelism, you need to set the number of cores to be used in the `OMP_NUM_THREADS` environment variable.\n",
"\n",
"You can set this variable just for the execution of your script. For example:\n",
"\n",
"```sh\n",
"$ OMP_NUM_THREADS=12 python my_script.py\n",
"```\n",
"\n",
"will use 12 cores for inverting the matrix in your script.\n",
"\n",
"It is also possible to set environment variable inside your python script.\n",
"\n",
"```python\n",
"import os\n",
"\n",
"os.environ['OMP_NUM_THREADS'] = 12\n",
"```\n",
"\n",
"It may be useful for technical reasons or to use different number of cores in some parts of your script.\n",
"\n",
"## Process-based parallelism\n",
"\n",
"Another kind of parallelization used in MsSpec is multiprocessing. Quite often, you need to run different *independent* calculations. MsSpec provides a simple *looper* that can be useful for multiprocessing. Let's demonstrate it with the previous example CO/Fe(001).\n",
"\n",
"[This script](COFe_mp.py) is the multiprocessed version of the previous one. You can see that the previous nested for loops are now replaced by some declarative content (lines 63-67) and the definition of a `process` function (whose name \n",
"can be changed).\n",
"\n",
"With the `msspec.looper` package, the user define `Sweep` objects that are parameters of the calculation or of the cluster. The `process` function must accept as many arguments as parameters to sweep (+ the `**kwargs`).\n",
"\n",
"A `Looper` object is created (line 76) and the `process` function is set to its `pipeline` attribute (line 77). When MsSpec will run the `looper`, it will combine all parameters values to unique individual sets and MsSpec will distribute the calculations over the number of processors specified in the `ncpu` option.\n",
"\n",
":::{literalinclude} COFe_mp.py\n",
":lineno-start: 63\n",
":linenos: true\n",
":lines: 63-84\n",
":::\n",
"\n",
"\n",
"::::{tab-set}\n",
"\n",
":::{tab-item} <i class=\"fa-solid fa-circle-question\"></i> Quiz\n",
"In the paper discussed in {ref}`RFactor`, experimental values of the anisotropy suggest an adsorption height between 0.2 and 0.6 Å. Modify the script to add another sweep for variying the adsorption height of the CO molecule.\n",
":::\n",
"\n",
"::::"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

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/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />

View File

@ -31,7 +31,7 @@
<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/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />

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/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />

Binary file not shown.

View File

@ -1,43 +0,0 @@
Traceback (most recent call last):
File "/opt/msspec/msspec_venv/lib/python3.11/site-packages/jupyter_core/utils/__init__.py", line 154, in wrapped
asyncio.get_running_loop()
RuntimeError: no running event loop
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/msspec/msspec_venv/lib/python3.11/site-packages/jupyter_cache/executors/utils.py", line 58, in single_nb_execution
executenb(
File "/opt/msspec/msspec_venv/lib/python3.11/site-packages/nbclient/client.py", line 1319, in execute
return NotebookClient(nb=nb, resources=resources, km=km, **kwargs).execute()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/msspec/msspec_venv/lib/python3.11/site-packages/jupyter_core/utils/__init__.py", line 158, in wrapped
return loop.run_until_complete(inner)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/pyenv/versions/3.11.3/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/opt/msspec/msspec_venv/lib/python3.11/site-packages/nbclient/client.py", line 709, in async_execute
await self.async_execute_cell(
File "/opt/msspec/msspec_venv/lib/python3.11/site-packages/nbclient/client.py", line 1062, in async_execute_cell
await self._check_raise_for_error(cell, cell_index, exec_reply)
File "/opt/msspec/msspec_venv/lib/python3.11/site-packages/nbclient/client.py", line 918, in _check_raise_for_error
raise CellExecutionError.from_cell_and_msg(cell, exec_reply_content)
nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
------------------
```{toggle}
:::{literalinclude} Ni_chain1.py
:lines: 1-9
:linenos: true
```
------------------
Cell In[1], line 1
 ```{toggle}
^
SyntaxError: invalid syntax

View File

@ -30,7 +30,7 @@
<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/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<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" />

File diff suppressed because one or more lines are too long