gm2calc is hosted by Hepforge, IPPP Durham


Quick Start

Download the source code:

wget --content-disposition
tar -xf GM2Calc-2.2.0.tar.gz
cd GM2Calc-2.2.0/

Compile it:

mkdir build
cd build
cmake ..

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:

  • CMake 3.12 or higher
  • C++14 and C11 compiler
  • Boost (version 1.37.0 or higher)
  • Eigen 3 (version 3.1 or higher)


To compile GM2Calc run

mkdir build
cd build
cmake ..

Customization of the build process

The used compiler and include paths can be passed as an argument to cmake. 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

cmake \
   -DEIGEN3_INCLUDE_DIR=/opt/eigen3/eigen3 \
   -DBOOST_ROOT=/opt/boost \


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 are build by default and the executables can be found in the bin/ directory:


Mathematica interface

Since version 1.3.0 GM2Calc provides a Mathematica interface. If Mathematica is installed on the host machine, a MathLink executable is created during the build process. 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   }