Skip to content

Commit

Permalink
Correct setting of model parameters from substitutions
Browse files Browse the repository at this point in the history
in separate EWSB solver classes, and update tests for
VCMSSM
  • Loading branch information
Dylan Harries committed Jan 13, 2017
1 parent 0f252da commit 801d5b8
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 37 deletions.
61 changes: 25 additions & 36 deletions meta/EWSB.m
Original file line number Diff line number Diff line change
Expand Up @@ -179,17 +179,17 @@
If[phases === {}, Null, phases[[1]]]
];

WrapPhase[phase_ /; phase === Null, str_String, macro_String:"LOCALINPUT"] :=
str;

WrapPhase[phase_, str_String, macro_String:"LOCALINPUT"] :=
macro <> "(" <> CConversion`ToValidCSymbolString[phase] <> ")*Abs(" <> str <> ")";

GetValueWithPhase[parameter_, gslIntputVector_String, index_Integer, freePhases_List] :=
Module[{result, parameterStr, freePhase, gslInput},
parameterStr = ToValidCSymbolString[parameter];
Module[{freePhase, gslInput},
freePhase = FindFreePhase[parameter, freePhases];
gslInput = gslIntputVector <> "(" <> ToString[index] <> ")";
If[freePhase =!= Null,
result = "INPUT(" <> CConversion`ToValidCSymbolString[freePhase] <> ") * " <> "Abs(" <> gslInput <> ")";
,
result = gslInput;
];
Return[result];
WrapPhase[freePhase, gslInput, "INPUT"]
];

FillArrayWithEWSBEqs[higgs_, gslOutputVector_String] :=
Expand Down Expand Up @@ -707,9 +707,10 @@
ReplaceFixedParametersBySymbolsInTarget[solution, GetFixedParameter /@ solution];

CreateMemberTreeLevelEwsbSolver[solution_List, substitutions_List:{}] :=
Module[{result = "", body = "",
Module[{result = "", body = "", fixedPars,
i, par, expr, parStr, oldParStr, reducedSolution,
type},
fixedPars = GetFixedParameter /@ solution;
reducedSolution = solution;
If[reducedSolution =!= {},
(* create local const refs to input parameters appearing
Expand Down Expand Up @@ -762,7 +763,7 @@
"}";,
result = result <>
"if (is_finite) {\n" <>
IndentText[WrapLines[SetModelParametersFromEWSB[substitutions]]] <>
IndentText[WrapLines[SetModelParametersFromEWSB[fixedPars, substitutions]]] <>
"} else {\n" <>
IndentText[body] <>
"}";
Expand All @@ -774,9 +775,10 @@
];

CreateTreeLevelEwsbSolver[solution_List, substitutions_List:{}] :=
Module[{result = "", failBody = "", successBody = "",
Module[{result = "", failBody = "", successBody = "", fixedPars,
i, par, expr, parStr, oldParStr, decls = "", reducedSolution,
type},
fixedPars = GetFixedParameter /@ solution;
reducedSolution = solution;
If[reducedSolution =!= {},
(* create local const refs to input parameters appearing
Expand Down Expand Up @@ -834,9 +836,9 @@
"}";,
result = result <>
"if (is_finite) {\n" <>
IndentText[WrapLines[SetModelParametersFromEWSB[substitutions]]] <>
IndentText[WrapLines[SetModelParametersFromEWSB[fixedPars, substitutions, "model->"]]] <>
"} else {\n" <>
IndentText[body] <>
IndentText[failBody] <>
"}";
];
,
Expand Down Expand Up @@ -881,24 +883,6 @@
CreateEWSBRootFinders[rootFinders_List] :=
Utils`StringJoinWithSeparator[MakeUniquePtr[#,"EWSB_solver"]& /@ (CreateEWSBRootFinder /@ rootFinders), ",\n"];

WrapPhase[phase_ /; phase === Null, str_String] :=
str;

WrapPhase[phase_, str_String] :=
"LOCALINPUT(" <> CConversion`ToValidCSymbolString[phase] <> ")*Abs(" <> str <> ")";

SetEWSBSolution[par_, idx_, phase_, func_String, class_String] :=
Parameters`SetParameter[par, WrapPhase[phase, func <> "(" <> ToString[idx-1] <> ")"], class, None];

SetEWSBSolution[parametersFixedByEWSB_List, freePhases_List, func_String, class_String] :=
Module[{result = "", i, phase},
For[i = 1, i <= Length[parametersFixedByEWSB], i++,
phase = FindFreePhase[parametersFixedByEWSB[[i]], freePhases];
result = result <> SetEWSBSolution[parametersFixedByEWSB[[i]], i, phase, func, class];
];
result
];

ConvertToReal[par_] :=
If[Parameters`IsRealParameter[par],
CConversion`ToValidCSymbolString[par],
Expand Down Expand Up @@ -993,6 +977,10 @@
result
];

SetEWSBSolution[parametersFixedByEWSB_List, freePhases_List, func_String, class_String] :=
GetEWSBParametersFromVector[parametersFixedByEWSB, freePhases, func] <>
SetEWSBParametersFromLocalCopies[parametersFixedByEWSB, class];

CreateEWSBParametersInitializationComma[{}] := "";

CreateEWSBParametersInitializationComma[parameters_List] :=
Expand All @@ -1007,17 +995,18 @@
CreateEWSBParametersInitialization[parameters_List, array_String] :=
StringJoin[MapIndexed[SetEWSBParameter[#1,First[#2 - 1],array]&, parameters]];

SetModelParametersFromEWSB[substitutions_List] :=
Module[{subs = substitutions, result = ""},
SetModelParametersFromEWSB[parametersFixedByEWSB_List, substitutions_List, class_String] :=
Module[{subs = substitutions, localPars, result = ""},
subs = subs /. { RuleDelayed[Sign[p_] /; Parameters`IsInputParameter[Sign[p]],
Global`LOCALINPUT[CConversion`ToValidCSymbol[Sign[p]]]],
RuleDelayed[FlexibleSUSY`Phase[p_] /; Parameters`IsInputParameter[FlexibleSUSY`Phase[p]],
Global`LOCALINPUT[CConversion`ToValidCSymbol[FlexibleSUSY`Phase[p]]]] };
(result = result <> Parameters`SetParameter[#[[1]], #[[2]], Parameters`GetType[#[[1]]]])& /@ subs;
Parameters`CreateLocalConstRefsForInputParameters[#[[2]]& /@ subs, "LOCALINPUT"] <> result
(result = result <> Parameters`SetParameter[#[[1]], #[[2]], class])& /@ subs;
localPars = Parameters`FindAllParameters[#[[2]]& /@ subs, parametersFixedByEWSB];
Parameters`CreateLocalConstRefs[localPars] <> result
];

ApplyEWSBSubstitutions[parametersFixedByEWSB_List, substitutions_List, class_String:"model."] :=
ApplyEWSBSubstitutions[parametersFixedByEWSB_List, substitutions_List, class_String:"model->"] :=
Module[{pars, subs = substitutions, result = ""},
subs = subs /. { RuleDelayed[Sign[p_] /; Parameters`IsInputParameter[Sign[p]],
Global`INPUT[CConversion`ToValidCSymbol[Sign[p]]]],
Expand Down
2 changes: 1 addition & 1 deletion meta/FlexibleSUSY.m
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,7 @@ corresponding tadpole is real or imaginary (only in models with CP
solveEwsbWithTadpoles = EWSB`CreateEwsbSolverWithTadpoles[ewsbSolution];
getEWSBParametersFromVector = EWSB`GetEWSBParametersFromVector[parametersFixedByEWSB, freePhases, "ewsb_pars"];
setEWSBParametersFromLocalCopies = EWSB`SetEWSBParametersFromLocalCopies[parametersFixedByEWSB, "model->"];
setModelParametersFromEWSB = EWSB`SetModelParametersFromEWSB[ewsbSubstitutions];
setModelParametersFromEWSB = EWSB`SetModelParametersFromEWSB[parametersFixedByEWSB, ewsbSubstitutions, "model->"];
applyEWSBSubstitutions = EWSB`ApplyEWSBSubstitutions[parametersFixedByEWSB, ewsbSubstitutions];
WriteOut`ReplaceInFiles[files,
{ "@calculateOneLoopTadpolesNoStruct@" -> IndentText[calculateOneLoopTadpolesNoStruct],
Expand Down
18 changes: 18 additions & 0 deletions test/test_VCMSSM_ewsb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <boost/test/unit_test.hpp>

#include "test_VCMSSM.hpp"
#include "CMSSM_two_scale_ewsb_solver.hpp"
#include "VCMSSM_two_scale_ewsb_solver.hpp"

using namespace flexiblesusy;

Expand All @@ -13,6 +15,8 @@ BOOST_AUTO_TEST_CASE( test_VCMSSM_ewsb_tree_level )
VCMSSM_mass_eigenstates vcmssm(input);
const double precision = 1.0e-5;
setup_VCMSSM(vcmssm, input);
VCMSSM_ewsb_solver<Two_scale> vcmssm_solver;
vcmssm.set_ewsb_solver(&vcmssm_solver);

// initial guess
const double vev = Sqrt(Sqr(vcmssm.get_vd()) + Sqr(vcmssm.get_vu()));
Expand All @@ -36,6 +40,8 @@ BOOST_AUTO_TEST_CASE( test_VCMSSM_ewsb_tree_level )

CMSSM_mass_eigenstates cmssm;
match_CMSSM_to_VCMSSM(cmssm, vcmssm);
CMSSM_ewsb_solver<Two_scale> cmssm_solver;
cmssm.set_ewsb_solver(&cmssm_solver);

// initial guess: VCMSSM solution with small perturbation
const double shift = 5.;
Expand Down Expand Up @@ -63,6 +69,8 @@ BOOST_AUTO_TEST_CASE( test_VCMSSM_ewsb_tree_level_negative_Mu )
VCMSSM_mass_eigenstates vcmssm(input);
const double precision = 1.0e-5;
setup_VCMSSM(vcmssm, input);
VCMSSM_ewsb_solver<Two_scale> vcmssm_solver;
vcmssm.set_ewsb_solver(&vcmssm_solver);

input.SignMu = -1;
vcmssm.set_input_parameters(input);
Expand All @@ -89,6 +97,8 @@ BOOST_AUTO_TEST_CASE( test_VCMSSM_ewsb_tree_level_negative_Mu )

CMSSM_mass_eigenstates cmssm;
match_CMSSM_to_VCMSSM(cmssm, vcmssm);
CMSSM_ewsb_solver<Two_scale> cmssm_solver;
cmssm.set_ewsb_solver(&cmssm_solver);

// initial guess: VCMSSM solution with small perturbation
const double shift = 5.;
Expand Down Expand Up @@ -116,6 +126,8 @@ BOOST_AUTO_TEST_CASE( test_VCMSSM_ewsb_one_loop )
VCMSSM_mass_eigenstates vcmssm(vcmssm_input);
const double precision = 1.0e-5;
setup_VCMSSM(vcmssm, vcmssm_input);
VCMSSM_ewsb_solver<Two_scale> vcmssm_solver;
vcmssm.set_ewsb_solver(&vcmssm_solver);

// initial guess
const double vev = Sqrt(Sqr(vcmssm.get_vd()) + Sqr(vcmssm.get_vu()));
Expand Down Expand Up @@ -153,6 +165,8 @@ BOOST_AUTO_TEST_CASE( test_VCMSSM_ewsb_one_loop )
cmssm_input.SignMu = vcmssm_input.SignMu;
CMSSM_mass_eigenstates cmssm(cmssm_input);
match_CMSSM_to_VCMSSM(cmssm, vcmssm);
CMSSM_ewsb_solver<Two_scale> cmssm_solver;
cmssm.set_ewsb_solver(&cmssm_solver);

cmssm.calculate_DRbar_masses();

Expand Down Expand Up @@ -188,6 +202,8 @@ BOOST_AUTO_TEST_CASE( test_VCMSSM_ewsb_one_loop_negative_Mu )
VCMSSM_mass_eigenstates vcmssm(vcmssm_input);
const double precision = 1.0e-5;
setup_VCMSSM(vcmssm, vcmssm_input);
VCMSSM_ewsb_solver<Two_scale> vcmssm_solver;
vcmssm.set_ewsb_solver(&vcmssm_solver);

vcmssm_input.SignMu = -1;
vcmssm.set_input_parameters(vcmssm_input);
Expand Down Expand Up @@ -228,6 +244,8 @@ BOOST_AUTO_TEST_CASE( test_VCMSSM_ewsb_one_loop_negative_Mu )
cmssm_input.SignMu = vcmssm_input.SignMu;
CMSSM_mass_eigenstates cmssm(cmssm_input);
match_CMSSM_to_VCMSSM(cmssm, vcmssm);
CMSSM_ewsb_solver<Two_scale> cmssm_solver;
cmssm.set_ewsb_solver(&cmssm_solver);

cmssm.calculate_DRbar_masses();

Expand Down

0 comments on commit 801d5b8

Please sign in to comment.