Skip to content

Commit

Permalink
Merge branch 'feature-2.0' into feature-2.0-semianalytic-solver
Browse files Browse the repository at this point in the history
  • Loading branch information
Dylan Harries committed Jan 19, 2017
2 parents 589469d + d589ce2 commit f98f412
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 49 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Expand Up @@ -87,6 +87,11 @@ FlexibleSUSY 2.0.0 [not released yet]

FlexibleSUSY-1.7.3 [not released yet]

* Change (commit 43bb03a): FlexibleSUSY now aborts the code
generation if the user tries to fix an unknown parameter in a
constraint. (Before this commit, FlexibleSUSY did only print a
warning.)

* Bugfix (commit 4a5ada7): Adding missing return statement in
function recalculate_mw_pole(). This bug was only present if the W
pole mass is used as input (not GF).
Expand Down
Binary file modified doc/images/FS-models.xcf
Binary file not shown.
34 changes: 17 additions & 17 deletions meta/Constraint.m
Expand Up @@ -25,8 +25,6 @@

SetTemporarily::usage="set temporary variables";

ResetTemporarily::usage="set temporary variables";

Begin["`Private`"];

allBetaFunctions = {};
Expand All @@ -43,7 +41,9 @@
Parameters`IsExtraParameter[parameter],
Parameters`SetParameter[parameter, value, modelPrefix],
True,
Print["Error: ", parameter, " is neither a model nor an input parameter!"];
Print["Error: ", parameter, " cannot be set in the constraint,",
" because it is neither a model nor an input parameter!"];
Quit[1];
""
];

Expand Down Expand Up @@ -599,30 +599,30 @@
Parameters`CreateLocalConstRefs[pars] <> "\n" <>
StringJoin[CheckPerturbativityForParameter[#,thresh]& /@ pars];

SaveValue[par_[idx__], prefix_String] :=
SaveValue[par_[idx__]] :=
Module[{parStr = CConversion`ToValidCSymbolString[par],
parStrIdx = CConversion`ToValidCSymbolString[par[idx]]},
"const auto " <> prefix <> parStrIdx <> " = MODELPARAMETER(" <> parStr <> ")" <>
"(" <> Utils`StringJoinWithSeparator[ToString /@ {idx},","] <> ");"
parStrIdx = CConversion`ToValidCSymbolString[par[idx]], oldVal},
oldVal = "old_" <> parStrIdx;
"const auto " <> oldVal <> " = MODELPARAMETER(" <> parStr <> ")" <>
"(" <> Utils`StringJoinWithSeparator[ToString /@ {idx},","] <> ");\n" <>
"const auto save_" <> parStrIdx <> " = make_raii_guard([this," <> oldVal <> "]{ " <>
Parameters`SetParameter[par[idx], oldVal, "MODEL->"] <> " });\n"
];

SaveValue[par_, prefix_String] :=
Module[{parStr = CConversion`ToValidCSymbolString[par]},
"const auto " <> prefix <> parStr <> " = MODELPARAMETER(" <> parStr <> ");"
SaveValue[par_] :=
Module[{parStr = CConversion`ToValidCSymbolString[par], oldVal},
oldVal = "old_" <> parStr;
"const auto " <> oldVal <> " = MODELPARAMETER(" <> parStr <> ");\n" <>
"const auto save_" <> parStr <> " = make_raii_guard([this," <> oldVal <> "]{ " <>
Parameters`SetParameter[par, oldVal, "MODEL->"] <> " });\n"
];

RestoreValue[par_, prefix_String] :=
Parameters`SetParameter[
par,
prefix <> CConversion`ToValidCSymbolString[par],
"MODEL->"];

SetTemporarily[settings_List] :=
Module[{tempSettings = Cases[settings, {FlexibleSUSY`Temporary[p_], v_} :> {p,v}],
set, savedVals},
If[tempSettings === {}, Return[""];];
set = ApplyConstraints[tempSettings];
savedVals = Utils`StringJoinWithSeparator[SaveValue[#[[1]], "old_"]& /@ tempSettings, "\n"];
savedVals = Utils`StringJoinWithSeparator[SaveValue[#[[1]]]& /@ tempSettings, "\n"];
"// temporary parameter re-definitons\n" <>
savedVals <> "\n{\n" <> IndentText[set] <> "}"
];
Expand Down
4 changes: 1 addition & 3 deletions meta/FlexibleSUSY.m
Expand Up @@ -739,7 +739,7 @@ FlexibleSUSY model file (FlexibleSUSY.m).
{minimumScale_, maximumScale_}, files_List] :=
Module[{applyConstraint = "", calculateScale, scaleGuess,
restrictScale,
temporarySetting = "", temporaryResetting = "",
temporarySetting = "",
setDRbarYukawaCouplings,
calculateDRbarMasses,
calculateDeltaAlphaEm, calculateDeltaAlphaS,
Expand All @@ -753,7 +753,6 @@ FlexibleSUSY model file (FlexibleSUSY.m).
scaleGuess = Constraint`CalculateScale[scaleFirstGuess, "initial_scale_guess"];
restrictScale = Constraint`RestrictScale[{minimumScale, maximumScale}];
temporarySetting = Constraint`SetTemporarily[settings];
temporaryResetting = Constraint`ResetTemporarily[settings];
calculateDeltaAlphaEm = ThresholdCorrections`CalculateDeltaAlphaEm[FlexibleSUSY`FSRenormalizationScheme];
calculateDeltaAlphaS = ThresholdCorrections`CalculateDeltaAlphaS[FlexibleSUSY`FSRenormalizationScheme];
calculateThetaW = ThresholdCorrections`CalculateThetaW[FSWeakMixingAngleOptions,SARAH`SupersymmetricModel];
Expand Down Expand Up @@ -791,7 +790,6 @@ FlexibleSUSY model file (FlexibleSUSY.m).
"@scaleGuess@" -> IndentText[WrapLines[scaleGuess]],
"@restrictScale@" -> IndentText[WrapLines[restrictScale]],
"@temporarySetting@" -> IndentText[WrapLines[temporarySetting]],
"@temporaryResetting@" -> IndentText[WrapLines[temporaryResetting]],
"@calculateGaugeCouplings@" -> IndentText[WrapLines[calculateGaugeCouplings]],
"@calculateDeltaAlphaEm@" -> IndentText[WrapLines[calculateDeltaAlphaEm]],
"@calculateDeltaAlphaS@" -> IndentText[WrapLines[calculateDeltaAlphaS]],
Expand Down
10 changes: 5 additions & 5 deletions meta/LoopMasses.m
Expand Up @@ -143,7 +143,7 @@
"const double self_energy = Re(" <> selfEnergyFunction <> "(p));\n" <>
"const double mass_sqr = " <> massMatrixName <> " - self_energy;\n\n" <>
"if (mass_sqr < 0.)\n" <>
IndentText["problems.flag_pole_tachyon(" <> particleName <> ");"] <> "\n\n" <>
IndentText[TreeMasses`FlagPoleTachyon[particleName]] <> "\n" <>
"PHYSICAL(" <> massName <> ") = AbsSqrt(mass_sqr);\n";


Expand Down Expand Up @@ -686,7 +686,7 @@ be set to the (positive) tree-level mass. M_tree
Module[{result, body = ""},
If[!IsFermion[particle] &&
!(IsUnmixed[particle] && GetMassOfUnmixedParticle[particle] === 0),
body = "if (!force_output && problems.is_running_tachyon(" <> ToValidCSymbolString[particle] <> "))\n" <>
body = "if (!force_output && problems.is_running_tachyon(" <> FlexibleSUSY`FSModelName <> "_info::" <> ToValidCSymbolString[particle] <> "))\n" <>
IndentText["return;"] <> "\n\n";
];
body = body <> DoDiagonalization[particle, precision, tadpole];
Expand Down Expand Up @@ -715,7 +715,7 @@ be set to the (positive) tree-level mass. M_tree
Return[""];
];
If[!(IsUnmixed[particle] && GetMassOfUnmixedParticle[particle] === 0),
body = "if (!force_output && problems.is_running_tachyon(" <> ToValidCSymbolString[particle] <> "))\n" <>
body = "if (!force_output && problems.is_running_tachyon(" <> FlexibleSUSY`FSModelName <> "_info::" <> ToValidCSymbolString[particle] <> "))\n" <>
IndentText["return 0.;"] <> "\n\n";
];
If[!IsMassless[particle],
Expand All @@ -734,7 +734,7 @@ be set to the (positive) tree-level mass. M_tree
"const double self_energy = Re(" <> selfEnergyFunction <> "(p));\n" <>
"const double mass_sqr = " <> mTree <> " - self_energy;\n\n" <>
"if (mass_sqr < 0.)\n" <>
IndentText["problems.flag_pole_tachyon(" <> particleName <> ");"] <> "\n\n" <>
IndentText[TreeMasses`FlagPoleTachyon[particleName]] <> "\n" <>
"return AbsSqrt(mass_sqr);\n";
,
body = "return 0.;\n";
Expand Down Expand Up @@ -1085,7 +1085,7 @@ be set to the (positive) tree-level mass. M_tree
"const double self_energy = Re(" <> selfEnergyFunction <> "(p));\n" <>
"const double mass_sqr = Sqr(m_pole) + self_energy;\n\n" <>
"if (mass_sqr < 0.) {\n" <>
IndentText["problems.flag_running_tachyon(" <> particleName <> ");\n" <>
IndentText[TreeMasses`FlagPoleTachyon[particleName] <>
"return m_pole;"] <> "\n}\n\n" <>
"return AbsSqrt(mass_sqr);\n";
];
Expand Down
8 changes: 6 additions & 2 deletions meta/SelfEnergies.m
Expand Up @@ -589,8 +589,12 @@
DivideTadpoleByVEV[higgsAndVEV_List, arrayName_String] :=
Module[{body = "", v, vev},
For[v = 1, v <= Length[higgsAndVEV], v++,
vev = CConversion`RValueToCFormString[higgsAndVEV[[v,3]]];
body = body <> arrayName <> "[" <> ToString[v-1] <> "] /= " <> vev <> ";\n";
vev = higgsAndVEV[[v,3]];
If[vev === 0,
body = body <> arrayName <> "[" <> ToString[v-1] <> "] = 0.;\n";,
vev = CConversion`RValueToCFormString[vev];
body = body <> arrayName <> "[" <> ToString[v-1] <> "] /= " <> vev <> ";\n";
];
];
body
];
Expand Down
3 changes: 1 addition & 2 deletions meta/ThresholdCorrections.m
Expand Up @@ -601,8 +601,7 @@
const double mw_pole_sqr = Sqr(mw_drbar) - self_energy_w_at_mw;
if (mw_pole_sqr < 0.)
MODEL->get_problems().flag_pole_tachyon(" <> FlexibleSUSY`FSModelName <> "_info::" <> wStr <> ");
" <> TreeMasses`FlagPoleTachyon[wStr, "MODEL->get_problems()."] <> "
return AbsSqrt(mw_pole_sqr);"
];

Expand Down
30 changes: 19 additions & 11 deletions meta/TreeMasses.m
Expand Up @@ -198,6 +198,9 @@
CallDiagonalizeSymmetricFunction::usage="";
CallDiagonalizeHermitianFunction::usage="";

FlagPoleTachyon::usage = "";
FlagRunningTachyon::usage = "";

Begin["`Private`"];

unrotatedParticles = {};
Expand Down Expand Up @@ -1250,7 +1253,7 @@ the fundamental representation of SU(3) in SARAH.
WrapMacro[CConversion`ToValidCSymbolString[FlexibleSUSY`M[particle]],macro] <>
If[dimEnd > 1, ".tail<" <> ToString[dimEnd - dimStart + 1] <> ">().minCoeff()", ""]<>
" < 0.) " <>
"problems.flag_pole_tachyon(" <> particleName <> ");\n"
FlagPoleTachyon[particleName]
];

CheckPoleMassesForTachyons[macro_String] :=
Expand Down Expand Up @@ -1338,20 +1341,25 @@ the fundamental representation of SU(3) in SARAH.
{prototype, def}
];

FlagTachyon[particle_String] :=
"problems.flag_running_tachyon(" <>
FlagPoleTachyon[particle_String, problems_String:"problems."] :=
problems <> "flag_pole_tachyon(" <>
FlexibleSUSY`FSModelName <> "_info::" <> particle <>
");\n";

FlagRunningTachyon[particle_String, problems_String:"problems."] :=
problems <> "flag_running_tachyon(" <>
FlexibleSUSY`FSModelName <> "_info::" <> particle <>
");\n";

FlagTachyon[particles_List] :=
StringJoin[FlagTachyon /@ particles];
FlagRunningTachyon[particles_List] :=
StringJoin[FlagRunningTachyon /@ particles];

FlagTachyon[particle_] :=
FlagTachyon[ToValidCSymbolString[GetHead[particle]]];
FlagRunningTachyon[particle_] :=
FlagRunningTachyon[ToValidCSymbolString[GetHead[particle]]];

CheckTachyon[particle_, eigenvector_String] :=
CheckRunningTachyon[particle_, eigenvector_String] :=
"if (" <> eigenvector <> If[GetDimension[particle] > 1, ".minCoeff()", ""] <> " < 0.) {\n" <>
IndentText[FlagTachyon[particle]] <>
IndentText[FlagRunningTachyon[particle]] <>
"}\n";

FlagBadMass[particle_String, eigenvalue_String] :=
Expand Down Expand Up @@ -1473,7 +1481,7 @@ the fundamental representation of SU(3) in SARAH.
body = body <> "\n" <>
IndentText[
If[ContainsMassless[eigenVector], "",
CheckTachyon[eigenVector, ev] <> "\n"] <>
CheckRunningTachyon[eigenVector, ev] <> "\n"] <>
ev <> " = AbsSqrt(" <> ev <> ");\n"
];
];
Expand Down Expand Up @@ -1541,7 +1549,7 @@ the fundamental representation of SU(3) in SARAH.
!IsMassless[massESSymbol],
body = body <> "\n" <>
If[ContainsMassless[eigenVector], "",
CheckTachyon[massESSymbol, ev] <> "\n"] <>
CheckRunningTachyon[massESSymbol, ev] <> "\n"] <>
ev <> " = AbsSqrt(" <> ev <> ");\n";
];
body = IndentText[body];
Expand Down
4 changes: 4 additions & 0 deletions src/raii.hpp
Expand Up @@ -29,7 +29,11 @@ template <typename T>
class RAII_save {
public:
RAII_save(T& var_) noexcept : var(var_), value(var_) {}
RAII_save(const RAII_save&) = delete;
RAII_save(RAII_save&&) = default;
~RAII_save() { var = value; }
RAII_save& operator=(const RAII_save&) = delete;
RAII_save& operator=(RAII_save&& other) = default;

private:
T& var;
Expand Down
2 changes: 0 additions & 2 deletions templates/mass_eigenstates.cpp.in
Expand Up @@ -57,8 +57,6 @@

namespace flexiblesusy {

using namespace @ModelName@_info;

#define CLASSNAME @ModelName@_mass_eigenstates

#define PHYSICAL(parameter) physical.parameter
Expand Down
3 changes: 1 addition & 2 deletions templates/two_scale_high_scale_constraint.cpp.in
Expand Up @@ -26,6 +26,7 @@
#include "ew_input.hpp"
#include "gsl_utils.hpp"
#include "minimizer.hpp"
#include "raii.hpp"
#include "root_finder.hpp"
#include "threshold_loop_functions.hpp"
#include "numerics2.hpp"
Expand Down Expand Up @@ -75,8 +76,6 @@ void @ModelName@_high_scale_constraint<Two_scale>::apply()
@applyConstraint@

check_non_perturbative();

@temporaryResetting@
}

bool @ModelName@_high_scale_constraint<Two_scale>::check_non_perturbative()
Expand Down
3 changes: 1 addition & 2 deletions templates/two_scale_low_scale_constraint.cpp.in
Expand Up @@ -27,6 +27,7 @@
#include "ew_input.hpp"
#include "gsl_utils.hpp"
#include "minimizer.hpp"
#include "raii.hpp"
#include "root_finder.hpp"
#include "threshold_loop_functions.hpp"
#include "weinberg_angle.hpp"
Expand Down Expand Up @@ -86,8 +87,6 @@ void @ModelName@_low_scale_constraint<Two_scale>::apply()

if (model->get_thresholds())
qedqcd.setPoleMW(recalculate_mw_pole(qedqcd.displayPoleMW()));

@temporaryResetting@
}

const Eigen::Matrix<std::complex<double>,3,3>& @ModelName@_low_scale_constraint<Two_scale>::get_ckm()
Expand Down
2 changes: 0 additions & 2 deletions templates/two_scale_model.cpp.in
Expand Up @@ -34,8 +34,6 @@

namespace flexiblesusy {

using namespace @ModelName@_info;

#define CLASSNAME @ModelName@<Two_scale>

CLASSNAME::@ModelName@(const @ModelName@_input_parameters& input_)
Expand Down
2 changes: 1 addition & 1 deletion templates/two_scale_susy_scale_constraint.cpp.in
Expand Up @@ -26,6 +26,7 @@
#include "ew_input.hpp"
#include "gsl_utils.hpp"
#include "minimizer.hpp"
#include "raii.hpp"
#include "root_finder.hpp"
#include "threshold_loop_functions.hpp"

Expand Down Expand Up @@ -73,7 +74,6 @@ void @ModelName@_susy_scale_constraint<Two_scale>::apply()

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

double @ModelName@_susy_scale_constraint<Two_scale>::get_scale() const
Expand Down

0 comments on commit f98f412

Please sign in to comment.