Skip to content

Commit

Permalink
add the apply() function to the constraint
Browse files Browse the repository at this point in the history
in order to make it callable in the initial guesser
Performing an initial guess via run_to() and apply() yields a very
good first guess.
  • Loading branch information
Alexander Voigt committed Jul 15, 2015
1 parent 2653da4 commit 4647dc0
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 1 deletion.
5 changes: 4 additions & 1 deletion meta/FlexibleSUSY.m
Expand Up @@ -641,7 +641,8 @@

WriteRootConstraintClass[condition_, settings_List, scaleFirstGuess_,
{minimumScale_, maximumScale_}, files_List] :=
Module[{calculateFunction = "", calculateScale, scaleGuess,
Module[{applyConstraint = "", calculateFunction = "",
calculateScale, scaleGuess,
restrictScale,
numberOfFixedParameters,
setDRbarYukawaCouplings,
Expand All @@ -654,6 +655,7 @@
Constraint`SetBetaFunctions[GetBetaFunctions[]];
numberOfFixedParameters = Constraint`CalculateNumberOfParameters[settings];
calculateFunction = Constraint`CalculateDifferenceFunction[settings];
applyConstraint = Constraint`ApplyConstraints[settings];
calculateScale = Constraint`CalculateScale[condition, "scale"];
scaleGuess = Constraint`CalculateScale[scaleFirstGuess, "initial_scale_guess"];
restrictScale = Constraint`RestrictScale[{minimumScale, maximumScale}];
Expand All @@ -676,6 +678,7 @@
];
WriteOut`ReplaceInFiles[files,
{ "@numberOfFixedParameters@" -> numberOfFixedParameters,
"@applyConstraint@" -> IndentText[WrapLines[applyConstraint]],
"@calculateFunction@" -> IndentText[WrapLines[calculateFunction]],
"@calculateScale@" -> IndentText[WrapLines[calculateScale]],
"@scaleGuess@" -> IndentText[WrapLines[scaleGuess]],
Expand Down
1 change: 1 addition & 0 deletions src/root_constraint.hpp
Expand Up @@ -34,6 +34,7 @@ template<>
class Constraint<Root> {
public:
virtual ~Constraint() {}
virtual void apply() = 0;
virtual Eigen::ArrayXd calculate_function(const Eigen::ArrayXd&) = 0;
virtual std::size_t get_number_of_fixed_parameters() const = 0;
virtual double get_scale() const = 0; ///< get scale where to apply
Expand Down
34 changes: 34 additions & 0 deletions templates/root_high_scale_constraint.cpp.in
Expand Up @@ -70,6 +70,40 @@ namespace flexiblesusy {
{
}

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

if (std::fabs(model->get_@hyperchargeCoupling@()) > @perturbativityThreshold@) {
#ifdef ENABLE_VERBOSE
ERROR("@ModelName@_high_scale_constraint: Non-perturbative gauge "
"coupling @hyperchargeCoupling@ = " << model->get_@hyperchargeCoupling@());
#endif
model->set_@hyperchargeCoupling@(@perturbativityThreshold@);
}
if (std::fabs(model->get_@leftCoupling@()) > @perturbativityThreshold@) {
#ifdef ENABLE_VERBOSE
ERROR("@ModelName@_high_scale_constraint: Non-perturbative gauge "
"coupling @leftCoupling@ = " << model->get_@leftCoupling@());
#endif
model->set_@leftCoupling@(@perturbativityThreshold@);
}
if (std::fabs(model->get_@strongCoupling@()) > @perturbativityThreshold@) {
#ifdef ENABLE_VERBOSE
ERROR("@ModelName@_high_scale_constraint: Non-perturbative gauge "
"coupling @strongCoupling@ = " << model->get_@strongCoupling@());
#endif
model->set_@strongCoupling@(@perturbativityThreshold@);
}

update_scale();

@applyConstraint@

non_perturbative();
}

Eigen::ArrayXd @ModelName@_high_scale_constraint<Root>::calculate_function(
const Eigen::ArrayXd& arg_)
{
Expand Down
1 change: 1 addition & 0 deletions templates/root_high_scale_constraint.hpp.in
Expand Up @@ -38,6 +38,7 @@ public:
@ModelName@_high_scale_constraint();
@ModelName@_high_scale_constraint(@ModelName@<Root>*);
virtual ~@ModelName@_high_scale_constraint();
virtual void apply();
virtual Eigen::ArrayXd calculate_function(const Eigen::ArrayXd&);
virtual std::size_t get_number_of_fixed_parameters() const;
virtual double get_scale() const;
Expand Down
18 changes: 18 additions & 0 deletions templates/root_low_scale_constraint.cpp.in
Expand Up @@ -97,6 +97,24 @@ namespace flexiblesusy {
{
}

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

model->calculate_DRbar_masses();
update_scale();
calculate_DRbar_gauge_couplings();

@applyConstraint@

model->set_@hyperchargeCoupling@(new_@hyperchargeCoupling@);
model->set_@leftCoupling@(new_@leftCoupling@);
model->set_@strongCoupling@(new_@strongCoupling@);

recalculate_mw_pole();
}

Eigen::ArrayXd @ModelName@_low_scale_constraint<Root>::calculate_function(
const Eigen::ArrayXd& arg_)
{
Expand Down
1 change: 1 addition & 0 deletions templates/root_low_scale_constraint.hpp.in
Expand Up @@ -40,6 +40,7 @@ public:
@ModelName@_low_scale_constraint();
@ModelName@_low_scale_constraint(@ModelName@<Root>*, const QedQcd&);
virtual ~@ModelName@_low_scale_constraint();
virtual void apply();
virtual Eigen::ArrayXd calculate_function(const Eigen::ArrayXd&);
virtual std::size_t get_number_of_fixed_parameters() const;
virtual double get_scale() const;
Expand Down
12 changes: 12 additions & 0 deletions templates/root_susy_scale_constraint.cpp.in
Expand Up @@ -65,6 +65,18 @@ namespace flexiblesusy {
{
}

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

model->calculate_DRbar_masses();
update_scale();

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

Eigen::ArrayXd @ModelName@_susy_scale_constraint<Root>::calculate_function(
const Eigen::ArrayXd& arg_)
{
Expand Down
1 change: 1 addition & 0 deletions templates/root_susy_scale_constraint.hpp.in
Expand Up @@ -38,6 +38,7 @@ public:
@ModelName@_susy_scale_constraint();
@ModelName@_susy_scale_constraint(@ModelName@<Root>*);
virtual ~@ModelName@_susy_scale_constraint();
virtual void apply();
virtual Eigen::ArrayXd calculate_function(const Eigen::ArrayXd&);
virtual std::size_t get_number_of_fixed_parameters() const;
virtual double get_scale() const;
Expand Down

0 comments on commit 4647dc0

Please sign in to comment.