Creates spectrum generators for supersymmetric and non-supersymmetric models
Branch: development
Clone or download
Pull request Compare This branch is 18 commits ahead of Expander:development.
Expander allow user to chose awk command
Note: There seem to be problems with mawk.
Latest commit bfd1f3f Feb 12, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
addons update to GM2Calc 1.4.3 Oct 7, 2018
config Move FA/FC documentation in README.rst Dec 21, 2018
doc correcting format of bullet list Jan 30, 2019
examples simplify SLHA output Mar 23, 2018
fflite Merge branch 'development' into feature-mathlink Aug 29, 2016
meta Merge pull request #61 from wkotlarski/npoint-adapt-couplings-to-form… Feb 8, 2019
model_files adding 5-loop SM QCD beta function from [1606.08659] Jan 7, 2019
model_specific adding 5-loop SM QCD beta function from [1606.08659] Jan 7, 2019
models remove unused module Mar 29, 2018
release remove obsolete export script for FS+Himalaya models Sep 18, 2018
sarah make soft-breaking gaugino masses real Jan 18, 2019
slhaea avoid compiler warning about misleading indentation Jun 23, 2017
src remove unused header inclusions Nov 29, 2018
templates added mising header Feb 7, 2019
test test: NPointFunctions: rename OneParticleIrreducable to OneParticleRe… Jan 31, 2019
utils allow user to chose awk command Feb 12, 2019
.clang-format compatibility fix for clang-format 3.8 Nov 22, 2018
.gitattributes Merge remote-tracking branch 'organization/development' into feature-… May 15, 2018
.gitignore Add sane checks for FeynArts/FormCalc Dec 11, 2018
AUTHORS update references and authors Nov 25, 2018
BUGS.rst format BUGS in reStructuredText Dec 7, 2018
CHANGES.rst version 2.3.0 Jan 22, 2019
COPYING add license Oct 22, 2012
README.rst sort references Jan 21, 2019
TODO.rst format TODO list in rst format Dec 7, 2018
configure Merge pull request #49 from wkotlarski/feature-wilson Jan 22, 2019
createaddon create addons/ directory if not existing Feb 19, 2015
createmodel forgot one echo Oct 14, 2018
install-sarah update SARAH version Jan 21, 2019




FlexibleSUSY provides Mathematica and C++ code to create spectrum generators for supersymmetric and non-supersymmetric models. It is designed for generating fast and modular C++ code, allowing for easy modification, extension and reuse.

1   Building FlexibleSUSY

1.1   Requirements

  • C++ compiler (g++ >= 4.8.4 or clang++ >= 3.8.1 or icpc >= 15.0.0)
  • Fortran compiler (gfortran, ifort)
  • Mathematica (version 7.0 or higher)
  • SARAH (version 4.11.0 or higher)
  • Boost (version 1.37.0 or higher)
  • Eigen 3 (version 3.1 or higher)
  • GNU scientific library


1.2   Installation of SARAH

FlexibleSUSY requires SARAH to be installed and to be loadable with the Needs["SARAH`"] command from inside Mathematica. We recommend the following setup:

cd ~/.Mathematica/Applications/
tar -xf SARAH-${SARAH_VERSION}.tar.gz

cd ~/.Mathematica/Kernel/
echo "AppendTo[\$Path, \"${HOME}/.Mathematica/Applications/SARAH/\"];" >> init.m

All the above steps can be executed at once with the install-sarah script:


See ./install-sarah --help for more options.

1.3   Installation of FeynArts/FormCalc/LoopTools

If you want FlexibleSUSY to use either FeynArts, FormCalc or LoopTools you will need to install these packages first. Also — as with SARAH — they need to be loadable with the Needs[] command from inside Mathematica. We recommend using the installation script FeynInstall provided on the FeynArts web page. e.g.:

cd ~/.local
chmod 755 FeynInstall

which will install the latest versions of FeynArts, FormCalc and LoopTools in the ~/.local/ directory as well as configure Mathematica to find these packages. Note that running the FeynInstall script might require user intervention.

1.4   Building a FlexibleSUSY model

  1. 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 model (e.g. MSSM, NMSSM, etc.). Note, that there are already plenty of pre-installed model files in FlexibleSUSY's and SARAH's model directories that can be used.

  2. Create a new or re-initialize an existing 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>/
    • 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.), edit the FlexibleSUSY model file models/<model>/FlexibleSUSY.m. For more details see the documentation of the FlexibleSUSY model file and FlexibleEFTHiggs.

  3. Create the Makefile and register your model(s):

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

    Multiple models can be specified, separated by a comma. See ./configure --help for more options.

  4. Compile FlexibleSUSY with your model:


    Use make -j<N> to use <N> CPU cores. When make is executed, Mathematica is called, which generates the C++ code for the specified models. All C++ source files are written to the directory models/<model>/. When make has finished, the C++ code is compiled and the following spectrum generators are created for each specified model:

    • models/<model>/run_<model>.x: command line spectrum generator
    • models/<model>/run_<model>.m: Mathematica interface


./createmodel --name=HSSUSY
./configure --with-models=HSSUSY
make -j4

./models/HSSUSY/run_HSSUSY.x --slha-input-file=model_files/HSSUSY/

2   Using FlexibleSUSY

2.1   Available models

FlexibleSUSY ships with many pre-generated models. The following table includes an (incomplete) list of models with a detailed documentation.

Model Description
HSSUSY high-scale MSSM (pure EFT)
MSSMEFTHiggs high-scale MSSM (FlexibleEFTHiggs)
NUHMSSMNoFVHimalaya fixed-order MSSM

2.2   Command line

For each model FlexibleSUSY creates an executable models/<model>/run_<model>.x that can be run from the command line. The executable accepts the input in the SLHA format, for example in form of a file:

./models/MSSM/run_MSSM.x \
   --slha-input-file=models/MSSM/ \

or as a stream:

cat models/MSSM/ \
   | ./models/MSSM/run_MSSM.x --slha-input-file=- --slha-output-file=LesHouches.out.MSSM

For a documentation of FlexibleSUSY-specific switches in the SLHA input see the section on SLHA input parameters.

By default the executable writes the output in SLHA format to stdout. The output can also be appended to an SQLite database:

./models/MSSM/run_MSSM.x \
   --slha-input-file=models/MSSM/ \
   --slha-output-file=LesHouches.out.MSSM \

See models/<model>/run_<model>.x --help for further options.

2.2.1   Mass spectrum and renormalization group running

The pole mass spectrum and the RG flow can be written to text files for easy plotting. In the MSSM for example these text files can be generated via:

./models/MSSM/run_MSSM.x \
   --slha-input-file=model_files/MSSM/ \
   --rgflow-output-file=MSSM_rgflow.dat \

The generated files MSSM_rgflow.dat and MSSM_spectrum.dat can be plotted for example with the gnuplot scripts in the model directory:

gnuplot -persist -e "filename='MSSM_spectrum.dat'" \

gnuplot -persist -e "filename='MSSM_rgflow.dat'" \

The gnuplot scripts are just for illustration and currently plot all running parameters, regardless of their mass dimension, so the resulting plot is not particularly informative. However, one may easily adapt the scripts to plot any chosen subset of the parameters.

2.3   Mathematica interface

FlexibleSUSY can be called from within Mathematica using Wolfram's LibraryLink. By default, FlexibleSUSY creates a LibraryLink library for each spectrum genreator. The generated library can be found in models/<model>/<model>, where <model> is the model name.



(* Create a handle to a model given the input parameters.
   See Options[FSCMSSMOpenHandle] for all default options. *)
handle = FSCMSSMOpenHandle[
  fsSettings -> { precisionGoal -> 1.*^-4 },
  fsSMParameters -> { Mt -> 173.3 },
  fsModelParameters -> {
      m0 -> 125, m12 -> 500, TanBeta -> 10, SignMu -> 1, Azero -> 0 }

(* calculate pole mass spectrum *)

(* calculate observables *)

(* close the model handle *)

For each model, FlexibleSUSY creates an example Mathematica script which illustrates the use of the Mathematica interface. The generated example can be found in models/<model>/run_<model>.m which can be run for example as:

math -run "<< \"models/<model>/run_<model>.m\""

Before running it, the model parameters in the script should be set to reasonable values. More advanced examples can be found in the FlexibleSUSY documentation.

Note: In order to compile the library, Mathematica must be installed. To disable the LibraryLink interface, configure with --disable-librarylink.

Further details and examples can be found in the LibraryLink documentation.

2.4   Parameter scans

FlexibleSUSY contains two shell scripts aiming to help the user performing parameter scans based on SLHA files.

2.4.1   Tabular output

The script utils/ performs a scan over an input parameter.


To perform a scan over \tan\beta(M_Z) in the CMSSM (given in the SLHA input file in the MINPAR[3] field) and print out the the values of \tan\beta(M_Z), M_h (MASS[25]) and y_t(M_{\text{SUSY}}) (YU[2,2]) run:

utils/ \
   --spectrum-generator=models/CMSSM/run_CMSSM.x \
   --slha-input-file=model_files/CMSSM/ \
   --scan-range=MINPAR[3]=1~30:10 \

Alternatively, the SLHA input can be piped into the script as

cat model_files/CMSSM/ \
   | utils/ \
     --spectrum-generator=models/CMSSM/run_CMSSM.x \
     --scan-range=MINPAR[3]=1~30:10 \

The spectrum generator executable is specified using the --spectrum-generator= option. The parameter to be scanned over as well as the scan range and the number of steps must be specified using the --scan-range= option. The syntax is:


Here <block> is the SLHA block in which the input parameter is to be found and <field> is the block entry corresponding to the parameter. <start> and <stop> define the scan range and <number_of_steps> define the number of steps. By default the step size is linear. Alternatively, a logarithmic step size can be chosen by passing --step-size=log to the script. See also utils/ --help. The parameters to print to the output stream must be defined using the --output= option. The syntax is:


where <block> is the SLHA block in which the output parameter is to be read from and <field> is the block entry corresponding to the parameter. To read a matrix element from a block, use a colon : to specify the matrix element indices. Multiple output parameters can be specified by a comma.

2.4.2   Database output

As an alternative, all parameters calculated during a scan can be written to a SQLite database using the script.


utils/ \
   --spectrum-generator=models/CMSSM/run_CMSSM.x \
   --slha-input-file=model_files/CMSSM/ \
   --scan-range=MINPAR[3]=1~30:10 \


cat model_files/CMSSM/ \
   | ./utils/ \
     --spectrum-generator=models/CMSSM/run_CMSSM.x \
     --scan-range=MINPAR[3]=1~30:10 \

The name of the database file must be set using the --database-output-file= option.

2.5   Convert SPheno to FlexibleSUSY model file

The script utils/convert_SPheno_to_FlexibleSUSY.m can help to convert a SPheno model file (SPheno.m) to a FlexibleSUSY model file ( The conversion is not perfect, because it is usually not unique. Therefore one should check the generated file.


cat << EOF | math -noprompt >
sphenoFile = "~/.Mathematica/Applications/SARAH/Models/MSSM/SPheno.m";

3   Advanced FlexibleSUSY build options

3.1   Generating source code files only (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

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

3.2   Compile only (don't generate source code)

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

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

This option is useful if you want to generate the source code on one computer and then transfer the generated code to another computer to compile it. This option can also be used with the pre-generated FlexibleSUSY models, which are provided at the FlexibleSUSY home page.

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

3.3   Exporting the generated source code

The complete FlexibleSUSY source code, including the generated C++ code for the specified model(s) (but without the Mathematica meta code), can be exported to a new directory. The exported source code is 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


make install-src

must be executed, which will copy the generated C++ source code for all <models> 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 like this:

cd /path/to/export/directory

It is also possible to create a "model package", which includes only the generated source code for a given model, but does not contain the whole FlexibleSUSY build system. This is useful when the source code for a model should be generated on one computer and later transferred to another one to be compiled. To create such a "model 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.

3.4   Dynamic libraries

If you want to create dynamic model libraries (instead of static libraries, which is the default) you need to pass the --enable-shared-libs option to the configure script. The file name extension for the shared libraries as well as the command to build them 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 for example move the FlexibleSUSY directory to another location, the executables will no longer find the libraries. To make the executables find the libraries again, you have to relink them via

make clean-executables
make allexec

3.5   Statically linked executables

External libraries can be linked statically to the spectrum generator executables by passing --enable-static to configure. This is useful when the executable should be transferred to another computer, where some libraries are not available.


./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= and --with-static-ldlibs=


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

In case of dynamic linking (--disable-static, which is the default), the options --with-shared-ldflags= and --with-shared-ldlibs= must be used to set LDFLAGS and LDLIBS.

3.6   LoopTools support

It is possible to use LoopTools for calculating the loop functions, instead of using SOFTSUSY's loop functions. To enable LoopTools configure FlexibleSUSY 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/" \

Note: LoopTools 2.8 or higher is required.

3.7   Creating an addon

A FlexibleSUSY addon is a program or library, which uses parts of the FlexibleSUSY libraries or the generated models or is integrated into FlexibleSUSY. An example is GM2Calc, which is included in FlexibleSUSY in form of an addon. An addon can be created via

./createaddon --name=<addon>

where <addon> is the name of the addon. The createaddon script creates the directory addons/<addon>/ and the corresponding makefile module addons/<addon>/ If an addon has been created with the above script, the user may edit the makefile module (addons/<addon>/ to add source files in to the three variables

LIB@ADDON@_SRC  # list of source files to be included in library
EXE@ADDON@_SRC  # list of source files with a main()
LIB@ADDON@_HDR  # list of header files


LIB@ADDON@_SRC := $(DIR)/file1.cpp
EXE@ADDON@_SRC := $(DIR)/run.cpp
LIB@ADDON@_HDR := $(DIR)/file1.hpp

To configure and compile the addon run

./configure --with-addons=<addon>

make compiles all source files and creates the addon library addons/<addon>/lib<addon>.a (including the object file file1.o in the above example) and an executable (addons/<addon>/run.x in the above example).

3.8   Creating the source code documentation

FlexibleSUSY's source code documentation (including the generated source code files) can be generated with Doxygen in HTML or man format. To generate the HTML documentation please run:

make doc-html

The generated HTML index file can then be found in doc/html/index.html and can be viewed with any HTML browser, e.g.

firefox doc/html/index.html

To generate the man documentation please run:

make doc-man

The generated man pages can then be found in doc/man/man3/ and can be viewed as

man doc/man/man3/model_file_options.3

3.9   Cleaning

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/

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 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

4   Package content

In the following all sub-directories within the FlexibleSUSY package are listed:

  • addons/ contains addons for FlexibleSUSY, such as GM2Calc
  • config/ contains helper scripts and makefile modules for the build system
  • doc/ contains the FlexibleSUSY documentation
  • examples/ contains examples how to build you own spectrum generator based on FlexibleSUSY
  • fflite/ contains an alternative implementation of the Passarino-Veltman loop functions, based on FF
  • meta/ contains the Mathematica meta code which generates the spectrum generators. See the meta code documentation for more details.
  • model_files/ contains default model files for some frequently used models (SM, SplitMSSM, MSSM, NMSSM, SMSSM, UMSSM, etc.)
  • model_specific/ contains model-specific higher order corrections for the MSSM, NMSSM, SM and SplitMSSM from the literature
  • models/ This is the output directory where the generated C++ code for the spectrum generators will be stored.
  • Output/ contains SARAHs model-specific output files
  • sarah/ contains SARAH model files shipped with FlexibleSUSY
  • slhaea/ contains the slhaea SLHA reader library
  • src/ contains model-independent FlexibleSUSY C++ source code
  • templates/ contains C++ template files for the spectrum generators
  • test/ contains the FlexibleSUSY test suite
  • utils/ contains some utility scripts to perform scans or extract data from SLHA files

5   Further reading

6   References

[hep-ph:0104145]CPC 143 (2002) 305-331 [arxiv:hep-ph/0104145]
[0909.2863]CPC 181 (2010) 1077-1086 [arxiv:0909.2863]
[1002.0840]CPC 182 (2011) 808-833 [arxiv:1002.0840]
[1005.5709]JHEP 1008 (2010) 104 [arxiv:1005.5709]
[1207.0906]CPC 184 (2013) 1792-1809 [arxiv:1207.0906]
[1309.7223]CPC 185 (2014) 1773-1790 [arxiv:1309.7223]
[1311.7659]CPC 185 (2014) 2322 [arxiv:1311.7659]
[1406.2319](1, 2) CPC 190 (2015) 139-172 [arxiv:1406.2319]
[1609.00371](1, 2) JHEP 1701 (2017) 079 [arxiv:1609.00371]
[1708.05720]Eur.Phys.J. C77 (2017) no.12, 814 [arxiv:1708.05720]
[1710.03760](1, 2, 3) CPC 230 (2018) 145-217 [arXiv:1710.03760]
[1807.03509]Eur.Phys.J. C78 (2018) no.10, 874 [arxiv:1807.03509]