# Unix on BornAgain

file:///usr/share/doc/bornagain/html/deploy/building/unix/index.html Recent content in Unix on BornAgain Hugo en-us

# Install third-party software

file:///usr/share/doc/bornagain/html/deploy/building/unix/third-party.html Mon, 01 Jan 0001 00:00:00 +0000 file:///usr/share/doc/bornagain/html/deploy/building/unix/third-party.html <h2 id="install-third-party-software">Install third-party software</h2> <p>As a prerequisite, Python and some Python modules must be installed. For the recommended installation under pyenv, see</p> <ul> <li><a href="file:///usr/share/doc/bornagain/html/deploy/py/linux">Python on Linux</a>.</li> <li><a href="file:///usr/share/doc/bornagain/html/deploy/py/mac">Python on Mac</a>.</li> </ul> <p>Further required software:</p> <ul> <li>Compiler with basic C++-20 support (<code>gcc</code> or <code>clang</code>)</li> <li><code>cmake &gt;= 3.20</code></li> <li><code>gsl &gt;= 1.15</code> (GNU scientific library)</li> <li><code>fftw3 &gt;= 3.3.1</code> (fast Fourier transform)</li> <li><code>libtiff &gt;= 4.0.2</code> (TIFF image loader)</li> <li><code>libcerf &gt;= 3</code> (complex error function) [1]</li> <li><code>boost &gt;= 1.74</code> [2]</li> <li><code>zlib1g-dev &gt;= 1.2.11</code> (zlib compression library)</li> <li><code>bzip2 &gt;= 1.0.8</code> (bzip2 compression library)</li> <li><code>Qt6</code></li> </ul> <p>[1] The library <code>libcerf</code> happens to be maintained by our own group. Nonetheless it is treated as an external dependency because packages are provided by all major Linux distributions (see <a href="https://pkgs.org">https://pkgs.org</a>).</p>

# Get the source

file:///usr/share/doc/bornagain/html/deploy/building/unix/get-source.html Mon, 01 Jan 0001 00:00:00 +0000 file:///usr/share/doc/bornagain/html/deploy/building/unix/get-source.html <h2 id="get-the-sources">Get the sources</h2> <p>Besides the sources of <a href="https://jugit.fz-juelich.de/mlz/bornagain">BornAgain</a> you need those of our support libraries <a href="https://jugit.fz-juelich.de/mlz/libheinz">libheinz</a> and <a href="https://jugit.fz-juelich.de/mlz/libformfactor">libformfactor</a> .</p> <p>If in doubt, install the tarballs of the latest published release:</p> <div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">https://jugit.fz-juelich.de/mlz/libheinz/-/releases </span></span><span class="line"><span class="cl">https://jugit.fz-juelich.de/mlz/libformfactor/-/releases </span></span><span class="line"><span class="cl">https://jugit.fz-juelich.de/mlz/bornagain/-/releases </span></span></code></pre></div><p>If you are ready to live on the edge, you may also clone our Git repository and work on the current &ldquo;main&rdquo; branch.</p> <h4 id="source-tarballs">Source tarballs</h4> <p>The <code>tar</code> command allows downloading and unpacking in one go:</p> <div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ wget -qO- https://jugit.fz-juelich.de/mlz/libheinz/-/archive/main/libheinz-main.tar.gz <span class="p">|</span> tar zx </span></span><span class="line"><span class="cl">$ wget -qO- https://jugit.fz-juelich.de/mlz/libformfactor/-/archive/main/libformfactor-main.tar.gz <span class="p">|</span> tar zx </span></span><span class="line"><span class="cl">$ wget -qO- https://jugit.fz-juelich.de/mlz/bornagain/-/archive/main/bornagain-main.tar.gz <span class="p">|</span> tar zx </span></span></code></pre></div><h4 id="git">Git</h4> <p>You can also get access to the source code by cloning our public Git repository:</p>

# Build and install BornAgain

file:///usr/share/doc/bornagain/html/deploy/building/unix/build-and-install.html Mon, 01 Jan 0001 00:00:00 +0000 file:///usr/share/doc/bornagain/html/deploy/building/unix/build-and-install.html <h2 id="build-and-install-bornagain">Build and install BornAgain</h2> <p>The following instructions must be executed for the software projects</p> <ul> <li>libheinz,</li> <li>libformfactor,</li> <li>BornAgain,</li> </ul> <p>in the given order.</p> <p>Each source package comes with configuration files for the cross-platform build system <a href="https://cmake.org">CMake</a>. Using CMake, it takes the following commands to build and install the software:</p> <div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ <span class="nb">cd</span> &lt;source_dir&gt; </span></span><span class="line"><span class="cl">$ mkdir build <span class="c1"># see note [1]</span> </span></span><span class="line"><span class="cl">$ <span class="nb">cd</span> build </span></span><span class="line"><span class="cl">$ cmake <span class="o">[</span>&lt;options&gt;<span class="o">]</span> .. <span class="c1"># see note [4]</span> </span></span><span class="line"><span class="cl">$ make -j4 <span class="c1"># see note [2]</span> </span></span><span class="line"><span class="cl">$ make ba_wheel <span class="c1"># make the Python wheel</span> </span></span><span class="line"><span class="cl">$ ctest -j4 </span></span><span class="line"><span class="cl">$ make install <span class="c1"># see note [3]</span> </span></span></code></pre></div><h5 id="note-1-build-directory">Note [1]: Build directory</h5> <p>The build process must take place &ldquo;out of place&rdquo;, i.e. not directly in the source directory. Otherwise, location and name of the build directory are arbitrary. We nonetheless recommend to follow our convention, create a subdirectory under the source directory, and call it <code>build</code>.</p>

# Run a first simulation

file:///usr/share/doc/bornagain/html/deploy/building/unix/first-simulation.html Mon, 01 Jan 0001 00:00:00 +0000 file:///usr/share/doc/bornagain/html/deploy/building/unix/first-simulation.html <h2 id="run-a-first-simulation">Run a first simulation</h2> <p>This section explains how to run a first simulation.</p> <ul> <li><a href="#post-installation-steps%22">Post installation steps</a></li> <li><a href="#running-the-first-python-simulation%22">Running the first Python simulation</a></li> <li><a href="#running-the-borngain-gui%22">Running the BornAgain GUI</a></li> </ul> <h4 id="post-installation-steps">Post installation steps</h4> <p>If a Python package is produced in the build phase, then after installation, the Python package (&lsquo;wheel&rsquo;) can be found under the folder <code>&lt;install_dir&gt;/python/&lt;python-version&gt;/wheel</code>. The wheel can be installed via <code>pip</code>; for instance</p> <div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">python3 -m pip install bornagain-&lt;detailed-wheel-tag&gt;.whl </span></span></code></pre></div><p>or</p> <div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">pip3 install bornagain-&lt;detailed-wheel-tag&gt;.whl </span></span></code></pre></div><h4 id="running-the-first-python-simulation">Running the first Python simulation</h4> <p>In your installation directory you will find the following directory structure:</p>