SpectroscopySchool/msspecbook/_build/html/light/Activity01_light.html

875 lines
38 KiB
HTML

<!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 1: Getting started &#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?v=be8a1c11" />
<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 = 'light/Activity01_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/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/light/Activity01_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 1: Getting started</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="#building-atomic-systems">Building atomic systems</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#barebone-script-for-msspec">Barebone script for MsSpec</a><ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#ped-polar-scan-for-cu-001">PED polar scan for Cu(001)</a></li>
</ul>
</li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#shaping-a-cluster">Shaping a cluster</a></li>
</ul>
</nav>
</div>
</div>
</div>
<div id="searchbox"></div>
<article class="bd-article">
<section class="tex2jax_ignore mathjax_ignore" id="activity-1-getting-started">
<h1>Activity 1: Getting started<a class="headerlink" href="#activity-1-getting-started" title="Link to this heading">#</a></h1>
<p>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.</p>
<p>In the most recent version of MsSpec, the program is interfaced with python (<a class="reference external" href="https://msspec.cnrs.fr/">https://msspec.cnrs.fr/</a>), allowing for much more flexibility and interplay with other simulation techniques.</p>
<section id="building-atomic-systems">
<h2>Building atomic systems<a class="headerlink" href="#building-atomic-systems" title="Link to this heading">#</a></h2>
<p>MsSpec works in the <em>cluster</em> approach. Building such a cluster for a calculation is a fundamental step.
We use the <a class="reference external" href="https://wiki.fysik.dtu.dk/ase/">python Atomic Simulation Environment (ASE)</a> for this.</p>
<p>ASE is a set of tools and Python modules for setting up, manipulating, running, visualizing and analyzing atomistic simulations.
Building atomic systems, structures… is pretty straightforward:</p>
<div class="cell tag_remove-output docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># To build a molecule with ASE</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">molecule</span>
<span class="c1"># To view</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 a water molecule</span>
<span class="n">water</span> <span class="o">=</span> <span class="n">molecule</span><span class="p">(</span><span class="s1">&#39;H2O&#39;</span><span class="p">)</span>
<span class="c1"># Display it</span>
<span class="n">view</span><span class="p">(</span><span class="n">water</span><span class="p">)</span>
</pre></div>
</div>
</div>
</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 3.052956">
<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.119262">
<shape>
<appearance>
<material diffuseColor="1.0 0.051 0.051"/>
</appearance>
<sphere radius="0.66"/>
</shape>
</transform>
<transform translation="0.0 0.763239 -0.477047">
<shape>
<appearance>
<material diffuseColor="1.0 1.0 1.0"/>
</appearance>
<sphere radius="0.31"/>
</shape>
</transform>
<transform translation="0.0 -0.763239 -0.477047">
<shape>
<appearance>
<material diffuseColor="1.0 1.0 1.0"/>
</appearance>
<sphere radius="0.31"/>
</shape>
</transform>
</group>
</group>
</transform>
</scene>
<!--End of Inserted Scene-->
</X3D>
</body>
</html>
</div></div>
</div>
</section>
<section id="barebone-script-for-msspec">
<h2>Barebone script for MsSpec<a class="headerlink" href="#barebone-script-for-msspec" title="Link to this heading">#</a></h2>
<p>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.</p>
<p>There are typically 3 steps to follow to get a result with MsSpec:</p>
<ol class="arabic simple">
<li><p>Create a <em>cluster</em></p></li>
<li><p>Create an ASE <em>calculator</em></p></li>
<li><p>Run the simulation</p></li>
</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 internal" href="#cu.py"><span class="xref myst">cu.py</span></a> python script and the <a class="reference internal" href="#copper.cif"><span class="xref 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="cell tag_remove-input docutils container">
<div class="cell_output docutils container">
<div class="output traceback highlight-ipythontb notranslate"><div class="highlight"><pre><span></span><span class="gt">---------------------------------------------------------------------------</span>
<span class="ne">FileNotFoundError</span><span class="g g-Whitespace"> </span>Traceback (most recent call last)
<span class="n">Cell</span> <span class="n">In</span><span class="p">[</span><span class="mi">3</span><span class="p">],</span> <span class="n">line</span> <span class="mi">6</span>
<span class="g g-Whitespace"> </span><span class="mi">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="g g-Whitespace"> </span><span class="mi">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="ne">----&gt; </span><span class="mi">6</span> <span class="n">cluster</span> <span class="o">=</span> <span class="n">read</span><span class="p">(</span><span class="s1">&#39;copper.cif&#39;</span><span class="p">)</span>
<span class="g g-Whitespace"> </span><span class="mi">7</span> <span class="c1"># view the cluster</span>
<span class="g g-Whitespace"> </span><span class="mi">8</span> <span class="n">view</span><span class="p">(</span><span class="n">cluster</span><span class="p">,</span> <span class="n">viewer</span><span class="o">=</span><span class="s1">&#39;x3d&#39;</span><span class="p">)</span>
<span class="nn">File /opt/msspec/msspec_venv/lib/python3.11/site-packages/ase/io/formats.py:808,</span> in <span class="ni">read</span><span class="nt">(filename, index, format, parallel, do_not_split_by_at_sign, **kwargs)</span>
<span class="g g-Whitespace"> </span><span class="mi">806</span> <span class="k">if</span> <span class="n">index</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="g g-Whitespace"> </span><span class="mi">807</span> <span class="n">index</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
<span class="ne">--&gt; </span><span class="mi">808</span> <span class="nb">format</span> <span class="o">=</span> <span class="nb">format</span> <span class="ow">or</span> <span class="n">filetype</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="n">read</span><span class="o">=</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="nb">str</span><span class="p">))</span>
<span class="g g-Whitespace"> </span><span class="mi">810</span> <span class="n">io</span> <span class="o">=</span> <span class="n">get_ioformat</span><span class="p">(</span><span class="nb">format</span><span class="p">)</span>
<span class="g g-Whitespace"> </span><span class="mi">811</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">index</span><span class="p">,</span> <span class="p">(</span><span class="nb">slice</span><span class="p">,</span> <span class="nb">str</span><span class="p">)):</span>
<span class="nn">File /opt/msspec/msspec_venv/lib/python3.11/site-packages/ase/io/formats.py:983,</span> in <span class="ni">filetype</span><span class="nt">(filename, read, guess)</span>
<span class="g g-Whitespace"> </span><span class="mi">980</span> <span class="k">return</span> <span class="n">ext</span>
<span class="g g-Whitespace"> </span><span class="mi">982</span> <span class="k">if</span> <span class="n">orig_filename</span> <span class="o">==</span> <span class="n">filename</span><span class="p">:</span>
<span class="ne">--&gt; </span><span class="mi">983</span> <span class="n">fd</span> <span class="o">=</span> <span class="n">open_with_compression</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;rb&#39;</span><span class="p">)</span>
<span class="g g-Whitespace"> </span><span class="mi">984</span> <span class="k">else</span><span class="p">:</span>
<span class="g g-Whitespace"> </span><span class="mi">985</span> <span class="n">fd</span> <span class="o">=</span> <span class="n">orig_filename</span> <span class="c1"># type: ignore[assignment]</span>
<span class="nn">File /opt/msspec/msspec_venv/lib/python3.11/site-packages/ase/io/formats.py:612,</span> in <span class="ni">open_with_compression</span><span class="nt">(filename, mode)</span>
<span class="g g-Whitespace"> </span><span class="mi">609</span> <span class="k">return</span> <span class="n">lzma</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="n">mode</span><span class="p">)</span>
<span class="g g-Whitespace"> </span><span class="mi">610</span> <span class="k">else</span><span class="p">:</span>
<span class="g g-Whitespace"> </span><span class="mi">611</span> <span class="c1"># Either None or unknown string</span>
<span class="ne">--&gt; </span><span class="mi">612</span> <span class="k">return</span> <span class="nb">open</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="n">mode</span><span class="p">)</span>
<span class="ne">FileNotFoundError</span>: [Errno 2] No such file or directory: &#39;copper.cif&#39;
</pre></div>
</div>
</div>
</div>
<figure class="align-default" id="cu-xpd">
<a class="reference internal image-reference" href="light/fig1.png"><img alt="light/fig1.png" class="align-center" src="light/fig1.png" style="width: 600px;" />
</a>
<figcaption>
<p><span class="caption-text">Cu(2p) polar scan for the copper cluster above</span><a class="headerlink" href="#cu-xpd" title="Link to this image">#</a></p>
</figcaption>
</figure>
</section>
</section>
<section id="shaping-a-cluster">
<h2>Shaping a cluster<a class="headerlink" href="#shaping-a-cluster" title="Link to this heading">#</a></h2>
<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>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>
<p>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</p>
<div class="cell tag_remove-output 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">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="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="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="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">cubic</span><span class="o">=</span><span class="kc">True</span><span class="p">)</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="n">planes</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> <span class="n">emitter_plane</span><span class="o">=</span><span class="mi">2</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>
<span class="n">view</span><span class="p">(</span><span class="n">cluster</span><span class="p">)</span>
</pre></div>
</div>
</div>
</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 14.440000000000001">
<group/>
</viewpoint>
<transform translation="-1.805 -1.805 -1.805">
<group>
<group>
<transform translation="0 0 0">
<shape>
<appearance>
<material diffuseColor="0 0 0"/>
</appearance>
<lineset vertexCount="5">
<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"/>
</lineset>
</shape>
</transform>
<transform translation="0.0 0.0 3.61">
<shape>
<appearance>
<material diffuseColor="0 0 0"/>
</appearance>
<lineset vertexCount="5">
<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"/>
</lineset>
</shape>
</transform>
<transform translation="0 0 0">
<shape>
<appearance>
<material diffuseColor="0 0 0"/>
</appearance>
<lineset vertexCount="5">
<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"/>
</lineset>
</shape>
</transform>
<transform translation="0.0 3.61 0.0">
<shape>
<appearance>
<material diffuseColor="0 0 0"/>
</appearance>
<lineset vertexCount="5">
<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"/>
</lineset>
</shape>
</transform>
</group>
<group>
<transform translation="-3.610000000000001 0.0 3.61">
<shape>
<appearance>
<material diffuseColor="0.784 0.502 0.2"/>
</appearance>
<sphere radius="1.32"/>
</shape>
</transform>
<transform translation="-1.8049999999999997 -1.8049999999999997 3.61">
<shape>
<appearance>
<material diffuseColor="0.784 0.502 0.2"/>
</appearance>
<sphere radius="1.32"/>
</shape>
</transform>
<transform translation="-1.8049999999999997 0.0 1.8050000000000002">
<shape>
<appearance>
<material diffuseColor="0.784 0.502 0.2"/>
</appearance>
<sphere radius="1.32"/>
</shape>
</transform>
<transform translation="-1.8049999999999997 1.8049999999999997 3.61">
<shape>
<appearance>
<material diffuseColor="0.784 0.502 0.2"/>
</appearance>
<sphere radius="1.32"/>
</shape>
</transform>
<transform translation="0.0 -3.6099999999999994 3.61">
<shape>
<appearance>
<material diffuseColor="0.784 0.502 0.2"/>
</appearance>
<sphere radius="1.32"/>
</shape>
</transform>
<transform translation="0.0 0.0 4.440892098500626e-16">
<shape>
<appearance>
<material diffuseColor="0.784 0.502 0.2"/>
</appearance>
<sphere radius="1.32"/>
</shape>
</transform>
<transform translation="0.0 -1.8049999999999997 1.8050000000000002">
<shape>
<appearance>
<material diffuseColor="0.784 0.502 0.2"/>
</appearance>
<sphere radius="1.32"/>
</shape>
</transform>
<transform translation="0.0 0.0 3.61">
<shape>
<appearance>
<material diffuseColor="0.784 0.502 0.2"/>
</appearance>
<sphere radius="1.32"/>
</shape>
</transform>
<transform translation="1.8049999999999997 -1.8049999999999997 3.61">
<shape>
<appearance>
<material diffuseColor="0.784 0.502 0.2"/>
</appearance>
<sphere radius="1.32"/>
</shape>
</transform>
<transform translation="1.8049999999999997 0.0 1.8050000000000002">
<shape>
<appearance>
<material diffuseColor="0.784 0.502 0.2"/>
</appearance>
<sphere radius="1.32"/>
</shape>
</transform>
<transform translation="0.0 1.8049999999999997 1.8050000000000002">
<shape>
<appearance>
<material diffuseColor="0.784 0.502 0.2"/>
</appearance>
<sphere radius="1.32"/>
</shape>
</transform>
<transform translation="0.0 3.6099999999999994 3.61">
<shape>
<appearance>
<material diffuseColor="0.784 0.502 0.2"/>
</appearance>
<sphere radius="1.32"/>
</shape>
</transform>
<transform translation="1.8049999999999997 1.8049999999999997 3.61">
<shape>
<appearance>
<material diffuseColor="0.784 0.502 0.2"/>
</appearance>
<sphere radius="1.32"/>
</shape>
</transform>
<transform translation="3.6099999999999994 0.0 3.61">
<shape>
<appearance>
<material diffuseColor="0.784 0.502 0.2"/>
</appearance>
<sphere radius="1.32"/>
</shape>
</transform>
</group>
</group>
</transform>
</scene>
<!--End of Inserted Scene-->
</X3D>
</body>
</html>
</div></div>
</div>
<figure class="align-default" id="cu-hemi">
<a class="reference internal image-reference" href="light/fig3.png"><img alt="light/fig3.png" class="align-center" src="light/fig3.png" style="width: 600px;" />
</a>
<figcaption>
<p><span class="caption-text">Cu(2p) polar scan for the hemispherical cluster.</span><a class="headerlink" href="#cu-hemi" title="Link to this image">#</a></p>
</figcaption>
</figure>
</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: "./light"
},
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="#building-atomic-systems">Building atomic systems</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#barebone-script-for-msspec">Barebone script for MsSpec</a><ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#ped-polar-scan-for-cu-001">PED polar scan for Cu(001)</a></li>
</ul>
</li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#shaping-a-cluster">Shaping a cluster</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>