GM2Calc is hosted by Hepforge, IPPP Durham


Quick Start

Download the source code:

tar -xf gm2calc-1.3.3.tar.gz
cd gm2calc-1.3.3/

Compile it:


Run GM2Calc using an SLHA-1 input file:

bin/gm2calc.x --slha-input-file=input/example.slha

Run GM2Calc using an input file in GM2Calc-specific format:

bin/gm2calc.x --gm2calc-input-file=input/example.gm2
We strongly discourage passing an SLHA-2 input file to GM2Calc. The reason is, that GM2Calc interprets the PDG numbers 1000013, 2000013 and 1000014 in the MASS block as the two smuon and the muon sneutrino pole masses, respectively. In an SLHA-2 compliant input file, however, it is not ensured, that these PDG numbers correspond to the two smuon and the muon sneutrino pole masses, because of possibly allowed slepton flavour violation.


The following packages must be available on your system to compile GM2Calc:



To compile GM2Calc run


Customization of the build process

The used compiler and include paths can be passed as an argument to make. For example, if Intel's C++ compiler icpc shall be used and the Boost and Eigen header files are in a non-standard location, one can write

make \
   CXX=icpc \
   EIGENFLAGS="-I/opt/eigen3/eigen3" \

The variables which control the compilation are set in the makefile to the following default values:

CXX         := g++                   # C++ compiler
CPPFLAGS    := -Isrc                 # C preprocessor flags
CXXFLAGS    := -O2 -std=c++11        # C++ compiler flags
CXX_DEP_GEN := g++                   # dependency generator
MAKELIB     := ar cru                # command to create static library
BOOSTFLAGS  := -I/usr/include        # C preprocessor flags for Boost headers
EIGENFLAGS  := -I/usr/include/eigen3 # C preprocessor flags for Eigen headers

The command line arguments passed to make are stored in the file make.args. To (re-)run make with the command line arguments stored in make.args run

cat make.args | xargs make

Using LAPACK (optional)

The routines which diagonalize the mass matrices by default use the algorithms provided by Eigen. However, the routines provided by LAPACK can be used alternatively. In order to make use of the LAPACK routines one has to pass ENABLE_LAPACK=1 to the make command. In addition, the LAPACK and BLAS libraries to be linked have to be passed in the LDFLAGS variable to the make command:

make ENABLE_LAPACK=1 LDLIBS="-llapack -lblas"


Usage together with a SUSY spectrum generator

GM2Calc can be run with an SLHA-1 compliant SUSY spectrum file as input, which contains the running DR-bar parameters and the SUSY pole masses. SLHA-1 spectrum files can be created by most SUSY spectrum generators, for example FlexibleSUSY (Models: CMSSMNoFV, MSSMNoFV, MSSMNoFVatMGUT), SOFTSUSY or SPheno. The output of SOFTSUSY, for example, can be piped to GM2Calc as follows (the paths to softpoint.x and gm2calc.x must be adapted according to the user's setup):

./softpoint.x leshouches < inOutFiles/lesHouchesInput | \
   bin/gm2calc.x --slha-input-file=-

SPheno, on the other hand, writes the SLHA-1 spectrum to the file SPheno.spc, which can be passed to GM2Calc as follows:

bin/SPheno input/
bin/gm2calc.x --slha-input-file=SPheno.spc

To add additional blocks to the input of GM2Calc one can make use of the "here documents" command:

{ ./softpoint.x leshouches < inOutFiles/lesHouchesInput;
  cat <<EOF
Block GM2CalcConfig
     0     0     # minimal output
} | bin/gm2calc.x --slha-input-file=-

The following advanced example demonstrates how to perform a parameter scan at the shell using SOFTSUSY and GM2Calc:

softpoint_with_block() {
  { cat -; printf "Block $1\n\t$2\t$3\n"; } | ./softpoint.x leshouches

amu_from_slha() {
  { cat -; printf "Block GM2CalcConfig\n\t0\t0\n"; } | # minimal output
    bin/gm2calc.x --slha-input-file=-

amu_with_block() {
  softpoint_with_block "$@" | amu_from_slha

amu_for_tanbeta() {
  amu_with_block < inOutFiles/lesHouchesInput MINPAR 3 $1 # tan(beta) at MZ

{ echo "set xlabel \"tan(beta)\";
        set ylabel \"amu\";
        plot '-' u 1:2 w linespoints t ''"
  for tb in $(seq 2 40); do
    echo "$tb $(amu_for_tanbeta $tb)"
} | gnuplot -p

C/C++ interface

GM2Calc provides a C/C++ interface which allows users to embed the calculation of $a_\mu$ into an existing code or create a custom C/C++ program that calculates $a_\mu$. In the GM2Calc package four example programs can be found which illustrate the C/C++ interface:

  • examples/example-gm2calc.cpp and examples/example-gm2calc_c.c illustrate how $a_\mu$ can be calculated by providing the input parameters in a physical on-shell renormalization scheme (GM2Calc-specific input format).
  • examples/example-slha.cpp and examples/example-slha_c.c illustrate how $a_\mu$ can be calculated by providing the input parameters in SLHA-1 convention.

These example programs can be compiled by running

make examples

Afterwards, the executables can be found in the bin/ directory and can be executed as


Mathematica interface

Since version 1.3.0 GM2Calc provides a Mathematica interface. In order to use it, the MathLink executable must be created by running

make mathlink

By default the MathLink compiler is the bin/mcc script, which finds the location of the MathLink compiler for most UNIX-like environments using the Mathematica kernel math. The Mathematica kernel can be overwritten by passing the MATH variable to make. Alternatively, the MathLink compiler can be set explicitly via the MCC variable.


make CXX=icpc CC=icc LDLIBS="-lboost_math_c99" MATH=math10.1

The MathLink executable can be found in bin/ This executable can be installed in Mathematica by calling


Afterwards, the GM2Calc Mathematica interface functions can be used. The following two files provide complete examples of how to use the interface functions (either SLHA-1 or GM2Calc-specific parameter convention):



math -run "<< \"examples/example-slha.m\""

The output of could look for example (printing $a_\mu$ and its uncertainty):

Mathematica 9.0 for Linux x86 (64-bit)
Copyright 1988-2012 Wolfram Research, Inc.
           -9            -10
{2.33924 10  , 2.33423 10   }

Source code documentation

Doxygen generated source code documentation