# Examples on BornAgain

file:///usr/share/doc/bornagain/html/ref/sim/class/scattering/ex/index.html Recent content in Examples on BornAgain Hugo en-us

# GISAS

file:///usr/share/doc/bornagain/html/ref/sim/class/scattering/ex/gisas.html Mon, 01 Jan 0001 00:00:00 +0000 file:///usr/share/doc/bornagain/html/ref/sim/class/scattering/ex/gisas.html <h2 id="gisas-simulation-example">GISAS simulation example</h2> <p>In the following introductory example, we take a standard sample model from module <a href="https://jugit.fz-juelich.de/mlz/bornagain/-/tree/r23/Wrap/Python/std_samples.py">bornagain.std_samples</a>, a dilute random assembly of monodisperse cylindrical disks on a substrate.</p> <div class="galleryscg "> <div class="row justify-content-center align-items-center"> <figure > <a href="file:///usr/share/doc/bornagain/html/img/draw/CylindersInDWBA_setup.jpg"> <img src="file:///usr/share/doc/bornagain/html/img/draw/CylindersInDWBA_setup.jpg" width="350px"> </a> <figcaption> <p>Real-space model</p> </figcaption> </figure> <figure > <a href="file:///usr/share/doc/bornagain/html/img/auto/scatter2d/Cylinders.png"> <img src="file:///usr/share/doc/bornagain/html/img/auto/scatter2d/Cylinders.png" width="350px"> </a> <figcaption> <p>Scattering intensity</p> </figcaption> </figure> </div> </div> <div class="highlight"><div class="chroma"> <table class="lntable"><tr><td class="lntd"> <pre tabindex="0" class="chroma"><code></code></pre></td> <td class="lntd"> <pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"></code></pre></td></tr></table> </div> </div> <a class="linktofile" href="https://jugit.fz-juelich.de/mlz/bornagain/-/tree/r23/auto/Examples/scatter2d/Cylinders.py"/>auto/Examples/scatter2d/Cylinders.py</a> <p> <h3 id="explanation">Explanation</h3> <h4 id="function-get_simulation">Function get_simulation</h4> <p>The simulation of type <a href="../">ScatteringSimulation</a> is defined by beam, sample, and detector.</p> <p>The incoming beam is defined by the constructor <code>Beam</code> with arguments intensity, wavelength, and glancing angle.</p> <p>To define the wavelength, we use the unit multiplier <code>nm</code>. As it happens, the internal unit for microscopic lengths in BornAgain is one nanometer; therefore the constant <code>nm</code> is just <code>1</code>, and <code>*nm</code> could be omitted from the code, but we recommend to leave it for the benefit of human readers.</p>

# without DWBA terms

file:///usr/share/doc/bornagain/html/ref/sim/class/scattering/ex/born-approximation.html Mon, 01 Jan 0001 00:00:00 +0000 file:///usr/share/doc/bornagain/html/ref/sim/class/scattering/ex/born-approximation.html <h2 id="gisas-without-dwba-terms">GISAS without DWBA terms</h2> <p>This example shows scattering from a monolayer that contains a dilute random assembly of monodisperse cylindrical disks.</p> <p>This is the same system as in our <a href="file:///usr/share/doc/bornagain/html/ref/sim/class/scattering/ex/gisas">basic GISAS example</a> except that there is no substrate. In consequence, there are no reflections, and therefore the DWBA boils down to the ordinary Born approximation.</p> <div class="galleryscg "> <div class="row justify-content-center align-items-center"> <figure > <a href="file:///usr/share/doc/bornagain/html/img/draw/CylindersInBA_setup.jpg"> <img src="file:///usr/share/doc/bornagain/html/img/draw/CylindersInBA_setup.jpg" width="350px"> </a> <figcaption> <p>Real-space model</p> </figcaption> </figure> <figure > <a href="file:///usr/share/doc/bornagain/html/img/auto/scatter2d/CylindersInBA.png"> <img src="file:///usr/share/doc/bornagain/html/img/auto/scatter2d/CylindersInBA.png" width="350px"> </a> <figcaption> <p>Scattering intensity</p> </figcaption> </figure> </div> </div> <div class="highlight"><div class="chroma"> <table class="lntable"><tr><td class="lntd"> <pre tabindex="0" class="chroma"><code></code></pre></td> <td class="lntd"> <pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"></code></pre></td></tr></table> </div> </div> <a class="linktofile" href="https://jugit.fz-juelich.de/mlz/bornagain/-/tree/r23/auto/Examples/scatter2d/CylindersInBA.py"/>auto/Examples/scatter2d/CylindersInBA.py</a>

# with specular peak

file:///usr/share/doc/bornagain/html/ref/sim/class/scattering/ex/with-specular.html Mon, 01 Jan 0001 00:00:00 +0000 file:///usr/share/doc/bornagain/html/ref/sim/class/scattering/ex/with-specular.html <h2 id="option-include-specular-reflection">Option: include specular reflection</h2> <p>Only if option <a href="file:///usr/share/doc/bornagain/html/ref/sim/setup/options/specular">include specular</a> is set, simulated detector images will include the specular reflection of the incident beam.</p> <p>Example: scattering by dilute boxes on a substrate.</p> <figure class="center"> <a href="file:///usr/share/doc/bornagain/html/img/auto/scatter2d/BoxesWithSpecularPeak.png"> <img src="file:///usr/share/doc/bornagain/html/img/auto/scatter2d/BoxesWithSpecularPeak.png" width="500px"> </a> <figcaption> <p></p> </figcaption> </figure> <div class="highlight"><div class="chroma"> <table class="lntable"><tr><td class="lntd"> <pre tabindex="0" class="chroma"><code></code></pre></td> <td class="lntd"> <pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"></code></pre></td></tr></table> </div> </div> <a class="linktofile" href="https://jugit.fz-juelich.de/mlz/bornagain/-/tree/r23/auto/Examples/scatter2d/BoxesWithSpecularPeak.py"/>auto/Examples/scatter2d/BoxesWithSpecularPeak.py</a>

# SAS

file:///usr/share/doc/bornagain/html/ref/sim/class/scattering/ex/sas.html Mon, 01 Jan 0001 00:00:00 +0000 file:///usr/share/doc/bornagain/html/ref/sim/class/scattering/ex/sas.html <h2 id="simulation-types-small-angle-scattering">Simulation types: Small-angle scattering</h2> <p>While BornAgain is designed for GISAS experiments (using the Distorted Wave Born Approximation), it naturally also contains the regular (plane wave) Born Approximation. Accordingly, BornAgain can also simulate standard small-angle scattering (SAS).</p> <p>However, there exist <a href="http://smallangle.org/content/software">several other specialized SAS softwares</a>. Therefore we do not advertise BornAgain for analysing SAS experiments, and in general we do not provide user support for this application domain. We rather recommend <a href="https://www.sasview.org/">SASView</a>, which is institutionally supported by the European Spallation Source, and was designated as standard SAS software in the European SINE2020 project.</p>

# Polarized SANS

file:///usr/share/doc/bornagain/html/ref/sim/class/scattering/ex/polarized_sans.html Mon, 01 Jan 0001 00:00:00 +0000 file:///usr/share/doc/bornagain/html/ref/sim/class/scattering/ex/polarized_sans.html <h3 id="polarized-sans">Polarized SANS</h3> <p>This example shows how to simulate polarized SANS with BornAgain, using the Born Approximation.</p> <p>The main difference between simulating GISAS and SAS in BornAgain is the presence of only a single layer in the multilayer object. This triggers the software to calculate the differential scattering cross section in the Born Approximation.</p> <p>In this example, a sample with a magnetic core-shell particle is constructed. Beam and detector are setup to detect the spin-flip scattering channel and the result of this simulation is plotted as usual.</p>

# Monte-Carlo

file:///usr/share/doc/bornagain/html/ref/sim/class/scattering/ex/mc.html Mon, 01 Jan 0001 00:00:00 +0000 file:///usr/share/doc/bornagain/html/ref/sim/class/scattering/ex/mc.html <h2 id="scattering-by-large-particles-with-monte-carlo-integration">Scattering by large particles with Monte-Carlo integration</h2> <p>Reference: <a href="file:///usr/share/doc/bornagain/html/ref/sim/setup/options/mc">Monte-Carlo</a></p> <p>This example demonstrates that for large particles (~$1000$ nm) the contribution to the scattered intensity from the form factor oscillates rapidly within one detector bin and analytical calculations (performed for the bin center) give completely a wrong intensity pattern. In this case Monte-Carlo integrations over detector bin should be used.</p> <p>The simulation generates four plots using different sizes of the particles, (radius $=10$ nm, height $=20$ nm) or (radius $=1$ $\mu$m, height $=2$ $\mu$m), and different calculation methods: analytical calculations or Monte-Carlo integration. The other parameters are identical:</p>