Skip to content

Commit

Permalink
Add initial template for outer, semi-analytic constraint
Browse files Browse the repository at this point in the history
Still to do: neat way to update input scale consistently
  • Loading branch information
Dylan Harries committed Jan 4, 2017
1 parent 6b65568 commit 5692a22
Show file tree
Hide file tree
Showing 6 changed files with 229 additions and 1 deletion.
3 changes: 3 additions & 0 deletions templates/module.mk
Expand Up @@ -89,10 +89,13 @@ SEMI_ANALYTIC_TEMPLATES := \
$(DIR)/semi_analytic_low_scale_constraint.cpp.in \
$(DIR)/semi_analytic_model.hpp.in \
$(DIR)/semi_analytic_model.cpp.in \
$(DIR)/semi_analytic_soft_parameters_constraint.hpp.in \
$(DIR)/semi_analytic_soft_parameters_constraint.cpp.in \
$(DIR)/semi_analytic_susy_convergence_tester.hpp.in \
$(DIR)/semi_analytic_susy_convergence_tester.cpp.in \
$(DIR)/semi_analytic_susy_scale_constraint.hpp.in \
$(DIR)/semi_analytic_susy_scale_constraint.cpp.in \
$(DIR)/soft_parameters_constraint.hpp.in \
$(DIR)/susy_convergence_tester.hpp.in

TEMPLATES := \
Expand Down
3 changes: 3 additions & 0 deletions templates/semi_analytic.mk.in
Expand Up @@ -24,6 +24,7 @@ LIB@ModelName@_SRC += \
$(DIR)/@ModelName@_semi_analytic_initial_guesser.cpp \
$(DIR)/@ModelName@_semi_analytic_low_scale_constraint.cpp \
$(DIR)/@ModelName@_semi_analytic_model.cpp \
$(DIR)/@ModelName@_semi_analytic_soft_parameters_constraint.cpp \
$(DIR)/@ModelName@_semi_analytic_spectrum_generator.cpp \
$(DIR)/@ModelName@_semi_analytic_susy_convergence_tester.cpp \
$(DIR)/@ModelName@_semi_analytic_susy_scale_constraint.cpp
Expand All @@ -33,7 +34,9 @@ LIB@ModelName@_HDR += \
$(DIR)/@ModelName@_semi_analytic_initial_guesser.hpp \
$(DIR)/@ModelName@_semi_analytic_low_scale_constraint.hpp \
$(DIR)/@ModelName@_semi_analytic_model.hpp \
$(DIR)/@ModelName@_semi_analytic_soft_parameters_constraint.hpp \
$(DIR)/@ModelName@_semi_analytic_spectrum_generator.hpp \
$(DIR)/@ModelName@_semi_analytic_susy_convergence_tester.hpp \
$(DIR)/@ModelName@_semi_analytic_susy_scale_constraint.hpp \
$(DIR)/@ModelName@_soft_parameters_constraint.hpp \
$(DIR)/@ModelName@_susy_convergence_tester.hpp
122 changes: 122 additions & 0 deletions templates/semi_analytic_soft_parameters_constraint.cpp.in
@@ -0,0 +1,122 @@
// ====================================================================
// This file is part of FlexibleSUSY.
//
// FlexibleSUSY is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// FlexibleSUSY is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with FlexibleSUSY. If not, see
// <http://www.gnu.org/licenses/>.
// ====================================================================

// File generated at @DateAndTime@

#include "@ModelName@_semi_analytic_soft_parameters_constraint.hpp"
#include "@ModelName@_semi_analytic_model.hpp"
#include "wrappers.hpp"
#include "logger.hpp"
#include "ew_input.hpp"
#include "gsl_utils.hpp"
#include "minimizer.hpp"
#include "root_finder.hpp"
#include "threshold_loop_functions.hpp"

#include <cassert>
#include <cmath>

namespace flexiblesusy {

#define DERIVEDPARAMETER(p) model->p()
#define INPUTPARAMETER(p) model->get_input().p
#define MODELPARAMETER(p) model->get_##p()
#define PHASE(p) model->get_##p()
#define BETAPARAMETER(p) beta_functions.get_##p()
#define BETAPARAMETER1(l,p) beta_functions_##l##L.get_##p()
#define BETA(p) beta_##p
#define BETA1(l,p) beta_##l##L_##p
#define LowEnergyConstant(p) Electroweak_constants::p
#define MZPole qedqcd.displayPoleMZ()
#define STANDARDDEVIATION(p) Electroweak_constants::Error_##p
#define Pole(p) model->get_physical().p
#define SCALE model->get_scale()
#define THRESHOLD static_cast<int>(model->get_thresholds())
#define MODEL model
#define MODELCLASSNAME @ModelName@<Semi_analytic>

@ModelName@_soft_parameters_constraint<Semi_analytic>::@ModelName@_soft_parameters_constraint(
@ModelName@<Semi_analytic>* model_, const softsusy::QedQcd& qedqcd_)
: model(model_)
, qedqcd(qedqcd_)
{
initialize();
}

@ModelName@_soft_parameters_constraint<Semi_analytic>::~@ModelName@_soft_parameters_constraint()
{
}

void @ModelName@_soft_parameters_constraint<Semi_analytic>::apply()
{
assert(model && "Error: @ModelName@_soft_parameters_constraint<Semi_analytic>::"
"apply():model pointer must not be zero");

@temporarySetting@

model->calculate_coefficients(input_scale);
model->calculate_DRbar_masses();
update_scale();

// apply user-defined susy scale constraints
@applyConstraint@
@temporaryResetting@
}

const @ModelName@_input_parameters& @ModelName@_soft_parameters_constraint<Semi_analytic>::get_input_parameters() const
{
assert(model && "Error: @ModelName@_soft_parameters_constraint<Semi_analytic>::"
"get_input_parameters(): model pointer is zero.");

return model->get_input();
}

void @ModelName@_soft_parameters_constraint<Semi_analytic>::set_model(Model* model_)
{
model = cast_model<@ModelName@<Semi_analytic>*>(model_);
}

void @ModelName@_soft_parameters_constraint<Semi_analytic>::clear()
{
scale = 0.;
initial_scale_guess = 0.;
input_scale = 0.;
model = nullptr;
qedqcd = softsusy::QedQcd();
}

void @ModelName@_soft_parameters_constraint<Semi_analytic>::initialize()
{
assert(model && "@ModelName@_soft_parameters_constraint<Semi_analytic>::"
"initialize(): model pointer is zero.");

@scaleGuess@
scale = initial_scale_guess;
input_scale = scale;
}

void @ModelName@_soft_parameters_constraint<Semi_analytic>::update_scale()
{
assert(model && "@ModelName@_soft_parameters_constraint<Semi_analytic>::"
"update_scale(): model pointer is zero.");

@calculateScale@
@restrictScale@
}

} // namespace flexiblesusy
69 changes: 69 additions & 0 deletions templates/semi_analytic_soft_parameters_constraint.hpp.in
@@ -0,0 +1,69 @@
// ====================================================================
// This file is part of FlexibleSUSY.
//
// FlexibleSUSY is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// FlexibleSUSY is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with FlexibleSUSY. If not, see
// <http://www.gnu.org/licenses/>.
// ====================================================================

// File generated at @DateAndTime@

#ifndef @ModelName@_SEMI_ANALYTIC_SOFT_PARAMETERS_CONSTRAINT_H
#define @ModelName@_SEMI_ANALYTIC_SOFT_PARAMETERS_CONSTRAINT_H

#include "@ModelName@_input_parameters.hpp"
#include "single_scale_constraint.hpp"
#include "lowe.h"

namespace flexiblesusy {

template <class T>
class @ModelName@;

class Semi_analytic;

template<>
class @ModelName@_soft_parameters_constraint<Semi_analytic> : public Single_scale_constraint {
public:
@ModelName@_soft_parameters_constraint() = default;
@ModelName@_soft_parameters_constraint(@ModelName@<Semi_analytic>*, const softsusy::QedQcd&);
virtual ~@ModelName@_soft_parameters_constraint();
virtual void apply() override;
virtual double get_scale() const override { return scale; }
virtual std::string name() const override { return "@ModelName@ soft parameters constraint"; }
virtual void set_model(Model*) override;

void clear();
double get_initial_scale_guess() const { return initial_scale_guess; }
double get_input_scale() const { return input_scale; }
void set_input_scale(double s) { input_scale = s; }
const @ModelName@_input_parameters& get_input_parameters() const;
@ModelName@<Semi_analytic>* get_model() const { return model; }
void initialize();
const softsusy::QedQcd& get_sm_parameters() const { return qedqcd; }
void set_sm_parameters(const softsusy::QedQcd& qedqcd_) { qedqcd = qedqcd_; }

protected:
void update_scale();

private:
double scale{0.};
double initial_scale_guess{0.};
double input_scale{0.};
@ModelName@<Semi_analytic>* model{nullptr};
softsusy::QedQcd qedqcd{};
};

} // namespace flexiblesusy

#endif
2 changes: 1 addition & 1 deletion templates/semi_analytic_susy_scale_constraint.hpp.in
Expand Up @@ -41,7 +41,7 @@ public:
virtual ~@ModelName@_susy_scale_constraint();
virtual void apply() override;
virtual double get_scale() const override { return scale; }
virtual std::string name() const override { return "@ModelName@_SUSY-scale constraint"; }
virtual std::string name() const override { return "@ModelName@ SUSY-scale constraint"; }
virtual void set_model(Model*) override;

void clear();
Expand Down
31 changes: 31 additions & 0 deletions templates/soft_parameters_constraint.hpp.in
@@ -0,0 +1,31 @@
// ====================================================================
// This file is part of FlexibleSUSY.
//
// FlexibleSUSY is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// FlexibleSUSY is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with FlexibleSUSY. If not, see
// <http://www.gnu.org/licenses/>.
// ====================================================================

// File generated at @DateAndTime@

#ifndef @ModelName@_SOFT_PARAMETERS_CONSTRAINT_H
#define @ModelName@_SOFT_PARAMETERS_CONSTRAINT_H

namespace flexiblesusy {

template <class T>
class @ModelName@_soft_parameters_constraint;

} // namespace flexiblesusy

#endif

0 comments on commit 5692a22

Please sign in to comment.