FlexibleSUSY is hosted by Hepforge, IPPP Durham
Generating a FlexibleSUSY spectrum generator

Generating a FlexibleSUSY spectrum generator



Generating a spectrum generator

Before you setup a FlexibleSUSY model, you have to provide a SARAH model file. To make it available in FlexibleSUSY, you can put it either into FlexibleSUSY's SARAH model directory (`FlexibleSUSY/sarah/<model>/`) or directly into SARAH's own model directly (`SARAH/Models/<model>/`).

Here `<model>` is the name of your SARAH model (e.g. SM, MSSM, NMSSM, etc.). Note, that there are already plenty of pre-installed model files under `SARAH/Models/` that can be used.

Setup a FlexibleSUSY model

./createmodel --name=<model>

See `./createmodel --help` for more details. Afterwards there will be

  • a model directory models/<model>/
  • a makefile module models/<model>/module.mk
  • a Mathematica start script models/<model>/start.m
  • and a FlexibleSUSY model file models/<model>/FlexibleSUSY.m

To modify the model details (input parameters, boundary conditions, etc.), please edit the FlexibleSUSY model file `models/<model>/FlexibleSUSY.m`. The model file options are explained in more detail in FlexibleSUSY model file .

Create the Makefile and register your model

./configure --with-models=<model>

Use `./configure --with-models=all` to build all available models. See `./configure --help` for more options.

Start the spectrum generator generation and compile it by running


When `make` is executed, Mathematica is called and generates the C++ code for the spectrum generator. All C++ source files are written to `models/<model>/`. Afterwards this C++ code will be compiled and a user example spectrum generator `models/<model>/run_<model>.x` will be created.

### Example ###

./createmodel --name=NMSSM ./configure --with-models=NMSSM make

Running the spectrum generator

Running the spectrum generator from the command line

To run the spectrum generator at the command line, execute

./models/<model>/run_<model>.x --slha-input-file=<slha-input-file>

where `<slha-input-file>` is an SLHA input file. For more details on the SLHA input options see SLHA input parameters .

### Example ###

./models/NMSSM/run_NMSSM.x --slha-input-file=model_files/NMSSM/LesHouches.in.NMSSM

The SLHA input can also read from `stdin` by using the dash `-` as input file name:

cat model_files/NMSSM/LesHouches.in.NMSSM | ./models/NMSSM/run_NMSSM.x --slha-input-file=-

To specify a file name for the SLHA output use the `--slha-output-file=` option.

### Example ###

./models/NMSSM/run_NMSSM.x --slha-input-file=model_files/NMSSM/LesHouches.in.NMSSM --slha-output-file=LesHouches.out.NMSSM

To suppress the SLHA output leave the file name after `--slha-output-file=` empty.

The output can also be written to an SQLite database using the `--database-output-file=` option.

### Example ###

./models/NMSSM/run_NMSSM.x --slha-input-file=model_files/NMSSM/LesHouches.in.NMSSM --slha-output-file= --database-output-file=point.db

Running the spectrum generator from inside Mathematica

Since version 1.7.0, FlexibleSUSY provides a Mathematica interface. Please see Mathematica interface for more details and examples.

Creating only the source code files (no compilation)

If you want to only create the C++ source files for your model, but do not want to compile the code, you can use the `--disable-compile` configure option:

./configure --with-models=MSSM --disable-compile make

Here, `configure` will not check for installed compilers or libraries. It will only check for Mathematica and SARAH. The execution of `make` will stop as soon as all C++ source code files are generated.

Compile only (no code generation)

If you want to only compile already created the C++ source files for your model, you can use the `--disable-meta` configure option:

./configure --with-models=MSSM --disable-meta make

Here, `configure` will only check for installed compilers or libraries. It will not check for Mathematica and SARAH.

Warning: Please make sure all C++ source files of your model are available in the model directory `models/<model>/`. Otherwise the compilation will fail.

Exporting the generated source code

The generated C++ source code can be exported to a separate directory, without the Mathematica meta code. This exported directory will be a complete standalone package, with it's own build system. To export the code, one has to set the target directory during configuration via the `--with-install-dir=` option. For example

./configure --with-models=<models> --with-install-dir=/path/to/export/directory

By running

make install-src

the generated C++ source code for all `<models>` is copied to `/path/to/export/directory`, together with the non-model specific source code from `config/`, `doc/`, `slhaea/` and `src/`. Afterwards, the standalone package can be build via

cd /path/to/export/directory ./configure --with-models=all make

It is also possible to create a package which includes only the generated source code of a given model. To create such a package run

make pack-<model>-src

where `<model>` is the name of the model whose generated source code shall be packed. After `make` has finished, the package file `<model>.tar.gz` can be found in the working directory.

Dynamic libraries

If you want to create dynamic libraries (instead of static libraries) you need to pass the `--enable-shared-libs` option to the `configure` script. The default file name extension for the shared libraries as well as the command to build the libraries can be overwritten using the

--with-shared-lib-ext= --with-shared-lib-cmd=

parameters. For example, when Intel compilers should be used, replace `gcc` by `icc` or `icpc`.


$ ./configure --with-models=CMSSM,NMSSM --enable-shared-libs --with-shared-lib-ext=".so" --with-shared-lib-cmd="gcc -shared -o"

Important remark:

The libraries are linked to the executables with absolute paths. This means that, if you move the package directory to another location, the executables will no longer find the libraries, because the libraries are now at another place. To make the executables find the libraries again, you have to relink them via

$ make clean-executables $ make allexec

Statically linked executables

External libraries can be linked statically to the spectrum generator executables by passing `--enable-static` to configure.

Example (using g++ on Debian Jessie):

$ ./configure --with-models=CMSSM --enable-static

If `--enable-static` is used, the following linker flags and additional libraries will be used:

LDFLAGS = -static LDLIBS = -ldl

These linker specific flags and additional libraries can be overwritten using

--with-static-ldflags= --with-static-ldlibs=


$ ./configure --with-models=CMSSM --enable-static --with-static-ldflags="-static" --with-static-ldlibs="-lquadmath -ldl"

In case of dynamic linking, the options

--with-shared-ldflags= --with-shared-ldlibs=

must be used to set `LDFLAGS` and `LDLIBS`.

Cleaning up

There are several make targets to remove generated files, compiled object files, libraries or executables:

make clean # deletes all .d .o .a .x files

make distclean # does `clean' and `clean-generated' # and deletes in addition: # Makefile flexiblesusy-config config.* # config/list_sarah_model_files.sh

make clean-dep # deletes all .d files

make clean-executables # deletes all .x files

make clean-generated # deletes generated files

make clean-lib # deletes all libraries

make clean-obj # deletes all .o files

For each model `<model>` or addon there are specific clean targets to remove model-specific files:

make clean-<model> # deletes .d .o .a .x and generated files

make distclean-<model> # same as `make clean-<model> clean-<model>-src'

make clean-<model>-dep # deletes .d files

make clean-<model>-lib # deletes model library

make clean-<model>-obj # deletes .o files

make clean-<model>-src # deletes generated files


It is possible to use LoopTools (http://www.feynarts.de/looptools/) for calculating the loop functions, instead of using Softsusy's loop functions. To enable LoopTools configure via

./configure --enable-looptools

To use the LoopTools library and header files from a specific directory configure via

./configure --enable-looptools --with-looptools-incdir="/path/to/looptools/build/" --with-looptools-libdir="/path/to/looptools/build/"

Note: LoopTools 2.8 or higher is required. Versions <= 2.7 will fail to build with the following compiler error message (or similar):

In file included from models/MSSM/MSSM_two_scale_model.cpp:28:0: /usr/include/clooptools.h:67:28: error: conflicting declaration ‘typedef struct std::complex<double> Complex’ In file included from src/utils.h:15:0, from src/rge.h:17, from models/MSSM/MSSM_two_scale_soft_parameters.hpp:24, from models/MSSM/MSSM_two_scale_model.hpp:25, from models/MSSM/MSSM_two_scale_model.cpp:21: src/mycomplex.h:17:7: error: ‘class Complex’ has a previous declaration as ‘class Complex’