Skip to content

Commit

Permalink
add NMSSM benchmark test
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Voigt authored and Alexander Voigt committed Mar 10, 2015
1 parent 42c9124 commit caf3300
Show file tree
Hide file tree
Showing 3 changed files with 229 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ TEST_SRC += \
$(DIR)/test_NMSSM_susy_scale_constraint.cpp \
$(DIR)/test_NMSSM_tree_level_spectrum.cpp
endif

ifeq ($(shell $(FSCONFIG) --with-SoftsusyMSSM --with-SoftsusyNMSSM --with-NMSSM),yes yes yes)
TEST_SRC += \
$(DIR)/test_NMSSM_benchmark.cpp
endif

ifeq ($(shell $(FSCONFIG) --with-SoftsusyNMSSM --with-SMSSM),yes yes)
TEST_SRC += \
$(DIR)/test_SMSSM_beta_functions.cpp \
Expand Down Expand Up @@ -441,6 +447,10 @@ $(DIR)/test_NMSSM_susy_scale_constraint.x: $(LIBSoftsusyMSSM) $(LIBSoftsusyNMSSM

$(DIR)/test_NMSSM_tree_level_spectrum.x: $(LIBSoftsusyMSSM) $(LIBSoftsusyNMSSM) $(LIBNMSSM) $(LIBFLEXI) $(LIBLEGACY) $(filter-out -%,$(LOOPFUNCLIBS))

$(DIR)/test_NMSSM_benchmark.x: CPPFLAGS += $(BOOSTFLAGS) $(EIGENFLAGS)
$(DIR)/test_NMSSM_benchmark.x: $(DIR)/test_NMSSM_benchmark.cpp $(RUN_NMSSM_EXE) $(RUN_SOFTPOINT_EXE) $(LIBTEST)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $(call abspathx,$<) $(LIBTEST) $(BOOSTTESTLIBS) $(GSLLIBS) $(FLIBS)

$(DIR)/test_SMSSM_beta_functions.x: $(LIBSoftsusyMSSM) $(LIBSoftsusyNMSSM) $(LIBSMSSM) $(LIBFLEXI) $(LIBLEGACY) $(filter-out -%,$(LOOPFUNCLIBS))

$(DIR)/test_SMSSM_ewsb.x: $(LIBSoftsusyMSSM) $(LIBSoftsusyNMSSM) $(LIBSMSSM) $(LIBFLEXI) $(LIBLEGACY) $(filter-out -%,$(LOOPFUNCLIBS))
Expand Down
161 changes: 161 additions & 0 deletions test/test_NMSSM_benchmark.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@

#include <iostream>
#include <fstream>
#include <string>
#include <boost/lexical_cast.hpp>

#include "test.h"
#include "run_cmd.hpp"
#include "slhaea.h"
#include "stopwatch.hpp"
#include "logger.hpp"

struct Data {
Data() : number_of_valid_points(0), sum_of_times(0.) {}

double time;
int error;
unsigned number_of_valid_points;
double sum_of_times;
};

bool is_valid_spectrum(const std::string& slha_file)
{
std::ifstream ifs(slha_file.c_str());
SLHAea::Coll coll(ifs);

// find SPINFO block
SLHAea::Coll::const_iterator block =
coll.find(coll.cbegin(), coll.cend(), "SPINFO");

if (block == coll.cend())
throw std::string("Error: SPINFO block not found in file ") + slha_file;

for (SLHAea::Block::const_iterator line = block->cbegin(),
end = block->cend(); line != end; ++line) {
if (line->is_data_line() && line->size() >= 2 &&
(*line)[0] == "4" && (*line)[1] != "")
return false;
}

return true;
}

int run_point(const std::string& slha_file, Data& fs_data, Data& ss_data)
{
int status;
flexiblesusy::Stopwatch stopwatch;

const std::string slha_output_file("test/test_NMSSM_benchmark.out.spc");

stopwatch.start();
status = run_cmd("./models/NMSSM/run_NMSSM.x --slha-input-file=" +
slha_file + " --slha-output-file=" + slha_output_file +
" > /dev/null 2>&1");
stopwatch.stop();

fs_data.time = stopwatch.get_time_in_seconds();
fs_data.error = status;

if (!fs_data.error) {
// look for errors in the SLHA output file
fs_data.error = !is_valid_spectrum(slha_output_file);
if (!fs_data.error) {
fs_data.number_of_valid_points++;
fs_data.sum_of_times += fs_data.time;
}
}

stopwatch.start();
status = run_cmd("./models/SoftsusyNMSSM/run_softpoint.x leshouches < " +
slha_file + " > " + slha_output_file);
stopwatch.stop();

ss_data.time = stopwatch.get_time_in_seconds();
ss_data.error = status;

if (!ss_data.error) {
// look for errors in the SLHA output file
ss_data.error = !is_valid_spectrum(slha_output_file);
if (!ss_data.error) {
ss_data.number_of_valid_points++;
ss_data.sum_of_times += ss_data.time;
}
}

return 0;
}

SLHAea::Coll create_point(double tanBeta)
{
std::ifstream ifs("test/test_NMSSM_benchmark.in.spc.in");
SLHAea::Coll coll(ifs);
SLHAea::Block minpar, extpar;

const std::string minpar_str(
"Block MINPAR\n"
" 1 2.000000000e+02 # m0\n"
" 2 5.000000000e+02 # m12\n"
" 3 " + boost::lexical_cast<std::string>(tanBeta) + " # TanBeta\n"
" 5 -5.000000000e+02 # A0\n");

const std::string extpar_str(
"Block EXTPAR\n"
" 61 0.1 # LambdaInput\n");

minpar.str(minpar_str);
coll.push_back(minpar);

extpar.str(extpar_str);
coll.push_back(extpar);

return coll;
}

void test_tanbeta_scan()
{
const unsigned num_points = 100;
const double tanBeta_start = 2.;
const double tanBeta_stop = 80.;
const double tanBeta_step = (tanBeta_stop - tanBeta_start) / num_points;

Data fs_data, ss_data;

printf("%10s %30s %30s \n", "tan(beta)",
"Softsusy / s (status)",
"FlexibleSUSY / s (status)");

for (unsigned i = 0; i < num_points; i++) {
const double tanBeta = tanBeta_start + i * tanBeta_step;
const SLHAea::Coll coll(create_point(tanBeta));
const std::string input_file("test/test_NMSSM_benchmark.in.spc");

std::ofstream ofs(input_file);
ofs << coll;
ofs.close();

run_point(input_file, fs_data, ss_data);

printf("%10g %24g (%3d) %24g (%3d)\n", tanBeta,
ss_data.time, ss_data.error,
fs_data.time, fs_data.error);
}

const double fs_average_time = fs_data.sum_of_times / fs_data.number_of_valid_points;
const double ss_average_time = ss_data.sum_of_times / ss_data.number_of_valid_points;

INFO("Summary: average times (in seconds) \n"
" FlexibleSUSY: " << fs_average_time <<
" (" << fs_data.number_of_valid_points << "/" << num_points << " points)\n" <<
" Softsusy : " << ss_average_time <<
" (" << ss_data.number_of_valid_points << "/" << num_points << " points)");

TEST_GREATER(ss_average_time, fs_average_time);
}

int main()
{
test_tanbeta_scan();

return flexiblesusy::get_errors();
}
58 changes: 58 additions & 0 deletions test/test_NMSSM_benchmark.in.spc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Block MODSEL # Select model
6 0 # flavour violation
1 1 # mSUGRA
3 1 # NMSSM
Block SMINPUTS # Standard Model inputs
1 1.279180000e+02 # alpha^(-1) SM MSbar(MZ)
2 1.166390000e-05 # G_Fermi
3 1.189000000e-01 # alpha_s(MZ) SM MSbar
4 9.118760000e+01 # MZ(pole)
5 4.200000000e+00 # mb(mb) SM MSbar
6 1.709000000e+02 # mtop(pole)
7 1.777000000e+00 # mtau(pole)
Block SOFTSUSY # SOFTSUSY specific inputs
1 1.000000000e-04 # tolerance
2 2 # up-quark mixing (=1) or down (=2)
5 1 # 2-loop running
3 0 # printout
Block FlexibleSUSY
0 1.000000000e-04 # precision goal
1 0 # max. iterations (0 = automatic)
2 0 # algorithm (0 = two_scale, 1 = lattice)
3 0 # calculate SM pole masses
4 2 # pole mass loop order
5 2 # EWSB loop order
6 2 # beta-functions loop order
7 2 # threshold corrections loop order
8 1 # Higgs 2-loop corrections O(alpha_t alpha_s)
9 1 # Higgs 2-loop corrections O(alpha_b alpha_s)
10 1 # Higgs 2-loop corrections O(alpha_t^2 + alpha_t alpha_b + alpha_b^2)
11 1 # Higgs 2-loop corrections O(alpha_tau^2)
12 0 # force output
13 1 # Top quark 2-loop corrections QCD
Block SPhenoInput # SPheno specific input
1 -1 # error level
2 1 # SPA conventions
11 0 # calculate branching ratios
13 0 # include 3-Body decays
12 1.000E-04 # write only branching ratios larger than this value
31 -1 # fixed GUT scale (-1: dynamical GUT scale)
32 0 # Strict unification
34 1.000E-04 # Precision of mass calculation
35 40 # Maximal number of iterations
37 1 # Set Yukawa scheme
38 2 # 1- or 2-Loop RGEs
50 1 # Majorana phases: use only positive masses
51 0 # Write Output in CKM basis
52 0 # Write spectrum in case of tachyonic states
55 1 # Calculate one loop masses
57 0 # Calculate low energy constraints
60 0 # Include possible, kinetic mixing
65 1 # Solution tadpole equation
75 0 # Write WHIZARD files
76 0 # Write HiggsBounds file
86 0. # Maximal width to be counted as invisible in Higgs decays; -1: only LSP
510 0. # Write tree level values for tadpole solutions
515 0 # Write parameter values at GUT scale
520 0. # Write effective Higgs couplings (HiggsBounds blocks)
525 0. # Write loop contributions to diphoton decay of Higgs

0 comments on commit caf3300

Please sign in to comment.