Getting Started - Tobionecenobi/SEB GitHub Wiki
Getting Started with SEB
Dependencies
SEB has only been compiled on linux systems and has not been tested on mac OS or Windows. If you are using Windows, we recommend using the Windows Subsystem for Linux (WSL), search for it in the search bar. Before downloading the source code make sure you have installed
- A working C++11 compliant compiler.
- A standard development environment with make and git.
- The GiNaC symbolic manipulation library for C++
- The GNU scientific Library
Installing SEB on Linux
Cloning the code
You can clone the source code in the terminal using
git clone https://github.com/Tobionecenobi/SEB.git
this will create a SEB folder in the current working directory and download the source code into this folder.
Install dependencies
Ubuntu:
sudo apt update
sudo apt install libcln-dev libgsl-dev libginac-dev
This will install the GNU scientific library and GiNaC package along with their dependencies.
[!TIP] If you have problems installing GiNaC: If you have trouble installing GiNaC you can try to build GiNaC from the bottom. To do this see following guide in SEB's wiki.
[!TIP] Another tip for installing GiNaC is to:
1) clone the cln library
git clone git://www.ginac.de/cln.git
and read the INSTALL* files.2) clone the GiNaC library
git clone git://www.ginac.de/ginac.git
and again read the INSTALL* files.There are guides for installing using cmake or installing on windows for both libraries.
Compiling
cd SEB
make
will compile the SEB library (into build/libseb.a), along with all the examples (in Examples), code for generating figures in the SEB paper (in PaperFigs). Assuming everything went well, then Examples and PaperFigs will be full of executables which you can run to see how SEB works. These targets can be recompiled individually by calling make with "seb", "examples", "paperFigs", or "work" as an argument. The last argument compiles user own code in the work folder, which is empty when you clone the repo.
Running an example
cd Examples
./Micelle
This example calculates the scattering from 100 Gaussian polymers added to the surface of a solid sphere, in particular, the form factor, the form factor amplitude relative to the center, and the phase factor between two free polymer ends. The output of the program is
Form factor= \frac{9900 \frac{ \sin( R_{sphere} q)^{2} {(-1+\exp(- R_{g_{poly}}^{2} q^{2}))}^{2} \beta_{poly}^{2}}{ R_{sphere}^{2} R_{g_{poly}}^{4} q^{6}}+200 \frac{ \beta_{poly}^{2} {(-1+ R_{g_{poly}}^{2} q^{2}+\exp(- R_{g_{poly}}^{2} q^{2}))}}{ R_{g_{poly}}^{4} q^{4}}-600 \frac{ \beta_{sphere} \sin( R_{sphere} q) {(-1+\exp(- R_{g_{poly}}^{2} q^{2}))} \beta_{poly} {(\sin( R_{sphere} q)- R_{sphere} \cos( R_{sphere} q) q)}}{ R_{sphere}^{4} R_{g_{poly}}^{2} q^{6}}+9 \frac{ \beta_{sphere}^{2} {(\sin( R_{sphere} q)- R_{sphere} \cos( R_{sphere} q) q)}^{2}}{ R_{sphere}^{6} q^{6}}}{\beta_{sphere}^{2}+10000 \beta_{poly}^{2}+200 \beta_{sphere} \beta_{poly}}
Form factor amplitude relative to centre= -\frac{100 \frac{ \sin( R_{sphere} q) {(-1+\exp(- R_{g_{poly}}^{2} q^{2}))} \beta_{poly}}{ R_{sphere} R_{g_{poly}}^{2} q^{3}}-3 \frac{ \beta_{sphere} {(\sin( R_{sphere} q)- R_{sphere} \cos( R_{sphere} q) q)}}{ R_{sphere}^{3} q^{3}}}{\beta_{sphere}+100 \beta_{poly}}
Phase factor tip-to-tip= \frac{ \sin( R_{sphere} q)^{2} \exp(-2 R_{g_{poly}}^{2} q^{2})}{ R_{sphere}^{2} q^{2}}
Here R_{sphere}
is the radius of the sphere, \beta_{sphere}
the excess scattering length of the sphere, R_{poly}
is the radius of gyration of the polymer, and \beta_{poly}
is its excess scattering length. All scattering expressions are normalized so they converge to unity in the q->0 limit.
LaTeX produce the following rendering of the form factor expression: $$\frac{9900 \frac{ \sin( R_{sphere} q)^{2} {(-1+\exp(- R_{g_{poly}}^{2} q^{2}))}^{2} \beta_{poly}^{2}}{ R_{sphere}^{2} R_{g_{poly}}^{4} q^{6}}+200 \frac{ \beta_{poly}^{2} {(-1+ R_{g_{poly}}^{2} q^{2}+\exp(- R_{g_{poly}}^{2} q^{2}))}}{ R_{g_{poly}}^{4} q^{4}}-600 \frac{ \beta_{sphere} \sin( R_{sphere} q) {(-1+\exp(- R_{g_{poly}}^{2} q^{2}))} \beta_{poly} {(\sin( R_{sphere} q)- R_{sphere} \cos( R_{sphere} q) q)}}{ R_{sphere}^{4} R_{g_{poly}}^{2} q^{6}}+9 \frac{ \beta_{sphere}^{2} {(\sin( R_{sphere} q)- R_{sphere} \cos( R_{sphere} q) q)}^{2}}{ R_{sphere}^{6} q^{6}}}{\beta_{sphere}^{2}+10000 \beta_{poly}^{2}+200 \beta_{sphere} \beta_{poly}} $$
This looks pretty horrific because GiNaC does not attempt to simplify expressions, but it has the advantage that we can immediately provide a physical interpretation of all the terms. The terms in the numerator describe 1) the polymer-to-polymer interference contribution, 2) the single polymer Debye form factor, 3) the polymer-to-core interference contribution, 4) the Rayleigh form factor of the core. The numerator is the total excess scattering length squared hence its just $\left(100 \beta_{poly}+\beta_{sphere}\right)^2$.
The example folder has numerous other examples, most of which produce symbolic expressions. These can become very long. The code to generate all the figures from the SEB paper is located in PaperFigs. We have uploaded png plots of the figures with illustrations of the structures. For each curve, there is a corresponding C++ file that generates that structure and its scattering curve.
One can also find examples on SEB's wiki under (Examples on usages of SEB)[https://github.com/Tobionecenobi/SEB/wiki/Examples-on-usages-of-SEB]. These are more pratical guides.