Skip to content

Commit

Permalink
test SM with root solver
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Voigt authored and Alexander Voigt committed Jul 18, 2015
1 parent 306fdb4 commit 139b649
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/module.mk
Expand Up @@ -55,6 +55,15 @@ TEST_SRC += \
endif
endif

ifneq ($(findstring root,$(ALGORITHMS)),)
ifneq ($(findstring two_scale,$(ALGORITHMS)),)
ifeq ($(shell $(FSCONFIG) --with-SM),yes)
TEST_SH += \
$(DIR)/test_SM_spectrum.sh
endif
endif
endif

ifneq ($(findstring two_scale,$(ALGORITHMS)),)
TEST_SRC += \
$(DIR)/test_two_scale_running_precision.cpp \
Expand Down
90 changes: 90 additions & 0 deletions test/test_SM_spectrum.sh
@@ -0,0 +1,90 @@
#!/bin/bash

# spectrums are the same.

BASEDIR=$(dirname $0)
FSCONFIG="$BASEDIR/../flexiblesusy-config"

sm_input="$BASEDIR/../model_files/SM/LesHouches.in.SM"

sm_two_scale_input="$BASEDIR/SM_two_scale.in.spc"
sm_two_scale_output="$BASEDIR/SM_two_scale.out.spc"

sm_root_input="$BASEDIR/SM_root.in.spc"
sm_root_output="$BASEDIR/SM_root.out.spc"

rel_error="0.00001"

sm_exe="$BASEDIR/../models/SM/run_SM.x"

[ $("$FSCONFIG" --with-SM) = yes ] || exit 1

if test ! -x "$sm_exe"; then
echo "Error: SM spectrum generator not found: $sm_exe"
exit 1
fi

create_input() {
local inp="$1"
local out="$2"
local flag="$3"

cp "$inp" "$out"
cat <<EOF >> "$out"
Block FlexibleSUSY
2 $flag # algorithm (0 = two_scale, 1 = root)
EOF
}

run() {
local inp="$1"
local out="$2"

echo "running SM point ... "
echo "SM SLHA input file: $inp"
echo "SM SLHA output file: $out"
$sm_exe --slha-input-file="$inp" --slha-output-file="$out" > /dev/null 2>&1
if test "$?" -ne 0; then
echo "Error: SM failed"
echo "Test status: FAIL"
exit 1
fi
echo "done"
}

compare() {
local a="$1"
local b="$2"
local max_diff="$3"
local diff

a_bc="`echo ${a} | sed -e 's/[eE]+*/\\*10\\^/'`"
b_bc="`echo ${b} | sed -e 's/[eE]+*/\\*10\\^/'`"

diff=$(cat <<EOF | bc $BASEDIR/abs.bc
scale=10
abs($a_bc - $b_bc) / ($a_bc) < $max_diff
EOF
)
return $diff
}

create_input "${sm_input}" "${sm_two_scale_input}" 0
create_input "${sm_input}" "${sm_root_input}" 1

run "$sm_two_scale_input" "$sm_two_scale_output"
run "$sm_root_input" "$sm_root_output"

mh_ts="`grep hh $sm_two_scale_output | awk '{ print $2 }'`"
mh_ro="`grep hh $sm_root_output | awk '{ print $2 }'`"

if compare "$mh_ts" "$mh_ro" "$rel_error" ; then
echo "Error: relative difference between"
echo " $mh_ts and $mh_ro is larger than $rel_error"
echo "Test status: FAIL"
exit 1
else
echo "Test status: OK"
fi

exit 0

0 comments on commit 139b649

Please sign in to comment.