diff --git a/.clang-format b/.clang-format index 4d381aa3..250a143f 100644 --- a/.clang-format +++ b/.clang-format @@ -9,7 +9,6 @@ AllowShortCaseLabelsOnASingleLine: 'true' AllowShortFunctionsOnASingleLine: InlineOnly AllowShortIfStatementsOnASingleLine: WithoutElse AllowShortLoopsOnASingleLine: 'false' -AlwaysBreakAfterReturnType: All BinPackArguments: 'false' BinPackParameters: 'false' BreakBeforeBraces: Allman diff --git a/include/BSMPT/Kfactors/Kfactors.h b/include/BSMPT/Kfactors/Kfactors.h index 03a9f37f..2fbe8b48 100644 --- a/include/BSMPT/Kfactors/Kfactors.h +++ b/include/BSMPT/Kfactors/Kfactors.h @@ -47,8 +47,7 @@ struct GSL_integration /** * Helper function which displays the numbers in a more readable way */ -void -display_results(std::string title, double result, double error); +void display_results(std::string title, double result, double error); /** * Calculates the distribution f0, defined in Eq(13) in 0604159 @@ -58,8 +57,7 @@ display_results(std::string title, double result, double error); * @param diff number of derivatives w.r.t. E0, diff = 0 no derivative and diff * = 1 or 2 accordingly */ -double -distribution_f0(double E0, int s, double Temp, int diff = 0); +double distribution_f0(double E0, int s, double Temp, int diff = 0); /** * Evaluates the integrand in the K functions @@ -70,19 +68,17 @@ distribution_f0(double E0, int s, double Temp, int diff = 0); * @param s s=-1 yields the function for a bosonic distribution, s=+1 for a * fermionic one */ -double -K_integrand(const std::vector &p, - double masssquared, - int switchvalue, - int s, - double Temp); +double K_integrand(const std::vector &p, + double masssquared, + int switchvalue, + int s, + double Temp); /** * Interface to communicate the value of K_integrand() to the GSL integration * routine */ -double -K_integrand_gsl(double *x, std::size_t dim, void *params); +double K_integrand_gsl(double *x, std::size_t dim, void *params); /** * Calculates the values of the K functions given in Eq (23) in 0604159 without @@ -93,8 +89,7 @@ K_integrand_gsl(double *x, std::size_t dim, void *params); * @param s s=-1 yields the function for a bosonic distribution, s=+1 for a * fermionic one */ -double -K_integration(double masssquared, double Temp, int switchvalue, int s); +double K_integration(double masssquared, double Temp, int switchvalue, int s); /** * Calculates the normalized K function @@ -104,24 +99,21 @@ K_integration(double masssquared, double Temp, int switchvalue, int s); * @param s s=-1 yields the function for a bosonic distribution, s=+1 for a * fermionic one */ -double -K_functions(double masssquared, double Temp, int switchvalue, int s); +double K_functions(double masssquared, double Temp, int switchvalue, int s); /** * Integrand to calculate the normalization for the Ktilde functions. Used in * Ktilde_normalization() * @param x vector which containts the momentum * @param params GSL_integration struct */ -double -Ktilde_normalization_func(double x, void *params); +double Ktilde_normalization_func(double x, void *params); /** * Calculates the normalization for the non tilde K functions * @param Temp Temperature * @param s +1 for fermions and -1 for bosons * @param masssquared m^2 value */ -double -Ktilde_normalization(double Temp, int s, double masssquared); +double Ktilde_normalization(double Temp, int s, double masssquared); } // namespace Kfactors } // namespace BSMPT diff --git a/include/BSMPT/Kfactors/KfactorsinterpolatedGSL.h b/include/BSMPT/Kfactors/KfactorsinterpolatedGSL.h index 57ca7bf4..e5a6ab87 100644 --- a/include/BSMPT/Kfactors/KfactorsinterpolatedGSL.h +++ b/include/BSMPT/Kfactors/KfactorsinterpolatedGSL.h @@ -44,8 +44,7 @@ namespace Kfactors * Calculates the norm for < > Integrals * @param T temperature at which the normalisation should be evaluated */ -double -CalculateNorm1(const double &T); +double CalculateNorm1(const double &T); /** * Calculates the norm for [] Integrals @@ -53,8 +52,7 @@ CalculateNorm1(const double &T); * @param T temperature at which the normalisation should be evaluated * @param s switch for bosons (s=-1) and fermions (s=1) */ -double -CalculateNorm2(const double &msquared, const double &T, const int &s); +double CalculateNorm2(const double &msquared, const double &T, const int &s); /** * @brief initializeK1fermionGrid @@ -121,144 +119,124 @@ initializeK9fermionGrid(); * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K1fermion(double msquared, double T); +double K1fermion(double msquared, double T); /** * Calculates the non normalised function K1 for bosons * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K1boson(double msquared, double T); +double K1boson(double msquared, double T); /** * Calculates the non normalised function K2 for fermions * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K2fermion(double msquared, double T); +double K2fermion(double msquared, double T); /** * Calculates the non normalised function K4 for fermions * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K4fermion(double msquared, double T); +double K4fermion(double msquared, double T); /** * Calculates the non normalised function K4 for bosons * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K4boson(double msquared, double T); +double K4boson(double msquared, double T); /** * Calculates the non normalised function K5 for fermions * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K5fermion(double msquared, double T); +double K5fermion(double msquared, double T); /** * Calculates the non normalised function K5 for bosons * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K5boson(double msquared, double T); +double K5boson(double msquared, double T); /** * Calculates the non normalised function K6 for fermions * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K6fermion(double msquared, double T); +double K6fermion(double msquared, double T); /** * Calculates the non normalised function K8 for fermions * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K8fermion(double msquared, double T); +double K8fermion(double msquared, double T); /** * Calculates the non normalised function K9 for fermions * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K9fermion(double msquared, double T); +double K9fermion(double msquared, double T); /** * Calculates the normalised function K1 for fermions * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K1fermion_normalized(double msquared, double T); +double K1fermion_normalized(double msquared, double T); /** * Calculates the normalised function K1 for bosons * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K1boson_normalized(double msquared, double T); +double K1boson_normalized(double msquared, double T); /** * Calculates the normalised function K2 for fermions * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K2fermion_normalized(double msquared, double T); +double K2fermion_normalized(double msquared, double T); /** * Calculates the normalised function K4 for fermions * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K4fermion_normalized(double msquared, double T); +double K4fermion_normalized(double msquared, double T); /** * Calculates the normalised function K4 for bosons * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K4boson_normalized(double msquared, double T); +double K4boson_normalized(double msquared, double T); /** * Calculates the normalised function K5 for fermions * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K5fermion_normalized(double msquared, double T); +double K5fermion_normalized(double msquared, double T); /** * Calculates the normalised function K5 for bosons * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K5boson_normalized(double msquared, double T); +double K5boson_normalized(double msquared, double T); /** * Calculates the normalised function K6 for fermions * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K6fermion_normalized(double msquared, double T); +double K6fermion_normalized(double msquared, double T); /** * Calculates the normalised function K8 for fermions * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K8fermion_normalized(double msquared, double T); +double K8fermion_normalized(double msquared, double T); /** * Calculates the normalised function K9 for fermions * @param msquared m^2 [GeV^2] * @param T temperature [GeV] */ -double -K9fermion_normalized(double msquared, double T); +double K9fermion_normalized(double msquared, double T); } // namespace Kfactors } // namespace BSMPT diff --git a/include/BSMPT/ThermalFunctions/ThermalFunctions.h b/include/BSMPT/ThermalFunctions/ThermalFunctions.h index ca353de8..8ed52eea 100644 --- a/include/BSMPT/ThermalFunctions/ThermalFunctions.h +++ b/include/BSMPT/ThermalFunctions/ThermalFunctions.h @@ -64,8 +64,7 @@ const double C_euler_gamma = 0.5772156649015328606065; * @param diff Returns the integrand of J_- for diff = 0 and for the dJ_-/dx for * diff = 1 */ -double -JbosonIntegrand(const double &x, const double &k, int diff = 0); +double JbosonIntegrand(const double &x, const double &k, int diff = 0); /** * Numerical integration of the thermical integral for the bosons \f$ J_-(x) = * \int\limits_{0}^{\infty} \,\mathrm{d}k \, k^2 \log\left[ 1 - \exp\left( @@ -74,8 +73,7 @@ JbosonIntegrand(const double &x, const double &k, int diff = 0); * @param diff Returns the numerical integration of J_- for diff = 0 and J_-/dx * for diff = 1 */ -double -JbosonNumericalIntegration(const double &x, int diff = 0); +double JbosonNumericalIntegration(const double &x, int diff = 0); /** * Taylor expansion of J_- for small x=m^2/T^2, \f$ J_{_,s}(x,n) = * -\frac{\pi^4}{45} + \frac{\pi}{12} x - \frac{\pi}{6} x^{3/2} - @@ -87,23 +85,20 @@ JbosonNumericalIntegration(const double &x, int diff = 0); * @param diff Returns the expansion for diff = 0 and its derivative for diff = * 1 */ -double -JbosonInterpolatedLow(const double &x, const int &n, int diff = 0); +double JbosonInterpolatedLow(const double &x, const int &n, int diff = 0); /** * Using linear interpolation with data points to interpolate the thermal * integral for bosons for x=m^2/T^2 < 0 * @param x The ratio m^2/T^2 */ -double -JbosonInterpolatedNegative(const double &x); +double JbosonInterpolatedNegative(const double &x); /** * Puts together the separate interpolations for J_- * @param x The ratio m^2/T^2 * @param diff Returns the interpolation of J_- for diff = 0 and for dJ_-/dx for * diff = 1 */ -double -JbosonInterpolated(const double &x, int diff = 0); +double JbosonInterpolated(const double &x, int diff = 0); /** * Integrand of the thermic integral for the fermions \f$ J_+(x) = @@ -114,8 +109,7 @@ JbosonInterpolated(const double &x, int diff = 0); * @param diff Returns the integrand of J_+ for diff = 0 and for the dJ_+/dx for * diff = 1 */ -double -JfermionIntegrand(const double &x, const double &k, int diff = 0); +double JfermionIntegrand(const double &x, const double &k, int diff = 0); /** * Numerical integration of the thermical integral for the fermions \f$ J_+(x) = * \int\limits_{0}^{\infty} \,\mathrm{d}k \, k^2 \log\left[ 1 + \exp\left( @@ -124,8 +118,7 @@ JfermionIntegrand(const double &x, const double &k, int diff = 0); * @param diff Returns the integrand of J_+ for diff = 0 and for the dJ_+/dx for * diff = 1 */ -double -JfermionNumericalIntegration(const double &x, int diff = 0); +double JfermionNumericalIntegration(const double &x, int diff = 0); /** * Taylor expansion of J_+ for small x=m^2/T^2, \f$ J_{+,s}(x,n) = * -\frac{7\pi^4}{360} + \frac{\pi^2}{24} x + \frac{x^2}{32}\left( \log x - c_+ @@ -136,8 +129,7 @@ JfermionNumericalIntegration(const double &x, int diff = 0); * @param n The order of the taylor expansion * @param diff Returns the expansion for diff = 0 and dJ_+/dx for diff = 1 */ -double -JfermionInterpolatedLow(const double &x, const int &n, int diff = 0); +double JfermionInterpolatedLow(const double &x, const int &n, int diff = 0); /** * Puts together the separate interpolations for J_+, see Eq. (2.44) in the * manual @@ -145,8 +137,7 @@ JfermionInterpolatedLow(const double &x, const int &n, int diff = 0); * @param diff Returns the interpolation of J_+ for diff = 0 and dJ_+/dx for * diff = 1 */ -double -JfermionInterpolated(const double &x, int diff = 0); +double JfermionInterpolated(const double &x, int diff = 0); /** * Expansion for large x = m^2/T^2 of the thermal integrals, \f$ J_{\pm,l}(x,n) @@ -158,8 +149,7 @@ JfermionInterpolated(const double &x, int diff = 0); * @param diff Returns the expansion for diff = 0 and for its derivative for * diff = 1 */ -double -JInterpolatedHigh(const double &x, const int &n, int diff = 0); +double JInterpolatedHigh(const double &x, const int &n, int diff = 0); } // namespace ThermalFunctions } // namespace BSMPT diff --git a/include/BSMPT/WallThickness/WallThicknessLib.h b/include/BSMPT/WallThickness/WallThicknessLib.h index 085cad30..1c54b163 100644 --- a/include/BSMPT/WallThickness/WallThicknessLib.h +++ b/include/BSMPT/WallThickness/WallThicknessLib.h @@ -44,8 +44,7 @@ namespace Wall * @param vevsymmetric the electroweak VEV in the symmetric minimum * @return The thickness of the wall in 1/GeV */ -double -calculate_wall_thickness_plane( +double calculate_wall_thickness_plane( const std::shared_ptr &modelPointer_input, const double &Temp, const std::vector &vcritical, @@ -61,8 +60,7 @@ calculate_wall_thickness_plane( * @param vevsymmetric the electroweak VEV in the symmetric minimum * @return */ -double -calculate_wall_thickness_1D( +double calculate_wall_thickness_1D( const std::shared_ptr &modelPointer, const double &Temp, const std::vector &vcritical, @@ -77,8 +75,7 @@ calculate_wall_thickness_1D( * @param solV vector to store the solution * @return true if successfull, false if not */ -bool -GSL_Find_Maximum_line( +bool GSL_Find_Maximum_line( const std::shared_ptr &modelPointer, const double &Temp, const std::vector &vcritical, @@ -95,10 +92,9 @@ GSL_Find_Maximum_line( * @param initial_guess starting point for the local optimisation * @return true if successfull, false if not */ -bool -GSL_Maximize_From_S_gen_line(struct GSL_params ¶ms, - std::vector> &solution, - double initial_guess); +bool GSL_Maximize_From_S_gen_line(struct GSL_params ¶ms, + std::vector> &solution, + double initial_guess); /** * @brief GSL_VEFF_gen_all_maximum_line Maximization along the line @@ -106,8 +102,7 @@ GSL_Maximize_From_S_gen_line(struct GSL_params ¶ms, * @param p pointer to the params struct storing the parameters * @return -1*VEff at the parameter point */ -double -GSL_VEFF_gen_all_maximum_line( +double GSL_VEFF_gen_all_maximum_line( double t, void *p); // 1D Maximization along the line from 0 to omega diff --git a/include/BSMPT/baryo_calculation/CalculateEtaInterface.h b/include/BSMPT/baryo_calculation/CalculateEtaInterface.h index e8351747..5e832c3d 100644 --- a/include/BSMPT/baryo_calculation/CalculateEtaInterface.h +++ b/include/BSMPT/baryo_calculation/CalculateEtaInterface.h @@ -157,8 +157,7 @@ class CalculateEtaInterface * Returns a string with the labels of the used EWBG methods stored in * CalculateEtaInterface::method_transport */ - std::vector - legend() const; + std::vector legend() const; /** * Sets the numerical values needed for the calculation * @param vw_input Sets the wall velocity CalculateEtaInterface::vw @@ -208,8 +207,7 @@ class CalculateEtaInterface * CalculateEtaInterface::setNumerics() * @return The results of the different EWBG methods */ - std::vector - CalcEta(); + std::vector CalcEta(); /** * Calls the CalculateEtaInterface::setNumerics() function and then calculates * the EWBG methods stored in CalculateEtaInterface::method_transport @@ -261,39 +259,33 @@ class CalculateEtaInterface * Sets the wall velocity CalculateEtaInterface::vw * @param vw_in Input value for the wall velocity CalculateEtaInterface::vw */ - void - setvw(double vw_in); + void setvw(double vw_in); /** * @return Wall thickness LW calculated through GSL_integration_mubl::init() */ - double - getLW() const; + double getLW() const; /** * @brief get_class_CalcGamM * @return Calc_Gam_inp */ - Calc_Gam_M - get_class_CalcGamM() const; + Calc_Gam_M get_class_CalcGamM() const; /** * @brief get_class_Scp * @return Calc_Scp_inp */ - Calc_Scp - get_class_Scp() const; + Calc_Scp get_class_Scp() const; /** * @brief get_class_kappa * @return Calc_kappa_inp */ - Calc_kappa_t - get_class_kappa() const; + Calc_kappa_t get_class_kappa() const; /** * @brief getSymmetricCPViolatingPhase_top */ - auto - getSymmetricCPViolatingPhase_top() const + auto getSymmetricCPViolatingPhase_top() const { return GSL_integration_mubl_container.getSymmetricCPViolatingPhase_top(); } @@ -301,8 +293,7 @@ class CalculateEtaInterface /** * @brief getBrokenCPViolatingPhase_top */ - auto - getBrokenCPViolatingPhase_top() const + auto getBrokenCPViolatingPhase_top() const { return GSL_integration_mubl_container.getBrokenCPViolatingPhase_top(); } @@ -310,8 +301,7 @@ class CalculateEtaInterface /** * @brief getSymmetricCPViolatingPhase_bot */ - auto - getSymmetricCPViolatingPhase_bot() const + auto getSymmetricCPViolatingPhase_bot() const { return GSL_integration_mubl_container.getSymmetricCPViolatingPhase_bot(); } @@ -319,8 +309,7 @@ class CalculateEtaInterface /** * @brief getBrokenCPViolatingPhase_bot */ - auto - getBrokenCPViolatingPhase_bot() const + auto getBrokenCPViolatingPhase_bot() const { return GSL_integration_mubl_container.getBrokenCPViolatingPhase_bot(); } @@ -328,8 +317,7 @@ class CalculateEtaInterface /** * @brief getSymmetricCPViolatingPhase_tau */ - auto - getSymmetricCPViolatingPhase_tau() const + auto getSymmetricCPViolatingPhase_tau() const { return GSL_integration_mubl_container.getSymmetricCPViolatingPhase_tau(); } @@ -337,8 +325,7 @@ class CalculateEtaInterface /** * @brief getBrokenCPViolatingPhase_tau */ - auto - getBrokenCPViolatingPhase_tau() const + auto getBrokenCPViolatingPhase_tau() const { return GSL_integration_mubl_container.getBrokenCPViolatingPhase_tau(); } @@ -348,8 +335,7 @@ class CalculateEtaInterface * underlying GSL_integration_mubl * @param method */ - void - set_transport_method(TransportMethod method) + void set_transport_method(TransportMethod method) { GSL_integration_mubl_container.set_transport_method(method); } @@ -357,8 +343,7 @@ class CalculateEtaInterface /** * @brief getGSL_integration_mubl_container */ - auto - getGSL_integration_mubl_container() const + auto getGSL_integration_mubl_container() const { return GSL_integration_mubl_container; } diff --git a/include/BSMPT/baryo_calculation/Fluid_Type/bot_source.h b/include/BSMPT/baryo_calculation/Fluid_Type/bot_source.h index 5c712724..ef51b16e 100644 --- a/include/BSMPT/baryo_calculation/Fluid_Type/bot_source.h +++ b/include/BSMPT/baryo_calculation/Fluid_Type/bot_source.h @@ -59,8 +59,7 @@ class bot_source : public gen_fluid * potentials in respect to the wall distance z. * @param z Current wall distance. */ - void - operator()(const state_type &omega, state_type &domega, const double z); + void operator()(const state_type &omega, state_type &domega, const double z); /** * @brief Calc_nL Calculates the sum of all left-handed fermions in front of * the bubble wall contributing to the SU(2) sphaleron transition. @@ -70,8 +69,7 @@ class bot_source : public gen_fluid * @return Returns the left-handed fermion density in front of the bubble wall * evaluated at z_end. */ - double - Calc_nL(double z_start, double z_end) const; + double Calc_nL(double z_start, double z_end) const; }; } // namespace Baryo diff --git a/include/BSMPT/baryo_calculation/Fluid_Type/gen_func_fluid.h b/include/BSMPT/baryo_calculation/Fluid_Type/gen_func_fluid.h index 00aab803..a1ea8fcc 100644 --- a/include/BSMPT/baryo_calculation/Fluid_Type/gen_func_fluid.h +++ b/include/BSMPT/baryo_calculation/Fluid_Type/gen_func_fluid.h @@ -53,16 +53,14 @@ class Calc_Gam_M * @param w = sqrt(m^2+k^2) * @return hf(w) */ - double - hf(double w); + double hf(double w); /** * @brief hf_prime Calculates the derivative of h_f function as in * arXiv:1710.04061 * @param w = sqrt(m^2+k^2) * @return hf'(w) */ - double - hf_prime(double w); + double hf_prime(double w); public: /** @@ -100,21 +98,19 @@ class Calc_Gam_M * @param vw Wall velocity * @param mt Quark mass */ - void - set_class(double T, - double vw, - double mt, - double m_thermal, - double dm_thermal, - bool use_lep = false); + void set_class(double T, + double vw, + double mt, + double m_thermal, + double dm_thermal, + bool use_lep = false); /** * @brief operator () Needed for the boost interface. * @param Gam Current state of Gam_M. * @param dGam Current derivative of Gam_M. * @param k Integration variable/Momentum. */ - void - operator()(const state_type &Gam, state_type &dGam, const double k); + void operator()(const state_type &Gam, state_type &dGam, const double k); }; /** * @brief Nintegrate_GamM The numerical evaluation of the relaxation rates at @@ -122,8 +118,7 @@ class Calc_Gam_M * @param C_Gam Class reference to pass the parameters. * @return Relaxation rate at given temperature and quark mass. */ -double -Nintegrate_GamM(Calc_Gam_M &C_Gam); +double Nintegrate_GamM(Calc_Gam_M &C_Gam); /** * @brief The Calc_Scp class Class instance for the numerical evaluation of the * CP-violating source terms at given temperature and quark mass. @@ -136,16 +131,14 @@ class Calc_Scp * @param w = sqrt(m^2+k^2) * @return Distribution function of a fermion. */ - double - nf(double w); + double nf(double w); /** * @brief nf Derivative of the distribution function of fermions at given * temperature and mass. * @param w = sqrt(m^2+k^2) * @return Derivative of the distribution function of a fermion. */ - double - nf_prime(double w); + double nf_prime(double w); public: double GamT; @@ -186,8 +179,7 @@ class Calc_Scp * @param dScp Current derivative of Scp. * @param k Integration variable/Momentum. */ - void - operator()(const state_type &Scp, state_type &dScp, const double k); + void operator()(const state_type &Scp, state_type &dScp, const double k); /** * @brief set_class Defines all needed parameter of the class Calc_Scp * @param T Temperature @@ -196,14 +188,13 @@ class Calc_Scp * @param theta_prime Derivative of the quark phase in respect of the wall * distance z */ - void - set_class(double T, - double vw, - double mt, - double theta_prime, - double msqrt_thermal_in, - double dmsqrt_thermal_in, - bool use_lep = false); + void set_class(double T, + double vw, + double mt, + double theta_prime, + double msqrt_thermal_in, + double dmsqrt_thermal_in, + bool use_lep = false); }; /** * @brief Nintegrate_Scp Numerical evaluation of the CP-violating source terms @@ -211,8 +202,7 @@ class Calc_Scp * @param C_Scp Class reference to pass the parameters. * @return Value of Scp at given temperature and quark mass. */ -double -Nintegrate_Scp(Calc_Scp &C_Scp); +double Nintegrate_Scp(Calc_Scp &C_Scp); /** * @brief The Calc_kappa_t class Class instance for the numerical calculation of @@ -235,13 +225,11 @@ class Calc_kappa_t * @param Temp_in Temperature * @param mt_in Quark mass */ - void - set_class(double Temp_in, double mt_in); + void set_class(double Temp_in, double mt_in); /** * @brief operator () Needed for the boost interface. */ - void - operator()(const state_type &, state_type &, const double); + void operator()(const state_type &, state_type &, const double); }; /** * @brief NIntegrate_kappa Numerical Numerical evaluation of the statistical @@ -249,8 +237,7 @@ class Calc_kappa_t * @param C_kap Class reference to pass the needed parameters * @return Value of the statistical factor at given temperature and mass. */ -double -NIntegrate_kappa(const Calc_kappa_t &C_kap); +double NIntegrate_kappa(const Calc_kappa_t &C_kap); /** * Numerical evaluation of the eta value; * Checked with 1710.04061 @@ -281,11 +268,10 @@ class Calc_eta public: double prefactor; - void - set_class(std::vector array_z, - std::vector array_nL, - double Temp, - double vw); + void set_class(std::vector array_z, + std::vector array_nL, + double Temp, + double vw); /** * @brief set_class Set function to set all class parameters. * @param arr Grid for the cubic spline of the left-handed quark density as @@ -293,18 +279,16 @@ class Calc_eta * @param Temp Temperature * @param vw Bubble wall velocity */ - void - set_class(std::pair, std::vector> arr, - double Temp, - double vw); + void set_class(std::pair, std::vector> arr, + double Temp, + double vw); /** * @brief operator () Needed for the boost interface. * @param eta Current state of eta. * @param deta Current state of the derivative of eta. * @param z Bubble wall distance. */ - void - operator()(const state_type &eta, state_type &deta, const double z); + void operator()(const state_type &eta, state_type &deta, const double z); }; /** * @brief Nintegrate_eta Numerical evaluation of the eta value at a given @@ -315,10 +299,9 @@ class Calc_eta * @param z_end Distance at which eta is evaluated. * @return Numerical value of eta. */ -double -Nintegrate_eta(const Calc_eta &C_eta, - const double &z_start, - const double &z_end); +double Nintegrate_eta(const Calc_eta &C_eta, + const double &z_start, + const double &z_end); /** * @brief The gen_fluid class Class instance overhead for all transport classes. @@ -495,12 +478,11 @@ class gen_fluid * @param Calc_kappa_inp Class reference for the numerical evaluation of the * statistical factor. */ - void - set_class(const int bottom_mass_inp, - struct GSL_integration_mubl &container, - const Calc_Gam_M &calc_Gam_obj, - const Calc_Scp &Calc_Scp_obj, - const Calc_kappa_t &Calc_kappa_inp); + void set_class(const int bottom_mass_inp, + struct GSL_integration_mubl &container, + const Calc_Gam_M &calc_Gam_obj, + const Calc_Scp &Calc_Scp_obj, + const Calc_kappa_t &Calc_kappa_inp); /** * @brief Right-handed thermal mass of the top quark as defined in Eq (97,98) * in 1910.11794 @@ -545,8 +527,8 @@ class gen_fluid * @return Pair of right-handed thermal mass and the mass difference of right- * and left-handed thermal mass */ - std::pair - Calc_ThermalMass_q(double &YukCoupling_in, double &T_in); + std::pair Calc_ThermalMass_q(double &YukCoupling_in, + double &T_in); /** * @brief Calc_ThermalMass_l Calculates the right-handed thermal mass of the * lepton and the difference of right- and left-handed quark thermal mass @@ -555,8 +537,8 @@ class gen_fluid * @return Pair of right-handed thermal mass and the mass difference of right- * and left-handed thermal mass */ - std::pair - Calc_ThermalMass_l(double &YukCoupling_in, double &T_in); + std::pair Calc_ThermalMass_l(double &YukCoupling_in, + double &T_in); /** * @brief top_func Calculation of the top and bot mass at a given distance of @@ -566,10 +548,9 @@ class gen_fluid * @param m_quark_prime m_quark_prime[0/1]-->Derivative of the top/bot quark * mass in respect of the wall distance z. */ - void - top_func(double z, - std::vector &m_quark, - std::vector &m_quark_prime); + void top_func(double z, + std::vector &m_quark, + std::vector &m_quark_prime); /** * @brief tau_func Calculation of the tau mass and derivative. * @param z Wall distance. @@ -577,14 +558,11 @@ class gen_fluid * @param m_lep_prime Return the derivative of the tau lepton mass in respect * of the bubble wall distance z. */ - void - tau_func(double z, - std::vector &m_lep, - std::vector &m_lep_prime); - std::vector - omegaprime(double z); - double - atan2_mod(double Im, double Re); + void tau_func(double z, + std::vector &m_lep, + std::vector &m_lep_prime); + std::vector omegaprime(double z); + double atan2_mod(double Im, double Re); /** * @brief Calc_theta Caclulates the phase profile over the bubble wall by * assuming the Kink-profile ansatz. @@ -594,8 +572,7 @@ class gen_fluid * @return The value of the CP-violating phase at given distance of the bubble * wall z and the boundary values CP_sym and CP_brk */ - std::vector - Calc_theta(double z, double CP_sym, double CP_brk); + std::vector Calc_theta(double z, double CP_sym, double CP_brk); }; } // namespace Baryo diff --git a/include/BSMPT/baryo_calculation/Fluid_Type/tau_source.h b/include/BSMPT/baryo_calculation/Fluid_Type/tau_source.h index e7f3f3a4..8448eb7b 100644 --- a/include/BSMPT/baryo_calculation/Fluid_Type/tau_source.h +++ b/include/BSMPT/baryo_calculation/Fluid_Type/tau_source.h @@ -54,8 +54,7 @@ class tau_source : public gen_fluid * potentials in respect to the wall distance z. * @param z Current wall distance. */ - void - operator()(const state_type &omega, state_type &domega, const double z); + void operator()(const state_type &omega, state_type &domega, const double z); /** * @brief Calc_nL Calculates the sum of all left-handed fermions in front of * the bubble wall contributing to the SU(2) sphaleron transition. @@ -65,8 +64,7 @@ class tau_source : public gen_fluid * @return Returns the left-handed fermion density in front of the bubble wall * evaluated at z_end. */ - double - Calc_nL(double z_start, double z_end) const; + double Calc_nL(double z_start, double z_end) const; }; } // namespace Baryo diff --git a/include/BSMPT/baryo_calculation/Fluid_Type/top_source.h b/include/BSMPT/baryo_calculation/Fluid_Type/top_source.h index cfeed3b4..e701e0ba 100644 --- a/include/BSMPT/baryo_calculation/Fluid_Type/top_source.h +++ b/include/BSMPT/baryo_calculation/Fluid_Type/top_source.h @@ -54,8 +54,7 @@ class top_source : public gen_fluid * potentials in respect to the wall distance z. * @param z Current wall distance. */ - void - operator()(const state_type &omega, state_type &domega, const double z); + void operator()(const state_type &omega, state_type &domega, const double z); /** * @brief Calc_nL Calculates the sum of all left-handed fermions in front of * the bubble wall contributing to the SU(2) sphaleron transition. @@ -65,8 +64,7 @@ class top_source : public gen_fluid * @return Returns the left-handed fermion density in front of the bubble wall * evaluated at z_end. */ - double - Calc_nL(double z_start, double z_end) const; + double Calc_nL(double z_start, double z_end) const; }; } // namespace Baryo diff --git a/include/BSMPT/baryo_calculation/transport_equations.h b/include/BSMPT/baryo_calculation/transport_equations.h index 398f049c..a8960b05 100644 --- a/include/BSMPT/baryo_calculation/transport_equations.h +++ b/include/BSMPT/baryo_calculation/transport_equations.h @@ -144,8 +144,7 @@ the function call. This will have 9 entries, the first is the mass and then the * @param vev The VEV configuration at which to compute the W mass * @param T The temperature at which to compute the W mass */ - double - get_W_mass(const std::vector &vev, const double &T) const; + double get_W_mass(const std::vector &vev, const double &T) const; /** * Calculates the VEV at a given distance z from the wall @@ -153,8 +152,7 @@ the function call. This will have 9 entries, the first is the mass and then the * is in the symmetric phase. * @return vector in which the VEV configuration will be stored */ - std::vector - calculate_vev(const double &z) const; + std::vector calculate_vev(const double &z) const; /** * Calculates the derivatives of the VEV at a given distance z from the wall @@ -162,8 +160,7 @@ the function call. This will have 9 entries, the first is the mass and then the * is in the symmetric phase. * @return vector in which the VEV configuration will be stored */ - std::vector - calculate_vev_derivative(const double &z) const; + std::vector calculate_vev_derivative(const double &z) const; /** * Calculates the CP violating angle theta according to 0605242 and its @@ -173,8 +170,7 @@ the function call. This will have 9 entries, the first is the mass and then the * @param diff Switch if the actual value should be returned (0), the first * derivative (1) or the second (2) */ - double - calculate_theta(const double &z, const int &diff) const; + double calculate_theta(const double &z, const int &diff) const; }; /** @@ -285,91 +281,74 @@ struct GSL_integration_mubl /** * set the CP violating phase in the symmetric vacuum */ - void - setSymmetricCPViolatingPhase(double Phase); + void setSymmetricCPViolatingPhase(double Phase); /** * get the CP violating phase in the symmetric vacuum */ - double - getSymmetricCPViolatingPhase() const; + double getSymmetricCPViolatingPhase() const; /** * get the CP violating phase in the symmetric vacuum */ - double - getBrokenCPViolatingPhase() const; + double getBrokenCPViolatingPhase() const; /** * get the CP-violating phase of the top quark in the symmetric vacuum */ - double - getSymmetricCPViolatingPhase_top() const; + double getSymmetricCPViolatingPhase_top() const; /** * get the CP-violating phase of the bot quark in the symmetric vacuum */ - double - getSymmetricCPViolatingPhase_bot() const; + double getSymmetricCPViolatingPhase_bot() const; /** * get the CP-violating phase of the tau quark in the symmetric vacuum */ - double - getSymmetricCPViolatingPhase_tau() const; + double getSymmetricCPViolatingPhase_tau() const; /** * get the CP-violating phase of the top quark in the broken vacuum */ - double - getBrokenCPViolatingPhase_top() const; + double getBrokenCPViolatingPhase_top() const; /** * get the CP-violating phase of the bot quark in the broken vacuum */ - double - getBrokenCPViolatingPhase_bot() const; + double getBrokenCPViolatingPhase_bot() const; /** * get the CP-violating phase of the tau quark in the broken vacuum */ - double - getBrokenCPViolatingPhase_tau() const; + double getBrokenCPViolatingPhase_tau() const; /** * get critical VEV */ - std::vector - getVEVCritical() const; + std::vector getVEVCritical() const; /** * get vev_symmetric */ - std::vector - getVEVsym() const; + std::vector getVEVsym() const; /** * get TC */ - double - getTC() const; + double getTC() const; /** * set TC */ - void - setTC(double TC_in); + void setTC(double TC_in); /** * get zmax */ - double - getZMAX() const; + double getZMAX() const; /** * set vw */ - void - setvw(double vw_in); + void setvw(double vw_in); /** * get vw */ - double - getvw() const; + double getvw() const; /** * @brief getLW * @return LW */ - double - getLW() const; + double getLW() const; /** * @brief setpar sets par @@ -379,52 +358,44 @@ struct GSL_integration_mubl * @brief getpar * @return par */ - std::vector - getpar(); + std::vector getpar(); /** * Set function to chose the method for the transport equations */ - void - set_transport_method(TransportMethod method); + void set_transport_method(TransportMethod method); /** * @brief get_transport_method * @return transport_method */ - TransportMethod - get_transport_method(); + TransportMethod get_transport_method(); /** * @brief setZMAX defines the value to treat mu(ZMAX) = 0 * @param z_in new value to set zMAX to * @param MultiplesOfLW if true sets zMAX = z_in * LW */ - void - setZMAX(double z_in, bool MultiplesOfLW); + void setZMAX(double z_in, bool MultiplesOfLW); /** * @brief set_vev_sym_theta * @param vev_in new value of vev_sym_theta */ - void - set_vev_sym_theta(std::vector &vev_in); + void set_vev_sym_theta(std::vector &vev_in); /** * @brief get_vev_sym_theta * @return vev_sym_theta */ - std::vector - get_vev_sym_theta() const; + std::vector get_vev_sym_theta() const; /** * set the UseVelocityTransportEquations parameter */ - void - setUseVelocityTransportEquations(bool in); + void setUseVelocityTransportEquations(bool in); /** * @brief getUseVelocityTransportEquations * @return the UseVelocityTransportEquations parameter */ - bool - getUseVelocityTransportEquations() const; + bool getUseVelocityTransportEquations() const; /** * @brief init initialises the parameters of struct @@ -434,20 +405,18 @@ struct GSL_integration_mubl * @param TC_input new value of TC * @param modelPointer_input shared_ptr for the model */ - void - init(const double &vw_input, - std::vector &vev_critical_input, - std::vector &vev_symmetric_input, - const double &TC_input, - std::shared_ptr &modelPointer_input, - const int &WhichMinimizer = Minimizer::WhichMinimizerDefault); + void init(const double &vw_input, + std::vector &vev_critical_input, + std::vector &vev_symmetric_input, + const double &TC_input, + std::shared_ptr &modelPointer_input, + const int &WhichMinimizer = Minimizer::WhichMinimizerDefault); /** * @brief getModelPointer * @return the shared_ptr to the model */ - std::shared_ptr - getModelPointer() const; + std::shared_ptr getModelPointer() const; }; /** @@ -490,23 +459,20 @@ calculateTransportEquation(const double &z, * @param p GSL_integration_mubl object with the necessary information for the * integration */ -double -mubl_func(double z, void *p); +double mubl_func(double z, void *p); /** * Calculates the integrand necessary for the baryon-antibaryon asymmetry * @param z distance to the wall * @param p void pointer to a GSL_integration_mubl struct */ -double -eta_integrand_func(double z, void *p); +double eta_integrand_func(double z, void *p); /** * Integrate over mu_BL without using the interpolation for mu_BL * @param p GSL_integration_mubl without the mubl spline */ -double -Integrate_mubl(const struct GSL_integration_mubl &p); +double Integrate_mubl(const struct GSL_integration_mubl &p); /** * generate the spline of 0605242 Eq (47) @@ -527,15 +493,13 @@ generate_mubl_spline(const struct GSL_integration_mubl &p, int nstep); * @param p GSL_mubl_interpolation object with the spline of mu_BL calculated in * generate_mubl_spline */ -double -mubl_interpolation(double z, void *p); +double mubl_interpolation(double z, void *p); /** * Integrates over mubl_interpolation and evaluates 0605242 Eq (48) * @param p GSL_integration_mubl with the mubl spline */ -double -Integrate_mubl_interpolated(const struct GSL_integration_mubl &p); +double Integrate_mubl_interpolated(const struct GSL_integration_mubl &p); /** * struct for intermediate outputs during the ODE solving. @@ -552,8 +516,7 @@ struct push_back_state_and_time { } - void - operator()(const state_type &x, double t) + void operator()(const state_type &x, double t) { m_states.push_back(x); m_times.push_back(t); diff --git a/include/BSMPT/minimizer/LibNLOPT/MinimizeNLOPT.h b/include/BSMPT/minimizer/LibNLOPT/MinimizeNLOPT.h index 75ac0233..d0f84b7b 100644 --- a/include/BSMPT/minimizer/LibNLOPT/MinimizeNLOPT.h +++ b/include/BSMPT/minimizer/LibNLOPT/MinimizeNLOPT.h @@ -97,10 +97,9 @@ MinimizePlaneUsingNLOPT(const struct PointerContainerMinPlane ¶ms); * @param data pointer to PointerContainerMinPlane struct * @return */ -double -NLOPTVEffPlane(const std::vector &x, - std::vector &grad, - void *data); +double NLOPTVEffPlane(const std::vector &x, + std::vector &grad, + void *data); /** * @brief FindLocalMinimum finds the local minimum near the starting point diff --git a/include/BSMPT/minimizer/MinimizeGSL.h b/include/BSMPT/minimizer/MinimizeGSL.h index 7f3edcc3..47e07ddd 100644 --- a/include/BSMPT/minimizer/MinimizeGSL.h +++ b/include/BSMPT/minimizer/MinimizeGSL.h @@ -57,17 +57,15 @@ struct GSL_params * Calculates the value of the effective potential at the vev v and temperature * p->Temp for the gsl interface */ -double -GSL_VEFF_gen_all(const gsl_vector *v, void *p); +double GSL_VEFF_gen_all(const gsl_vector *v, void *p); /** * Calculates the next local minimum in the model from the point start * @returns The final status of the gsl minimization process. */ -int -GSL_Minimize_From_S_gen_all(struct GSL_params &p, - std::vector &sol, - const std::vector &start); +int GSL_Minimize_From_S_gen_all(struct GSL_params &p, + std::vector &sol, + const std::vector &start); /** * Minimize the Potential from different random starting points and choose the @@ -80,8 +78,7 @@ GSL_Minimize_From_S_gen_all(struct GSL_params &p, * @return first: vector with candidate for the global minimum, second: True if * a candidate for the global minimum is found and false otherwise */ -std::pair, bool> -GSL_Minimize_gen_all( +std::pair, bool> GSL_Minimize_gen_all( const std::shared_ptr &modelPointer, const double &Temp, const int &seed); @@ -98,8 +95,7 @@ GSL_Minimize_gen_all( * @return first: vector with candidate for the global minimum, second: True if * a candidate for the global minimum is found and false otherwise */ -std::pair, bool> -GSL_Minimize_gen_all( +std::pair, bool> GSL_Minimize_gen_all( const std::shared_ptr &modelPointer, const double &Temp, const int &seed, @@ -118,8 +114,7 @@ GSL_Minimize_gen_all( * @return first: vector with the solution, second: True if a candidate for the * global minimum is found and false otherwise */ -std::pair, bool> -GSL_Minimize_gen_all( +std::pair, bool> GSL_Minimize_gen_all( const std::shared_ptr &modelPointer, const double &Temp, const int &seed, diff --git a/include/BSMPT/minimizer/MinimizePlane.h b/include/BSMPT/minimizer/MinimizePlane.h index 0aef7e1e..6ea12bfb 100644 --- a/include/BSMPT/minimizer/MinimizePlane.h +++ b/include/BSMPT/minimizer/MinimizePlane.h @@ -172,8 +172,7 @@ TransformCoordinates(const std::vector &vMinTilde, * @param p Pointer to a PointerContainerMinPlane struct which contains the * model information */ -double -GSL_VEFF_Minimize_Plane(const gsl_vector *v, void *p); +double GSL_VEFF_Minimize_Plane(const gsl_vector *v, void *p); /** * Uses the GSL minimisation routines to find the next local minimum from a @@ -184,10 +183,9 @@ GSL_VEFF_Minimize_Plane(const gsl_vector *v, void *p); * @param start Starting point from where to look for the next local minimum * @returns The final status of the gsl minimization process. */ -int -GSL_Minimize_Plane_From_S_gen_all(const struct PointerContainerMinPlane &p, - std::vector &sol, - const std::vector &start); +int GSL_Minimize_Plane_From_S_gen_all(const struct PointerContainerMinPlane &p, + std::vector &sol, + const std::vector &start); /** * Minimise the Potential from different random starting points and choose the diff --git a/include/BSMPT/minimizer/Minimizer.h b/include/BSMPT/minimizer/Minimizer.h index 7787cb71..ffad5438 100644 --- a/include/BSMPT/minimizer/Minimizer.h +++ b/include/BSMPT/minimizer/Minimizer.h @@ -71,10 +71,9 @@ const std::size_t Num_threads = std::thread::hardware_concurrency(); * @param UseNLopt Should NLopt be used? * @return */ -constexpr int -CalcWhichMinimizer(bool UseGSL = UseGSLDefault, - bool UseCMAES = UseLibCMAESDefault, - bool UseNLopt = UseNLoptDefault) +constexpr int CalcWhichMinimizer(bool UseGSL = UseGSLDefault, + bool UseCMAES = UseLibCMAESDefault, + bool UseNLopt = UseNLoptDefault) { return static_cast(UseCMAES) + 2 * static_cast(UseGSL) + 4 * static_cast(UseNLopt); @@ -102,8 +101,7 @@ struct MinimizersToUse * @param WhichMinimizer * @return */ -MinimizersToUse -GetMinimizers(int WhichMinimizer); +MinimizersToUse GetMinimizers(int WhichMinimizer); /** * @brief WhichMinimizerDefault default value for the Minimizers to use diff --git a/include/BSMPT/models/ClassPotentialC2HDM.h b/include/BSMPT/models/ClassPotentialC2HDM.h index d25e24e0..38f0589f 100644 --- a/include/BSMPT/models/ClassPotentialC2HDM.h +++ b/include/BSMPT/models/ClassPotentialC2HDM.h @@ -112,16 +112,12 @@ class Class_Potential_C2HDM : public Class_Potential_Origin R_Hsm_1 = 0, R_Hsm_2 = 0, R_Hsm_3 = 0; double g1uu = 0, g2uu = 0; - void - ReadAndSet(const std::string &linestr, std::vector &par) override; - std::vector - addLegendCT() const override; - std::vector - addLegendTemp() const override; - std::vector - addLegendTripleCouplings() const override; - std::vector - addLegendVEV() const override; + void ReadAndSet(const std::string &linestr, + std::vector &par) override; + std::vector addLegendCT() const override; + std::vector addLegendTemp() const override; + std::vector addLegendTripleCouplings() const override; + std::vector addLegendVEV() const override; /** * Set the numerical values for the Lagrange parameters @@ -135,31 +131,20 @@ class Class_Potential_C2HDM : public Class_Potential_Origin * @param par[7] = tan(beta) * @param par[8] = Yukawa Type */ - void - set_gen(const std::vector &par) override; - void - set_CT_Pot_Par(const std::vector &par) override; - void - write() const override; - - void - TripleHiggsCouplings() override; - std::vector - calc_CT() const override; - - void - SetCurvatureArrays() override; - bool - CalculateDebyeSimplified() override; - bool - CalculateDebyeGaugeSimplified() override; - double - VTreeSimplified(const std::vector &v) const override; - double - VCounterSimplified(const std::vector &v) const override; - void - Debugging(const std::vector &input, - std::vector &output) const override; + void set_gen(const std::vector &par) override; + void set_CT_Pot_Par(const std::vector &par) override; + void write() const override; + + void TripleHiggsCouplings() override; + std::vector calc_CT() const override; + + void SetCurvatureArrays() override; + bool CalculateDebyeSimplified() override; + bool CalculateDebyeGaugeSimplified() override; + double VTreeSimplified(const std::vector &v) const override; + double VCounterSimplified(const std::vector &v) const override; + void Debugging(const std::vector &input, + std::vector &output) const override; bool IncludeChargeBreakingVEV = true; bool CTAlternative = false; diff --git a/include/BSMPT/models/ClassPotentialCxSM.h b/include/BSMPT/models/ClassPotentialCxSM.h index 0e6c337c..116af98c 100644 --- a/include/BSMPT/models/ClassPotentialCxSM.h +++ b/include/BSMPT/models/ClassPotentialCxSM.h @@ -96,16 +96,12 @@ class Class_CxSM : public Class_Potential_Origin double vh, vs, va; - void - ReadAndSet(const std::string &linestr, std::vector &par) override; - std::vector - addLegendCT() const override; - std::vector - addLegendTemp() const override; - std::vector - addLegendTripleCouplings() const override; - std::vector - addLegendVEV() const override; + void ReadAndSet(const std::string &linestr, + std::vector &par) override; + std::vector addLegendCT() const override; + std::vector addLegendTemp() const override; + std::vector addLegendTripleCouplings() const override; + std::vector addLegendVEV() const override; /** * @brief set_gen @@ -122,31 +118,20 @@ class Class_CxSM : public Class_Potential_Origin * @param par[10] = Rea1 * @param par[11] = Ima1 */ - void - set_gen(const std::vector &par) override; - void - set_CT_Pot_Par(const std::vector &par) override; - void - write() const override; - - void - TripleHiggsCouplings() override; - std::vector - calc_CT() const override; - - void - SetCurvatureArrays() override; - bool - CalculateDebyeSimplified() override; - bool - CalculateDebyeGaugeSimplified() override; - double - VTreeSimplified(const std::vector &v) const override; - double - VCounterSimplified(const std::vector &v) const override; - void - Debugging(const std::vector &input, - std::vector &output) const override; + void set_gen(const std::vector &par) override; + void set_CT_Pot_Par(const std::vector &par) override; + void write() const override; + + void TripleHiggsCouplings() override; + std::vector calc_CT() const override; + + void SetCurvatureArrays() override; + bool CalculateDebyeSimplified() override; + bool CalculateDebyeGaugeSimplified() override; + double VTreeSimplified(const std::vector &v) const override; + double VCounterSimplified(const std::vector &v) const override; + void Debugging(const std::vector &input, + std::vector &output) const override; }; } // namespace Models diff --git a/include/BSMPT/models/ClassPotentialOrigin.h b/include/BSMPT/models/ClassPotentialOrigin.h index 599251dc..7817cd8d 100644 --- a/include/BSMPT/models/ClassPotentialOrigin.h +++ b/include/BSMPT/models/ClassPotentialOrigin.h @@ -616,136 +616,79 @@ class Class_Potential_Origin * @brief get_scale * @return the MSBar renormalisation scale */ - double - get_scale() const - { - return scale; - } + double get_scale() const { return scale; } /** * @brief set_scale sets the MSBar renormalisation scale to scale_new * @param scale_new */ - void - set_scale(double scale_new) - { - scale = scale_new; - } + void set_scale(double scale_new) { scale = scale_new; } /** * @brief get_nPar * @return nPar */ - std::size_t - get_nPar() const - { - return nPar; - } + std::size_t get_nPar() const { return nPar; } /** * @brief get_nParCT * @return nParCT */ - std::size_t - get_nParCT() const - { - return nParCT; - } + std::size_t get_nParCT() const { return nParCT; } /** * @brief get_nVEV * @return nVEV */ - std::size_t - get_nVEV() const - { - return nVEV; - } + std::size_t get_nVEV() const { return nVEV; } /** * @brief get_vevTreeMin * @return vevTreeMin */ - std::vector - get_vevTreeMin() const - { - return vevTreeMin; - } + std::vector get_vevTreeMin() const { return vevTreeMin; } /** * @brief get_vevTreeMin * @param k * @return vevTreeMin.at(k) */ - double - get_vevTreeMin(const std::size_t &k) const - { - return vevTreeMin.at(k); - } + double get_vevTreeMin(const std::size_t &k) const { return vevTreeMin.at(k); } /** * @brief get_parStored * @return parStored */ - std::vector - get_parStored() const - { - return parStored; - } + std::vector get_parStored() const { return parStored; } /** * @brief get_parCTStored * @return parCTStored */ - std::vector - get_parCTStored() const - { - return parCTStored; - } + std::vector get_parCTStored() const { return parCTStored; } /** * @brief get_NGauge * @return NGauge */ - std::size_t - get_NGauge() const - { - return NGauge; - } + std::size_t get_NGauge() const { return NGauge; } /** * @brief get_NQuarks * @return NQuarks */ - std::size_t - get_NQuarks() const - { - return NQuarks; - } + std::size_t get_NQuarks() const { return NQuarks; } /** * @brief get_NHiggs * @return NHiggs */ - std::size_t - get_NHiggs() const - { - return NHiggs; - } + std::size_t get_NHiggs() const { return NHiggs; } /** * @brief get_NLepton * @return NLepton */ - std::size_t - get_NLepton() const - { - return NLepton; - } + std::size_t get_NLepton() const { return NLepton; } /** * @brief get_Model * @return ModelID of the Model */ - ModelID::ModelIDs - get_Model() const - { - return Model; - } + ModelID::ModelIDs get_Model() const { return Model; } /** * @brief set_InputLineNumber * @param InputLineNumber_in value to set InputLineNumber */ - void - set_InputLineNumber(int InputLineNumber_in) + void set_InputLineNumber(int InputLineNumber_in) { InputLineNumber = InputLineNumber_in; } @@ -756,10 +699,9 @@ class Class_Potential_Origin * @param k * @return TripleHiggsCorrectionsTreePhysical[i][j][k] */ - double - get_TripleHiggsCorrectionsTreePhysical(std::size_t i, - std::size_t j, - std::size_t k) const + double get_TripleHiggsCorrectionsTreePhysical(std::size_t i, + std::size_t j, + std::size_t k) const { return TripleHiggsCorrectionsTreePhysical.at(i).at(j).at(k); } @@ -770,10 +712,9 @@ class Class_Potential_Origin * @param k * @return TripleHiggsCorrectionsCTPhysical[i][j][k] */ - double - get_TripleHiggsCorrectionsCTPhysical(std::size_t i, - std::size_t j, - std::size_t k) const + double get_TripleHiggsCorrectionsCTPhysical(std::size_t i, + std::size_t j, + std::size_t k) const { return TripleHiggsCorrectionsCTPhysical.at(i).at(j).at(k); } @@ -784,10 +725,9 @@ class Class_Potential_Origin * @param k * @return TripleHiggsCorrectionsCWPhysical[i][j][k] */ - double - get_TripleHiggsCorrectionsCWPhysical(std::size_t i, - std::size_t j, - std::size_t k) const + double get_TripleHiggsCorrectionsCWPhysical(std::size_t i, + std::size_t j, + std::size_t k) const { return TripleHiggsCorrectionsCWPhysical.at(i).at(j).at(k); } @@ -795,14 +735,12 @@ class Class_Potential_Origin /** * Sets the UseIndexCol var */ - void - setUseIndexCol(std::string legend); + void setUseIndexCol(std::string legend); /** * Initializes all vectors needed for the calculations. */ - void - initVectors(); + void initVectors(); /** * Calculates the effective potential and its derivatives. @@ -813,11 +751,10 @@ class Class_Potential_Origin * @param Order 0 returns the tree level potential and 1 the NLO potential. * Default value is the NLO potential */ - double - VEff(const std::vector &v, - double Temp = 0, - int diff = 0, - int Order = 1) const; + double VEff(const std::vector &v, + double Temp = 0, + int diff = 0, + int Order = 1) const; /** * Calculates the tree-level potential and its derivatives. * @param v the configuration of all VEVs at which the potential should be @@ -827,10 +764,9 @@ class Class_Potential_Origin * @param ForceExplicitCalculation Calculate the tensors directly from the * tensors even if VTreeSimplified() is given */ - double - VTree(const std::vector &v, - int diff = 0, - bool ForceExplicitCalculation = false) const; + double VTree(const std::vector &v, + int diff = 0, + bool ForceExplicitCalculation = false) const; /** * Calculates the counterterm potential and its derivatives * @param v the configuration of all VEVs at which the potential should be @@ -840,10 +776,9 @@ class Class_Potential_Origin * @param ForceExplicitCalculation Calculate the tensors directly from the * tensors even if VCounterSimplified() is given */ - double - CounterTerm(const std::vector &v, - int diff = 0, - bool ForceExplicitCalculation = false) const; + double CounterTerm(const std::vector &v, + int diff = 0, + bool ForceExplicitCalculation = false) const; /** * Calculates the Coleman-Weinberg and temperature-dependent 1-loop part of * the effective potential and its derivatives. @@ -854,120 +789,103 @@ class Class_Potential_Origin * @param Temp the temperature at which the potential should be evaluated * @return the value of the one-loop part of the effective potential */ - double - V1Loop(const std::vector &v, double Temp, int diff) const; + double V1Loop(const std::vector &v, double Temp, int diff) const; /** * This function calculates the EW breaking VEV from all contributing field * configurations. */ - double - EWSBVEV(const std::vector &v) const; + double EWSBVEV(const std::vector &v) const; /** * Reads the string linestr and sets the parameter point */ - virtual void - ReadAndSet(const std::string &linestr, std::vector &par) = 0; + virtual void ReadAndSet(const std::string &linestr, + std::vector &par) = 0; /** * Adds the name of the counterterms to the legend of the output file. This * has to be specified in the model file. */ - virtual std::vector - addLegendCT() const = 0; + virtual std::vector addLegendCT() const = 0; /** * Adds the name of the VEVs, together with the critical VEV, the critical * temperature and the ratio, to the legend of the output file. This has to be * specified in the model file. */ - virtual std::vector - addLegendTemp() const = 0; + virtual std::vector addLegendTemp() const = 0; /** * Adds the name of the triple Higgs couplings at T=0 to the legend of the * output file. This has to be specified in the model file. */ - virtual std::vector - addLegendTripleCouplings() const = 0; + virtual std::vector addLegendTripleCouplings() const = 0; /** * Adds the name of the VEVs to the legend of the output file. This has to be * specified in the model file. */ - virtual std::vector - addLegendVEV() const = 0; + virtual std::vector addLegendVEV() const = 0; /** * Reads the Lagrangian parameters from the vector 'par' and sets them to the * model parameters. This also sets the VEV configuration as well as the * scale. This has to be specified in the model file. */ - virtual void - set_gen(const std::vector &par) = 0; + virtual void set_gen(const std::vector &par) = 0; /** * Reads the counterterm parameters from the vector 'par' and sets them to the * model parameters as well as the Tensors \p Curvature_Higgs_CT_L1, \p * Curvature_Higgs_CT_L2, \p Curvature_Higgs_CT_L3 , \p Curvature_Higgs_CT_L4 * . This has to be specified in the model file. */ - virtual void - set_CT_Pot_Par(const std::vector &par) = 0; + virtual void set_CT_Pot_Par(const std::vector &par) = 0; /** * This will produce a terminal output of all the model parameters. * This has to be specified in the model file. */ - virtual void - write() const = 0; + virtual void write() const = 0; - void - set_All(const std::vector &par, const std::vector &parCT); + void set_All(const std::vector &par, + const std::vector &parCT); /** * This will set all the tensors needed to describe the tree-level Lagrangian * except for the counterterms in the potential. * This has to be specified in the model file. */ - virtual void - SetCurvatureArrays() = 0; + virtual void SetCurvatureArrays() = 0; /** Calculates all triple and quartic couplings in the physical basis */ - void - CalculatePhysicalCouplings(); + void CalculatePhysicalCouplings(); /** * Calculates the first derivative of the Coleman-Weinberg potential evaluated * at the tree-level minimum. */ - std::vector - WeinbergFirstDerivative() const; + std::vector WeinbergFirstDerivative() const; /** * Calculates the second derivative of the Coleman-Weinberg potential at the * tree-level minimum. */ - std::vector - WeinbergSecondDerivative() const; + std::vector WeinbergSecondDerivative() const; /** * Calculates the third derivative of the Coleman-Weinberg potential at the * tree-level minimum. */ - std::vector - WeinbergThirdDerivative() const; + std::vector WeinbergThirdDerivative() const; /** * Calculates the Debye corrections to the Higgs mass matrix. * If you can provide CalculateDebyeSimplified() with the Matrix as this will * reduce the runtime. */ - void - CalculateDebye(); + void CalculateDebye(); /** * Calculates the Debye corrections to the gauge sector. By using * CalculateDebyeGaugeSimplified() the runtime can be reduced. */ - void - CalculateDebyeGauge(); + void CalculateDebyeGauge(); /** * Sets a tensor needed to calculate the contribution of the counterterm * potential to the triple Higgs couplings. */ - void - Prepare_Triple(); + void Prepare_Triple(); /** * You can give the explicit Debye corrections to the Higgs mass matrix with @@ -975,8 +893,7 @@ class Class_Potential_Origin * CalculateDebye(). If you know the corrections use this and let the function * return true, this will save you a lot of computing time. */ - virtual bool - CalculateDebyeSimplified() = 0; + virtual bool CalculateDebyeSimplified() = 0; /** * You can give the explicit Debye corrections to the gauge boson mass matrix @@ -984,15 +901,13 @@ class Class_Potential_Origin * CalculateDebyeGauge(). If you know the corrections use this and let the * function return true, this will save you a lot of computing time. */ - virtual bool - CalculateDebyeGaugeSimplified() = 0; + virtual bool CalculateDebyeGaugeSimplified() = 0; /** * You can give the explicit form of your tree-level potential here. This * speeds up the computation time. */ - virtual double - VTreeSimplified(const std::vector &v) const = 0; + virtual double VTreeSimplified(const std::vector &v) const = 0; /** * @brief UseVTreeSimplified Decides wether VTreeSimplified will be used or * not. VTreeSimplified returns 0 if UseVTreeSimplified is false Set in @@ -1003,8 +918,7 @@ class Class_Potential_Origin * You can give the explicit form of your counterterm potential here. This * speeds up the computation time. */ - virtual double - VCounterSimplified(const std::vector &v) const = 0; + virtual double VCounterSimplified(const std::vector &v) const = 0; /** * @brief UseVCounterSimplified Decides wether VCounterSimplified will be used * or not. VCounterSimplified returns 0 if UseVCounterSimplified is false Set @@ -1023,10 +937,9 @@ class Class_Potential_Origin * @return Vector in which the eigenvalues m^2 of the mass matrix will be * stored */ - std::vector - HiggsMassesSquared(const std::vector &v, - const double &Temp = 0, - const int &diff = 0) const; + std::vector HiggsMassesSquared(const std::vector &v, + const double &Temp = 0, + const int &diff = 0) const; /** * Calculates the gauge mass matrix and saves all eigenvalues * @param v the configuration of all VEVs at which the eigenvalues should be @@ -1038,10 +951,9 @@ class Class_Potential_Origin * @return Vector in which the eigenvalues m^2 of the mass matrix will be * stored */ - std::vector - GaugeMassesSquared(const std::vector &v, - const double &Temp = 0, - const int &diff = 0) const; + std::vector GaugeMassesSquared(const std::vector &v, + const double &Temp = 0, + const int &diff = 0) const; /** * Calculates the quark mass matrix and saves all eigenvalues, this assumes * the same masses for different colours. @@ -1052,8 +964,8 @@ class Class_Potential_Origin * @return Vector in which the eigenvalues m^2 of the mass matrix will be * stored */ - std::vector - QuarkMassesSquared(const std::vector &v, const int &diff = 0) const; + std::vector QuarkMassesSquared(const std::vector &v, + const int &diff = 0) const; /** * Calculates the lepton mass matrix and saves all eigenvalues * @param v the configuration of all VEVs at which the eigenvalues should be @@ -1063,8 +975,8 @@ class Class_Potential_Origin * @return Vector in which the eigenvalues m^2 of the mass matrix will be * stored */ - std::vector - LeptonMassesSquared(const std::vector &v, const int &diff = 0) const; + std::vector LeptonMassesSquared(const std::vector &v, + const int &diff = 0) const; /** * Calculates the quark mass matrix and saves all eigenvalues, this assumes @@ -1084,8 +996,7 @@ class Class_Potential_Origin * @return the Mass Matrix for the Quarks of the form $ M^{IJ} = Y^{IJ} + * Y^{IJk} v_k $ */ - Eigen::MatrixXcd - QuarkMassMatrix(const std::vector &v) const; + Eigen::MatrixXcd QuarkMassMatrix(const std::vector &v) const; /** * Calculates the quark mass matrix and saves all eigenvalues, this assumes * the same masses for different colours. @@ -1104,8 +1015,7 @@ class Class_Potential_Origin * @return the Mass Matrix for the Leptons of the form $ M^{IJ} = Y^{IJ} + * Y^{IJk} v_k $ */ - Eigen::MatrixXcd - LeptonMassMatrix(const std::vector &v) const; + Eigen::MatrixXcd LeptonMassMatrix(const std::vector &v) const; /** * Calculates the triple Higgs couplings at NLO in the mass basis. @@ -1113,14 +1023,12 @@ class Class_Potential_Origin * Use the vector TripleHiggsCorrectionsCWPhysical to save your couplings and * set the nTripleCouplings to the number of couplings you want as output. */ - virtual void - TripleHiggsCouplings() = 0; + virtual void TripleHiggsCouplings() = 0; /** * Calculates the function f^1 needed for the derivatives of the Coleman * Weinberg potential. */ - double - fbase(double MassSquaredA, double MassSquaredB) const; + double fbase(double MassSquaredA, double MassSquaredB) const; /** * Calculates the function f^2 needed for the 3rd derivatives of the Coleman * Weinberg potential. @@ -1131,22 +1039,19 @@ class Class_Potential_Origin * Calculates the counterterm parameters. Here you need to work out the scheme * and implement the formulas. This has to be specified in the model file. */ - virtual std::vector - calc_CT() const = 0; + virtual std::vector calc_CT() const = 0; /** * Calculates the Coleman-Weinberg contribution of a particle with m^2 = * MassSquared and the constant scheme-dependent parameter cb as well as the * first derivative with respect to m^2. */ - double - CWTerm(double MassSquared, double cb, int diff = 0) const; + double CWTerm(double MassSquared, double cb, int diff = 0) const; /** * Calculates Re(log(MassSquared)) and returns 0 if the argument is too small * as this function is only called with an (m^2)^n in front of it. */ - double - FCW(double MassSquared) const; + double FCW(double MassSquared) const; /** * @brief Calculation of the bosonic std::size_tegral + Coleman-Weinberg * potential __without__ taking d.o.f. std::size_to account @@ -1161,8 +1066,7 @@ class Class_Potential_Origin * * */ - double - boson(double MassSquared, double Temp, double cb, int diff = 0) const; + double boson(double MassSquared, double Temp, double cb, int diff = 0) const; /** * Deprecated version of boson() as present in the v1.X release. Still here * for legacy reasons @@ -1181,8 +1085,7 @@ class Class_Potential_Origin * @param diff : 0 = Value of the potential, diff > 0 returns the derivative * w.r.t. m^2 and diff=-1 w.r.t Temp */ - double - fermion(double MassSquared, double Temp, int diff = 0) const; + double fermion(double MassSquared, double Temp, int diff = 0) const; /** * Deprecated version of fermion() as present in the v1.X release. Still here * for legacy reasons @@ -1227,8 +1130,7 @@ class Class_Potential_Origin * Resets all bools. Needed if you want to deal with multiple posize_ts one * after another with the same pointer. */ - void - resetbools(); + void resetbools(); /** * This will convert the vector VEVminimizer with the VEVs used by the @@ -1266,8 +1168,7 @@ class Class_Potential_Origin * @return the mass eigenvalues in the vector and then the derivatives in the * same order */ - std::vector - SecondDerivativeOfEigenvaluesNonRepeated( + std::vector SecondDerivativeOfEigenvaluesNonRepeated( const Eigen::Ref M, const Eigen::Ref MDiffX, const Eigen::Ref MDiffY, @@ -1277,23 +1178,20 @@ class Class_Potential_Origin * This function will check if the VEV at NLO is still close enough to the LO * VEV. v has to be given in the configuration of the minimizer. */ - bool - CheckNLOVEV(const std::vector &v) const; + bool CheckNLOVEV(const std::vector &v) const; /** * This is a possible debugging function. */ - virtual void - Debugging(const std::vector &input, - std::vector &output) const = 0; + virtual void Debugging(const std::vector &input, + std::vector &output) const = 0; /** * Checks if the tensors are correctly implemented. For this the fermion, * quark and gauge boson masses are calculated and printed next to the values * defined in SMparah.h */ - void - CheckImplementation( + void CheckImplementation( const int &WhichMinimizer = Minimizer::WhichMinimizerDefault) const; /** @@ -1305,14 +1203,12 @@ class Class_Potential_Origin * @brief FindSignSymmetries checks for all possible sign changes in the VEV * components and checks for all possible Z2 symmetries */ - void - FindSignSymmetries(); + void FindSignSymmetries(); /** * Set the parameter UseTreeLevel to the input */ - void - SetUseTreeLevel(bool val); + void SetUseTreeLevel(bool val); /** * Gets the parameter line as an Input and calls @@ -1330,26 +1226,23 @@ class Class_Potential_Origin * set_gen() * @return Vector with the CT */ - std::vector - initModel(const std::vector &par); + std::vector initModel(const std::vector &par); /** * @brief resetScale changes the MSBar scale to newScale * @param newScale the new Scale in GeV * @return the CT at the new scale */ - std::vector - resetScale(const double &newScale); + std::vector resetScale(const double &newScale); /** * Calculate the ratio of the latent heat w.r.t. the energy density of the * plasma background Formula taken from */ - double - CalculateRatioAlpha(const std::vector &vev_symmetric, - const std::vector &vev_broken, - const double &Temp) const; + double CalculateRatioAlpha(const std::vector &vev_symmetric, + const std::vector &vev_broken, + const double &Temp) const; }; } // namespace BSMPT diff --git a/include/BSMPT/models/ClassPotentialR2HDM.h b/include/BSMPT/models/ClassPotentialR2HDM.h index ac5bbf02..e6ca508b 100644 --- a/include/BSMPT/models/ClassPotentialR2HDM.h +++ b/include/BSMPT/models/ClassPotentialR2HDM.h @@ -103,16 +103,12 @@ class Class_Potential_R2HDM : public Class_Potential_Origin int Type = 0; double CTempC1 = 0, CTempC2 = 0, CTempCS = 0; - void - ReadAndSet(const std::string &linestr, std::vector &par) override; - std::vector - addLegendCT() const override; - std::vector - addLegendTemp() const override; - std::vector - addLegendTripleCouplings() const override; - std::vector - addLegendVEV() const override; + void ReadAndSet(const std::string &linestr, + std::vector &par) override; + std::vector addLegendCT() const override; + std::vector addLegendTemp() const override; + std::vector addLegendTripleCouplings() const override; + std::vector addLegendVEV() const override; /** * Set the numerical values for the Lagrange parameters @@ -125,31 +121,20 @@ class Class_Potential_R2HDM : public Class_Potential_Origin * @param par[6] = tan(beta) * @param par[7] = Yukawa Type */ - void - set_gen(const std::vector &par) override; - void - set_CT_Pot_Par(const std::vector &par) override; - void - write() const override; + void set_gen(const std::vector &par) override; + void set_CT_Pot_Par(const std::vector &par) override; + void write() const override; - void - TripleHiggsCouplings() override; - std::vector - calc_CT() const override; + void TripleHiggsCouplings() override; + std::vector calc_CT() const override; - void - SetCurvatureArrays() override; - bool - CalculateDebyeSimplified() override; - bool - CalculateDebyeGaugeSimplified() override; - double - VTreeSimplified(const std::vector &v) const override; - double - VCounterSimplified(const std::vector &v) const override; - void - Debugging(const std::vector &input, - std::vector &output) const override; + void SetCurvatureArrays() override; + bool CalculateDebyeSimplified() override; + bool CalculateDebyeGaugeSimplified() override; + double VTreeSimplified(const std::vector &v) const override; + double VCounterSimplified(const std::vector &v) const override; + void Debugging(const std::vector &input, + std::vector &output) const override; }; } // namespace Models diff --git a/include/BSMPT/models/ClassPotentialRN2HDM.h b/include/BSMPT/models/ClassPotentialRN2HDM.h index b509f070..0658a17b 100644 --- a/include/BSMPT/models/ClassPotentialRN2HDM.h +++ b/include/BSMPT/models/ClassPotentialRN2HDM.h @@ -112,16 +112,12 @@ class Class_Potential_RN2HDM : public Class_Potential_Origin double NDus = 0, NDL6 = 0, NDL7 = 0, NDL8 = 0, NDvs = 0, NDTS = 0; double DTCharged = 0; - void - ReadAndSet(const std::string &linestr, std::vector &par) override; - std::vector - addLegendCT() const override; - std::vector - addLegendTemp() const override; - std::vector - addLegendTripleCouplings() const override; - std::vector - addLegendVEV() const override; + void ReadAndSet(const std::string &linestr, + std::vector &par) override; + std::vector addLegendCT() const override; + std::vector addLegendTemp() const override; + std::vector addLegendTripleCouplings() const override; + std::vector addLegendVEV() const override; /** * Set the numerical values for the Lagrange parameters @@ -138,31 +134,20 @@ class Class_Potential_RN2HDM : public Class_Potential_Origin * @param par[10] = m_{12}^2 * @param par[11] = Yukawa Type */ - void - set_gen(const std::vector &par) override; - void - set_CT_Pot_Par(const std::vector &par) override; - void - write() const override; + void set_gen(const std::vector &par) override; + void set_CT_Pot_Par(const std::vector &par) override; + void write() const override; - void - TripleHiggsCouplings() override; - std::vector - calc_CT() const override; + void TripleHiggsCouplings() override; + std::vector calc_CT() const override; - void - SetCurvatureArrays() override; - bool - CalculateDebyeSimplified() override; - bool - CalculateDebyeGaugeSimplified() override; - double - VTreeSimplified(const std::vector &v) const override; - double - VCounterSimplified(const std::vector &v) const override; - void - Debugging(const std::vector &input, - std::vector &output) const override; + void SetCurvatureArrays() override; + bool CalculateDebyeSimplified() override; + bool CalculateDebyeGaugeSimplified() override; + double VTreeSimplified(const std::vector &v) const override; + double VCounterSimplified(const std::vector &v) const override; + void Debugging(const std::vector &input, + std::vector &output) const override; }; } // namespace Models diff --git a/include/BSMPT/models/ClassTemplate.h b/include/BSMPT/models/ClassTemplate.h index 628e944d..1a309bc9 100644 --- a/include/BSMPT/models/ClassTemplate.h +++ b/include/BSMPT/models/ClassTemplate.h @@ -50,42 +50,27 @@ class Class_Template : public Class_Potential_Origin double dms, dlambda, dT, yt, g; - void - ReadAndSet(const std::string &linestr, std::vector &par) override; - std::vector - addLegendCT() const override; - std::vector - addLegendTemp() const override; - std::vector - addLegendTripleCouplings() const override; - std::vector - addLegendVEV() const override; - - void - set_gen(const std::vector &par) override; - void - set_CT_Pot_Par(const std::vector &par) override; - void - write() const override; - - void - TripleHiggsCouplings() override; - std::vector - calc_CT() const override; - - void - SetCurvatureArrays() override; - bool - CalculateDebyeSimplified() override; - bool - CalculateDebyeGaugeSimplified() override; - double - VTreeSimplified(const std::vector &v) const override; - double - VCounterSimplified(const std::vector &v) const override; - void - Debugging(const std::vector &input, - std::vector &output) const override; + void ReadAndSet(const std::string &linestr, + std::vector &par) override; + std::vector addLegendCT() const override; + std::vector addLegendTemp() const override; + std::vector addLegendTripleCouplings() const override; + std::vector addLegendVEV() const override; + + void set_gen(const std::vector &par) override; + void set_CT_Pot_Par(const std::vector &par) override; + void write() const override; + + void TripleHiggsCouplings() override; + std::vector calc_CT() const override; + + void SetCurvatureArrays() override; + bool CalculateDebyeSimplified() override; + bool CalculateDebyeGaugeSimplified() override; + double VTreeSimplified(const std::vector &v) const override; + double VCounterSimplified(const std::vector &v) const override; + void Debugging(const std::vector &input, + std::vector &output) const override; }; } // namespace Models diff --git a/include/BSMPT/models/IncludeAllModels.h b/include/BSMPT/models/IncludeAllModels.h index f7ebab6d..8b651acd 100644 --- a/include/BSMPT/models/IncludeAllModels.h +++ b/include/BSMPT/models/IncludeAllModels.h @@ -71,8 +71,7 @@ const std::unordered_map ModelNames{ * @brief InvertModelNames * @return The switched map to ModelNames */ -std::unordered_map -InvertModelNames(); +std::unordered_map InvertModelNames(); /** * @param choice ModelIDs for the Model under investigation @@ -81,8 +80,7 @@ InvertModelNames(); * @throw Runtime error if an invalid model was given into choice */ -std::unique_ptr -FChoose(ModelIDs choice); +std::unique_ptr FChoose(ModelIDs choice); /** * @@ -91,15 +89,13 @@ FChoose(ModelIDs choice); * @return If a match in ModelNames is found, return the corresponding ModelIDs * entry, otherwise return ModelIDs::NoSet */ -ModelIDs -getModel(const std::string &s); +ModelIDs getModel(const std::string &s); } // namespace ModelID /** * @brief ShowInputError shows all the available models in the terminal */ -void -ShowInputError(); +void ShowInputError(); } // namespace BSMPT diff --git a/include/BSMPT/utility.h b/include/BSMPT/utility.h index a1b15406..a659ee9f 100644 --- a/include/BSMPT/utility.h +++ b/include/BSMPT/utility.h @@ -43,8 +43,7 @@ namespace BSMPT /** * @brief StringStartsWith checks if str starts with prefix */ -bool -StringStartsWith(const std::string &str, const std::string &prefix); +bool StringStartsWith(const std::string &str, const std::string &prefix); /** * @brief seperator used to write into output files @@ -55,8 +54,7 @@ const std::string sep = "\t"; * Overload to print out vectors with the << operator */ template -std::ostream & -operator<<(std::ostream &os, const std::vector &vec) +std::ostream &operator<<(std::ostream &os, const std::vector &vec) { bool first = true; for (const auto &el : vec) @@ -81,8 +79,7 @@ namespace ModelID { enum class ModelIDs; } -std::ostream & -operator<<(std::ostream &os, const ModelID::ModelIDs &Model); +std::ostream &operator<<(std::ostream &os, const ModelID::ModelIDs &Model); #if BOOST_VERSION >= 107200 template diff --git a/src/Kfactors/Kfactors.cpp b/src/Kfactors/Kfactors.cpp index 6be2e63d..6636b5ab 100644 --- a/src/Kfactors/Kfactors.cpp +++ b/src/Kfactors/Kfactors.cpp @@ -3,18 +3,18 @@ * * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller - This program 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. - - This program 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 this program. If not, see . + This program 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. + + This program 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 this program. If not, see . */ #include @@ -27,82 +27,113 @@ * @file */ -namespace BSMPT { -namespace Kfactors { - - +namespace BSMPT +{ +namespace Kfactors +{ -double distribution_f0(double E0, int s, double Temp,int diff){ - double beta = 1.0/Temp; - double res = 0; - double expv=std::exp(beta*E0); - if( diff == 0){ - res = 1.0/(expv+s); +double distribution_f0(double E0, int s, double Temp, int diff) +{ + double beta = 1.0 / Temp; + double res = 0; + double expv = std::exp(beta * E0); + if (diff == 0) + { + res = 1.0 / (expv + s); } - else if(diff == 1){ - res = - beta * expv/std::pow(expv+s,2); + else if (diff == 1) + { + res = -beta * expv / std::pow(expv + s, 2); } - else if(diff == 2){ - res = beta*beta*expv*(expv-s)/std::pow(expv+s,3); + else if (diff == 2) + { + res = beta * beta * expv * (expv - s) / std::pow(expv + s, 3); } return res; } - -double K_integrand(const std::vector& p, double masssquared, int switchvalue,int s, double Temp){ +double K_integrand(const std::vector &p, + double masssquared, + int switchvalue, + int s, + double Temp) +{ double res = 0; - double px = p.at(0), py=p.at(1), pz=p.at(2); - double E0z = std::sqrt(pz*pz+masssquared); - double E0 = std::sqrt(px*px+py*py+pz*pz+masssquared); - switch (switchvalue) { - case 1: res = -pz*pz/E0 * distribution_f0(E0,s,Temp,2); break; - case 2: res = distribution_f0(E0,s,Temp,2)/(2.0*E0);break; - case 3: res = distribution_f0(E0,s,Temp,1)/(2.0*E0);break; - case 4: res = (pz*pz)/(E0*E0) * distribution_f0(E0,s,Temp,1);break; - case 5: res = (pz*pz)/E0 * distribution_f0(E0,s,Temp,1);break; - case 6: res = (E0*E0-pz*pz)/(2.0*std::pow(E0,3)) * distribution_f0(E0,s,Temp,1);break; - case 7: res = std::abs(pz)/(2*E0*E0*E0z) *( distribution_f0(E0,s,Temp,1)/E0 - distribution_f0(E0,s,Temp,2));break; - case 8: res = std::abs(pz)*distribution_f0(E0,s,Temp,1)/(2.0*E0*E0*E0z);break; - case 9: res = std::abs(pz)/(4*std::pow(E0,3)*E0z) * (distribution_f0(E0,s,Temp,1)/E0 - distribution_f0(E0,s,Temp,2));break; - case 10: res = std::abs(pz)*distribution_f0(E0,s,Temp,0)/(2.0*std::pow(E0,3)*E0z);break; - default: std::cerr << "Wrong call for " << __func__ << std::endl;break; + double px = p.at(0), py = p.at(1), pz = p.at(2); + double E0z = std::sqrt(pz * pz + masssquared); + double E0 = std::sqrt(px * px + py * py + pz * pz + masssquared); + switch (switchvalue) + { + case 1: res = -pz * pz / E0 * distribution_f0(E0, s, Temp, 2); break; + case 2: res = distribution_f0(E0, s, Temp, 2) / (2.0 * E0); break; + case 3: res = distribution_f0(E0, s, Temp, 1) / (2.0 * E0); break; + case 4: res = (pz * pz) / (E0 * E0) * distribution_f0(E0, s, Temp, 1); break; + case 5: res = (pz * pz) / E0 * distribution_f0(E0, s, Temp, 1); break; + case 6: + res = (E0 * E0 - pz * pz) / (2.0 * std::pow(E0, 3)) * + distribution_f0(E0, s, Temp, 1); + break; + case 7: + res = std::abs(pz) / (2 * E0 * E0 * E0z) * + (distribution_f0(E0, s, Temp, 1) / E0 - + distribution_f0(E0, s, Temp, 2)); + break; + case 8: + res = + std::abs(pz) * distribution_f0(E0, s, Temp, 1) / (2.0 * E0 * E0 * E0z); + break; + case 9: + res = std::abs(pz) / (4 * std::pow(E0, 3) * E0z) * + (distribution_f0(E0, s, Temp, 1) / E0 - + distribution_f0(E0, s, Temp, 2)); + break; + case 10: + res = std::abs(pz) * distribution_f0(E0, s, Temp, 0) / + (2.0 * std::pow(E0, 3) * E0z); + break; + default: std::cerr << "Wrong call for " << __func__ << std::endl; break; } return res; - - } - -double K_integrand_gsl(double *x, std::size_t dim, void *p ){ +double K_integrand_gsl(double *x, std::size_t dim, void *p) +{ std::vector momentum(dim); - for(std::size_t i=0;i(p); //(struct GSL_integration *) p; - double res = K_integrand(momentum, params->masssquared, params->switchval, params->s, params->Temp); + for (std::size_t i = 0; i < dim; i++) + momentum[i] = x[i]; + struct GSL_integration *params = + static_cast(p); //(struct GSL_integration *) p; + double res = K_integrand(momentum, + params->masssquared, + params->switchval, + params->s, + params->Temp); return res; } - -double K_integration(double masssquared,double Temp, int switchvalue, int s){ +double K_integration(double masssquared, double Temp, int switchvalue, int s) +{ struct GSL_integration p; - p.Temp = Temp; - p.s = s; - p.switchval = switchvalue; + p.Temp = Temp; + p.s = s; + p.switchval = switchvalue; p.masssquared = masssquared; - const std::size_t dim = 3; double numint = 1e3; - double xl[dim] = {0,0,0}; // We integrate from 0 to + infinity and multiply by 2^3 using the symmetry p -> -p - double xu[dim] = {numint,numint,numint}; + double xl[dim] = {0, 0, 0}; // We integrate from 0 to + infinity and multiply + // by 2^3 using the symmetry p -> -p + double xu[dim] = {numint, numint, numint}; - const gsl_rng_type *T; gsl_rng *r; + const gsl_rng_type *T; + gsl_rng *r; gsl_monte_function G; - G.f = &K_integrand_gsl; - G.dim = dim; + G.f = &K_integrand_gsl; + G.dim = dim; G.params = &p; // std::size_t calls = 500000; @@ -111,18 +142,18 @@ double K_integration(double masssquared,double Temp, int switchvalue, int s){ gsl_rng_env_setup(); T = gsl_rng_default; - r = gsl_rng_alloc (T); - - gsl_monte_vegas_state *state = gsl_monte_vegas_alloc (dim); + r = gsl_rng_alloc(T); - double res,err; + gsl_monte_vegas_state *state = gsl_monte_vegas_alloc(dim); - gsl_monte_vegas_integrate (&G, xl, xu, dim, 10000, r, state,&res, &err); + double res, err; - do{ - gsl_monte_vegas_integrate (&G, xl, xu, 3, calls/5, r, state,&res, &err); - }while(std::fabs(gsl_monte_vegas_chisq(state)-1) > 0.5); + gsl_monte_vegas_integrate(&G, xl, xu, dim, 10000, r, state, &res, &err); + do + { + gsl_monte_vegas_integrate(&G, xl, xu, 3, calls / 5, r, state, &res, &err); + } while (std::fabs(gsl_monte_vegas_chisq(state) - 1) > 0.5); gsl_monte_vegas_free(state); gsl_rng_free(r); @@ -131,25 +162,27 @@ double K_integration(double masssquared,double Temp, int switchvalue, int s){ return res; } - -double K_functions(double masssquared, double Temp,int switchvalue,int s){ - double numerator = K_integration(masssquared, Temp,switchvalue,s ); - double norm = 0; - if(switchvalue >10){ +double K_functions(double masssquared, double Temp, int switchvalue, int s) +{ + double numerator = K_integration(masssquared, Temp, switchvalue, s); + double norm = 0; + if (switchvalue > 10) + { std::cerr << "Wrong switch value for K_functions ! " << std::endl; exit(EXIT_FAILURE); - } - else if(switchvalue == 5 or switchvalue == 6 or switchvalue == 10){ - norm = Ktilde_normalization(Temp,s,masssquared); - } - else{ - norm = -std::pow(M_PI,3)*std::pow(Temp,2) * 2.0/3.0; - } - return numerator/norm; + } + else if (switchvalue == 5 or switchvalue == 6 or switchvalue == 10) + { + norm = Ktilde_normalization(Temp, s, masssquared); + } + else + { + norm = -std::pow(M_PI, 3) * std::pow(Temp, 2) * 2.0 / 3.0; + } + return numerator / norm; } - -void display_results (std::string title, double result, double error) +void display_results(std::string title, double result, double error) { std::cout << std::scientific; std::cout << title << "==================\n"; @@ -158,38 +191,40 @@ void display_results (std::string title, double result, double error) std::cout << "sigma = " << error << std::endl; } - -double Ktilde_normalization_func(double x, void *p){ - struct GSL_integration *params = static_cast(p); //(struct GSL_integration * )p; - double a = params->masssquared * std::pow(1.0/params->Temp,2); - int s = params->s; - double res = std::pow(x,2)/(std::exp(std::sqrt(a+std::pow(x,2)))+s); - return res; +double Ktilde_normalization_func(double x, void *p) +{ + struct GSL_integration *params = + static_cast(p); //(struct GSL_integration * )p; + double a = params->masssquared * std::pow(1.0 / params->Temp, 2); + int s = params->s; + double res = std::pow(x, 2) / (std::exp(std::sqrt(a + std::pow(x, 2))) + s); + return res; } - -double Ktilde_normalization(double Temp, int s, double masssquared){ +double Ktilde_normalization(double Temp, int s, double masssquared) +{ struct GSL_integration p; - p.Temp = Temp; - p.s = s; + p.Temp = Temp; + p.s = s; p.masssquared = masssquared; - std::size_t workspace_size = 1000; - gsl_integration_workspace *w = gsl_integration_workspace_alloc(workspace_size); + gsl_integration_workspace *w = + gsl_integration_workspace_alloc(workspace_size); double result, error; gsl_function F; - F.function=&Ktilde_normalization_func; - F.params=&p; + F.function = &Ktilde_normalization_func; + F.params = &p; - double xmax = 30; //around x = 30 the integrand becomes < 10^-10 for m^2 = 0. For m^2 > 0 this happens earlierer. - gsl_integration_qags(&F,0,xmax,0,1e-9,workspace_size,w,&result,&error); + double xmax = 30; // around x = 30 the integrand becomes < 10^-10 for m^2 = 0. + // For m^2 > 0 this happens earlierer. + gsl_integration_qags( + &F, 0, xmax, 0, 1e-9, workspace_size, w, &result, &error); gsl_integration_workspace_free(w); - result *= 4*M_PI*std::pow(Temp,3); + result *= 4 * M_PI * std::pow(Temp, 3); return result; } - -} -} +} // namespace Kfactors +} // namespace BSMPT diff --git a/src/Kfactors/KfactorsinterpolatedGSL.cpp b/src/Kfactors/KfactorsinterpolatedGSL.cpp index 5e569926..16b080cf 100644 --- a/src/Kfactors/KfactorsinterpolatedGSL.cpp +++ b/src/Kfactors/KfactorsinterpolatedGSL.cpp @@ -3,356 +3,460 @@ * * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller - This program 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. - - This program 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 this program. If not, see . + This program 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. + + This program 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 this program. If not, see . */ /** * @file */ - -#include #include #include #include +#include #include #include - - - - - -namespace BSMPT { -namespace Kfactors{ +namespace BSMPT +{ +namespace Kfactors +{ /** * @brief GSLAcclType Type used by the interpolations of the Kfunctions */ -using GSLAcclType = std::unique_ptr; - -double CalculateNorm1(const double& T) -{ - return -std::pow(M_PI,3)*std::pow(T,2) * 2.0/3.0; -} - -double CalculateNorm2(const double& msquared, const double& T, const int& s) -{ -// static const double startingValue = 0; -// static const double StepSize = 1; - - static const boost_cubic_b_spline KtildeNormalisationFermionSpline(Data::KtildeNormFermion_grid.data(), - Data::KtildeNormFermion_grid.size() - ,0,1); - - static const boost_cubic_b_spline KtildeNormalisationBosonSpline(Data::KtildeNormBoson_grid.data(), - Data::KtildeNormBoson_grid.size() - ,0,1); - - double norm = -1; - if(s==1){ - norm = KtildeNormalisationFermionSpline(msquared/std::pow(T,2)); +using GSLAcclType = + std::unique_ptr; + +double CalculateNorm1(const double &T) +{ + return -std::pow(M_PI, 3) * std::pow(T, 2) * 2.0 / 3.0; +} + +double CalculateNorm2(const double &msquared, const double &T, const int &s) +{ + // static const double startingValue = 0; + // static const double StepSize = 1; + + static const boost_cubic_b_spline KtildeNormalisationFermionSpline( + Data::KtildeNormFermion_grid.data(), + Data::KtildeNormFermion_grid.size(), + 0, + 1); + + static const boost_cubic_b_spline KtildeNormalisationBosonSpline( + Data::KtildeNormBoson_grid.data(), + Data::KtildeNormBoson_grid.size(), + 0, + 1); + + double norm = -1; + if (s == 1) + { + norm = KtildeNormalisationFermionSpline(msquared / std::pow(T, 2)); + } + else + { + norm = KtildeNormalisationBosonSpline(msquared / std::pow(T, 2)); + } + norm *= std::pow(T, 3); + return norm; +} + +std::unique_ptr +initializeK1fermionGrid() +{ + auto grid = std::unique_ptr( + gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size), + gsl_spline2d_free); + std::vector zav(Data::msg_size * Data::Tg_size); + for (std::size_t i = 0; i < Data::msg_size; i++) + { + for (std::size_t j = 0; j < Data::Tg_size; j++) + { + zav.at(j * Data::msg_size + i) = Data::K1p[i][j]; } - else{ - norm = KtildeNormalisationBosonSpline(msquared/std::pow(T,2)); + } + gsl_spline2d_init(grid.get(), + Data::msg.data(), + Data::Tg.data(), + zav.data(), + Data::msg_size, + Data::Tg_size); + return grid; +} +std::unique_ptr +initializeK1bosonGrid() +{ + auto grid = std::unique_ptr( + gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size), + gsl_spline2d_free); + std::vector zav(Data::msg_size * Data::Tg_size); + for (std::size_t i = 0; i < Data::msg_size; i++) + { + for (std::size_t j = 0; j < Data::Tg_size; j++) + { + zav.at(j * Data::msg_size + i) = Data::K1m[i][j]; } - norm *= std::pow(T,3); - return norm; -} - -std::unique_ptr initializeK1fermionGrid() -{ - auto grid= std::unique_ptr(gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size),gsl_spline2d_free); - std::vector zav(Data::msg_size*Data::Tg_size); - for(std::size_t i=0;i +initializeK2fermionGrid() +{ + auto grid = std::unique_ptr( + gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size), + gsl_spline2d_free); + std::vector zav(Data::msg_size * Data::Tg_size); + for (std::size_t i = 0; i < Data::msg_size; i++) + { + for (std::size_t j = 0; j < Data::Tg_size; j++) + { + zav.at(j * Data::msg_size + i) = Data::K2p[i][j]; } - gsl_spline2d_init(grid.get(), Data::msg.data(), Data::Tg.data(), zav.data(), Data::msg_size, Data::Tg_size); - return grid; -} -std::unique_ptr initializeK1bosonGrid() -{ - auto grid= std::unique_ptr(gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size),gsl_spline2d_free); - std::vector zav(Data::msg_size*Data::Tg_size); - for(std::size_t i=0;i +initializeK4fermionGrid() +{ + auto grid = std::unique_ptr( + gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size), + gsl_spline2d_free); + std::vector zav(Data::msg_size * Data::Tg_size); + for (std::size_t i = 0; i < Data::msg_size; i++) + { + for (std::size_t j = 0; j < Data::Tg_size; j++) + { + zav.at(j * Data::msg_size + i) = Data::K4p[i][j]; } - gsl_spline2d_init(grid.get(), Data::msg.data(), Data::Tg.data(), zav.data(), Data::msg_size, Data::Tg_size); - return grid; -} -std::unique_ptr initializeK2fermionGrid() -{ - auto grid= std::unique_ptr(gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size),gsl_spline2d_free); - std::vector zav(Data::msg_size*Data::Tg_size); - for(std::size_t i=0;i initializeK4fermionGrid() -{ - auto grid= std::unique_ptr(gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size),gsl_spline2d_free); - std::vector zav(Data::msg_size*Data::Tg_size); - for(std::size_t i=0;i initializeK4bosonGrid() -{ - auto grid= std::unique_ptr(gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size),gsl_spline2d_free); - std::vector zav(Data::msg_size*Data::Tg_size); - for(std::size_t i=0;i +initializeK4bosonGrid() +{ + auto grid = std::unique_ptr( + gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size), + gsl_spline2d_free); + std::vector zav(Data::msg_size * Data::Tg_size); + for (std::size_t i = 0; i < Data::msg_size; i++) + { + for (std::size_t j = 0; j < Data::Tg_size; j++) + { + zav.at(j * Data::msg_size + i) = Data::K4m[i][j]; } - gsl_spline2d_init(grid.get(), Data::msg.data(), Data::Tg.data(), zav.data(), Data::msg_size, Data::Tg_size); - return grid; -} -std::unique_ptr initializeK5fermionGrid() -{ - auto grid= std::unique_ptr(gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size),gsl_spline2d_free); - std::vector zav(Data::msg_size*Data::Tg_size); - for(std::size_t i=0;i +initializeK5fermionGrid() +{ + auto grid = std::unique_ptr( + gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size), + gsl_spline2d_free); + std::vector zav(Data::msg_size * Data::Tg_size); + for (std::size_t i = 0; i < Data::msg_size; i++) + { + for (std::size_t j = 0; j < Data::Tg_size; j++) + { + zav.at(j * Data::msg_size + i) = Data::K5p[i][j]; } - gsl_spline2d_init(grid.get(), Data::msg.data(), Data::Tg.data(), zav.data(), Data::msg_size, Data::Tg_size); - return grid; -} -std::unique_ptr initializeK5bosonGrid() -{ - auto grid= std::unique_ptr(gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size),gsl_spline2d_free); - std::vector zav(Data::msg_size*Data::Tg_size); - for(std::size_t i=0;i +initializeK5bosonGrid() +{ + auto grid = std::unique_ptr( + gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size), + gsl_spline2d_free); + std::vector zav(Data::msg_size * Data::Tg_size); + for (std::size_t i = 0; i < Data::msg_size; i++) + { + for (std::size_t j = 0; j < Data::Tg_size; j++) + { + zav.at(j * Data::msg_size + i) = Data::K5m[i][j]; } - gsl_spline2d_init(grid.get(), Data::msg.data(), Data::Tg.data(), zav.data(), Data::msg_size, Data::Tg_size); - return grid; -} -std::unique_ptr initializeK6fermionGrid() -{ - auto grid= std::unique_ptr(gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size),gsl_spline2d_free); - std::vector zav(Data::msg_size*Data::Tg_size); - for(std::size_t i=0;i +initializeK6fermionGrid() +{ + auto grid = std::unique_ptr( + gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size), + gsl_spline2d_free); + std::vector zav(Data::msg_size * Data::Tg_size); + for (std::size_t i = 0; i < Data::msg_size; i++) + { + for (std::size_t j = 0; j < Data::Tg_size; j++) + { + zav.at(j * Data::msg_size + i) = Data::K6p[i][j]; } - gsl_spline2d_init(grid.get(), Data::msg.data(), Data::Tg.data(), zav.data(), Data::msg_size, Data::Tg_size); - return grid; -} -std::unique_ptr initializeK8fermionGrid() -{ - auto grid= std::unique_ptr(gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size),gsl_spline2d_free); - std::vector zav(Data::msg_size*Data::Tg_size); - for(std::size_t i=0;i +initializeK8fermionGrid() +{ + auto grid = std::unique_ptr( + gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size), + gsl_spline2d_free); + std::vector zav(Data::msg_size * Data::Tg_size); + for (std::size_t i = 0; i < Data::msg_size; i++) + { + for (std::size_t j = 0; j < Data::Tg_size; j++) + { + zav.at(j * Data::msg_size + i) = Data::K8p[i][j]; } - gsl_spline2d_init(grid.get(), Data::msg.data(), Data::Tg.data(), zav.data(), Data::msg_size, Data::Tg_size); - return grid; -} -std::unique_ptr initializeK9fermionGrid() -{ - auto grid= std::unique_ptr(gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size),gsl_spline2d_free); - std::vector zav(Data::msg_size*Data::Tg_size); - for(std::size_t i=0;i +initializeK9fermionGrid() +{ + auto grid = std::unique_ptr( + gsl_spline2d_alloc(gsl_interp2d_bicubic, Data::msg_size, Data::Tg_size), + gsl_spline2d_free); + std::vector zav(Data::msg_size * Data::Tg_size); + for (std::size_t i = 0; i < Data::msg_size; i++) + { + for (std::size_t j = 0; j < Data::Tg_size; j++) + { + zav.at(j * Data::msg_size + i) = Data::K9p[i][j]; } - gsl_spline2d_init(grid.get(), Data::msg.data(), Data::Tg.data(), zav.data(), Data::msg_size, Data::Tg_size); - return grid; + } + gsl_spline2d_init(grid.get(), + Data::msg.data(), + Data::Tg.data(), + zav.data(), + Data::msg_size, + Data::Tg_size); + return grid; } - double K1fermion(double msquared, double T) { - static const std::unique_ptr grid = initializeK1fermionGrid(); - GSLAcclType xacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - GSLAcclType yacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - double res = gsl_spline2d_eval(grid.get(),msquared,T,xacc.get(),yacc.get()); - return res; + static const std::unique_ptr + grid = initializeK1fermionGrid(); + GSLAcclType xacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + GSLAcclType yacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + double res = + gsl_spline2d_eval(grid.get(), msquared, T, xacc.get(), yacc.get()); + return res; } double K1boson(double msquared, double T) { - static const std::unique_ptr grid = initializeK1bosonGrid(); - GSLAcclType xacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - GSLAcclType yacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - double res = gsl_spline2d_eval(grid.get(),msquared,T,xacc.get(),yacc.get()); - return res; + static const std::unique_ptr + grid = initializeK1bosonGrid(); + GSLAcclType xacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + GSLAcclType yacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + double res = + gsl_spline2d_eval(grid.get(), msquared, T, xacc.get(), yacc.get()); + return res; } double K2fermion(double msquared, double T) { - static const std::unique_ptr grid = initializeK2fermionGrid(); - GSLAcclType xacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - GSLAcclType yacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - double res = gsl_spline2d_eval(grid.get(),msquared,T,xacc.get(),yacc.get()); - return res; + static const std::unique_ptr + grid = initializeK2fermionGrid(); + GSLAcclType xacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + GSLAcclType yacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + double res = + gsl_spline2d_eval(grid.get(), msquared, T, xacc.get(), yacc.get()); + return res; } double K4fermion(double msquared, double T) { - static const std::unique_ptr grid = initializeK4fermionGrid(); - GSLAcclType xacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - GSLAcclType yacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - double res = gsl_spline2d_eval(grid.get(),msquared,T,xacc.get(),yacc.get()); - return res; + static const std::unique_ptr + grid = initializeK4fermionGrid(); + GSLAcclType xacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + GSLAcclType yacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + double res = + gsl_spline2d_eval(grid.get(), msquared, T, xacc.get(), yacc.get()); + return res; } double K4boson(double msquared, double T) { - static const std::unique_ptr grid = initializeK4bosonGrid(); - GSLAcclType xacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - GSLAcclType yacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - double res = gsl_spline2d_eval(grid.get(),msquared,T,xacc.get(),yacc.get()); - return res; + static const std::unique_ptr + grid = initializeK4bosonGrid(); + GSLAcclType xacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + GSLAcclType yacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + double res = + gsl_spline2d_eval(grid.get(), msquared, T, xacc.get(), yacc.get()); + return res; } double K5fermion(double msquared, double T) { - static const std::unique_ptr grid = initializeK5fermionGrid(); - GSLAcclType xacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - GSLAcclType yacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - double res = gsl_spline2d_eval(grid.get(),msquared,T,xacc.get(),yacc.get()); - return res; + static const std::unique_ptr + grid = initializeK5fermionGrid(); + GSLAcclType xacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + GSLAcclType yacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + double res = + gsl_spline2d_eval(grid.get(), msquared, T, xacc.get(), yacc.get()); + return res; } double K5boson(double msquared, double T) { - static const std::unique_ptr grid = initializeK5bosonGrid(); - GSLAcclType xacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - GSLAcclType yacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - double res = gsl_spline2d_eval(grid.get(),msquared,T,xacc.get(),yacc.get()); - return res; + static const std::unique_ptr + grid = initializeK5bosonGrid(); + GSLAcclType xacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + GSLAcclType yacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + double res = + gsl_spline2d_eval(grid.get(), msquared, T, xacc.get(), yacc.get()); + return res; } double K6fermion(double msquared, double T) { - static const std::unique_ptr grid = initializeK6fermionGrid(); - GSLAcclType xacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - GSLAcclType yacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - double res = gsl_spline2d_eval(grid.get(),msquared,T,xacc.get(),yacc.get()); - return res; + static const std::unique_ptr + grid = initializeK6fermionGrid(); + GSLAcclType xacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + GSLAcclType yacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + double res = + gsl_spline2d_eval(grid.get(), msquared, T, xacc.get(), yacc.get()); + return res; } double K8fermion(double msquared, double T) { - static const std::unique_ptr grid = initializeK8fermionGrid(); - GSLAcclType xacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - GSLAcclType yacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - double res = gsl_spline2d_eval(grid.get(),msquared,T,xacc.get(),yacc.get()); - return res; + static const std::unique_ptr + grid = initializeK8fermionGrid(); + GSLAcclType xacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + GSLAcclType yacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + double res = + gsl_spline2d_eval(grid.get(), msquared, T, xacc.get(), yacc.get()); + return res; } double K9fermion(double msquared, double T) { - static const std::unique_ptr grid = initializeK9fermionGrid(); - GSLAcclType xacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - GSLAcclType yacc(gsl_interp_accel_alloc(),gsl_interp_accel_free); - double res = gsl_spline2d_eval(grid.get(),msquared,T,xacc.get(),yacc.get()); - return res; + static const std::unique_ptr + grid = initializeK9fermionGrid(); + GSLAcclType xacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + GSLAcclType yacc(gsl_interp_accel_alloc(), gsl_interp_accel_free); + double res = + gsl_spline2d_eval(grid.get(), msquared, T, xacc.get(), yacc.get()); + return res; } - - double K1fermion_normalized(double msquared, double T) { - double nom = K1fermion(msquared,T); - double denom = CalculateNorm1(T); - return nom/denom; + double nom = K1fermion(msquared, T); + double denom = CalculateNorm1(T); + return nom / denom; } - double K1boson_normalized(double msquared, double T) { - return K1boson(msquared,T)/CalculateNorm1(T); + return K1boson(msquared, T) / CalculateNorm1(T); } - double K2fermion_normalized(double msquared, double T) { - return K2fermion(msquared,T)/CalculateNorm1(T); + return K2fermion(msquared, T) / CalculateNorm1(T); } - - double K4fermion_normalized(double msquared, double T) { - return K4fermion(msquared,T)/CalculateNorm1(T); + return K4fermion(msquared, T) / CalculateNorm1(T); } - - double K4boson_normalized(double msquared, double T) { - return K4boson(msquared,T)/CalculateNorm1(T); + return K4boson(msquared, T) / CalculateNorm1(T); } - double K5fermion_normalized(double msquared, double T) { - return K5fermion(msquared,T)/CalculateNorm2(msquared,T,1); + return K5fermion(msquared, T) / CalculateNorm2(msquared, T, 1); } - - double K5boson_normalized(double msquared, double T) { - return K5boson(msquared,T)/CalculateNorm2(msquared,T,-1); + return K5boson(msquared, T) / CalculateNorm2(msquared, T, -1); } - double K6fermion_normalized(double msquared, double T) { - return K6fermion(msquared,T)/CalculateNorm2(msquared,T,1); + return K6fermion(msquared, T) / CalculateNorm2(msquared, T, 1); } - - double K8fermion_normalized(double msquared, double T) { - return K8fermion(msquared,T)/CalculateNorm2(msquared,T,1); + return K8fermion(msquared, T) / CalculateNorm2(msquared, T, 1); } - - double K9fermion_normalized(double msquared, double T) { - return K9fermion(msquared,T)/CalculateNorm1(T); + return K9fermion(msquared, T) / CalculateNorm1(T); } - - -} -} +} // namespace Kfactors +} // namespace BSMPT diff --git a/src/ThermalFunctions/ThermalFunctions.cpp b/src/ThermalFunctions/ThermalFunctions.cpp index 9e5a6cea..03b89449 100644 --- a/src/ThermalFunctions/ThermalFunctions.cpp +++ b/src/ThermalFunctions/ThermalFunctions.cpp @@ -3,283 +3,333 @@ * * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller - This program 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. + This program 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. - This program 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. + This program 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 this program. If not, see . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ /** * @file */ -#include #include +#include #include #include +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include -namespace BSMPT { -namespace ThermalFunctions { +namespace BSMPT +{ +namespace ThermalFunctions +{ -double JbosonIntegrand(const double& x, const double& k, int diff){ - using std::exp; - using std::log; - using std::complex; - complex res(0,0); - complex kcomplex(k,0), xcomplex(x,0); - complex TmpSqrt = std::sqrt(kcomplex*kcomplex+xcomplex); - if(diff == 0){ - res = kcomplex*kcomplex*log(complex(1,0)-exp(-TmpSqrt)); - } - else if(diff == 1){ - res = kcomplex*kcomplex *exp(-TmpSqrt)/(complex(2,0)*TmpSqrt*(complex(1,0)-exp(-TmpSqrt))); - } - else{ - (void) x; - (void) k; - } - return res.real(); +double JbosonIntegrand(const double &x, const double &k, int diff) +{ + using std::complex; + using std::exp; + using std::log; + complex res(0, 0); + complex kcomplex(k, 0), xcomplex(x, 0); + complex TmpSqrt = std::sqrt(kcomplex * kcomplex + xcomplex); + if (diff == 0) + { + res = kcomplex * kcomplex * log(complex(1, 0) - exp(-TmpSqrt)); + } + else if (diff == 1) + { + res = kcomplex * kcomplex * exp(-TmpSqrt) / + (complex(2, 0) * TmpSqrt * + (complex(1, 0) - exp(-TmpSqrt))); + } + else + { + (void)x; + (void)k; + } + return res.real(); } -double JfermionIntegrand(const double& x, const double& k, int diff){ - using std::exp; - using std::log; - using std::complex; - complex res(0,0); - complex kcomplex(k,0), xcomplex(x,0); - complex TmpSqrt = std::sqrt(kcomplex*kcomplex+xcomplex); - if(diff == 0){ - res = kcomplex*kcomplex*log(complex(1,0)+exp(-TmpSqrt)); - } - else if(diff == 1){ - res = -kcomplex*kcomplex *exp(-TmpSqrt)/(complex(2,0)*TmpSqrt*(complex(1,0)+exp(-TmpSqrt))); - } - else{ - (void) x; - (void) k; - } - return res.real(); +double JfermionIntegrand(const double &x, const double &k, int diff) +{ + using std::complex; + using std::exp; + using std::log; + complex res(0, 0); + complex kcomplex(k, 0), xcomplex(x, 0); + complex TmpSqrt = std::sqrt(kcomplex * kcomplex + xcomplex); + if (diff == 0) + { + res = kcomplex * kcomplex * log(complex(1, 0) + exp(-TmpSqrt)); + } + else if (diff == 1) + { + res = -kcomplex * kcomplex * exp(-TmpSqrt) / + (complex(2, 0) * TmpSqrt * + (complex(1, 0) + exp(-TmpSqrt))); + } + else + { + (void)x; + (void)k; + } + return res.real(); } - -double JbosonNumericalIntegration(const double& x, int diff){ - const std::size_t workspaceSize = 1000; - gsl_integration_workspace * w = gsl_integration_workspace_alloc (workspaceSize); - gsl_function F; - struct GSLTemp{ - double x; - int diff; - }; - GSLTemp dummy; - dummy.diff = diff; - dummy.x = x; - F.function = [](double k, void* p){ - struct GSLTemp * params = static_cast(p); - return JbosonIntegrand(params->x,k,params->diff); - }; - F.params = &dummy; - double error, result; - double upperLimit = 30; - gsl_integration_qags(&F,0,upperLimit,0,1e-7,workspaceSize,w,&result,&error); - gsl_integration_workspace_free(w); - return result; +double JbosonNumericalIntegration(const double &x, int diff) +{ + const std::size_t workspaceSize = 1000; + gsl_integration_workspace *w = gsl_integration_workspace_alloc(workspaceSize); + gsl_function F; + struct GSLTemp + { + double x; + int diff; + }; + GSLTemp dummy; + dummy.diff = diff; + dummy.x = x; + F.function = [](double k, void *p) { + struct GSLTemp *params = static_cast(p); + return JbosonIntegrand(params->x, k, params->diff); + }; + F.params = &dummy; + double error, result; + double upperLimit = 30; + gsl_integration_qags( + &F, 0, upperLimit, 0, 1e-7, workspaceSize, w, &result, &error); + gsl_integration_workspace_free(w); + return result; } -double JfermionNumericalIntegration(const double& x, int diff){ - const std::size_t workspaceSize = 1000; - gsl_integration_workspace * w = gsl_integration_workspace_alloc (workspaceSize); - gsl_function F; - struct GSLTemp{ - double x; - int diff; - }; - GSLTemp dummy; - dummy.diff = diff; - dummy.x = x; - F.function = [](double k, void* p){ - struct GSLTemp * params = static_cast(p); - return JfermionIntegrand(params->x,k,params->diff); - }; - F.params = &dummy; - double error, result; - double upperLimit = 30; - gsl_integration_qags(&F,0,upperLimit,0,1e-7,workspaceSize,w,&result,&error); - gsl_integration_workspace_free(w); - return result; +double JfermionNumericalIntegration(const double &x, int diff) +{ + const std::size_t workspaceSize = 1000; + gsl_integration_workspace *w = gsl_integration_workspace_alloc(workspaceSize); + gsl_function F; + struct GSLTemp + { + double x; + int diff; + }; + GSLTemp dummy; + dummy.diff = diff; + dummy.x = x; + F.function = [](double k, void *p) { + struct GSLTemp *params = static_cast(p); + return JfermionIntegrand(params->x, k, params->diff); + }; + F.params = &dummy; + double error, result; + double upperLimit = 30; + gsl_integration_qags( + &F, 0, upperLimit, 0, 1e-7, workspaceSize, w, &result, &error); + gsl_integration_workspace_free(w); + return result; } +double JfermionInterpolatedLow(const double &x, const int &n, int diff) +{ + if (x == 0 and diff == 0) + { + return -7 * pow(M_PI, 4) / 360.0; + } + else if (x == 0 and diff == 1) + { + return pow(M_PI, 2) / 24; + } + using std::log; + using std::pow; + double res = 0; + double cf = 1.5 + 2 * log(4 * M_PI) - 2 * C_euler_gamma - 2 * log(4); + if (diff == 0) + { + res = -7 * pow(M_PI, 4) / 360.0; + res += pow(M_PI, 2) / 24 * x; + res += 1 / 32.0 * pow(x, 2) * (log(x) - cf); + double sum = 0; + for (int l = 2; l <= n; l++) + { + double Kl = gsl_sf_doublefact(2 * l - 3) * gsl_sf_zeta(2 * l - 1) / + (gsl_sf_doublefact(2 * l) * (l + 1)) * + (pow(2, 2 * l - 1) - 1); + sum += pow(-x / (4 * pow(M_PI, 2)), l) * Kl; + } + res += -pow(M_PI, 2) * x * sum; + } + else if (diff == 1) + { + res = pow(M_PI, 2) / 24.0; + res += x * (-6 * cf + 3) / 96; + res += x * log(x) / 16; + double sum = 0; + for (int l = 2; l <= n; l++) + { + double Kl = gsl_sf_doublefact(2 * l - 3) * gsl_sf_zeta(2 * l - 1) / + (gsl_sf_doublefact(2 * l) * (l + 1)) * + (pow(2, 2 * l - 1) - 1); + sum += -Kl * pow(-x / 4.0, l) * (l + 1) * pow(M_PI, 2 - 2 * l); + } + res += sum; + } -double JfermionInterpolatedLow(const double& x, const int& n, int diff){ - if(x == 0 and diff == 0){ - return -7*pow(M_PI,4)/360.0; - } - else if(x==0 and diff == 1){ - return pow(M_PI,2)/24; - } - using std::pow; - using std::log; - double res = 0; - double cf = 1.5+2*log(4*M_PI)-2*C_euler_gamma-2*log(4); - if(diff == 0){ - res = -7*pow(M_PI,4)/360.0; - res +=pow(M_PI,2)/24 *x; - res += 1/32.0*pow(x,2) * (log(x) - cf); - double sum = 0; - for(int l=2;l<=n;l++){ - double Kl = gsl_sf_doublefact(2*l-3)*gsl_sf_zeta(2*l-1)/(gsl_sf_doublefact(2*l)*(l+1))*(pow(2,2*l-1)-1); - sum += pow(-x/(4*pow(M_PI,2)),l) * Kl ; - } - res += -pow(M_PI,2)*x*sum; - } - else if(diff == 1){ - res = pow(M_PI,2)/24.0; - res += x*(-6*cf+3)/96; - res += x*log(x)/16; - double sum = 0; - for(int l=2;l<=n;l++){ - double Kl = gsl_sf_doublefact(2*l-3)*gsl_sf_zeta(2*l-1)/(gsl_sf_doublefact(2*l)*(l+1))*(pow(2,2*l-1)-1); - sum += -Kl *pow(-x/4.0,l)*(l+1)*pow(M_PI,2-2*l); - } - res += sum; - } - - - - return res; + return res; } - -double JbosonInterpolatedLow(const double& x, const int& n, int diff){ - if(x == 0 and diff == 0){ - return -pow(M_PI,4)/45.0; - } - else if(x==0 and diff == 1){ - return pow(M_PI,2)/12.0; - } - using std::pow; - using std::log; - using std::sqrt; - double cb = 1.5+2*std::log(4*M_PI)-2*C_euler_gamma; - double res = 0; - if(diff == 0){ - res = -pow(M_PI,4)/45.0; - res += pow(M_PI,2)*x/12.0; - res += -M_PI*pow(x,1.5)/6; - res += -pow(x,2)*(log(x)-cb)/32.0; - double sum = 0; - for(int l=2;l<=n;l++){ - double Kl = gsl_sf_doublefact(2*l-3)*gsl_sf_zeta(2*l-1)/(gsl_sf_doublefact(2*l)*(l+1)); - sum += pow(-x/(4*pow(M_PI,2)),l) *Kl; - } - res += pow(M_PI,2)*x*sum; - } - else if(diff == 1){ - res = pow(M_PI,2); - res += x*(6*cb-3)/96.0; - res += -x*log(x)/16.0; - res += -M_PI*sqrt(x)/4.0; - double sum = 0; - for(int l=2;l<=n;l++){ - double Kl = gsl_sf_doublefact(2*l-3)*gsl_sf_zeta(2*l-1)/(gsl_sf_doublefact(2*l)*(l+1)); - sum += Kl *pow(-x/4.0,l)*(l+1)*pow(M_PI,2-2*l); - } - res += sum; - } - return res; +double JbosonInterpolatedLow(const double &x, const int &n, int diff) +{ + if (x == 0 and diff == 0) + { + return -pow(M_PI, 4) / 45.0; + } + else if (x == 0 and diff == 1) + { + return pow(M_PI, 2) / 12.0; + } + using std::log; + using std::pow; + using std::sqrt; + double cb = 1.5 + 2 * std::log(4 * M_PI) - 2 * C_euler_gamma; + double res = 0; + if (diff == 0) + { + res = -pow(M_PI, 4) / 45.0; + res += pow(M_PI, 2) * x / 12.0; + res += -M_PI * pow(x, 1.5) / 6; + res += -pow(x, 2) * (log(x) - cb) / 32.0; + double sum = 0; + for (int l = 2; l <= n; l++) + { + double Kl = gsl_sf_doublefact(2 * l - 3) * gsl_sf_zeta(2 * l - 1) / + (gsl_sf_doublefact(2 * l) * (l + 1)); + sum += pow(-x / (4 * pow(M_PI, 2)), l) * Kl; + } + res += pow(M_PI, 2) * x * sum; + } + else if (diff == 1) + { + res = pow(M_PI, 2); + res += x * (6 * cb - 3) / 96.0; + res += -x * log(x) / 16.0; + res += -M_PI * sqrt(x) / 4.0; + double sum = 0; + for (int l = 2; l <= n; l++) + { + double Kl = gsl_sf_doublefact(2 * l - 3) * gsl_sf_zeta(2 * l - 1) / + (gsl_sf_doublefact(2 * l) * (l + 1)); + sum += Kl * pow(-x / 4.0, l) * (l + 1) * pow(M_PI, 2 - 2 * l); + } + res += sum; + } + return res; } -double JInterpolatedHigh(const double& x, const int& n, int diff){ - using std::pow; - using std::exp; - using std::sqrt; +double JInterpolatedHigh(const double &x, const int &n, int diff) +{ + using std::exp; + using std::pow; + using std::sqrt; - double res = 0; - if(diff == 0){ - double sum = 0; - for(int l=0;l<=n;l++){ - double Kl = 1/(std::pow(2,l)*gsl_sf_fact(l)) * gsl_sf_gamma(2.5+l)/gsl_sf_gamma(2.5-l) ; - sum += Kl * pow(x,-l/2.0); - } - res = -exp(-sqrt(x))*sqrt(M_PI/2 * pow(x,1.5))*sum; - } - else if(diff == 1){ - double sum = 0; - for(int l=0;l<=n;l++) - { - double Kl = 1/(std::pow(2,l)*gsl_sf_fact(l)) * gsl_sf_gamma(2.5+l)/gsl_sf_gamma(2.5-l); - sum += Kl *pow(x,(1-l)/2)*(2*l+2*sqrt(x)-3); - } - res = exp(-sqrt(x)) *sqrt(2*M_PI)/(8*pow(x,3.0/4.0)) * sum; - } - return res; + double res = 0; + if (diff == 0) + { + double sum = 0; + for (int l = 0; l <= n; l++) + { + double Kl = 1 / (std::pow(2, l) * gsl_sf_fact(l)) * + gsl_sf_gamma(2.5 + l) / gsl_sf_gamma(2.5 - l); + sum += Kl * pow(x, -l / 2.0); + } + res = -exp(-sqrt(x)) * sqrt(M_PI / 2 * pow(x, 1.5)) * sum; + } + else if (diff == 1) + { + double sum = 0; + for (int l = 0; l <= n; l++) + { + double Kl = 1 / (std::pow(2, l) * gsl_sf_fact(l)) * + gsl_sf_gamma(2.5 + l) / gsl_sf_gamma(2.5 - l); + sum += Kl * pow(x, (1 - l) / 2) * (2 * l + 2 * sqrt(x) - 3); + } + res = exp(-sqrt(x)) * sqrt(2 * M_PI) / (8 * pow(x, 3.0 / 4.0)) * sum; + } + return res; } -double JfermionInterpolated(const double& x, int diff){ - double res = 0; - if(x>= C_FermionTheta) { - res = -JInterpolatedHigh(x,3,diff); - } - else { - res = -JfermionInterpolatedLow(x,4,diff); - if(diff == 0) res += -C_FermionShift; - } - return res; +double JfermionInterpolated(const double &x, int diff) +{ + double res = 0; + if (x >= C_FermionTheta) + { + res = -JInterpolatedHigh(x, 3, diff); + } + else + { + res = -JfermionInterpolatedLow(x, 4, diff); + if (diff == 0) res += -C_FermionShift; + } + return res; } -double JbosonInterpolated(const double& x, int diff){ - double res = 0; - if(x>= C_BosonTheta){ - res = JInterpolatedHigh(x,3,diff); - } - else if(x>= 0){ - res = JbosonInterpolatedLow(x,3,diff); - if(diff == 0) res += C_BosonShift; - } - else if(x<0 and diff == 0){ - res = JbosonInterpolatedNegative(x); - } - return res; +double JbosonInterpolated(const double &x, int diff) +{ + double res = 0; + if (x >= C_BosonTheta) + { + res = JInterpolatedHigh(x, 3, diff); + } + else if (x >= 0) + { + res = JbosonInterpolatedLow(x, 3, diff); + if (diff == 0) res += C_BosonShift; + } + else if (x < 0 and diff == 0) + { + res = JbosonInterpolatedNegative(x); + } + return res; } -double JbosonInterpolatedNegative(const double& x){ - if(x>=0) return 0; - double PotVal = 0; - double xprev,fprev,xnext,fnext; - if(-x >= C_NegLine-2) { - xprev = NegLinearInt[C_NegLine-2][0]; - xnext = NegLinearInt[C_NegLine-1][0]; - fprev = NegLinearInt[C_NegLine-2][1]; - fnext = NegLinearInt[C_NegLine-1][1]; - } - else{ - std::size_t pos = (std::size_t (-x)); - xprev = NegLinearInt[pos][0]; - fprev = NegLinearInt[pos][1]; - xnext = NegLinearInt[pos+1][0]; - fnext = NegLinearInt[pos+1][1]; - } +double JbosonInterpolatedNegative(const double &x) +{ + if (x >= 0) return 0; + double PotVal = 0; + double xprev, fprev, xnext, fnext; + if (-x >= C_NegLine - 2) + { + xprev = NegLinearInt[C_NegLine - 2][0]; + xnext = NegLinearInt[C_NegLine - 1][0]; + fprev = NegLinearInt[C_NegLine - 2][1]; + fnext = NegLinearInt[C_NegLine - 1][1]; + } + else + { + std::size_t pos = (std::size_t(-x)); + xprev = NegLinearInt[pos][0]; + fprev = NegLinearInt[pos][1]; + xnext = NegLinearInt[pos + 1][0]; + fnext = NegLinearInt[pos + 1][1]; + } - PotVal = (fnext-fprev)/(xnext-xprev) * (x-xprev) + fprev; - PotVal += C_BosonShift; - return PotVal; + PotVal = (fnext - fprev) / (xnext - xprev) * (x - xprev) + fprev; + PotVal += C_BosonShift; + return PotVal; } - -} -} +} // namespace ThermalFunctions +} // namespace BSMPT diff --git a/src/WallThickness/WallThicknessLib.cpp b/src/WallThickness/WallThicknessLib.cpp index 32cecea3..a9e4db7c 100644 --- a/src/WallThickness/WallThicknessLib.cpp +++ b/src/WallThickness/WallThicknessLib.cpp @@ -3,25 +3,24 @@ * * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller - This program 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. - - This program 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 this program. If not, see . + This program 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. + + This program 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 this program. If not, see . */ /** * @file */ - #include #include #include @@ -29,322 +28,336 @@ #include -#include #include -#include #include +#include +#include -#include -#include #include #include +#include +#include -namespace BSMPT{ -namespace Wall{ -const double GSL_Tolerance=std::pow(10,-4); +namespace BSMPT +{ +namespace Wall +{ +const double GSL_Tolerance = std::pow(10, -4); const std::size_t Num_threads = std::thread::hardware_concurrency(); - - /** * struct containing the required Parameters of the model for the gsl interface */ -struct GSL_params { - /** - * @brief nVEV number of VEVs - */ -std::size_t nVEV; -/** - * @brief VevMinimum electroweak minimum in the broken phase - */ -std::vector VevMinimum; -/** - * @brief VeVSymmetric electroweak minimum in the symmetric phase - */ -std::vector VeVSymmetric; -/** - * @brief modelPointer shared_ptr for the parameter point - */ -std::shared_ptr modelPointer; -/** - * @brief Temp temperature at which to evaluate the parameter point - */ -double Temp; -/** - * @brief spline cubic spline used to find the potential barrier - */ -boost_cubic_b_spline spline; -/** - * @brief UseSpline Decides if the spline is to be used or not - */ -bool UseSpline=false; +struct GSL_params +{ + /** + * @brief nVEV number of VEVs + */ + std::size_t nVEV; + /** + * @brief VevMinimum electroweak minimum in the broken phase + */ + std::vector VevMinimum; + /** + * @brief VeVSymmetric electroweak minimum in the symmetric phase + */ + std::vector VeVSymmetric; + /** + * @brief modelPointer shared_ptr for the parameter point + */ + std::shared_ptr modelPointer; + /** + * @brief Temp temperature at which to evaluate the parameter point + */ + double Temp; + /** + * @brief spline cubic spline used to find the potential barrier + */ + boost_cubic_b_spline spline; + /** + * @brief UseSpline Decides if the spline is to be used or not + */ + bool UseSpline = false; }; - - -double GSL_VEFF_gen_all_maximum_line(double t, void *p){ - struct GSL_params * params = static_cast(p); - std::vector vIn,vMin; - std::size_t nVEVs = params->modelPointer->get_nVEV(); - - for(std::size_t i=0;iVevMinimum.at(i) + (1-t) * params->VeVSymmetric.at(i)); - } - - vIn.resize(params->modelPointer->get_NHiggs()); - vIn=params->modelPointer->MinimizeOrderVEV(vMin); - - double res = -1*params->modelPointer->VEff(vIn,params->Temp,0); // -1 makes the maximum the minimum - return res; +double GSL_VEFF_gen_all_maximum_line(double t, void *p) +{ + struct GSL_params *params = static_cast(p); + std::vector vIn, vMin; + std::size_t nVEVs = params->modelPointer->get_nVEV(); + + for (std::size_t i = 0; i < nVEVs; i++) + { + vMin.push_back(t * params->VevMinimum.at(i) + + (1 - t) * params->VeVSymmetric.at(i)); + } + + vIn.resize(params->modelPointer->get_NHiggs()); + vIn = params->modelPointer->MinimizeOrderVEV(vMin); + + double res = + -1 * params->modelPointer->VEff( + vIn, params->Temp, 0); // -1 makes the maximum the minimum + return res; } - - double calculate_wall_thickness_plane( - const std::shared_ptr& modelPointer, - const double &Temp, - const std::vector& vcritical, - const std::vector& vevsymmetric, - const int& WhichMinimizer){ - - if(vcritical.size() != vevsymmetric.size()){ - throw std::runtime_error("vcritical and vevsymmetric in calculate_wall_thickness_plane do not have the same size "); - } - double LW = 0; - int maxstep = 10; - double Stepsize = 1.0/(maxstep); - std::vector Data_min_negative(maxstep+1); - std::vector Data_min_threads(Num_threads); - - std::atomic DataIndex{0}; - std::mutex WriteLock; - - std::vector>> BasePoints; - for(int ncounter=0;ncounter<=maxstep;++ncounter) - { - double line_parameter=Stepsize*ncounter; - std::vector basepoint; - for(std::size_t i=0;i& mDataIndex, - std::vector>>& a_BasePoints, - std::vector& Data_min, - std::mutex& mWriteResultLock, - const std::vector& a_vevsymmetric, - const std::vector& a_vcritical, - std::shared_ptr a_modelPointer, - const double& a_Temp, - const int& a_WhichMinimizer - ) - { - while (mDataIndex < a_BasePoints.size() ) { - const auto data = a_BasePoints.at(mDataIndex++); - auto MinimumPlaneResult = Minimizer::MinimizePlane( - data.second, - a_vevsymmetric, - a_vcritical, - a_modelPointer, - a_Temp, - a_WhichMinimizer); - { - std::unique_lock lock(mWriteResultLock); - Data_min.at(data.first) = -MinimumPlaneResult.PotVal; - } - - } - }; - - + const std::shared_ptr &modelPointer, + const double &Temp, + const std::vector &vcritical, + const std::vector &vevsymmetric, + const int &WhichMinimizer) +{ - for(auto& thr: Data_min_threads) + if (vcritical.size() != vevsymmetric.size()) + { + throw std::runtime_error( + "vcritical and vevsymmetric in calculate_wall_thickness_plane do not " + "have the same size "); + } + double LW = 0; + int maxstep = 10; + double Stepsize = 1.0 / (maxstep); + std::vector Data_min_negative(maxstep + 1); + std::vector Data_min_threads(Num_threads); + + std::atomic DataIndex{0}; + std::mutex WriteLock; + + std::vector>> BasePoints; + for (int ncounter = 0; ncounter <= maxstep; ++ncounter) + { + double line_parameter = Stepsize * ncounter; + std::vector basepoint; + for (std::size_t i = 0; i < vcritical.size(); i++) { - thr = std::thread([&](){ - thread_Job(DataIndex, BasePoints, Data_min_negative, WriteLock, vevsymmetric,vcritical, modelPointer, Temp, WhichMinimizer); - }); + basepoint.push_back(vevsymmetric.at(i) * (1 - line_parameter) + + vcritical.at(i) * line_parameter); } - - for(auto& thr : Data_min_threads) - { - if(thr.joinable()) + BasePoints.push_back(std::make_pair(ncounter, basepoint)); + } + + auto thread_Job = + [](std::atomic &mDataIndex, + std::vector>> &a_BasePoints, + std::vector &Data_min, + std::mutex &mWriteResultLock, + const std::vector &a_vevsymmetric, + const std::vector &a_vcritical, + std::shared_ptr a_modelPointer, + const double &a_Temp, + const int &a_WhichMinimizer) { + while (mDataIndex < a_BasePoints.size()) { - thr.join(); + const auto data = a_BasePoints.at(mDataIndex++); + auto MinimumPlaneResult = Minimizer::MinimizePlane(data.second, + a_vevsymmetric, + a_vcritical, + a_modelPointer, + a_Temp, + a_WhichMinimizer); + { + std::unique_lock lock(mWriteResultLock); + Data_min.at(data.first) = -MinimumPlaneResult.PotVal; + } } + }; + + for (auto &thr : Data_min_threads) + { + thr = std::thread([&]() { + thread_Job(DataIndex, + BasePoints, + Data_min_negative, + WriteLock, + vevsymmetric, + vcritical, + modelPointer, + Temp, + WhichMinimizer); + }); + } + + for (auto &thr : Data_min_threads) + { + if (thr.joinable()) + { + thr.join(); } + } - struct GSL_params spline; - boost_cubic_b_spline splinef(Data_min_negative.data(),Data_min_negative.size(),0,Stepsize); - spline.spline = splinef; - spline.UseSpline=true; + struct GSL_params spline; + boost_cubic_b_spline splinef( + Data_min_negative.data(), Data_min_negative.size(), 0, Stepsize); + spline.spline = splinef; + spline.UseSpline = true; - int precision=std::numeric_limits::digits; - std::pair MaxPair = boost::math::tools::brent_find_minima(splinef,0.,1.,precision); + int precision = std::numeric_limits::digits; + std::pair MaxPair = + boost::math::tools::brent_find_minima(splinef, 0., 1., precision); -// double Max_pos = MaxPair.first; - double VMax = -MaxPair.second; - double Vmin = std::min(-splinef(0),-splinef(1)); - double Vbarrier = VMax-Vmin; + // double Max_pos = MaxPair.first; + double VMax = -MaxPair.second; + double Vmin = std::min(-splinef(0), -splinef(1)); + double Vbarrier = VMax - Vmin; - auto vc = modelPointer->EWSBVEV(modelPointer->MinimizeOrderVEV(vcritical)); + auto vc = modelPointer->EWSBVEV(modelPointer->MinimizeOrderVEV(vcritical)); - LW = vc/std::sqrt(8*Vbarrier); + LW = vc / std::sqrt(8 * Vbarrier); - - return LW; + return LW; } - double calculate_wall_thickness_1D( - const std::shared_ptr& modelPointer, - const double &Temp, - const std::vector& vcritical, - const std::vector& vevsymmetric) + const std::shared_ptr &modelPointer, + const double &Temp, + const std::vector &vcritical, + const std::vector &vevsymmetric) { - std::vector vbarrier; - GSL_Find_Maximum_line(modelPointer,Temp,vcritical,vevsymmetric,vbarrier); - double LW1D = 0, Vb1D = 0; - Vb1D = vbarrier.at(vcritical.size()); - auto vc = modelPointer->EWSBVEV(modelPointer->MinimizeOrderVEV(vcritical)); - if(Vb1D != 0) LW1D = vc/std::sqrt(8*Vb1D); - return LW1D; + std::vector vbarrier; + GSL_Find_Maximum_line(modelPointer, Temp, vcritical, vevsymmetric, vbarrier); + double LW1D = 0, Vb1D = 0; + Vb1D = vbarrier.at(vcritical.size()); + auto vc = modelPointer->EWSBVEV(modelPointer->MinimizeOrderVEV(vcritical)); + if (Vb1D != 0) LW1D = vc / std::sqrt(8 * Vb1D); + return LW1D; } - bool GSL_Find_Maximum_line( - const std::shared_ptr& modelPointer, - const double &Temp, - const std::vector& vcritical, - const std::vector& vevsymmetric, - std::vector& solV) + const std::shared_ptr &modelPointer, + const double &Temp, + const std::vector &vcritical, + const std::vector &vevsymmetric, + std::vector &solV) { - std::cout << std::scientific; - - struct GSL_params params; - params.Temp = Temp; - params.nVEV = modelPointer->get_nVEV(); - params.modelPointer = modelPointer; - params.VevMinimum=vcritical; - params.VeVSymmetric = vevsymmetric; - - double tmax = 0; - - - std::vector> solutions ; - std::size_t nSolutions=20; - int ntry=0; - int seed=5; - std::default_random_engine randGen(seed); - do { - double initial_guess = std::generate_canonical::digits>(randGen); - GSL_Maximize_From_S_gen_line(params,solutions,initial_guess); - ntry++; - } while(solutions.size()!=nSolutions); - - tmax = solutions.at(0).at(0); - double fmax = solutions.at(0).at(1); - for(std::size_t i=1;i fmax){ - fmax = solutions.at(i).at(1); - tmax = solutions.at(i).at(0); - } - } - - if(solV.size()!= 0 and solV.size()!= vcritical.size()){ - std::cerr << "The length of solV in " << __func__ << " does not match with vcritical and is not zero." << std::endl; - } - else if(solV.size()!= 0){ - for(std::size_t i=0;i vIn; - - - vIn.resize(params.modelPointer->get_NHiggs()); - vIn=params.modelPointer->MinimizeOrderVEV(solV); - - double MaxVal = params.modelPointer->VEff(vIn,params.Temp,0); - - vIn=params.modelPointer->MinimizeOrderVEV(vcritical); - double MinValC = params.modelPointer->VEff(vIn,params.Temp,0); - for(std::size_t i=0;iVEff(vIn,params.Temp,0); - - double MinVal = std::min(MinVal0,MinValC); // They can differ through the numerical error of the minimization - - double Vb = MaxVal - MinVal; - - solV.push_back(Vb); - return true; -} - -bool GSL_Maximize_From_S_gen_line(struct GSL_params& params, std::vector>& solution, double initial_guess){ - gsl_set_error_handler_off(); + std::cout << std::scientific; + + struct GSL_params params; + params.Temp = Temp; + params.nVEV = modelPointer->get_nVEV(); + params.modelPointer = modelPointer; + params.VevMinimum = vcritical; + params.VeVSymmetric = vevsymmetric; + + double tmax = 0; + + std::vector> solutions; + std::size_t nSolutions = 20; + int ntry = 0; + int seed = 5; + std::default_random_engine randGen(seed); + do + { + double initial_guess = + std::generate_canonical::digits>( + randGen); + GSL_Maximize_From_S_gen_line(params, solutions, initial_guess); + ntry++; + } while (solutions.size() != nSolutions); + + tmax = solutions.at(0).at(0); + double fmax = solutions.at(0).at(1); + for (std::size_t i = 1; i < solutions.size(); i++) + { + if (solutions.at(i).at(1) > fmax) + { + fmax = solutions.at(i).at(1); + tmax = solutions.at(i).at(0); + } + } + + if (solV.size() != 0 and solV.size() != vcritical.size()) + { + std::cerr << "The length of solV in " << __func__ + << " does not match with vcritical and is not zero." << std::endl; + } + else if (solV.size() != 0) + { + for (std::size_t i = 0; i < solV.size(); i++) + { + solV.at(i) = tmax * vcritical.at(i); + } + } + else if (solV.size() == 0) + { + for (std::size_t i = 0; i < vcritical.size(); i++) + { + solV.push_back(tmax * vcritical.at(i)); + } + } + std::vector vIn; + vIn.resize(params.modelPointer->get_NHiggs()); + vIn = params.modelPointer->MinimizeOrderVEV(solV); - gsl_min_fminimizer * s; - const gsl_min_fminimizer_type *T; + double MaxVal = params.modelPointer->VEff(vIn, params.Temp, 0); - T= gsl_min_fminimizer_brent; - s = gsl_min_fminimizer_alloc(T); + vIn = params.modelPointer->MinimizeOrderVEV(vcritical); + double MinValC = params.modelPointer->VEff(vIn, params.Temp, 0); + for (std::size_t i = 0; i < vIn.size(); i++) + vIn.at(i) = 0; + double MinVal0 = params.modelPointer->VEff(vIn, params.Temp, 0); + double MinVal = + std::min(MinVal0, MinValC); // They can differ through the numerical error + // of the minimization - std::size_t MaxIter = 600; + double Vb = MaxVal - MinVal; - std::size_t iter = 0; - int status; + solV.push_back(Vb); + return true; +} +bool GSL_Maximize_From_S_gen_line(struct GSL_params ¶ms, + std::vector> &solution, + double initial_guess) +{ + gsl_set_error_handler_off(); - gsl_function F; - F.function = &GSL_VEFF_gen_all_maximum_line; - F.params = ¶ms; + gsl_min_fminimizer *s; + const gsl_min_fminimizer_type *T; + T = gsl_min_fminimizer_brent; + s = gsl_min_fminimizer_alloc(T); + std::size_t MaxIter = 600; + std::size_t iter = 0; + int status; - gsl_min_fminimizer_set(s,&F,initial_guess,0,1); + gsl_function F; + F.function = &GSL_VEFF_gen_all_maximum_line; + F.params = ¶ms; - double xsol,xlow,xup,fval; + gsl_min_fminimizer_set(s, &F, initial_guess, 0, 1); + double xsol, xlow, xup, fval; - do - { - iter++; - status = gsl_min_fminimizer_iterate(s); - if (status) break; - xlow = gsl_min_fminimizer_x_lower(s); - xup = gsl_min_fminimizer_x_upper(s); - xsol = gsl_min_fminimizer_x_minimum(s); - fval = gsl_min_fminimizer_f_minimum(s); - status = gsl_min_test_interval(xlow,xup,GSL_Tolerance,0); - } - while (status == GSL_CONTINUE && iter < MaxIter); + do + { + iter++; + status = gsl_min_fminimizer_iterate(s); + if (status) break; + xlow = gsl_min_fminimizer_x_lower(s); + xup = gsl_min_fminimizer_x_upper(s); + xsol = gsl_min_fminimizer_x_minimum(s); + fval = gsl_min_fminimizer_f_minimum(s); + status = gsl_min_test_interval(xlow, xup, GSL_Tolerance, 0); + } while (status == GSL_CONTINUE && iter < MaxIter); - std::vector row; + std::vector row; - if(status == GSL_SUCCESS) - { - row.push_back(xsol); - row.push_back(fval); - solution.push_back(row); - } + if (status == GSL_SUCCESS) + { + row.push_back(xsol); + row.push_back(fval); + solution.push_back(row); + } - gsl_min_fminimizer_free (s); + gsl_min_fminimizer_free(s); - return status == GSL_SUCCESS; + return status == GSL_SUCCESS; } -} -} +} // namespace Wall +} // namespace BSMPT diff --git a/src/baryo_calculation/CalculateEtaInterface.cpp b/src/baryo_calculation/CalculateEtaInterface.cpp index 4429654b..41e5ac00 100644 --- a/src/baryo_calculation/CalculateEtaInterface.cpp +++ b/src/baryo_calculation/CalculateEtaInterface.cpp @@ -3,249 +3,320 @@ * * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller - This program 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. - - This program 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 this program. If not, see . + This program 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. + + This program 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 this program. If not, see . */ /** * @file */ -#include #include "stdexcept" -#include +#include +#include #include +#include #include -#include -#include #include #include +#include -namespace BSMPT{ -namespace Baryo{ +namespace BSMPT +{ +namespace Baryo +{ -std::pair,int> CalculateEtaInterface::ReadConfigFile(const std::string& file) const +std::pair, int> +CalculateEtaInterface::ReadConfigFile(const std::string &file) const { - std::pair,int> res; - std::string line; - std::ifstream configFile(file); - if(not configFile.good()) + std::pair, int> res; + std::string line; + std::ifstream configFile(file); + if (not configFile.good()) + { + std::string errmsg("Can not open file: " + file + " in function " + + __func__); + throw std::runtime_error(errmsg); + } + std::vector method_transport_local; + int bot_mass_flag_local = 0; + while (std::getline(configFile, line)) + { + if (boost::starts_with(line, "#") or line.empty()) continue; + std::for_each(line.begin(), line.end(), [](char &c) { c = ::tolower(c); }); + if (boost::starts_with(line, "include")) { - std::string errmsg("Can not open file: " + file + " in function " + __func__); + std::stringstream ss(line); + std::vector words; + std::string tmp; + while (ss >> tmp) + words.push_back(tmp); + if (words.size() < 2) + { + std::string errmsg = "One of the settings in the EWBG config files is " + "not configured correctly."; + throw std::runtime_error(errmsg); + } + if (words.at(1) != "yes" and words.at(1) != "no") + { + std::string errmsg = "One of the settings for the EWBG config file is " + "not set to yes or no. Please change this."; throw std::runtime_error(errmsg); + } + method_transport_local.push_back(words.at(1) == "yes"); } - std::vector method_transport_local; - int bot_mass_flag_local=0; - while(std::getline(configFile,line)){ - if(boost::starts_with(line,"#") or line.empty()) continue; - std::for_each(line.begin(),line.end(),[](char &c) { c = ::tolower(c);} ); - if(boost::starts_with(line,"include")) - { - std::stringstream ss(line); - std::vector words; - std::string tmp; - while(ss>>tmp) words.push_back(tmp); - if(words.size() < 2){ - std::string errmsg = "One of the settings in the EWBG config files is not configured correctly."; - throw std::runtime_error(errmsg); - } - if(words.at(1) != "yes" and words.at(1) != "no"){ - std::string errmsg = "One of the settings for the EWBG config file is not set to yes or no. Please change this."; - throw std::runtime_error(errmsg); - } - method_transport_local.push_back(words.at(1) == "yes"); - } - - if(boost::starts_with(line,"massive")){ - std::stringstream ss(line); - std::vector words; - std::string tmp; - while(ss>>tmp) words.push_back(tmp); - if(words.size() < 2){ - std::string errmsg = "The setting for the bottom mass flag is missing."; - throw std::runtime_error(errmsg); - } - if(words.at(1) != "yes" and words.at(1) != "no"){ - std::string errmsg = "The setting for the bottom mass flag is not set correctly. Please change it to yes or no."; - throw std::runtime_error(errmsg); - } - if(words.at(1) == "yes") bot_mass_flag_local = 1; - } - } - - configFile.close(); - - res.first=method_transport_local; - res.second = bot_mass_flag_local; - - return res; -} - - -CalculateEtaInterface::CalculateEtaInterface(const std::pair,int>& config) - : method_transport{config.first}, bot_mass_flag{config.second} -{ - if(config.first.size() != 5){ - std::string errmsg = "Warning: "; - errmsg += __func__; - errmsg += " expects a vector of length 5 but only received "; - errmsg += std::to_string(config.first.size()); - errmsg+= "."; + + if (boost::starts_with(line, "massive")) + { + std::stringstream ss(line); + std::vector words; + std::string tmp; + while (ss >> tmp) + words.push_back(tmp); + if (words.size() < 2) + { + std::string errmsg = "The setting for the bottom mass flag is missing."; + throw std::runtime_error(errmsg); + } + if (words.at(1) != "yes" and words.at(1) != "no") + { + std::string errmsg = "The setting for the bottom mass flag is not set " + "correctly. Please change it to yes or no."; throw std::runtime_error(errmsg); + } + if (words.at(1) == "yes") bot_mass_flag_local = 1; } + } + + configFile.close(); + + res.first = method_transport_local; + res.second = bot_mass_flag_local; + + return res; +} + +CalculateEtaInterface::CalculateEtaInterface( + const std::pair, int> &config) + : method_transport{config.first} + , bot_mass_flag{config.second} +{ + if (config.first.size() != 5) + { + std::string errmsg = "Warning: "; + errmsg += __func__; + errmsg += " expects a vector of length 5 but only received "; + errmsg += std::to_string(config.first.size()); + errmsg += "."; + throw std::runtime_error(errmsg); + } } -CalculateEtaInterface::CalculateEtaInterface(const std::string& file) +CalculateEtaInterface::CalculateEtaInterface(const std::string &file) : CalculateEtaInterface(ReadConfigFile(file)) { } -CalculateEtaInterface::CalculateEtaInterface(const std::vector& method_input, const int& bot_mass_flag_in) - : CalculateEtaInterface(std::make_pair (method_input,bot_mass_flag_in)) +CalculateEtaInterface::CalculateEtaInterface( + const std::vector &method_input, + const int &bot_mass_flag_in) + : CalculateEtaInterface(std::make_pair(method_input, bot_mass_flag_in)) { } -CalculateEtaInterface::~CalculateEtaInterface() { - // TODO Auto-generated destructor stub +CalculateEtaInterface::~CalculateEtaInterface() +{ + // TODO Auto-generated destructor stub } std::vector CalculateEtaInterface::legend() const { - std::vector etaLegend; - if(method_transport.at(0)) etaLegend.push_back("eta_TopOnly"); - if(method_transport.at(1)) etaLegend.push_back("eta_TopBot"); - if(method_transport.at(2)) etaLegend.push_back("eta_TopBotTau"); - if(method_transport.at(3)) etaLegend.push_back("eta_PlasmaVelocities"); - if(method_transport.at(4)) etaLegend.push_back("eta_PlasmaVelocitiesReplaced"); - - return etaLegend; -} - -void CalculateEtaInterface::setNumerics(const double& vw_input, - std::vector& vev_critical_input, - std::vector& vev_symmetric_input, - const double& TC_input, - std::shared_ptr& modelPointer_input, - const int& WhichMinimizer){ - AdditionalBaryoArgs optionalArgs(false); - setNumerics(vw_input,vev_critical_input,vev_symmetric_input,TC_input,modelPointer_input,optionalArgs,WhichMinimizer); -} - - -void CalculateEtaInterface::setNumerics(const double& vw_input, - std::vector& vev_critical_input, - std::vector& vev_symmetric_input, - const double& TC_input, - std::shared_ptr& modelPointer_input, - const AdditionalBaryoArgs& AddBaryoArgs, - const int& WhichMinimizer ) -{ - vw=vw_input; - vev_critical=vev_critical_input; - vev_symmetric=vev_symmetric_input; - TC=TC_input; - modelPointer=modelPointer_input; - if (modelPointer->get_Model() != ModelID::ModelIDs::C2HDM){ - throw std::runtime_error("Baryogenesis is only implemented for the C2HDM at the moment."); - } - GSL_integration_mubl_container.init(vw,vev_critical,vev_symmetric,TC,modelPointer,WhichMinimizer); - if(AddBaryoArgs.Used) - { - // Work with the additional arguments - } + std::vector etaLegend; + if (method_transport.at(0)) etaLegend.push_back("eta_TopOnly"); + if (method_transport.at(1)) etaLegend.push_back("eta_TopBot"); + if (method_transport.at(2)) etaLegend.push_back("eta_TopBotTau"); + if (method_transport.at(3)) etaLegend.push_back("eta_PlasmaVelocities"); + if (method_transport.at(4)) + etaLegend.push_back("eta_PlasmaVelocitiesReplaced"); + + return etaLegend; } -void CalculateEtaInterface::setvw(double vw_in){ - vw=vw_in; - GSL_integration_mubl_container.setvw(vw_in); +void CalculateEtaInterface::setNumerics( + const double &vw_input, + std::vector &vev_critical_input, + std::vector &vev_symmetric_input, + const double &TC_input, + std::shared_ptr &modelPointer_input, + const int &WhichMinimizer) +{ + AdditionalBaryoArgs optionalArgs(false); + setNumerics(vw_input, + vev_critical_input, + vev_symmetric_input, + TC_input, + modelPointer_input, + optionalArgs, + WhichMinimizer); } -std::vector CalculateEtaInterface::CalcEta(const double& vw_input, - std::vector& vev_critical_input, - std::vector& vev_symmetric_input, - const double& TC_input, - std::shared_ptr& modelPointer_input, - const AdditionalBaryoArgs& AddBaryoArgs, - const int& WhichMinimizer) +void CalculateEtaInterface::setNumerics( + const double &vw_input, + std::vector &vev_critical_input, + std::vector &vev_symmetric_input, + const double &TC_input, + std::shared_ptr &modelPointer_input, + const AdditionalBaryoArgs &AddBaryoArgs, + const int &WhichMinimizer) { - setNumerics(vw_input,vev_critical_input,vev_symmetric_input,TC_input,modelPointer_input,AddBaryoArgs,WhichMinimizer); - return CalcEta(); + vw = vw_input; + vev_critical = vev_critical_input; + vev_symmetric = vev_symmetric_input; + TC = TC_input; + modelPointer = modelPointer_input; + if (modelPointer->get_Model() != ModelID::ModelIDs::C2HDM) + { + throw std::runtime_error( + "Baryogenesis is only implemented for the C2HDM at the moment."); + } + GSL_integration_mubl_container.init( + vw, vev_critical, vev_symmetric, TC, modelPointer, WhichMinimizer); + if (AddBaryoArgs.Used) + { + // Work with the additional arguments + } } -std::vector CalculateEtaInterface::CalcEta(const double& vw_input, - std::vector& vev_critical_input, - std::vector& vev_symmetric_input, - const double& TC_input, - std::shared_ptr& modelPointer_input, - const int& WhichMinimizer){ - AdditionalBaryoArgs OptionalArgs{false}; - setNumerics(vw_input,vev_critical_input,vev_symmetric_input,TC_input,modelPointer_input,OptionalArgs,WhichMinimizer); - return CalcEta(); +void CalculateEtaInterface::setvw(double vw_in) +{ + vw = vw_in; + GSL_integration_mubl_container.setvw(vw_in); } -std::vector CalculateEtaInterface::CalcEta() +std::vector CalculateEtaInterface::CalcEta( + const double &vw_input, + std::vector &vev_critical_input, + std::vector &vev_symmetric_input, + const double &TC_input, + std::shared_ptr &modelPointer_input, + const AdditionalBaryoArgs &AddBaryoArgs, + const int &WhichMinimizer) { - std::vector eta; - if(method_transport.at(0)){ - GSL_integration_mubl_container.set_transport_method(TransportMethod::top); - top_source C_top; - C_top.set_class(bot_mass_flag, GSL_integration_mubl_container,Calc_Gam_inp,Calc_Scp_inp,Calc_kappa_inp); - auto arr_nL = set_up_nL_grid(n_step , GSL_integration_mubl_container , C_top ); - C_eta.set_class(arr_nL,TC,vw); - eta.push_back(Nintegrate_eta(C_eta,0 , GSL_integration_mubl_container.getZMAX())); - } - if(method_transport.at(1)){ - GSL_integration_mubl_container.set_transport_method(TransportMethod::bottom); - bot_source C_bot; - C_bot.set_class(bot_mass_flag, GSL_integration_mubl_container,Calc_Gam_inp,Calc_Scp_inp,Calc_kappa_inp); - auto arr_nL = set_up_nL_grid(n_step , GSL_integration_mubl_container , C_bot ); - C_eta.set_class(arr_nL,TC,vw); - eta.push_back(Nintegrate_eta(C_eta,0 , GSL_integration_mubl_container.getZMAX())); - } - if(method_transport.at(2)){ - GSL_integration_mubl_container.set_transport_method(TransportMethod::tau); - tau_source C_tau; - C_tau.set_class(bot_mass_flag, GSL_integration_mubl_container,Calc_Gam_inp,Calc_Scp_inp,Calc_kappa_inp); - auto arr_nL = set_up_nL_grid(n_step , GSL_integration_mubl_container , C_tau); - C_eta.set_class(arr_nL,TC,vw); - eta.push_back(Nintegrate_eta(C_eta,0 , GSL_integration_mubl_container.getZMAX())); - } - if(method_transport.at(3)){ - GSL_integration_mubl_container.setUseVelocityTransportEquations(true); - eta.push_back(Integrate_mubl_interpolated(GSL_integration_mubl_container)); - } - if(method_transport.at(4)){ - GSL_integration_mubl_container.setUseVelocityTransportEquations(false); - eta.push_back(Integrate_mubl_interpolated(GSL_integration_mubl_container)); - } - return eta; -} - - -double CalculateEtaInterface::getLW() const{ - return GSL_integration_mubl_container.getLW(); -} -Calc_Gam_M CalculateEtaInterface::get_class_CalcGamM() const{ - return Calc_Gam_inp; -} -Calc_Scp CalculateEtaInterface::get_class_Scp() const{ - return Calc_Scp_inp; -} -Calc_kappa_t CalculateEtaInterface::get_class_kappa() const{ - return Calc_kappa_inp; + setNumerics(vw_input, + vev_critical_input, + vev_symmetric_input, + TC_input, + modelPointer_input, + AddBaryoArgs, + WhichMinimizer); + return CalcEta(); } +std::vector CalculateEtaInterface::CalcEta( + const double &vw_input, + std::vector &vev_critical_input, + std::vector &vev_symmetric_input, + const double &TC_input, + std::shared_ptr &modelPointer_input, + const int &WhichMinimizer) +{ + AdditionalBaryoArgs OptionalArgs{false}; + setNumerics(vw_input, + vev_critical_input, + vev_symmetric_input, + TC_input, + modelPointer_input, + OptionalArgs, + WhichMinimizer); + return CalcEta(); +} +std::vector CalculateEtaInterface::CalcEta() +{ + std::vector eta; + if (method_transport.at(0)) + { + GSL_integration_mubl_container.set_transport_method(TransportMethod::top); + top_source C_top; + C_top.set_class(bot_mass_flag, + GSL_integration_mubl_container, + Calc_Gam_inp, + Calc_Scp_inp, + Calc_kappa_inp); + auto arr_nL = set_up_nL_grid(n_step, GSL_integration_mubl_container, C_top); + C_eta.set_class(arr_nL, TC, vw); + eta.push_back( + Nintegrate_eta(C_eta, 0, GSL_integration_mubl_container.getZMAX())); + } + if (method_transport.at(1)) + { + GSL_integration_mubl_container.set_transport_method( + TransportMethod::bottom); + bot_source C_bot; + C_bot.set_class(bot_mass_flag, + GSL_integration_mubl_container, + Calc_Gam_inp, + Calc_Scp_inp, + Calc_kappa_inp); + auto arr_nL = set_up_nL_grid(n_step, GSL_integration_mubl_container, C_bot); + C_eta.set_class(arr_nL, TC, vw); + eta.push_back( + Nintegrate_eta(C_eta, 0, GSL_integration_mubl_container.getZMAX())); + } + if (method_transport.at(2)) + { + GSL_integration_mubl_container.set_transport_method(TransportMethod::tau); + tau_source C_tau; + C_tau.set_class(bot_mass_flag, + GSL_integration_mubl_container, + Calc_Gam_inp, + Calc_Scp_inp, + Calc_kappa_inp); + auto arr_nL = set_up_nL_grid(n_step, GSL_integration_mubl_container, C_tau); + C_eta.set_class(arr_nL, TC, vw); + eta.push_back( + Nintegrate_eta(C_eta, 0, GSL_integration_mubl_container.getZMAX())); + } + if (method_transport.at(3)) + { + GSL_integration_mubl_container.setUseVelocityTransportEquations(true); + eta.push_back(Integrate_mubl_interpolated(GSL_integration_mubl_container)); + } + if (method_transport.at(4)) + { + GSL_integration_mubl_container.setUseVelocityTransportEquations(false); + eta.push_back(Integrate_mubl_interpolated(GSL_integration_mubl_container)); + } + return eta; +} + +double CalculateEtaInterface::getLW() const +{ + return GSL_integration_mubl_container.getLW(); +} +Calc_Gam_M CalculateEtaInterface::get_class_CalcGamM() const +{ + return Calc_Gam_inp; } +Calc_Scp CalculateEtaInterface::get_class_Scp() const +{ + return Calc_Scp_inp; } +Calc_kappa_t CalculateEtaInterface::get_class_kappa() const +{ + return Calc_kappa_inp; +} + +} // namespace Baryo +} // namespace BSMPT diff --git a/src/baryo_calculation/Fluid_Type/bot_source.cpp b/src/baryo_calculation/Fluid_Type/bot_source.cpp index 3f36cdd6..89743c93 100644 --- a/src/baryo_calculation/Fluid_Type/bot_source.cpp +++ b/src/baryo_calculation/Fluid_Type/bot_source.cpp @@ -3,170 +3,193 @@ * * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller - This program 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. - - This program 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 this program. If not, see . + This program 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. + + This program 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 this program. If not, see . */ - #include /** * @file */ -namespace BSMPT{ -namespace Baryo{ - -typedef runge_kutta_cash_karp54< state_type > error_stepper_type; -typedef controlled_runge_kutta< error_stepper_type > controlled_stepper_type; - - -void bot_source::operator()(const state_type &omega , state_type &domega , const double z) -{ - /* - omega[0] -> q - omega[1] -> t - omega[2] -> b - omega[3] -> h1 - omega[4] -> h2 - omega[5] -> u - omega[6] -> q_prime - omega[7] -> t_prime - omega[8] -> b_prime - omega[9] -> h1_prime - omega[10] -> h2_prime - omega[11] -> u_prime - */ - - /* - Definition of all transport coefficients - */ - std::vector quark_mass; - std::vector quark_mass_prime; - //TOP and BOT quark mass calculation - top_func(z , quark_mass, quark_mass_prime); - double mt = quark_mass[0]; - double mb; - //BOTTOM quark mass can be set to zero to have a crosscheck - if(bot_mass_flag==1) mb = quark_mass[1]; - if(bot_mass_flag==2) mb = 0; - if((bot_mass_flag!=1)and(bot_mass_flag!=2)) throw std::runtime_error("No valid option for the bottom mass @ ()"); - - //Phase Calculation - //top - auto theta_vec_top = Calc_theta(z , gen_fluid::TOP_symmetric_CP_violating_phase , gen_fluid::TOP_broken_CP_violating_phase); - // double theta_top = theta_vec_top[0]; - double theta_prime_top = theta_vec_top[1]; - //bot - auto theta_vec_bot = Calc_theta(z , gen_fluid::BOT_symmetric_CP_violating_phase , BOT_broken_CP_violating_phase); - // double theta_bot = theta_vec_bot[0]; - double theta_prime_bot = theta_vec_bot[1]; - //TOP statistical factor - Calc_kappa_obj.set_class(Temp, mt); - double num_int = NIntegrate_kappa(Calc_kappa_obj); - double kappa_tL = kappa_QL_0*num_int; - double kappa_tR = kappa_QR_0*num_int; - //BOT statistical factor - Calc_kappa_obj.set_class(Temp,mb); - num_int = NIntegrate_kappa(Calc_kappa_obj); - double kappa_bL = kappa_QL_0*num_int; - double kappa_bR = kappa_QR_0*num_int; - //Effective statistical factor - double kappa_q = kappa_tL*kappa_bL/(kappa_tL+kappa_bL); - - - //Rescaled chemical potential like in 1811.11104 - double mu_M_t = omega[1]/kappa_tR - omega[0]/kappa_q; - double mu_M_b = omega[2]/kappa_bR - omega[0]/kappa_q; - double mu_Y_t = omega[1]/kappa_tR - omega[0]/kappa_q - omega[3]/kappa_H_0 - omega[4]/kappa_H_0; - double mu_Y_b = omega[2]/kappa_bR - omega[0]/kappa_q - omega[3]/kappa_H_0 - omega[4]/kappa_H_0; - double mu_SS = -4*omega[5] *(2/kappa_QL_0 + 1/kappa_QR_0) + 2*omega[0]/kappa_q - omega[1]/kappa_tR - omega[2]/kappa_bR; - Calc_Gam_obj.set_class(Temp,vw,mt,msqrt_thermal_top,dmsqrt_thermal_top); - double Gam_M_t = Nintegrate_GamM(Calc_Gam_obj); - Calc_Gam_obj.set_class(Temp,vw,mb,msqrt_thermal_bot,dmsqrt_thermal_bot); - double Gam_M_b = Nintegrate_GamM(Calc_Gam_obj); - - //Gam_Y_b has to be zero if the bottom mass vanishes - if(bot_mass_flag == 2) Gam_Y_b =0; - - Calc_Scp_obj.set_class(Temp,vw,mt,theta_prime_top,msqrt_thermal_top,dmsqrt_thermal_top); - double Scp_t = Nintegrate_Scp(Calc_Scp_obj); - double Scp_b = 0 ; - if(bot_mass_flag==1) - { - Calc_Scp_obj.set_class(Temp,vw,mb,theta_prime_bot,msqrt_thermal_bot,dmsqrt_thermal_bot); - Scp_b = Nintegrate_Scp(Calc_Scp_obj); - } - if(bot_mass_flag==2) - { - Scp_b = 0 ; - } - if((bot_mass_flag!=1) and (bot_mass_flag!=2)){ - std::cout<< "bot_mass_flag = "<< bot_mass_flag < q_dprime = ( vw qprime - C)/Dq - */ - - domega[6] = (vw*omega[6] - ( Gam_M_t*mu_M_t + Gam_M_b*mu_M_b + Gam_Y_t*mu_Y_t + Gam_Y_b * mu_Y_b - 2*Gam_SS*mu_SS - Scp_t-Scp_b))/Dq; - domega[7] = (vw*omega[7] - (- Gam_M_t*mu_M_t - Gam_Y_t*mu_Y_t + Gam_SS*mu_SS + Scp_t ) )/ Dq; - domega[8] = (vw*omega[8] - (- Gam_M_b*mu_M_b - Gam_Y_b*mu_Y_b + Gam_SS*mu_SS + Scp_b))/Dq; - domega[9] = (vw*omega[9] - (Gam_Y_t*mu_Y_t - Gam_Y_b*mu_Y_b ))/Dh; - domega[10] = (vw*omega[10] - (Gam_Y_t*mu_Y_t - Gam_Y_b*mu_Y_b ))/Dh; - domega[11] = (vw*omega[11] - Gam_SS*mu_SS)/Dq; +namespace BSMPT +{ +namespace Baryo +{ -} +typedef runge_kutta_cash_karp54 error_stepper_type; +typedef controlled_runge_kutta controlled_stepper_type; -double bot_source::Calc_nL(double z_start,double z_end) const +void bot_source::operator()(const state_type &omega, + state_type &domega, + const double z) { - /* - omega[0] -> q - omega[1] -> t - omega[2] -> b - omega[3] -> h1 - omega[4] -> h2 - omega[5] -> u - omega[6] -> q_prime - omega[7] -> t_prime - omega[8] -> b_prime - omega[9] -> h1_prime - omega[10] -> h2_prime - omega[11] -> u_prime - */ - state_type mu(12); - mu = {0,0,0,0,0,0,0,0,0,0,0,0}; - const double C_AbsErr = 1e-9; - const double C_RelErr = 1e-5; - double stepsize_initial; - if(z_startz_end) stepsize_initial = -1e-8; - double abs_err = C_AbsErr; - double rel_err =C_RelErr; - integrate_adaptive(make_controlled( abs_err , rel_err , error_stepper_type() ) , *this , mu , z_start , z_end , stepsize_initial ); - - return mu[0] - 2*mu[5]; //Additional left-handed up-type quarks; q1 = -2 u - + /* + omega[0] -> q + omega[1] -> t + omega[2] -> b + omega[3] -> h1 + omega[4] -> h2 + omega[5] -> u + omega[6] -> q_prime + omega[7] -> t_prime + omega[8] -> b_prime + omega[9] -> h1_prime + omega[10] -> h2_prime + omega[11] -> u_prime + */ + + /* + Definition of all transport coefficients + */ + std::vector quark_mass; + std::vector quark_mass_prime; + // TOP and BOT quark mass calculation + top_func(z, quark_mass, quark_mass_prime); + double mt = quark_mass[0]; + double mb; + // BOTTOM quark mass can be set to zero to have a crosscheck + if (bot_mass_flag == 1) mb = quark_mass[1]; + if (bot_mass_flag == 2) mb = 0; + if ((bot_mass_flag != 1) and (bot_mass_flag != 2)) + throw std::runtime_error("No valid option for the bottom mass @ ()"); + + // Phase Calculation + // top + auto theta_vec_top = Calc_theta(z, + gen_fluid::TOP_symmetric_CP_violating_phase, + gen_fluid::TOP_broken_CP_violating_phase); + // double theta_top = theta_vec_top[0]; + double theta_prime_top = theta_vec_top[1]; + // bot + auto theta_vec_bot = Calc_theta(z, + gen_fluid::BOT_symmetric_CP_violating_phase, + BOT_broken_CP_violating_phase); + // double theta_bot = theta_vec_bot[0]; + double theta_prime_bot = theta_vec_bot[1]; + // TOP statistical factor + Calc_kappa_obj.set_class(Temp, mt); + double num_int = NIntegrate_kappa(Calc_kappa_obj); + double kappa_tL = kappa_QL_0 * num_int; + double kappa_tR = kappa_QR_0 * num_int; + // BOT statistical factor + Calc_kappa_obj.set_class(Temp, mb); + num_int = NIntegrate_kappa(Calc_kappa_obj); + double kappa_bL = kappa_QL_0 * num_int; + double kappa_bR = kappa_QR_0 * num_int; + // Effective statistical factor + double kappa_q = kappa_tL * kappa_bL / (kappa_tL + kappa_bL); + + // Rescaled chemical potential like in 1811.11104 + double mu_M_t = omega[1] / kappa_tR - omega[0] / kappa_q; + double mu_M_b = omega[2] / kappa_bR - omega[0] / kappa_q; + double mu_Y_t = omega[1] / kappa_tR - omega[0] / kappa_q - + omega[3] / kappa_H_0 - omega[4] / kappa_H_0; + double mu_Y_b = omega[2] / kappa_bR - omega[0] / kappa_q - + omega[3] / kappa_H_0 - omega[4] / kappa_H_0; + double mu_SS = -4 * omega[5] * (2 / kappa_QL_0 + 1 / kappa_QR_0) + + 2 * omega[0] / kappa_q - omega[1] / kappa_tR - + omega[2] / kappa_bR; + Calc_Gam_obj.set_class(Temp, vw, mt, msqrt_thermal_top, dmsqrt_thermal_top); + double Gam_M_t = Nintegrate_GamM(Calc_Gam_obj); + Calc_Gam_obj.set_class(Temp, vw, mb, msqrt_thermal_bot, dmsqrt_thermal_bot); + double Gam_M_b = Nintegrate_GamM(Calc_Gam_obj); + + // Gam_Y_b has to be zero if the bottom mass vanishes + if (bot_mass_flag == 2) Gam_Y_b = 0; + + Calc_Scp_obj.set_class( + Temp, vw, mt, theta_prime_top, msqrt_thermal_top, dmsqrt_thermal_top); + double Scp_t = Nintegrate_Scp(Calc_Scp_obj); + double Scp_b = 0; + if (bot_mass_flag == 1) + { + Calc_Scp_obj.set_class( + Temp, vw, mb, theta_prime_bot, msqrt_thermal_bot, dmsqrt_thermal_bot); + Scp_b = Nintegrate_Scp(Calc_Scp_obj); + } + if (bot_mass_flag == 2) + { + Scp_b = 0; + } + if ((bot_mass_flag != 1) and (bot_mass_flag != 2)) + { + std::cout << "bot_mass_flag = " << bot_mass_flag << std::endl; + throw std::runtime_error("No valid bot_mass_flag @ operator()"); + } + + domega[0] = omega[6]; + domega[1] = omega[7]; + domega[2] = omega[8]; + domega[3] = omega[9]; + domega[4] = omega[10]; + domega[5] = omega[11]; + + /* + dmu qmu = vw qprime - Dq q_drpime = C + --> q_dprime = ( vw qprime - C)/Dq + */ + + domega[6] = (vw * omega[6] - + (Gam_M_t * mu_M_t + Gam_M_b * mu_M_b + Gam_Y_t * mu_Y_t + + Gam_Y_b * mu_Y_b - 2 * Gam_SS * mu_SS - Scp_t - Scp_b)) / + Dq; + domega[7] = (vw * omega[7] - (-Gam_M_t * mu_M_t - Gam_Y_t * mu_Y_t + + Gam_SS * mu_SS + Scp_t)) / + Dq; + domega[8] = (vw * omega[8] - (-Gam_M_b * mu_M_b - Gam_Y_b * mu_Y_b + + Gam_SS * mu_SS + Scp_b)) / + Dq; + domega[9] = (vw * omega[9] - (Gam_Y_t * mu_Y_t - Gam_Y_b * mu_Y_b)) / Dh; + domega[10] = (vw * omega[10] - (Gam_Y_t * mu_Y_t - Gam_Y_b * mu_Y_b)) / Dh; + domega[11] = (vw * omega[11] - Gam_SS * mu_SS) / Dq; } +double bot_source::Calc_nL(double z_start, double z_end) const +{ + /* + omega[0] -> q + omega[1] -> t + omega[2] -> b + omega[3] -> h1 + omega[4] -> h2 + omega[5] -> u + omega[6] -> q_prime + omega[7] -> t_prime + omega[8] -> b_prime + omega[9] -> h1_prime + omega[10] -> h2_prime + omega[11] -> u_prime + */ + state_type mu(12); + mu = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + const double C_AbsErr = 1e-9; + const double C_RelErr = 1e-5; + double stepsize_initial; + if (z_start < z_end) stepsize_initial = 1e-8; + if (z_start > z_end) stepsize_initial = -1e-8; + double abs_err = C_AbsErr; + double rel_err = C_RelErr; + integrate_adaptive(make_controlled(abs_err, rel_err, error_stepper_type()), + *this, + mu, + z_start, + z_end, + stepsize_initial); + + return mu[0] - 2 * mu[5]; // Additional left-handed up-type quarks; q1 = -2 u } -} + +} // namespace Baryo +} // namespace BSMPT diff --git a/src/baryo_calculation/Fluid_Type/gen_calc.cpp b/src/baryo_calculation/Fluid_Type/gen_calc.cpp index 43c84e06..9a2c7a8e 100644 --- a/src/baryo_calculation/Fluid_Type/gen_calc.cpp +++ b/src/baryo_calculation/Fluid_Type/gen_calc.cpp @@ -17,76 +17,79 @@ along with this program. If not, see . */ +#include #include #include -#include -#include #include +#include /** * @file */ -namespace BSMPT{ -namespace Baryo{ +namespace BSMPT +{ +namespace Baryo +{ -std::pair , std::vector> set_up_nL_grid( - std::size_t n_step, - GSL_integration_mubl& container, - boost::any const & classpointer) +std::pair, std::vector> +set_up_nL_grid(std::size_t n_step, + GSL_integration_mubl &container, + boost::any const &classpointer) { - std::vector arr_z(n_step+1); - std::vector arr_nL(n_step+1); + std::vector arr_z(n_step + 1); + std::vector arr_nL(n_step + 1); - double wall_factor = container.getZMAX(); - double zstart = container.getZMAX(); - if(container.get_transport_method()== TransportMethod::top) + double wall_factor = container.getZMAX(); + double zstart = container.getZMAX(); + if (container.get_transport_method() == TransportMethod::top) + { + auto C_class = boost::any_cast(&classpointer); + if (not C_class) + { + std::string errmsg = "boost::any_cast failed @ setting to top_source\n"; + throw std::runtime_error(errmsg); + } + for (std::size_t i = 0; i <= n_step; i++) + { + double zend = i * wall_factor / n_step; + arr_z.at(i) = zend; + arr_nL.at(i) = C_class->Calc_nL(zstart, zend); + } + } + if (container.get_transport_method() == TransportMethod::bottom) + { + auto C_class = boost::any_cast(&classpointer); + if (not C_class) { - auto C_class = boost::any_cast(&classpointer); - if(not C_class) - { - std::string errmsg = "boost::any_cast failed @ setting to top_source\n"; - throw std::runtime_error(errmsg); - } - for(std::size_t i=0;i<=n_step;i++) - { - double zend = i*wall_factor/n_step; - arr_z.at(i) = zend; - arr_nL.at(i) = C_class->Calc_nL(zstart , zend); - } + std::string errmsg = "boost::any_cast failed @ setting to bot_source\n"; + throw std::runtime_error(errmsg); } - if(container.get_transport_method()== TransportMethod::bottom) + for (std::size_t i = 0; i <= n_step; i++) { - auto C_class = boost::any_cast(&classpointer); - if(not C_class) - { - std::string errmsg = "boost::any_cast failed @ setting to bot_source\n"; - throw std::runtime_error(errmsg); - } - for(std::size_t i=0;i<=n_step;i++) - { - double zend = i*wall_factor/n_step; - arr_z.at(i) = zend; - arr_nL.at(i) = C_class->Calc_nL(zstart , zend); - } + double zend = i * wall_factor / n_step; + arr_z.at(i) = zend; + arr_nL.at(i) = C_class->Calc_nL(zstart, zend); } - if(container.get_transport_method()== TransportMethod::tau) + } + if (container.get_transport_method() == TransportMethod::tau) + { + auto C_class = boost::any_cast(&classpointer); + if (not C_class) { - auto C_class = boost::any_cast(&classpointer); - if(not C_class) - { - std::string errmsg = "boost::any_cast failed @ setting to tau_source\n"; - throw std::runtime_error(errmsg); - } - for(std::size_t i=0;i<=n_step;i++) - { - double zend = i*wall_factor/n_step; - arr_z.at(i) = zend; - arr_nL.at(i) = C_class->Calc_nL(zstart , zend); - } + std::string errmsg = "boost::any_cast failed @ setting to tau_source\n"; + throw std::runtime_error(errmsg); } - std::pair , std::vector> res = std::make_pair(arr_z,arr_nL); - return res; + for (std::size_t i = 0; i <= n_step; i++) + { + double zend = i * wall_factor / n_step; + arr_z.at(i) = zend; + arr_nL.at(i) = C_class->Calc_nL(zstart, zend); + } + } + std::pair, std::vector> res = + std::make_pair(arr_z, arr_nL); + return res; } -} -} +} // namespace Baryo +} // namespace BSMPT diff --git a/src/baryo_calculation/Fluid_Type/gen_func_fluid.cpp b/src/baryo_calculation/Fluid_Type/gen_func_fluid.cpp index 3719e551..d66c9d19 100644 --- a/src/baryo_calculation/Fluid_Type/gen_func_fluid.cpp +++ b/src/baryo_calculation/Fluid_Type/gen_func_fluid.cpp @@ -3,595 +3,671 @@ * * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller - This program 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. - - This program 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 this program. If not, see . + This program 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. + + This program 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 this program. If not, see . */ #include #include - /** * @file */ namespace BSMPT { - namespace Baryo - { - /** +namespace Baryo +{ +/** * @brief C_AbsErr Absolute tolerance for boost::integrate_adaptive */ - const double C_AbsErr = 1e-6; - /** +const double C_AbsErr = 1e-6; +/** * @brief C_RelErr Relative tolerance for boost::integrate_adaptive */ - const double C_RelErr = 1e-9; - - void Calc_Gam_M::operator()(const state_type &Gam, state_type &dGam, const double k) - { - (void)Gam; - double fsqrt = 2 * Calc_Gam_M::m_full * Calc_Gam_M::m_full; - double Nc = 3; - double pi = M_PI; - double w = std::sqrt(std::pow(k, 2) + msqrt_thermal); - double delta_w = dmsqrt_thermal / (2 * std::sqrt(std::pow(k, 2) + msqrt_thermal)); - double integrand = 0; - if (std::abs(msqrt_thermal) > C_threshold) - { - integrand += std::pow(k, 2) / GamT; - integrand -= std::pow(k, 4) / (std::pow(w, 2) * GamT); - integrand += std::pow(k, 4) * GamT / (std::pow(w, 4)); - integrand += delta_w * std::pow(k, 4) / (std::pow(w, 3) * GamT); - integrand -= 2 * delta_w * std::pow(k, 4) * GamT / std::pow(w, 5); - integrand = integrand * hf(w); - //Checked with Mathematica Calc_Relax.m-->GammaMinus - } - if (std::abs(msqrt_thermal) < C_threshold) - { - throw std::runtime_error("Thermal mass under numerical threshold-->Proper limit needed in Calc_Gam_M"); - //Check with Mathematica Calc_Relax.m-->GammaMinus - } - if (std::abs(integrand) > C_smallcut) - { - dGam[0] = (6. / std::pow(T, 2)) * (Nc * fsqrt * integrand) / (2 * pi * pi * T); - } - if (std::abs(integrand) < C_smallcut) - dGam[0] = 0; - } - - void Calc_Gam_M::set_class(double T_in, double vw_in, double m_in, double msqrt_thermal_in, double dmsqrt_thermal_in, bool use_lep_in) - { - Calc_Gam_M::T = T_in; - Calc_Gam_M::vw = vw_in; - Calc_Gam_M::m_full = m_in; - Calc_Gam_M::beta = 1 / T; - if (use_lep_in) - { - Calc_Gam_M::GamT = 0.002 * T; - } - else - Calc_Gam_M::GamT = 0.16 * T; - Calc_Gam_M::msqrt_thermal = msqrt_thermal_in; - Calc_Gam_M::dmsqrt_thermal = dmsqrt_thermal_in; - } - - double Calc_Gam_M::hf(double w) - { - double beta_calc = Calc_Gam_M::beta; - double exp = std::exp(w * beta_calc); - if (std::isnan(exp)) - return 0; - double res = exp / std::pow(1 + exp, 2); - if (std::abs(res) < C_smallcut) - res = 0; - if (std::isnan(res)) - throw std::runtime_error("NaN @ Calc_Gam_M::hf"); - return res; - } - double Calc_Gam_M::hf_prime(double w) - { - double beta_calc = Calc_Gam_M::beta; - double exp = std::exp(w * beta_calc); - double res = -beta * exp * (exp - 1) / std::pow((1 + exp), 3); - if (std::abs(res) < C_smallcut) - res = 0; - if (std::isnan(res)) - throw std::runtime_error("NaN @ Calc_Gam_M::h_prime"); - - return res; - } - - double Nintegrate_GamM(Calc_Gam_M &C_Gam) - { - state_type Gam(1); - //Paramters for the numerical evaluation - double stepsize_initial = 0.01; - double k_start = 0; - //upper limit on k is chosen such that no std::limit overflow occurs in hf, hf_prime functions - double k_end = 1e4; - - double abs_err = C_AbsErr; - double rel_err = C_RelErr; - integrate_adaptive(make_controlled(abs_err, rel_err, error_stepper_type()), C_Gam, Gam, k_start, k_end, stepsize_initial); - - if (std::isnan(Gam[0])) - { - throw std::runtime_error("NaN in Nintegrate_GamM"); - } - else - return Gam[0]; - } - - void Calc_Scp::operator()(const state_type &Scp, state_type &dScp, const double k) - { - state_type res = Scp; - double pi = M_PI; - double NC = 3; - double w = std::sqrt(std::pow(k, 2) + msqrt_thermal); - double delta_w = dmsqrt_thermal / (2 * std::sqrt(k * k + msqrt_thermal)); - double Imff = 2 * Calc_Scp::m_full * Calc_Scp::m_full * theta_prime; - - double integrand = 0; - if (std::abs(Calc_Scp::msqrt_thermal) > 1e-3) - { - integrand -= std::pow(k, 4) * GamT / (2 * std::pow(w, 5)); - if (std::abs(integrand) < C_smallcut) - integrand = 0; - integrand += 5 * std::pow(k, 4) * GamT * delta_w / (4 * std::pow(w, 6)); - if (std::abs(integrand) < C_smallcut) - integrand = 0; - integrand += std::pow(k, 4) * GamT * nf(w) / std::pow(w, 5); - if (std::abs(integrand) < C_smallcut) - integrand = 0; - integrand -= 5 * std::pow(k, 4) * GamT * delta_w * nf(w) / (2 * std::pow(w, 6)); - if (std::abs(integrand) < C_smallcut) - integrand = 0; - integrand += (k * k / (2 * GamT) - std::pow(k, 4) / (2 * w * w * GamT) - std::pow(k, 4) * GamT / (2 * std::pow(k, 4))) * nf_prime(w); - if (std::abs(integrand) < C_smallcut) - integrand = 0; - integrand += (std::pow(k, 4) / (2 * std::pow(w, 3) * GamT) + (3 * std::pow(k, 4) * GamT) / (2 * std::pow(w, 5))) * delta_w * nf_prime(w); - if (std::abs(integrand) < C_smallcut) - integrand = 0; - //Checked with Mathematica Calc_Relax.m-->Scp - } - if (std::abs(Calc_Scp::msqrt_thermal) < 1e-3) - { - throw std::runtime_error("No valid thermal mass-->proper limit needed in Calc_Scp"); - } - if (std::abs(integrand) > C_smallcut) - { - dScp[0] = (NC * vw * Imff * integrand) / (pi * pi); - } - else - dScp[0] = 0; - } - - double Calc_Scp::nf(double w) - { - double res = 1. / (std::exp(w / Calc_Scp::T) + 1); - if (std::abs(res) < C_smallcut) - res = 0; - return res; - } - double Calc_Scp::nf_prime(double w) - { - double beta = 1. / Calc_Scp::T; - double res = -(beta * std::exp(beta * w)) / std::pow(1 + std::exp(beta * w), 2); - if (std::abs(res) < C_smallcut) - res = 0; - return res; - } - void Calc_Scp::set_class(double T_in, double vw_in, double mt_in, double theta_prime_in, double msqrt_thermal_in, double dmsqrt_thermal_in, bool use_lep) - { - Calc_Scp::m_full = mt_in; - Calc_Scp::vw = vw_in; - Calc_Scp::theta_prime = theta_prime_in; - Calc_Scp::T = T_in; - Calc_Scp::msqrt_thermal = msqrt_thermal_in; - Calc_Scp::dmsqrt_thermal = dmsqrt_thermal_in; - if (use_lep) - Calc_Scp::GamT = 0.002 * T; - else - Calc_Scp::GamT = 0.16 * T; - } - - double Nintegrate_Scp(Calc_Scp &C_Scp) - { - state_type Scp(1); - - double stepsize_initial = 0.01; - double abs_err = C_AbsErr; - double rel_err = C_RelErr; - double k_start = 0; - - double k_end = 1e4; //Ranges checked with NIntegrage in mathematica - integrate_adaptive(make_controlled(abs_err, rel_err, error_stepper_type()), C_Scp, Scp, k_start, k_end, stepsize_initial); - - if (std::isnan(Scp[0])) - throw std::runtime_error("NaN in Nintegrate_SCP"); - - else - return Scp[0]; - } - - void Calc_kappa_t::set_class(double Temp_in, double mt_in) - { - Calc_kappa_t::Temp = Temp_in; - Calc_kappa_t::mt = mt_in; - } - void Calc_kappa_t::operator()(const state_type &kappa, state_type &dkappa, const double x) - { - (void)kappa; //No compiler warnings :) - double cF = 6; - double prefactor = cF / (M_PI * M_PI); - dkappa[0] = prefactor * (x * std::exp(x) * std::sqrt(x * x - std::pow(mt / Temp, 2)) / std::pow(std::exp(x) + 1, 2)); - } - - double NIntegrate_kappa(const Calc_kappa_t &C_kap) - { - state_type kappa(1); - - double stepsize_initial = 1e-5; - double abs_err = C_AbsErr; - double rel_err = C_RelErr; - double eps = 1e-5; - double xstart = C_kap.mt / C_kap.Temp + eps; - double xend = 3 * 1e2; - - integrate_adaptive(make_controlled(abs_err, rel_err, error_stepper_type()), C_kap, kappa, xstart, xend, stepsize_initial); - return kappa[0]; - } - - void Calc_eta::operator()(const state_type &eta, state_type &deta, const double z) - { - (void)eta; //avoid compiler errors - deta[0] = Calc_eta::nL_cub(z) * std::exp(exponent_prefactor * z); //prefactor is not used here for numerical stability - } - void Calc_eta::set_class(std::vector array_z_in, std::vector array_nL_in, double Temp_in, double vw_in) - { - Calc_eta::array_z = array_z_in; - Calc_eta::array_nL = array_nL_in; - Calc_eta::Temp = Temp_in; - Calc_eta::vw = vw_in; - - double R = 15. / 4; - double kappa = 20; - double gBMP = 0.65; - double gstar = 106.75; - double s_entr = gstar * std::pow(Temp, 3) * 2 * M_PI * M_PI / (45); - double Dq = 6. / Temp; - double alpha_W = gBMP * gBMP / (4 * M_PI); - double GamWS = 6 * kappa * std::pow(alpha_W, 5) * Temp; - // double alpha_P = (vw + std::sqrt(4 * Dq * GamWS * R + vw * vw)) / (2 * Dq); - // double alpha_M = (vw - std::sqrt(4 * Dq * GamWS * R + vw * vw)) / (2 * Dq); - double omega = std::sqrt(vw * vw + 4 * GamWS * Dq * R); - //FULL EXPRESSION (Calculated from scratch) - prefactor = -3 * GamWS / (2 * omega * s_entr); - exponent_prefactor = (vw - omega) / (2 * Dq); - // exponent_prefactor = -alpha_M; - //SIMPLIFIED EXPRESSION - // prefactor = -3*GamWS/(2*vw*s_entr); - // exponent_prefactor = -R*GamWS/vw; - double t0, h; - if (array_z.at(0) < array_z.at(array_z.size() - 1)) - { - t0 = array_z.at(0); - h = array_z.at(1) - array_z.at(0); - } - if (array_z.at(0) > array_z.at(array_z.size() - 1)) - { - t0 = array_z.at(array_z.size() - 1); - h = array_z.at(0) - array_z.at(1); - } - boost_cubic_b_spline spline(array_nL.begin(), array_nL.end(), t0, h); - Calc_eta::nL_cub = spline; - } - void Calc_eta::set_class(std::pair, std::vector> arr_in, double Temp_in, double vw_in) - { - Calc_eta::array_z = arr_in.first; - Calc_eta::array_nL = arr_in.second; - Calc_eta::Temp = Temp_in; - Calc_eta::vw = vw_in; - - double R = 15. / 4; - double kappa = 20; - double gBMP = 0.65; - double gstar = 106.75; - double s_entr = gstar * std::pow(Temp, 3) * 2 * M_PI * M_PI / (45.); - double Dq = 6. / Temp; - double alpha_W = gBMP * gBMP / (4 * M_PI); - double GamWS = 6 * kappa * std::pow(alpha_W, 5) * Temp; - // double alpha_P = (vw + std::sqrt(4 * Dq * GamWS * R + vw * vw)) / (2 * Dq); - // double alpha_M = (vw - std::sqrt(4 * Dq * GamWS * R + vw * vw)) / (2 * Dq); - double omega = std::sqrt(vw * vw + 4 * GamWS * Dq * R); - //FULL EXPRESSION (Calculated from scratch) - prefactor = -3 * GamWS / (2 * omega * s_entr); - exponent_prefactor = (vw - omega) / (2 * Dq); - // exponent_prefactor = -alpha_M; - //SIMPLIFIED EXPRESSION - // prefactor = -3*GamWS/(2*vw*s_entr); - // exponent_prefactor = -R*GamWS/vw; - double t0, h; - if (array_z.at(0) < array_z.at(array_z.size() - 1)) - { - t0 = array_z.at(0); - h = array_z.at(1) - array_z.at(0); - } - if (array_z.at(0) > array_z.at(array_z.size() - 1)) - { - t0 = array_z.at(array_z.size() - 1); - h = array_z.at(0) - array_z.at(1); - } - boost_cubic_b_spline spline(array_nL.begin(), array_nL.end(), t0, h); - Calc_eta::nL_cub = spline; - } - double Nintegrate_eta(const Calc_eta &C_eta, const double &z_start, const double &z_end) - { - - state_type eta(1); - double stepsize_initial = -1e-5; - double abs_err = C_AbsErr; - double rel_err = C_RelErr; - integrate_adaptive(make_controlled(abs_err, rel_err, error_stepper_type()), C_eta, eta, z_end, z_start, stepsize_initial); - if (std::isnan(eta[0]) or std::isnan(C_eta.prefactor)) - throw std::runtime_error("NaN in Nintegrate_eta"); - return C_eta.prefactor * eta[0]; - } - - void gen_fluid::top_func(double z, std::vector &m_quark, std::vector &m_quark_prime) - { - std::vector m_i; - std::vector dif_mt; - std::vector dif_mb; - m_i.clear(); - dif_mt.clear(); - dif_mb.clear(); - std::size_t nquark = gen_fluid::modelPointer->get_NQuarks(); - std::vector phi, gen_phi; - phi.clear(); - gen_phi.clear(); - std::size_t gen_nvev = gen_fluid::gen_vcritical.size(); - for (std::size_t i = 0; i < gen_nvev; i++) - gen_phi.push_back(gen_fluid::gen_vcritical.at(i) / 2 * (1 - std::tanh(z / gen_fluid::LW))); - - for (std::size_t i = 1; i <= gen_nvev; i++) - { - m_i.clear(); - m_i = gen_fluid::modelPointer->QuarkMassesSquared(gen_phi, i); - /* - m_i: nquark eigenvalues and nquark derivatives with respect to field i - top is the heaviest quark -> at position nquark-1 and the derivative at position 2 nquark -1 - bot is the second heaviest quark ->at position nquark-2 and the derivative at position 2 nquark -2 - */ - dif_mt.push_back(m_i.at(2 * nquark - 1)); - //top --> anti_top-->b-->anti b - dif_mb.push_back(m_i.at(2 * nquark - 3)); - } - double mtop = std::sqrt(std::abs(m_i.at(nquark - 1))); - double mbot = std::sqrt(std::abs(m_i.at(nquark - 3))); - double res_t = 0; - double res_b = 0; - std::vector grad_omega = gen_fluid::omegaprime(z); - for (std::size_t i = 0; i < dif_mt.size(); i++) - res_t += dif_mt.at(i) * grad_omega.at(i); - for (std::size_t i = 0; i < dif_mb.size(); i++) - res_b += dif_mb.at(i) * grad_omega.at(i); - - m_quark.resize(2); - m_quark_prime.resize(2); - - m_quark[0] = mtop; - m_quark[1] = mbot; - m_quark_prime[0] = res_t; - m_quark_prime[1] = res_b; - } - std::vector gen_fluid::omegaprime(double z) - { - std::vector dummy; - dummy.clear(); - for (std::size_t i = 0; i < gen_fluid::gen_vcritical.size(); i++) - dummy.push_back((-gen_fluid::gen_vcritical.at(i) / (2 * gen_fluid::LW)) * (1. / (std::pow(std::cosh(z / gen_fluid::LW), 2)))); - - return dummy; - } - - double gen_fluid::atan2_mod(double Im, double Re) - { - double foo = std::atan2(Im, Re); - if (std::abs(foo) < M_PI / 2.) - return std::atan2(Im, Re); - else - return std::atan2(-Im, -Re); - } - - std::vector gen_fluid::Calc_theta(double z, double CP_sym, double CP_brk) - { - std::vector res; - res.resize(3); - if (modelPointer->get_Model() != ModelID::ModelIDs::C2HDM) - std::cerr << "This is only programmed for the C2HDM" << std::endl; - if ((std::abs(CP_sym) < 1e-12) and (std::abs(CP_brk) < 1e-12)) - { - res[0] = 0; - res[1] = 0; - res[2] = 0; - return res; - } - double delta_theta = CP_brk - CP_sym; - /* - //The following lines correspond to tan beta surpression of the phase factor - Calculation of the thermal tanbeta - double omega_1_brk = gen_fluid::vcritical.at(1); - double omega_2_brk = gen_fluid::vcritical.at(2); - double omega_CP_brk = gen_fluid::vcritical.at(3); - double tanbetasqrt_bar = (std::pow(omega_CP_brk,2) + std::pow(omega_2_brk,2))/(std::pow(omega_1_brk,2)); - TODO: Check for the Tbeta suppression? Does this need to be taken into account?! - double theta = (CP_brk - delta_theta/2. * ( 1 + std::tanh(z/gen_fluid::LW)))/(1+tanbetasqrt_bar); - double theta_prime = - (delta_theta)/(2*gen_fluid::LW*std::pow(std::cosh(z/gen_fluid::LW),2)*(1+tanbetasqrt_bar)); - - double theta_2prime = (delta_theta*std::tanh(z/gen_fluid::LW))/(std::pow(gen_fluid::LW*std::cosh(z/gen_fluid::LW),2)*(1+tanbetasqrt_bar)); - */ - double theta = (CP_brk - delta_theta / 2. * (1 + std::tanh(z / gen_fluid::LW))); - double theta_prime = -(delta_theta) / (2 * gen_fluid::LW * std::pow(std::cosh(z / gen_fluid::LW), 2)); - double theta_2prime = (delta_theta * std::tanh(z / gen_fluid::LW)) / (std::pow(gen_fluid::LW * std::cosh(z / gen_fluid::LW), 2)); - - res[0] = theta; - res[1] = theta_prime; - res[2] = theta_2prime; - - return res; - } - - void gen_fluid::tau_func(double z, std::vector &m_lep, std::vector &m_lep_prime) - { - int nlep = gen_fluid::modelPointer->get_NLepton(); - //Configure z-dep VEV - std::vector gen_phi; - std::size_t gen_nvev = gen_fluid::gen_vcritical.size(); - for (std::size_t i = 0; i < gen_nvev; i++) - gen_phi.push_back(gen_fluid::gen_vcritical.at(i) / 2 * (1 - std::tanh(z / gen_fluid::LW))); - //Calculation of the mass mtau - std::vector mi; - std::vector grad_mtau; - grad_mtau.clear(); - - for (std::size_t i = 1; i <= gen_nvev; i++) - { - mi.clear(); - mi = gen_fluid::modelPointer->LeptonMassesSquared(gen_phi, i); - /* - m_i: nlep eigenvalues and nlep derivatives with respect to field i - Since the tau lepton is the heaviest lepton - --> mtau = m_i.at(N) - */ - grad_mtau.push_back(mi.at(2 * nlep - 1)); - } - double mtau = std::sqrt(std::abs(mi.at(nlep - 1))); - double res = 0; - std::vector grad_omega = gen_fluid::omegaprime(z); - for (std::size_t i = 0; i < grad_mtau.size(); i++) - res += grad_mtau.at(i) * grad_omega.at(i); - if (std::isnan(res)) - throw std::runtime_error("NaN @ tau_func"); - m_lep.resize(1); - m_lep_prime.resize(1); - m_lep[0] = mtau; - m_lep_prime[0] = res; - } - - void gen_fluid::set_class( - const int bottom_mass_inp, - struct GSL_integration_mubl &container, - const Calc_Gam_M &Calc_Gam_inp, - const Calc_Scp &Calc_Scp_inp, - const Calc_kappa_t &Calc_kappa_inp) - { - gen_fluid::bot_mass_flag = bottom_mass_inp; - gen_fluid::modelPointer = container.getModelPointer(); - gen_fluid::par = modelPointer->get_parStored(); - gen_fluid::symmetric_CP_violating_phase = container.getSymmetricCPViolatingPhase(); - gen_fluid::broken_CP_violating_phase = container.getBrokenCPViolatingPhase(); - gen_fluid::TOP_symmetric_CP_violating_phase = container.getSymmetricCPViolatingPhase_top(); - gen_fluid::BOT_symmetric_CP_violating_phase = container.getSymmetricCPViolatingPhase_bot(); - gen_fluid::TOP_broken_CP_violating_phase = container.getBrokenCPViolatingPhase_top(); - gen_fluid::BOT_broken_CP_violating_phase = container.getBrokenCPViolatingPhase_bot(); - gen_fluid::TAU_broken_CP_violating_phase = container.getBrokenCPViolatingPhase_tau(); - gen_fluid::TAU_symmetric_CP_violating_phase = container.getSymmetricCPViolatingPhase_tau(); - - gen_fluid::vcritical = container.getVEVCritical(); - gen_fluid::Calc_Gam_obj = Calc_Gam_inp; - gen_fluid::Calc_Scp_obj = Calc_Scp_inp; - gen_fluid::Calc_kappa_obj = Calc_kappa_inp; - gen_fluid::tanbeta = par.at(7); - gen_fluid::Yuk_Type = par.at(8); - gen_fluid::gen_vcritical = gen_fluid::modelPointer->MinimizeOrderVEV(container.getVEVCritical()); - gen_fluid::vsym = container.get_vev_sym_theta(); - gen_fluid::LW = container.getLW(); - gen_fluid::Temp = container.getTC(); - gen_fluid::vw = container.getvw(); - //Consistent with hep-ph/9410281 - gen_fluid::Dq = 6. / Temp; - gen_fluid::Dt = 6. / Temp; - gen_fluid::Dh = 100. / Temp; - gen_fluid::Dlep = 380. / Temp; - gen_fluid::Dtau = 100. / Temp; - double sinbeta = std::sin(std::atan(tanbeta)); - double cosbeta = std::cos(std::atan(tanbeta)); - gen_fluid::yuk_q = std::sqrt(2) * mtop_0 / (C_vev0 * sinbeta); - gen_fluid::Gam_SS = 14 * std::pow(alphaS, 4) * Temp; - - double yuk_t = 0, yuk_b = 0, yuk_tau = 0; - //top thermal mass - yuk_t = std::sqrt(2) * mtop_0 / (C_vev0 * sinbeta); - auto top_thermal = Calc_ThermalMass_q(yuk_t, Temp); - msqrt_thermal_top = top_thermal.first; - dmsqrt_thermal_top = top_thermal.second; - - if (Yuk_Type == 1) - { - //bot&tau thermal mass - yuk_b = std::sqrt(2) * mbot_0 / (C_vev0 * sinbeta); - auto bot_thermal = Calc_ThermalMass_q(yuk_b, Temp); - msqrt_thermal_bot = bot_thermal.first; - dmsqrt_thermal_bot = bot_thermal.second; - - yuk_tau = std::sqrt(2) * mtau_0 / (C_vev0 * sinbeta); - auto tau_thermal = Calc_ThermalMass_l(yuk_tau, Temp); - msqrt_thermal_tau = tau_thermal.first; - dmsqrt_thermal_tau = tau_thermal.second; - } - if (Yuk_Type == 2) - { - yuk_b = std::sqrt(2) * mbot_0 / (C_vev0 * cosbeta); - auto bot_thermal = Calc_ThermalMass_q(yuk_b, Temp); - msqrt_thermal_bot = bot_thermal.first; - dmsqrt_thermal_bot = bot_thermal.second; - - yuk_tau = std::sqrt(2) * mtau_0 / (C_vev0 * cosbeta); - auto tau_thermal = Calc_ThermalMass_l(yuk_tau, Temp); - msqrt_thermal_tau = tau_thermal.first; - dmsqrt_thermal_tau = tau_thermal.second; - } - if ((Yuk_Type != 1) and (Yuk_Type != 2)) - { - throw std::runtime_error("No valid Yuk Type in gen_fluid::set_class\n"); - } - - //ArxiV: hep-ph/9410281 @ Appendix C+D WITHOUT HIGGS EXCHANGE! (only Higgs induced rates!) - gen_fluid::Gam_Y = 0.19 * alphaS * yuk_q * yuk_q * Temp; - gen_fluid::Gam_Y_t = 0.19 * alphaS * yuk_t * yuk_t * Temp; - gen_fluid::Gam_Y_b = 0.19 * alphaS * yuk_b * yuk_b * Temp; - gen_fluid::Gam_Y_tau = 0.28 * alphaW * yuk_tau * yuk_tau * Temp; - // gen_fluid::Gam_Y_u = 0.19*alphaS*yuk_u*yuk_u*Temp; - } - - std::pair gen_fluid::Calc_ThermalMass_q(double &YukCoupling, double &T_in) - { - double msqrt = std::pow(gprime, 2) / 18 + std::pow(gS, 2) / 6 + std::pow(YukCoupling, 2) / 8; - msqrt = msqrt * std::pow(T_in, 2); - double dmsqrt = 5 * std::pow(gprime, 2) / 96 - 3 * std::pow(g, 2) / 32 + std::pow(YukCoupling, 2) / 16; - dmsqrt = dmsqrt * std::pow(T_in, 2); - return std::make_pair(msqrt, dmsqrt); - } - std::pair gen_fluid::Calc_ThermalMass_l(double &YukCoupling, double &T_in) - { - double msqrt = std::pow(gprime, 2) / 8 + std::pow(YukCoupling, 2) / 8; - msqrt = msqrt * std::pow(T_in, 2); - double dmsqrt = 3 * std::pow(gprime, 2) / 4 - 3 * std::pow(g, 2) / 32 + std::pow(YukCoupling, 2) / 16; - dmsqrt = dmsqrt * std::pow(T_in, 2); - return std::make_pair(msqrt, dmsqrt); - } - - } // namespace Baryo +const double C_RelErr = 1e-9; + +void Calc_Gam_M::operator()(const state_type &Gam, + state_type &dGam, + const double k) +{ + (void)Gam; + double fsqrt = 2 * Calc_Gam_M::m_full * Calc_Gam_M::m_full; + double Nc = 3; + double pi = M_PI; + double w = std::sqrt(std::pow(k, 2) + msqrt_thermal); + double delta_w = + dmsqrt_thermal / (2 * std::sqrt(std::pow(k, 2) + msqrt_thermal)); + double integrand = 0; + if (std::abs(msqrt_thermal) > C_threshold) + { + integrand += std::pow(k, 2) / GamT; + integrand -= std::pow(k, 4) / (std::pow(w, 2) * GamT); + integrand += std::pow(k, 4) * GamT / (std::pow(w, 4)); + integrand += delta_w * std::pow(k, 4) / (std::pow(w, 3) * GamT); + integrand -= 2 * delta_w * std::pow(k, 4) * GamT / std::pow(w, 5); + integrand = integrand * hf(w); + // Checked with Mathematica Calc_Relax.m-->GammaMinus + } + if (std::abs(msqrt_thermal) < C_threshold) + { + throw std::runtime_error("Thermal mass under numerical threshold-->Proper " + "limit needed in Calc_Gam_M"); + // Check with Mathematica Calc_Relax.m-->GammaMinus + } + if (std::abs(integrand) > C_smallcut) + { + dGam[0] = + (6. / std::pow(T, 2)) * (Nc * fsqrt * integrand) / (2 * pi * pi * T); + } + if (std::abs(integrand) < C_smallcut) dGam[0] = 0; +} + +void Calc_Gam_M::set_class(double T_in, + double vw_in, + double m_in, + double msqrt_thermal_in, + double dmsqrt_thermal_in, + bool use_lep_in) +{ + Calc_Gam_M::T = T_in; + Calc_Gam_M::vw = vw_in; + Calc_Gam_M::m_full = m_in; + Calc_Gam_M::beta = 1 / T; + if (use_lep_in) + { + Calc_Gam_M::GamT = 0.002 * T; + } + else + Calc_Gam_M::GamT = 0.16 * T; + Calc_Gam_M::msqrt_thermal = msqrt_thermal_in; + Calc_Gam_M::dmsqrt_thermal = dmsqrt_thermal_in; +} + +double Calc_Gam_M::hf(double w) +{ + double beta_calc = Calc_Gam_M::beta; + double exp = std::exp(w * beta_calc); + if (std::isnan(exp)) return 0; + double res = exp / std::pow(1 + exp, 2); + if (std::abs(res) < C_smallcut) res = 0; + if (std::isnan(res)) throw std::runtime_error("NaN @ Calc_Gam_M::hf"); + return res; +} +double Calc_Gam_M::hf_prime(double w) +{ + double beta_calc = Calc_Gam_M::beta; + double exp = std::exp(w * beta_calc); + double res = -beta * exp * (exp - 1) / std::pow((1 + exp), 3); + if (std::abs(res) < C_smallcut) res = 0; + if (std::isnan(res)) throw std::runtime_error("NaN @ Calc_Gam_M::h_prime"); + + return res; +} + +double Nintegrate_GamM(Calc_Gam_M &C_Gam) +{ + state_type Gam(1); + // Paramters for the numerical evaluation + double stepsize_initial = 0.01; + double k_start = 0; + // upper limit on k is chosen such that no std::limit overflow occurs in hf, + // hf_prime functions + double k_end = 1e4; + + double abs_err = C_AbsErr; + double rel_err = C_RelErr; + integrate_adaptive(make_controlled(abs_err, rel_err, error_stepper_type()), + C_Gam, + Gam, + k_start, + k_end, + stepsize_initial); + + if (std::isnan(Gam[0])) + { + throw std::runtime_error("NaN in Nintegrate_GamM"); + } + else + return Gam[0]; +} + +void Calc_Scp::operator()(const state_type &Scp, + state_type &dScp, + const double k) +{ + state_type res = Scp; + double pi = M_PI; + double NC = 3; + double w = std::sqrt(std::pow(k, 2) + msqrt_thermal); + double delta_w = dmsqrt_thermal / (2 * std::sqrt(k * k + msqrt_thermal)); + double Imff = 2 * Calc_Scp::m_full * Calc_Scp::m_full * theta_prime; + + double integrand = 0; + if (std::abs(Calc_Scp::msqrt_thermal) > 1e-3) + { + integrand -= std::pow(k, 4) * GamT / (2 * std::pow(w, 5)); + if (std::abs(integrand) < C_smallcut) integrand = 0; + integrand += 5 * std::pow(k, 4) * GamT * delta_w / (4 * std::pow(w, 6)); + if (std::abs(integrand) < C_smallcut) integrand = 0; + integrand += std::pow(k, 4) * GamT * nf(w) / std::pow(w, 5); + if (std::abs(integrand) < C_smallcut) integrand = 0; + integrand -= + 5 * std::pow(k, 4) * GamT * delta_w * nf(w) / (2 * std::pow(w, 6)); + if (std::abs(integrand) < C_smallcut) integrand = 0; + integrand += (k * k / (2 * GamT) - std::pow(k, 4) / (2 * w * w * GamT) - + std::pow(k, 4) * GamT / (2 * std::pow(k, 4))) * + nf_prime(w); + if (std::abs(integrand) < C_smallcut) integrand = 0; + integrand += (std::pow(k, 4) / (2 * std::pow(w, 3) * GamT) + + (3 * std::pow(k, 4) * GamT) / (2 * std::pow(w, 5))) * + delta_w * nf_prime(w); + if (std::abs(integrand) < C_smallcut) integrand = 0; + // Checked with Mathematica Calc_Relax.m-->Scp + } + if (std::abs(Calc_Scp::msqrt_thermal) < 1e-3) + { + throw std::runtime_error( + "No valid thermal mass-->proper limit needed in Calc_Scp"); + } + if (std::abs(integrand) > C_smallcut) + { + dScp[0] = (NC * vw * Imff * integrand) / (pi * pi); + } + else + dScp[0] = 0; +} + +double Calc_Scp::nf(double w) +{ + double res = 1. / (std::exp(w / Calc_Scp::T) + 1); + if (std::abs(res) < C_smallcut) res = 0; + return res; +} +double Calc_Scp::nf_prime(double w) +{ + double beta = 1. / Calc_Scp::T; + double res = + -(beta * std::exp(beta * w)) / std::pow(1 + std::exp(beta * w), 2); + if (std::abs(res) < C_smallcut) res = 0; + return res; +} +void Calc_Scp::set_class(double T_in, + double vw_in, + double mt_in, + double theta_prime_in, + double msqrt_thermal_in, + double dmsqrt_thermal_in, + bool use_lep) +{ + Calc_Scp::m_full = mt_in; + Calc_Scp::vw = vw_in; + Calc_Scp::theta_prime = theta_prime_in; + Calc_Scp::T = T_in; + Calc_Scp::msqrt_thermal = msqrt_thermal_in; + Calc_Scp::dmsqrt_thermal = dmsqrt_thermal_in; + if (use_lep) + Calc_Scp::GamT = 0.002 * T; + else + Calc_Scp::GamT = 0.16 * T; +} + +double Nintegrate_Scp(Calc_Scp &C_Scp) +{ + state_type Scp(1); + + double stepsize_initial = 0.01; + double abs_err = C_AbsErr; + double rel_err = C_RelErr; + double k_start = 0; + + double k_end = 1e4; // Ranges checked with NIntegrage in mathematica + integrate_adaptive(make_controlled(abs_err, rel_err, error_stepper_type()), + C_Scp, + Scp, + k_start, + k_end, + stepsize_initial); + + if (std::isnan(Scp[0])) + throw std::runtime_error("NaN in Nintegrate_SCP"); + + else + return Scp[0]; +} + +void Calc_kappa_t::set_class(double Temp_in, double mt_in) +{ + Calc_kappa_t::Temp = Temp_in; + Calc_kappa_t::mt = mt_in; +} +void Calc_kappa_t::operator()(const state_type &kappa, + state_type &dkappa, + const double x) +{ + (void)kappa; // No compiler warnings :) + double cF = 6; + double prefactor = cF / (M_PI * M_PI); + dkappa[0] = + prefactor * (x * std::exp(x) * std::sqrt(x * x - std::pow(mt / Temp, 2)) / + std::pow(std::exp(x) + 1, 2)); +} + +double NIntegrate_kappa(const Calc_kappa_t &C_kap) +{ + state_type kappa(1); + + double stepsize_initial = 1e-5; + double abs_err = C_AbsErr; + double rel_err = C_RelErr; + double eps = 1e-5; + double xstart = C_kap.mt / C_kap.Temp + eps; + double xend = 3 * 1e2; + + integrate_adaptive(make_controlled(abs_err, rel_err, error_stepper_type()), + C_kap, + kappa, + xstart, + xend, + stepsize_initial); + return kappa[0]; +} + +void Calc_eta::operator()(const state_type &eta, + state_type &deta, + const double z) +{ + (void)eta; // avoid compiler errors + deta[0] = Calc_eta::nL_cub(z) * + std::exp(exponent_prefactor * + z); // prefactor is not used here for numerical stability +} +void Calc_eta::set_class(std::vector array_z_in, + std::vector array_nL_in, + double Temp_in, + double vw_in) +{ + Calc_eta::array_z = array_z_in; + Calc_eta::array_nL = array_nL_in; + Calc_eta::Temp = Temp_in; + Calc_eta::vw = vw_in; + + double R = 15. / 4; + double kappa = 20; + double gBMP = 0.65; + double gstar = 106.75; + double s_entr = gstar * std::pow(Temp, 3) * 2 * M_PI * M_PI / (45); + double Dq = 6. / Temp; + double alpha_W = gBMP * gBMP / (4 * M_PI); + double GamWS = 6 * kappa * std::pow(alpha_W, 5) * Temp; + // double alpha_P = (vw + std::sqrt(4 * Dq * GamWS * R + vw * vw)) / (2 * Dq); + // double alpha_M = (vw - std::sqrt(4 * Dq * GamWS * R + vw * vw)) / (2 * Dq); + double omega = std::sqrt(vw * vw + 4 * GamWS * Dq * R); + // FULL EXPRESSION (Calculated from scratch) + prefactor = -3 * GamWS / (2 * omega * s_entr); + exponent_prefactor = (vw - omega) / (2 * Dq); + // exponent_prefactor = -alpha_M; + // SIMPLIFIED EXPRESSION + // prefactor = -3*GamWS/(2*vw*s_entr); + // exponent_prefactor = -R*GamWS/vw; + double t0, h; + if (array_z.at(0) < array_z.at(array_z.size() - 1)) + { + t0 = array_z.at(0); + h = array_z.at(1) - array_z.at(0); + } + if (array_z.at(0) > array_z.at(array_z.size() - 1)) + { + t0 = array_z.at(array_z.size() - 1); + h = array_z.at(0) - array_z.at(1); + } + boost_cubic_b_spline spline(array_nL.begin(), array_nL.end(), t0, h); + Calc_eta::nL_cub = spline; +} +void Calc_eta::set_class( + std::pair, std::vector> arr_in, + double Temp_in, + double vw_in) +{ + Calc_eta::array_z = arr_in.first; + Calc_eta::array_nL = arr_in.second; + Calc_eta::Temp = Temp_in; + Calc_eta::vw = vw_in; + + double R = 15. / 4; + double kappa = 20; + double gBMP = 0.65; + double gstar = 106.75; + double s_entr = gstar * std::pow(Temp, 3) * 2 * M_PI * M_PI / (45.); + double Dq = 6. / Temp; + double alpha_W = gBMP * gBMP / (4 * M_PI); + double GamWS = 6 * kappa * std::pow(alpha_W, 5) * Temp; + // double alpha_P = (vw + std::sqrt(4 * Dq * GamWS * R + vw * vw)) / (2 * Dq); + // double alpha_M = (vw - std::sqrt(4 * Dq * GamWS * R + vw * vw)) / (2 * Dq); + double omega = std::sqrt(vw * vw + 4 * GamWS * Dq * R); + // FULL EXPRESSION (Calculated from scratch) + prefactor = -3 * GamWS / (2 * omega * s_entr); + exponent_prefactor = (vw - omega) / (2 * Dq); + // exponent_prefactor = -alpha_M; + // SIMPLIFIED EXPRESSION + // prefactor = -3*GamWS/(2*vw*s_entr); + // exponent_prefactor = -R*GamWS/vw; + double t0, h; + if (array_z.at(0) < array_z.at(array_z.size() - 1)) + { + t0 = array_z.at(0); + h = array_z.at(1) - array_z.at(0); + } + if (array_z.at(0) > array_z.at(array_z.size() - 1)) + { + t0 = array_z.at(array_z.size() - 1); + h = array_z.at(0) - array_z.at(1); + } + boost_cubic_b_spline spline(array_nL.begin(), array_nL.end(), t0, h); + Calc_eta::nL_cub = spline; +} +double Nintegrate_eta(const Calc_eta &C_eta, + const double &z_start, + const double &z_end) +{ + + state_type eta(1); + double stepsize_initial = -1e-5; + double abs_err = C_AbsErr; + double rel_err = C_RelErr; + integrate_adaptive(make_controlled(abs_err, rel_err, error_stepper_type()), + C_eta, + eta, + z_end, + z_start, + stepsize_initial); + if (std::isnan(eta[0]) or std::isnan(C_eta.prefactor)) + throw std::runtime_error("NaN in Nintegrate_eta"); + return C_eta.prefactor * eta[0]; +} + +void gen_fluid::top_func(double z, + std::vector &m_quark, + std::vector &m_quark_prime) +{ + std::vector m_i; + std::vector dif_mt; + std::vector dif_mb; + m_i.clear(); + dif_mt.clear(); + dif_mb.clear(); + std::size_t nquark = gen_fluid::modelPointer->get_NQuarks(); + std::vector phi, gen_phi; + phi.clear(); + gen_phi.clear(); + std::size_t gen_nvev = gen_fluid::gen_vcritical.size(); + for (std::size_t i = 0; i < gen_nvev; i++) + gen_phi.push_back(gen_fluid::gen_vcritical.at(i) / 2 * + (1 - std::tanh(z / gen_fluid::LW))); + + for (std::size_t i = 1; i <= gen_nvev; i++) + { + m_i.clear(); + m_i = gen_fluid::modelPointer->QuarkMassesSquared(gen_phi, i); + /* +m_i: nquark eigenvalues and nquark derivatives with respect to field i +top is the heaviest quark -> at position nquark-1 and the derivative at position +2 nquark -1 bot is the second heaviest quark ->at position nquark-2 and the +derivative at position 2 nquark -2 +*/ + dif_mt.push_back(m_i.at(2 * nquark - 1)); + // top --> anti_top-->b-->anti b + dif_mb.push_back(m_i.at(2 * nquark - 3)); + } + double mtop = std::sqrt(std::abs(m_i.at(nquark - 1))); + double mbot = std::sqrt(std::abs(m_i.at(nquark - 3))); + double res_t = 0; + double res_b = 0; + std::vector grad_omega = gen_fluid::omegaprime(z); + for (std::size_t i = 0; i < dif_mt.size(); i++) + res_t += dif_mt.at(i) * grad_omega.at(i); + for (std::size_t i = 0; i < dif_mb.size(); i++) + res_b += dif_mb.at(i) * grad_omega.at(i); + + m_quark.resize(2); + m_quark_prime.resize(2); + + m_quark[0] = mtop; + m_quark[1] = mbot; + m_quark_prime[0] = res_t; + m_quark_prime[1] = res_b; +} +std::vector gen_fluid::omegaprime(double z) +{ + std::vector dummy; + dummy.clear(); + for (std::size_t i = 0; i < gen_fluid::gen_vcritical.size(); i++) + dummy.push_back((-gen_fluid::gen_vcritical.at(i) / (2 * gen_fluid::LW)) * + (1. / (std::pow(std::cosh(z / gen_fluid::LW), 2)))); + + return dummy; +} + +double gen_fluid::atan2_mod(double Im, double Re) +{ + double foo = std::atan2(Im, Re); + if (std::abs(foo) < M_PI / 2.) + return std::atan2(Im, Re); + else + return std::atan2(-Im, -Re); +} + +std::vector +gen_fluid::Calc_theta(double z, double CP_sym, double CP_brk) +{ + std::vector res; + res.resize(3); + if (modelPointer->get_Model() != ModelID::ModelIDs::C2HDM) + std::cerr << "This is only programmed for the C2HDM" << std::endl; + if ((std::abs(CP_sym) < 1e-12) and (std::abs(CP_brk) < 1e-12)) + { + res[0] = 0; + res[1] = 0; + res[2] = 0; + return res; + } + double delta_theta = CP_brk - CP_sym; + /* + //The following lines correspond to tan beta surpression of the phase factor + Calculation of the thermal tanbeta + double omega_1_brk = gen_fluid::vcritical.at(1); + double omega_2_brk = gen_fluid::vcritical.at(2); + double omega_CP_brk = gen_fluid::vcritical.at(3); + double tanbetasqrt_bar = (std::pow(omega_CP_brk,2) + + std::pow(omega_2_brk,2))/(std::pow(omega_1_brk,2)); + TODO: Check for the Tbeta suppression? Does this need to be taken into + account?! double theta = (CP_brk - delta_theta/2. * ( 1 + + std::tanh(z/gen_fluid::LW)))/(1+tanbetasqrt_bar); double theta_prime = - + (delta_theta)/(2*gen_fluid::LW*std::pow(std::cosh(z/gen_fluid::LW),2)*(1+tanbetasqrt_bar)); + + double theta_2prime = + (delta_theta*std::tanh(z/gen_fluid::LW))/(std::pow(gen_fluid::LW*std::cosh(z/gen_fluid::LW),2)*(1+tanbetasqrt_bar)); + */ + double theta = + (CP_brk - delta_theta / 2. * (1 + std::tanh(z / gen_fluid::LW))); + double theta_prime = + -(delta_theta) / + (2 * gen_fluid::LW * std::pow(std::cosh(z / gen_fluid::LW), 2)); + double theta_2prime = + (delta_theta * std::tanh(z / gen_fluid::LW)) / + (std::pow(gen_fluid::LW * std::cosh(z / gen_fluid::LW), 2)); + + res[0] = theta; + res[1] = theta_prime; + res[2] = theta_2prime; + + return res; +} + +void gen_fluid::tau_func(double z, + std::vector &m_lep, + std::vector &m_lep_prime) +{ + int nlep = gen_fluid::modelPointer->get_NLepton(); + // Configure z-dep VEV + std::vector gen_phi; + std::size_t gen_nvev = gen_fluid::gen_vcritical.size(); + for (std::size_t i = 0; i < gen_nvev; i++) + gen_phi.push_back(gen_fluid::gen_vcritical.at(i) / 2 * + (1 - std::tanh(z / gen_fluid::LW))); + // Calculation of the mass mtau + std::vector mi; + std::vector grad_mtau; + grad_mtau.clear(); + + for (std::size_t i = 1; i <= gen_nvev; i++) + { + mi.clear(); + mi = gen_fluid::modelPointer->LeptonMassesSquared(gen_phi, i); + /* +m_i: nlep eigenvalues and nlep derivatives with respect to field i +Since the tau lepton is the heaviest lepton +--> mtau = m_i.at(N) +*/ + grad_mtau.push_back(mi.at(2 * nlep - 1)); + } + double mtau = std::sqrt(std::abs(mi.at(nlep - 1))); + double res = 0; + std::vector grad_omega = gen_fluid::omegaprime(z); + for (std::size_t i = 0; i < grad_mtau.size(); i++) + res += grad_mtau.at(i) * grad_omega.at(i); + if (std::isnan(res)) throw std::runtime_error("NaN @ tau_func"); + m_lep.resize(1); + m_lep_prime.resize(1); + m_lep[0] = mtau; + m_lep_prime[0] = res; +} + +void gen_fluid::set_class(const int bottom_mass_inp, + struct GSL_integration_mubl &container, + const Calc_Gam_M &Calc_Gam_inp, + const Calc_Scp &Calc_Scp_inp, + const Calc_kappa_t &Calc_kappa_inp) +{ + gen_fluid::bot_mass_flag = bottom_mass_inp; + gen_fluid::modelPointer = container.getModelPointer(); + gen_fluid::par = modelPointer->get_parStored(); + gen_fluid::symmetric_CP_violating_phase = + container.getSymmetricCPViolatingPhase(); + gen_fluid::broken_CP_violating_phase = container.getBrokenCPViolatingPhase(); + gen_fluid::TOP_symmetric_CP_violating_phase = + container.getSymmetricCPViolatingPhase_top(); + gen_fluid::BOT_symmetric_CP_violating_phase = + container.getSymmetricCPViolatingPhase_bot(); + gen_fluid::TOP_broken_CP_violating_phase = + container.getBrokenCPViolatingPhase_top(); + gen_fluid::BOT_broken_CP_violating_phase = + container.getBrokenCPViolatingPhase_bot(); + gen_fluid::TAU_broken_CP_violating_phase = + container.getBrokenCPViolatingPhase_tau(); + gen_fluid::TAU_symmetric_CP_violating_phase = + container.getSymmetricCPViolatingPhase_tau(); + + gen_fluid::vcritical = container.getVEVCritical(); + gen_fluid::Calc_Gam_obj = Calc_Gam_inp; + gen_fluid::Calc_Scp_obj = Calc_Scp_inp; + gen_fluid::Calc_kappa_obj = Calc_kappa_inp; + gen_fluid::tanbeta = par.at(7); + gen_fluid::Yuk_Type = par.at(8); + gen_fluid::gen_vcritical = + gen_fluid::modelPointer->MinimizeOrderVEV(container.getVEVCritical()); + gen_fluid::vsym = container.get_vev_sym_theta(); + gen_fluid::LW = container.getLW(); + gen_fluid::Temp = container.getTC(); + gen_fluid::vw = container.getvw(); + // Consistent with hep-ph/9410281 + gen_fluid::Dq = 6. / Temp; + gen_fluid::Dt = 6. / Temp; + gen_fluid::Dh = 100. / Temp; + gen_fluid::Dlep = 380. / Temp; + gen_fluid::Dtau = 100. / Temp; + double sinbeta = std::sin(std::atan(tanbeta)); + double cosbeta = std::cos(std::atan(tanbeta)); + gen_fluid::yuk_q = std::sqrt(2) * mtop_0 / (C_vev0 * sinbeta); + gen_fluid::Gam_SS = 14 * std::pow(alphaS, 4) * Temp; + + double yuk_t = 0, yuk_b = 0, yuk_tau = 0; + // top thermal mass + yuk_t = std::sqrt(2) * mtop_0 / (C_vev0 * sinbeta); + auto top_thermal = Calc_ThermalMass_q(yuk_t, Temp); + msqrt_thermal_top = top_thermal.first; + dmsqrt_thermal_top = top_thermal.second; + + if (Yuk_Type == 1) + { + // bot&tau thermal mass + yuk_b = std::sqrt(2) * mbot_0 / (C_vev0 * sinbeta); + auto bot_thermal = Calc_ThermalMass_q(yuk_b, Temp); + msqrt_thermal_bot = bot_thermal.first; + dmsqrt_thermal_bot = bot_thermal.second; + + yuk_tau = std::sqrt(2) * mtau_0 / (C_vev0 * sinbeta); + auto tau_thermal = Calc_ThermalMass_l(yuk_tau, Temp); + msqrt_thermal_tau = tau_thermal.first; + dmsqrt_thermal_tau = tau_thermal.second; + } + if (Yuk_Type == 2) + { + yuk_b = std::sqrt(2) * mbot_0 / (C_vev0 * cosbeta); + auto bot_thermal = Calc_ThermalMass_q(yuk_b, Temp); + msqrt_thermal_bot = bot_thermal.first; + dmsqrt_thermal_bot = bot_thermal.second; + + yuk_tau = std::sqrt(2) * mtau_0 / (C_vev0 * cosbeta); + auto tau_thermal = Calc_ThermalMass_l(yuk_tau, Temp); + msqrt_thermal_tau = tau_thermal.first; + dmsqrt_thermal_tau = tau_thermal.second; + } + if ((Yuk_Type != 1) and (Yuk_Type != 2)) + { + throw std::runtime_error("No valid Yuk Type in gen_fluid::set_class\n"); + } + + // ArxiV: hep-ph/9410281 @ Appendix C+D WITHOUT HIGGS EXCHANGE! (only Higgs + // induced rates!) + gen_fluid::Gam_Y = 0.19 * alphaS * yuk_q * yuk_q * Temp; + gen_fluid::Gam_Y_t = 0.19 * alphaS * yuk_t * yuk_t * Temp; + gen_fluid::Gam_Y_b = 0.19 * alphaS * yuk_b * yuk_b * Temp; + gen_fluid::Gam_Y_tau = 0.28 * alphaW * yuk_tau * yuk_tau * Temp; + // gen_fluid::Gam_Y_u = 0.19*alphaS*yuk_u*yuk_u*Temp; +} + +std::pair gen_fluid::Calc_ThermalMass_q(double &YukCoupling, + double &T_in) +{ + double msqrt = std::pow(gprime, 2) / 18 + std::pow(gS, 2) / 6 + + std::pow(YukCoupling, 2) / 8; + msqrt = msqrt * std::pow(T_in, 2); + double dmsqrt = 5 * std::pow(gprime, 2) / 96 - 3 * std::pow(g, 2) / 32 + + std::pow(YukCoupling, 2) / 16; + dmsqrt = dmsqrt * std::pow(T_in, 2); + return std::make_pair(msqrt, dmsqrt); +} +std::pair gen_fluid::Calc_ThermalMass_l(double &YukCoupling, + double &T_in) +{ + double msqrt = std::pow(gprime, 2) / 8 + std::pow(YukCoupling, 2) / 8; + msqrt = msqrt * std::pow(T_in, 2); + double dmsqrt = 3 * std::pow(gprime, 2) / 4 - 3 * std::pow(g, 2) / 32 + + std::pow(YukCoupling, 2) / 16; + dmsqrt = dmsqrt * std::pow(T_in, 2); + return std::make_pair(msqrt, dmsqrt); +} + +} // namespace Baryo } // namespace BSMPT diff --git a/src/baryo_calculation/Fluid_Type/tau_source.cpp b/src/baryo_calculation/Fluid_Type/tau_source.cpp index 552a7753..21fd2d49 100644 --- a/src/baryo_calculation/Fluid_Type/tau_source.cpp +++ b/src/baryo_calculation/Fluid_Type/tau_source.cpp @@ -3,18 +3,18 @@ * * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller - This program 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. + This program 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. - This program 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. + This program 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 this program. If not, see . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include @@ -24,182 +24,234 @@ * @file */ -namespace BSMPT{ -namespace Baryo{ +namespace BSMPT +{ +namespace Baryo +{ -typedef runge_kutta_cash_karp54< state_type > error_stepper_type; -typedef controlled_runge_kutta< error_stepper_type > controlled_stepper_type; +typedef runge_kutta_cash_karp54 error_stepper_type; +typedef controlled_runge_kutta controlled_stepper_type; -void tau_source::operator()(const state_type &omega , state_type &domega , const double z) -{ - /* - omega[0] -> q - omega[1] -> t - omega[2] -> b - omega[3] -> l - omega[4] -> nu - omega[5] -> tau - omega[6] -> h1 - omega[7] -> h2 - omega[8] -> u - omega[9] -> q_prime - omega[10] -> t_prime - omega[11] -> b_prime - omega[12] -> l_prime - omega[13] -> nu_prime - omega[14] -> tau_prime - omega[15] -> h1_prime - omega[16] -> h2_prime - omega[17] -> u_prime - */ +void tau_source::operator()(const state_type &omega, + state_type &domega, + const double z) +{ + /* + omega[0] -> q + omega[1] -> t + omega[2] -> b + omega[3] -> l + omega[4] -> nu + omega[5] -> tau + omega[6] -> h1 + omega[7] -> h2 + omega[8] -> u + omega[9] -> q_prime + omega[10] -> t_prime + omega[11] -> b_prime + omega[12] -> l_prime + omega[13] -> nu_prime + omega[14] -> tau_prime + omega[15] -> h1_prime + omega[16] -> h2_prime + omega[17] -> u_prime + */ - /* - Definition of all transport coefficients - */ - std::vector quark_mass; - std::vector quark_mass_prime; - //TOP and BOT quark mass calculation - top_func(z , quark_mass, quark_mass_prime); - double mt = quark_mass[0]; - double mb; - if(bot_mass_flag==1) mb = quark_mass[1]; - if(bot_mass_flag==2) mb = 0; - if((bot_mass_flag!=1)and(bot_mass_flag!=2)) throw std::runtime_error("No valid mbot mass flag is chosen. Please make sure to chose a proper value"); - //TAU mass calculation - std::vector tau_mass, tau_mass_prime; - tau_func(z , tau_mass , tau_mass_prime); - double mtau; - if(tau_mass_flag ==1 ) mtau = tau_mass[0]; - if(tau_mass_flag ==2 ) mtau = 0; - if((tau_mass_flag!=1)and(tau_mass_flag!=2)) throw std::runtime_error("No valid mtau mass flag is chosen. Please make sure to chose a proper value"); - - - //Phase Calculation - //top - auto theta_vec_top = Calc_theta(z , gen_fluid::TOP_symmetric_CP_violating_phase , gen_fluid::TOP_broken_CP_violating_phase); - // double theta_top = theta_vec_top[0]; - double theta_prime_top = theta_vec_top[1]; - //bot - auto theta_vec_bot = Calc_theta(z , gen_fluid::BOT_symmetric_CP_violating_phase , gen_fluid::BOT_broken_CP_violating_phase); - // double theta_bot = theta_vec_bot[0]; - double theta_prime_bot = theta_vec_bot[1]; - //tau - auto theta_vec_tau = Calc_theta(z , gen_fluid::TAU_symmetric_CP_violating_phase , gen_fluid::TAU_broken_CP_violating_phase); - // double theta_tau = theta_vec_tau[0]; - double theta_prime_tau = theta_vec_tau[1]; + /* + Definition of all transport coefficients + */ + std::vector quark_mass; + std::vector quark_mass_prime; + // TOP and BOT quark mass calculation + top_func(z, quark_mass, quark_mass_prime); + double mt = quark_mass[0]; + double mb; + if (bot_mass_flag == 1) mb = quark_mass[1]; + if (bot_mass_flag == 2) mb = 0; + if ((bot_mass_flag != 1) and (bot_mass_flag != 2)) + throw std::runtime_error("No valid mbot mass flag is chosen. Please make " + "sure to chose a proper value"); + // TAU mass calculation + std::vector tau_mass, tau_mass_prime; + tau_func(z, tau_mass, tau_mass_prime); + double mtau; + if (tau_mass_flag == 1) mtau = tau_mass[0]; + if (tau_mass_flag == 2) mtau = 0; + if ((tau_mass_flag != 1) and (tau_mass_flag != 2)) + throw std::runtime_error("No valid mtau mass flag is chosen. Please make " + "sure to chose a proper value"); - //TOP statistical factor - Calc_kappa_obj.set_class(Temp, mt); - double num_int = NIntegrate_kappa(Calc_kappa_obj); - double kappa_tL = kappa_QL_0*num_int; - double kappa_tR = kappa_QR_0*num_int; - //BOT statistical factor - Calc_kappa_obj.set_class(Temp,mb); - num_int = NIntegrate_kappa(Calc_kappa_obj); - double kappa_bL = kappa_QL_0*num_int; - double kappa_bR = kappa_QR_0*num_int; - //TAU statistical factor - Calc_kappa_obj.set_class(Temp,mtau); - num_int = NIntegrate_kappa(Calc_kappa_obj); - double kappa_tauL = kappa_LL_0*num_int; - double kappa_tauR = kappa_RL_0*num_int; - //Effective statistical factor - double kappa_q = kappa_tL*kappa_bL/(kappa_tL+kappa_bL); + // Phase Calculation + // top + auto theta_vec_top = Calc_theta(z, + gen_fluid::TOP_symmetric_CP_violating_phase, + gen_fluid::TOP_broken_CP_violating_phase); + // double theta_top = theta_vec_top[0]; + double theta_prime_top = theta_vec_top[1]; + // bot + auto theta_vec_bot = Calc_theta(z, + gen_fluid::BOT_symmetric_CP_violating_phase, + gen_fluid::BOT_broken_CP_violating_phase); + // double theta_bot = theta_vec_bot[0]; + double theta_prime_bot = theta_vec_bot[1]; + // tau + auto theta_vec_tau = Calc_theta(z, + gen_fluid::TAU_symmetric_CP_violating_phase, + gen_fluid::TAU_broken_CP_violating_phase); + // double theta_tau = theta_vec_tau[0]; + double theta_prime_tau = theta_vec_tau[1]; - //Rescaled chemical potential like in 1811.11104 - //Relaxation Rates - double mu_M_t = omega[1]/kappa_tR - omega[0]/kappa_q; - double mu_M_b = omega[2]/kappa_bR - omega[0]/kappa_q; - double mu_M_tau = omega[5]/kappa_tauR- omega[3]/kappa_tauL; - //Yukawa Rates - double mu_Y_t = omega[1]/kappa_tR - omega[0]/kappa_q - omega[6]/kappa_H_0 - omega[7]/kappa_H_0; - double mu_Y_b = omega[2]/kappa_bR - omega[0]/kappa_q - omega[6]/kappa_H_0 - omega[7]/kappa_H_0; - double mu_Y_tau = omega[5]/kappa_tauR - omega[3]/kappa_tauL + omega[6]/kappa_H_0 + omega[7]/kappa_H_0; - //Strong sphaleron rate - double mu_SS = -4*omega[8] *(2/kappa_QL_0 + 1/kappa_QR_0) + 2*omega[0]/kappa_q - omega[1]/kappa_tR - omega[2]/kappa_bR; - //Numerical Integration Set up for the relaxation rates - Calc_Gam_obj.set_class(Temp,vw,mt,msqrt_thermal_top,dmsqrt_thermal_top); - double Gam_M_t = Nintegrate_GamM(Calc_Gam_obj); - Calc_Gam_obj.set_class(Temp,vw,mb,msqrt_thermal_bot,dmsqrt_thermal_bot); - double Gam_M_b = Nintegrate_GamM(Calc_Gam_obj); - Calc_Gam_obj.set_class(Temp,vw,mtau,msqrt_thermal_tau,dmsqrt_thermal_tau,true);//true--> Use lepton thermal width - double Gam_M_tau = Nintegrate_GamM(Calc_Gam_obj); - //Gam_Y_b has to be zero if the bottom mass vanishes - if(bot_mass_flag == 2) Gam_Y_b =0; - //Numerical Integration Set up for the CP-violating phase - Calc_Scp_obj.set_class(Temp,vw,mt,theta_prime_top,msqrt_thermal_top,dmsqrt_thermal_top); - double Scp_t = Nintegrate_Scp(Calc_Scp_obj); - double Scp_b = 0 ; - double Scp_tau = 0; - if((bot_mass_flag==1) and (tau_mass_flag==1)){ - Calc_Scp_obj.set_class(Temp,vw,mb,theta_prime_bot,msqrt_thermal_bot,dmsqrt_thermal_bot); - Scp_b = Nintegrate_Scp(Calc_Scp_obj); - Calc_Scp_obj.set_class(Temp,vw,mtau,theta_prime_tau,msqrt_thermal_tau,dmsqrt_thermal_tau,true);//true--> Use lepton thermal width - Scp_tau = Nintegrate_Scp(Calc_Scp_obj); - } + // TOP statistical factor + Calc_kappa_obj.set_class(Temp, mt); + double num_int = NIntegrate_kappa(Calc_kappa_obj); + double kappa_tL = kappa_QL_0 * num_int; + double kappa_tR = kappa_QR_0 * num_int; + // BOT statistical factor + Calc_kappa_obj.set_class(Temp, mb); + num_int = NIntegrate_kappa(Calc_kappa_obj); + double kappa_bL = kappa_QL_0 * num_int; + double kappa_bR = kappa_QR_0 * num_int; + // TAU statistical factor + Calc_kappa_obj.set_class(Temp, mtau); + num_int = NIntegrate_kappa(Calc_kappa_obj); + double kappa_tauL = kappa_LL_0 * num_int; + double kappa_tauR = kappa_RL_0 * num_int; + // Effective statistical factor + double kappa_q = kappa_tL * kappa_bL / (kappa_tL + kappa_bL); - domega[0] = omega[9]; - domega[1] = omega[10]; - domega[2] = omega[11]; - domega[3] = omega[12]; - domega[4] = omega[13]; - domega[5] = omega[14]; - domega[6] = omega[15]; - domega[7] = omega[16]; - domega[8] = omega[17]; - /* - dmu qmu = vw qprime - Dq q_drpime = C - --> q_dprime = ( vw qprime - C)/Dq - */ - domega[9] = (vw*omega[9] - ( Gam_M_t*mu_M_t + Gam_M_b*mu_M_b + Gam_Y_t*mu_Y_t+ Gam_Y_b*mu_Y_b - 2*Gam_SS*mu_SS - Scp_t - Scp_b )) / Dq; - domega[10] = (vw*omega[10] - (- Gam_M_t*mu_M_t - Gam_Y_t*mu_Y_t + Gam_SS*mu_SS + Scp_t)) / Dq; - domega[11] = (vw*omega[11] - (-Gam_M_b*mu_M_b - Gam_Y_b*mu_Y_b + Gam_SS*mu_SS + Scp_b)) / Dq; - domega[12] = (vw*omega[12] - (Gam_M_tau*mu_M_tau + Gam_Y_tau*mu_Y_tau - Scp_tau))/ Dlep; - domega[13] = (vw*omega[13] - (0.))/Dtau; - domega[14] = (vw*omega[14] - (- Gam_M_tau*mu_M_tau - Gam_Y_tau*mu_Y_tau + Scp_tau))/Dtau; - domega[15] = (vw*omega[15] - (Gam_Y_t*mu_Y_t - Gam_Y_b*mu_Y_b - Gam_Y_tau*mu_Y_tau)) / Dh; - domega[16] = (vw*omega[16] - (Gam_Y_t*mu_Y_t - Gam_Y_b*mu_Y_b - Gam_Y_tau*mu_Y_tau)) / Dh; - domega[17] = (vw*omega[17] - (Gam_SS*mu_SS))/Dq; -} - -double tau_source::Calc_nL(double z_start,double z_end) const { - /* - omega[0] -> q - omega[1] -> t - omega[2] -> b - omega[3] -> l - omega[4] -> nu - omega[5] -> tau - omega[6] -> h1 - omega[7] -> h2 - omega[8] -> u - omega[9] -> q_prime - omega[10] -> t_prime - omega[11] -> b_prime - omega[12] -> l_prime - omega[13] -> nu_prime - omega[14] -> tau_prime - omega[15] -> h1_prime - omega[16] -> h2_prime - omega[17] -> u_prime - */ - state_type mu(18); - mu = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - const double C_AbsErr = 1e-9; - const double C_RelErr = 1e-5; - double stepsize_initial; - if(z_startz_end) stepsize_initial = -1e-8; - double abs_err = C_AbsErr; - double rel_err =C_RelErr; - integrate_adaptive(make_controlled( abs_err , rel_err , error_stepper_type() ) , *this , mu , z_start , z_end , stepsize_initial ); - /* - We have to take the sum of all left-handed quarks and leptons - --> q && q1 = - 2 u && l - */ - return mu[0] - 2*mu[8] + mu[3];//as defined in 1811.11104 + // Rescaled chemical potential like in 1811.11104 + // Relaxation Rates + double mu_M_t = omega[1] / kappa_tR - omega[0] / kappa_q; + double mu_M_b = omega[2] / kappa_bR - omega[0] / kappa_q; + double mu_M_tau = omega[5] / kappa_tauR - omega[3] / kappa_tauL; + // Yukawa Rates + double mu_Y_t = omega[1] / kappa_tR - omega[0] / kappa_q - + omega[6] / kappa_H_0 - omega[7] / kappa_H_0; + double mu_Y_b = omega[2] / kappa_bR - omega[0] / kappa_q - + omega[6] / kappa_H_0 - omega[7] / kappa_H_0; + double mu_Y_tau = omega[5] / kappa_tauR - omega[3] / kappa_tauL + + omega[6] / kappa_H_0 + omega[7] / kappa_H_0; + // Strong sphaleron rate + double mu_SS = -4 * omega[8] * (2 / kappa_QL_0 + 1 / kappa_QR_0) + + 2 * omega[0] / kappa_q - omega[1] / kappa_tR - + omega[2] / kappa_bR; + // Numerical Integration Set up for the relaxation rates + Calc_Gam_obj.set_class(Temp, vw, mt, msqrt_thermal_top, dmsqrt_thermal_top); + double Gam_M_t = Nintegrate_GamM(Calc_Gam_obj); + Calc_Gam_obj.set_class(Temp, vw, mb, msqrt_thermal_bot, dmsqrt_thermal_bot); + double Gam_M_b = Nintegrate_GamM(Calc_Gam_obj); + Calc_Gam_obj.set_class(Temp, + vw, + mtau, + msqrt_thermal_tau, + dmsqrt_thermal_tau, + true); // true--> Use lepton thermal width + double Gam_M_tau = Nintegrate_GamM(Calc_Gam_obj); + // Gam_Y_b has to be zero if the bottom mass vanishes + if (bot_mass_flag == 2) Gam_Y_b = 0; + // Numerical Integration Set up for the CP-violating phase + Calc_Scp_obj.set_class( + Temp, vw, mt, theta_prime_top, msqrt_thermal_top, dmsqrt_thermal_top); + double Scp_t = Nintegrate_Scp(Calc_Scp_obj); + double Scp_b = 0; + double Scp_tau = 0; + if ((bot_mass_flag == 1) and (tau_mass_flag == 1)) + { + Calc_Scp_obj.set_class( + Temp, vw, mb, theta_prime_bot, msqrt_thermal_bot, dmsqrt_thermal_bot); + Scp_b = Nintegrate_Scp(Calc_Scp_obj); + Calc_Scp_obj.set_class(Temp, + vw, + mtau, + theta_prime_tau, + msqrt_thermal_tau, + dmsqrt_thermal_tau, + true); // true--> Use lepton thermal width + Scp_tau = Nintegrate_Scp(Calc_Scp_obj); + } + domega[0] = omega[9]; + domega[1] = omega[10]; + domega[2] = omega[11]; + domega[3] = omega[12]; + domega[4] = omega[13]; + domega[5] = omega[14]; + domega[6] = omega[15]; + domega[7] = omega[16]; + domega[8] = omega[17]; + /* + dmu qmu = vw qprime - Dq q_drpime = C + --> q_dprime = ( vw qprime - C)/Dq + */ + domega[9] = (vw * omega[9] - + (Gam_M_t * mu_M_t + Gam_M_b * mu_M_b + Gam_Y_t * mu_Y_t + + Gam_Y_b * mu_Y_b - 2 * Gam_SS * mu_SS - Scp_t - Scp_b)) / + Dq; + domega[10] = (vw * omega[10] - (-Gam_M_t * mu_M_t - Gam_Y_t * mu_Y_t + + Gam_SS * mu_SS + Scp_t)) / + Dq; + domega[11] = (vw * omega[11] - (-Gam_M_b * mu_M_b - Gam_Y_b * mu_Y_b + + Gam_SS * mu_SS + Scp_b)) / + Dq; + domega[12] = (vw * omega[12] - + (Gam_M_tau * mu_M_tau + Gam_Y_tau * mu_Y_tau - Scp_tau)) / + Dlep; + domega[13] = (vw * omega[13] - (0.)) / Dtau; + domega[14] = (vw * omega[14] - + (-Gam_M_tau * mu_M_tau - Gam_Y_tau * mu_Y_tau + Scp_tau)) / + Dtau; + domega[15] = (vw * omega[15] - + (Gam_Y_t * mu_Y_t - Gam_Y_b * mu_Y_b - Gam_Y_tau * mu_Y_tau)) / + Dh; + domega[16] = (vw * omega[16] - + (Gam_Y_t * mu_Y_t - Gam_Y_b * mu_Y_b - Gam_Y_tau * mu_Y_tau)) / + Dh; + domega[17] = (vw * omega[17] - (Gam_SS * mu_SS)) / Dq; } +double tau_source::Calc_nL(double z_start, double z_end) const +{ + /* + omega[0] -> q + omega[1] -> t + omega[2] -> b + omega[3] -> l + omega[4] -> nu + omega[5] -> tau + omega[6] -> h1 + omega[7] -> h2 + omega[8] -> u + omega[9] -> q_prime + omega[10] -> t_prime + omega[11] -> b_prime + omega[12] -> l_prime + omega[13] -> nu_prime + omega[14] -> tau_prime + omega[15] -> h1_prime + omega[16] -> h2_prime + omega[17] -> u_prime + */ + state_type mu(18); + mu = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + const double C_AbsErr = 1e-9; + const double C_RelErr = 1e-5; + double stepsize_initial; + if (z_start < z_end) stepsize_initial = 1e-8; + if (z_start > z_end) stepsize_initial = -1e-8; + double abs_err = C_AbsErr; + double rel_err = C_RelErr; + integrate_adaptive(make_controlled(abs_err, rel_err, error_stepper_type()), + *this, + mu, + z_start, + z_end, + stepsize_initial); + /* + We have to take the sum of all left-handed quarks and leptons + --> q && q1 = - 2 u && l + */ + return mu[0] - 2 * mu[8] + mu[3]; // as defined in 1811.11104 } -} + +} // namespace Baryo +} // namespace BSMPT diff --git a/src/baryo_calculation/Fluid_Type/top_source.cpp b/src/baryo_calculation/Fluid_Type/top_source.cpp index 97ecc8eb..e16f11b1 100644 --- a/src/baryo_calculation/Fluid_Type/top_source.cpp +++ b/src/baryo_calculation/Fluid_Type/top_source.cpp @@ -3,18 +3,18 @@ * * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller - This program 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. - - This program 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 this program. If not, see . + This program 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. + + This program 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 this program. If not, see . */ #include @@ -23,91 +23,104 @@ * @file */ -namespace BSMPT{ -namespace Baryo{ - -typedef runge_kutta_cash_karp54< state_type > error_stepper_type; -typedef controlled_runge_kutta< error_stepper_type > controlled_stepper_type; - +namespace BSMPT +{ +namespace Baryo +{ -double top_source::Calc_nL(double z_start, double z_end) const { - /* - omega[0] -> q - omega[1] -> t - omega[2] -> h1 - omega[3] -> h2 - omega[4] -> q_prime - omega[5] -> t_prime - omega[6] -> h1_prime - omega[7] -> h2_prime - */ - state_type mu(8); - mu = {0,0,0,0,0,0,0,0}; - const double C_AbsErr = 1e-9; - const double C_RelErr = 1e-5; - double stepsize_initial; - if(z_startz_end) stepsize_initial = -1e-8; - double abs_err = C_AbsErr; - double rel_err =C_RelErr; - integrate_adaptive(make_controlled( abs_err , rel_err , error_stepper_type() ) , *this , mu , z_start , z_end , stepsize_initial ); +typedef runge_kutta_cash_karp54 error_stepper_type; +typedef controlled_runge_kutta controlled_stepper_type; - return 3*mu[0]+2*mu[1];//as defined in 1811.11104; used q1=-2b and b = -(q+t) +double top_source::Calc_nL(double z_start, double z_end) const +{ + /* + omega[0] -> q + omega[1] -> t + omega[2] -> h1 + omega[3] -> h2 + omega[4] -> q_prime + omega[5] -> t_prime + omega[6] -> h1_prime + omega[7] -> h2_prime + */ + state_type mu(8); + mu = {0, 0, 0, 0, 0, 0, 0, 0}; + const double C_AbsErr = 1e-9; + const double C_RelErr = 1e-5; + double stepsize_initial; + if (z_start < z_end) stepsize_initial = 1e-8; + if (z_start > z_end) stepsize_initial = -1e-8; + double abs_err = C_AbsErr; + double rel_err = C_RelErr; + integrate_adaptive(make_controlled(abs_err, rel_err, error_stepper_type()), + *this, + mu, + z_start, + z_end, + stepsize_initial); + + return 3 * mu[0] + + 2 * mu[1]; // as defined in 1811.11104; used q1=-2b and b = -(q+t) } - - -void top_source::operator()(const state_type &omega , state_type &domega , const double z) +void top_source::operator()(const state_type &omega, + state_type &domega, + const double z) { - /* - Definition of all transport coefficients - */ - std::vector quark_mass; - std::vector quark_mass_prime; - top_func(z , quark_mass, quark_mass_prime); - double mt = quark_mass[0];//top quark mass - double sym_phase = gen_fluid::symmetric_CP_violating_phase; - double brk_phase = gen_fluid::broken_CP_violating_phase; - auto theta_vec = Calc_theta(z , sym_phase , brk_phase); - // double theta = theta_vec[0];//phase factor of the top quark - double theta_prime = theta_vec[1];//derivative of the phase factor of the top quark - //Calculation of kappa_t - Calc_kappa_obj.set_class(Temp, mt); - double num_int = NIntegrate_kappa(Calc_kappa_obj); - double kappa_q = kappa_QL_0*num_int;//left-handed kappa - double kappa_tR = kappa_QR_0*num_int;//right-handed kappa - - //Rescaled chemical potential like in 1811.11104 - double mu_M = (omega[1]/kappa_tR - omega[0]/kappa_q); - double bR = -(omega[1]+omega[0]);//local baryon conservation used to expresse the right-handed b density - double mu_SS = 2*omega[0]/kappa_q - omega[1]/kappa_tR - bR/kappa_QR_0; - double mu_Y = omega[1]/kappa_tR - omega[0]/kappa_q - omega[2]/kappa_H_0-omega[3]/kappa_H_0; - - Calc_Gam_obj.set_class(Temp,vw,mt, msqrt_thermal_top,dmsqrt_thermal_top); - double Gam_M = Nintegrate_GamM(Calc_Gam_obj); - Calc_Scp_obj.set_class(Temp,vw,mt,theta_prime,msqrt_thermal_top,dmsqrt_thermal_top); - double Scp = Nintegrate_Scp(Calc_Scp_obj); - - /* - omega[0] -> q - omega[1] -> t - omega[2] -> h1 - omega[3] -> h2 - omega[4] -> q_prime - omega[5] -> t_prime - omega[6] -> h1_prime - omega[7] -> h2_prime - */ - domega[0] = omega[4]; - domega[1] = omega[5]; - domega[2] = omega[6]; - domega[3] = omega[7]; - domega[4] = (Scp - Gam_M*mu_M + 2*Gam_SS*mu_SS - Gam_Y*mu_Y + vw* omega[4])/Dq; - domega[5] = (-Scp + Gam_M* mu_M + Gam_Y*mu_Y + vw* omega[5])/Dt; - domega[6] = (-Gam_Y*mu_Y + vw* omega[6])/Dh; - domega[7] = (- Gam_Y*mu_Y + vw*omega[7])/Dh; - + /* + Definition of all transport coefficients + */ + std::vector quark_mass; + std::vector quark_mass_prime; + top_func(z, quark_mass, quark_mass_prime); + double mt = quark_mass[0]; // top quark mass + double sym_phase = gen_fluid::symmetric_CP_violating_phase; + double brk_phase = gen_fluid::broken_CP_violating_phase; + auto theta_vec = Calc_theta(z, sym_phase, brk_phase); + // double theta = theta_vec[0];//phase factor of the top quark + double theta_prime = + theta_vec[1]; // derivative of the phase factor of the top quark + // Calculation of kappa_t + Calc_kappa_obj.set_class(Temp, mt); + double num_int = NIntegrate_kappa(Calc_kappa_obj); + double kappa_q = kappa_QL_0 * num_int; // left-handed kappa + double kappa_tR = kappa_QR_0 * num_int; // right-handed kappa + + // Rescaled chemical potential like in 1811.11104 + double mu_M = (omega[1] / kappa_tR - omega[0] / kappa_q); + double bR = -(omega[1] + omega[0]); // local baryon conservation used to + // expresse the right-handed b density + double mu_SS = 2 * omega[0] / kappa_q - omega[1] / kappa_tR - bR / kappa_QR_0; + double mu_Y = omega[1] / kappa_tR - omega[0] / kappa_q - + omega[2] / kappa_H_0 - omega[3] / kappa_H_0; + + Calc_Gam_obj.set_class(Temp, vw, mt, msqrt_thermal_top, dmsqrt_thermal_top); + double Gam_M = Nintegrate_GamM(Calc_Gam_obj); + Calc_Scp_obj.set_class( + Temp, vw, mt, theta_prime, msqrt_thermal_top, dmsqrt_thermal_top); + double Scp = Nintegrate_Scp(Calc_Scp_obj); + + /* + omega[0] -> q + omega[1] -> t + omega[2] -> h1 + omega[3] -> h2 + omega[4] -> q_prime + omega[5] -> t_prime + omega[6] -> h1_prime + omega[7] -> h2_prime + */ + domega[0] = omega[4]; + domega[1] = omega[5]; + domega[2] = omega[6]; + domega[3] = omega[7]; + domega[4] = + (Scp - Gam_M * mu_M + 2 * Gam_SS * mu_SS - Gam_Y * mu_Y + vw * omega[4]) / + Dq; + domega[5] = (-Scp + Gam_M * mu_M + Gam_Y * mu_Y + vw * omega[5]) / Dt; + domega[6] = (-Gam_Y * mu_Y + vw * omega[6]) / Dh; + domega[7] = (-Gam_Y * mu_Y + vw * omega[7]) / Dh; } -} -} +} // namespace Baryo +} // namespace BSMPT diff --git a/src/baryo_calculation/transport_equations.cpp b/src/baryo_calculation/transport_equations.cpp index e37f62f8..c2bf4b76 100644 --- a/src/baryo_calculation/transport_equations.cpp +++ b/src/baryo_calculation/transport_equations.cpp @@ -17,726 +17,996 @@ along with this program. If not, see . */ -#include #include -#include -#include +#include #include +#include +#include #include -#include #include +#include /** * @file */ -namespace BSMPT{ -namespace Baryo{ +namespace BSMPT +{ +namespace Baryo +{ -void GSL_integration_mubl::setSymmetricCPViolatingPhase(double Phase){ - symmetric_CP_violating_phase = Phase; +void GSL_integration_mubl::setSymmetricCPViolatingPhase(double Phase) +{ + symmetric_CP_violating_phase = Phase; } -double GSL_integration_mubl::getSymmetricCPViolatingPhase() const{ - return symmetric_CP_violating_phase; +double GSL_integration_mubl::getSymmetricCPViolatingPhase() const +{ + return symmetric_CP_violating_phase; } -double GSL_integration_mubl::getSymmetricCPViolatingPhase_top() const{ - return TOP_symmetric_CP_violating_phase; +double GSL_integration_mubl::getSymmetricCPViolatingPhase_top() const +{ + return TOP_symmetric_CP_violating_phase; } -double GSL_integration_mubl::getSymmetricCPViolatingPhase_bot() const{ - return BOT_symmetric_CP_violating_phase; +double GSL_integration_mubl::getSymmetricCPViolatingPhase_bot() const +{ + return BOT_symmetric_CP_violating_phase; } -double GSL_integration_mubl::getSymmetricCPViolatingPhase_tau() const{ - return TAU_symmetric_CP_violating_phase; +double GSL_integration_mubl::getSymmetricCPViolatingPhase_tau() const +{ + return TAU_symmetric_CP_violating_phase; } - -double GSL_integration_mubl::getBrokenCPViolatingPhase() const{ - return broken_CP_violating_phase; +double GSL_integration_mubl::getBrokenCPViolatingPhase() const +{ + return broken_CP_violating_phase; } -double GSL_integration_mubl::getBrokenCPViolatingPhase_top() const{ - return TOP_broken_CP_violating_phase; +double GSL_integration_mubl::getBrokenCPViolatingPhase_top() const +{ + return TOP_broken_CP_violating_phase; } -double GSL_integration_mubl::getBrokenCPViolatingPhase_bot() const{ - return BOT_broken_CP_violating_phase; +double GSL_integration_mubl::getBrokenCPViolatingPhase_bot() const +{ + return BOT_broken_CP_violating_phase; } -double GSL_integration_mubl::getBrokenCPViolatingPhase_tau() const{ - return TAU_broken_CP_violating_phase; +double GSL_integration_mubl::getBrokenCPViolatingPhase_tau() const +{ + return TAU_broken_CP_violating_phase; } -std::vector GSL_integration_mubl::getVEVCritical() const{ - return vev_critical; +std::vector GSL_integration_mubl::getVEVCritical() const +{ + return vev_critical; } -std::vector GSL_integration_mubl::getVEVsym() const{ - return vev_symmetric; +std::vector GSL_integration_mubl::getVEVsym() const +{ + return vev_symmetric; } -void GSL_integration_mubl::setTC(double TC_in){ - TC = TC_in; +void GSL_integration_mubl::setTC(double TC_in) +{ + TC = TC_in; } -double GSL_integration_mubl::getTC() const{ - return TC; +double GSL_integration_mubl::getTC() const +{ + return TC; } - -void GSL_integration_mubl::setvw(double vw_in){ - vw = vw_in; +void GSL_integration_mubl::setvw(double vw_in) +{ + vw = vw_in; } -double GSL_integration_mubl::getvw() const{ - return vw; +double GSL_integration_mubl::getvw() const +{ + return vw; } -void GSL_integration_mubl::setUseVelocityTransportEquations(bool in){ - UseVelocityTransportEquations = in; +void GSL_integration_mubl::setUseVelocityTransportEquations(bool in) +{ + UseVelocityTransportEquations = in; } -bool GSL_integration_mubl::getUseVelocityTransportEquations() const{ - return UseVelocityTransportEquations; +bool GSL_integration_mubl::getUseVelocityTransportEquations() const +{ + return UseVelocityTransportEquations; } -std::shared_ptr GSL_integration_mubl::getModelPointer() const{ - return modelPointer; +std::shared_ptr +GSL_integration_mubl::getModelPointer() const +{ + return modelPointer; } -double GSL_integration_mubl::getLW() const{ - return LW; +double GSL_integration_mubl::getLW() const +{ + return LW; } -double GSL_integration_mubl::getZMAX() const{ - return zmax; +double GSL_integration_mubl::getZMAX() const +{ + return zmax; } -void GSL_integration_mubl::setpar(std::vector inp){ - par = inp; +void GSL_integration_mubl::setpar(std::vector inp) +{ + par = inp; } -std::vector GSL_integration_mubl::getpar(){ - return par; +std::vector GSL_integration_mubl::getpar() +{ + return par; } -TransportMethod GSL_integration_mubl::get_transport_method(){ - return transport_method; +TransportMethod GSL_integration_mubl::get_transport_method() +{ + return transport_method; } -void GSL_integration_mubl::set_transport_method(TransportMethod method){ - transport_method = method; +void GSL_integration_mubl::set_transport_method(TransportMethod method) +{ + transport_method = method; } -void GSL_integration_mubl::setZMAX(double zin,bool MultiplesOfLW=false){ - zmax = zin; - if(MultiplesOfLW) zmax *= LW; +void GSL_integration_mubl::setZMAX(double zin, bool MultiplesOfLW = false) +{ + zmax = zin; + if (MultiplesOfLW) zmax *= LW; } -void GSL_integration_mubl::set_vev_sym_theta(std::vector & vev_in){ - vev_sym_theta = vev_in; +void GSL_integration_mubl::set_vev_sym_theta(std::vector &vev_in) +{ + vev_sym_theta = vev_in; } -std::vector GSL_integration_mubl::get_vev_sym_theta() const{ - return vev_sym_theta; +std::vector GSL_integration_mubl::get_vev_sym_theta() const +{ + return vev_sym_theta; } +void GSL_integration_mubl::init( + const double &vw_input, + std::vector &vev_critical_input, + std::vector &vev_symmetric_input, + const double &TC_input, + std::shared_ptr &modelPointer_input, + const int &WhichMinimizer) +{ - -void GSL_integration_mubl::init(const double& vw_input, - std::vector& vev_critical_input, - std::vector& vev_symmetric_input, - const double& TC_input, - std::shared_ptr& modelPointer_input, - const int& WhichMinimizer){ - - vw = vw_input; - TC = TC_input; - vev_critical = vev_critical_input; - vev_symmetric = vev_symmetric_input; - modelPointer = modelPointer_input; - setpar(modelPointer->get_parStored()); - UseVelocityTransportEquations = false; - - std::vector vevCriticalNhiggs; - vevCriticalNhiggs=modelPointer->MinimizeOrderVEV(vev_critical); - vc = modelPointer->EWSBVEV(vevCriticalNhiggs); - - - - double CompareNorm = 0; - for(auto x: modelPointer->get_vevTreeMin()) CompareNorm += std::pow(x,2); - - - double TestNorm=0; - for(std::size_t i =0 ;iget_vevTreeMin(i) - vev_critical.at(i),2); - if(TestNorm > CompareNorm) - { - for(auto symmetry : modelPointer->SignSymmetries){ - TestNorm = 0; - for(std::size_t i =0 ;iget_vevTreeMin(i) - symmetry.at(i)*vev_critical.at(i),2); - } - if(TestNorm < CompareNorm){ - for(std::size_t i=0;iget_vevTreeMin(i) - vev_symmetric.at(i),2); - if(TestNorm > CompareNorm) - { - for(auto symmetry : modelPointer->SignSymmetries){ - TestNorm = 0; - for(std::size_t i =0 ;iget_vevTreeMin(i) - symmetry.at(i)*vev_symmetric.at(i),2); - } - if(TestNorm < CompareNorm){ - for(std::size_t i=0;iget_parStored()); + UseVelocityTransportEquations = false; + + std::vector vevCriticalNhiggs; + vevCriticalNhiggs = modelPointer->MinimizeOrderVEV(vev_critical); + vc = modelPointer->EWSBVEV(vevCriticalNhiggs); + + double CompareNorm = 0; + for (auto x : modelPointer->get_vevTreeMin()) + CompareNorm += std::pow(x, 2); + + double TestNorm = 0; + for (std::size_t i = 0; i < vev_critical.size(); i++) + TestNorm += + std::pow(modelPointer->get_vevTreeMin(i) - vev_critical.at(i), 2); + if (TestNorm > CompareNorm) + { + for (auto symmetry : modelPointer->SignSymmetries) { - double LW1D = Wall::calculate_wall_thickness_1D(modelPointer,TC,vev_critical,vev_symmetric); - std::cout << "The 1D LW is given by " << LW1D << std::endl; - std::cout << "The relative error to the plane LW is given by " << (LW-LW1D)/LW *100 << " %" << std::endl; + TestNorm = 0; + for (std::size_t i = 0; i < vev_critical.size(); i++) + { + TestNorm += std::pow(modelPointer->get_vevTreeMin(i) - + symmetry.at(i) * vev_critical.at(i), + 2); + } + if (TestNorm < CompareNorm) + { + for (std::size_t i = 0; i < vev_critical.size(); i++) + vev_critical.at(i) *= symmetry.at(i); + break; + } } - - zmax = 4*LW; - - // Find minimum slightly before the symmetric phase to define the CP-violating phase in the symmetric minimum - std::vector basepoint; - for(std::size_t i=0;iget_vevTreeMin(i) - vev_symmetric.at(i), 2); + if (TestNorm > CompareNorm) + { + for (auto symmetry : modelPointer->SignSymmetries) { - basepoint.push_back(vev_symmetric.at(i) + 1e-2 * (vev_critical.at(i)-vev_symmetric.at(i))); + TestNorm = 0; + for (std::size_t i = 0; i < vev_symmetric.size(); i++) + { + TestNorm += std::pow(modelPointer->get_vevTreeMin(i) - + symmetry.at(i) * vev_symmetric.at(i), + 2); + } + if (TestNorm < CompareNorm) + { + for (std::size_t i = 0; i < vev_symmetric.size(); i++) + vev_symmetric.at(i) *= symmetry.at(i); + break; + } } - auto MinPlaneResult = Minimizer::MinimizePlane(basepoint,vev_symmetric,vev_critical,modelPointer,TC,WhichMinimizer); - auto MinimumPlane = MinPlaneResult.Minimum; - - - - - TestNorm = 0; - for(std::size_t i =0 ;iget_vevTreeMin(i) - MinimumPlane.at(i),2); - if(TestNorm > CompareNorm) + } + + LW = Wall::calculate_wall_thickness_plane( + modelPointer, TC, vev_critical, vev_symmetric, WhichMinimizer); + + if (false) + { + double LW1D = Wall::calculate_wall_thickness_1D( + modelPointer, TC, vev_critical, vev_symmetric); + std::cout << "The 1D LW is given by " << LW1D << std::endl; + std::cout << "The relative error to the plane LW is given by " + << (LW - LW1D) / LW * 100 << " %" << std::endl; + } + + zmax = 4 * LW; + + // Find minimum slightly before the symmetric phase to define the CP-violating + // phase in the symmetric minimum + std::vector basepoint; + for (std::size_t i = 0; i < vev_critical.size(); i++) + { + basepoint.push_back(vev_symmetric.at(i) + + 1e-2 * (vev_critical.at(i) - vev_symmetric.at(i))); + } + auto MinPlaneResult = Minimizer::MinimizePlane( + basepoint, vev_symmetric, vev_critical, modelPointer, TC, WhichMinimizer); + auto MinimumPlane = MinPlaneResult.Minimum; + + TestNorm = 0; + for (std::size_t i = 0; i < MinimumPlane.size(); i++) + TestNorm += + std::pow(modelPointer->get_vevTreeMin(i) - MinimumPlane.at(i), 2); + if (TestNorm > CompareNorm) + { + for (auto symmetry : modelPointer->SignSymmetries) { - for(auto symmetry : modelPointer->SignSymmetries){ - TestNorm = 0; - for(std::size_t i =0 ;iget_vevTreeMin(i) - symmetry.at(i)*MinimumPlane.at(i),2); - } - if(TestNorm < CompareNorm){ - for(std::size_t i=0;i TransformedVEV; - std::vector> ComplexQuarkMassMinimumPlane; - std::vector> ComplexLeptonMassMinimumPlane; - TransformedVEV=modelPointer->MinimizeOrderVEV(MinimumPlane); - ComplexQuarkMassMinimumPlane=modelPointer->QuarkMasses(TransformedVEV); - ComplexLeptonMassMinimumPlane=modelPointer->LeptonMasses(TransformedVEV); - symmetric_CP_violating_phase = std::arg(ComplexQuarkMassMinimumPlane.at(ComplexQuarkMassMinimumPlane.size()-1)); - TOP_symmetric_CP_violating_phase = std::arg(ComplexQuarkMassMinimumPlane.at(ComplexQuarkMassMinimumPlane.size()-1)); - BOT_symmetric_CP_violating_phase = std::arg(ComplexQuarkMassMinimumPlane.at(ComplexQuarkMassMinimumPlane.size()-3)); - TAU_symmetric_CP_violating_phase = std::arg(ComplexLeptonMassMinimumPlane.at(ComplexLeptonMassMinimumPlane.size()-1)); - if(std::abs(symmetric_CP_violating_phase) > 0.5*M_PI){ - symmetric_CP_violating_phase = std::arg(ComplexQuarkMassMinimumPlane.at(ComplexQuarkMassMinimumPlane.size()-2)); - TOP_symmetric_CP_violating_phase = std::arg(ComplexQuarkMassMinimumPlane.at(ComplexQuarkMassMinimumPlane.size()-2)); + TestNorm = 0; + for (std::size_t i = 0; i < MinimumPlane.size(); i++) + { + TestNorm += std::pow(modelPointer->get_vevTreeMin(i) - + symmetry.at(i) * MinimumPlane.at(i), + 2); + } + if (TestNorm < CompareNorm) + { + for (std::size_t i = 0; i < MinimumPlane.size(); i++) + MinimumPlane.at(i) *= symmetry.at(i); + break; + } } - if(std::abs(BOT_symmetric_CP_violating_phase) > 0.5*M_PI){ - BOT_symmetric_CP_violating_phase = std::arg(ComplexQuarkMassMinimumPlane.at(ComplexQuarkMassMinimumPlane.size()-4)); - } - if(std::abs(TAU_symmetric_CP_violating_phase) > 0.5*M_PI){ - TAU_symmetric_CP_violating_phase = std::arg(ComplexLeptonMassMinimumPlane.at(ComplexLeptonMassMinimumPlane.size()-2)); - } - //Numerical Stability Check - if(std::abs(TOP_symmetric_CP_violating_phase)<1e-14) TOP_symmetric_CP_violating_phase=0; - if(std::abs(BOT_symmetric_CP_violating_phase)<1e-14) BOT_symmetric_CP_violating_phase=0; - if(std::abs(TAU_symmetric_CP_violating_phase)<1e-14) TAU_symmetric_CP_violating_phase=0; - - - std::vector> ComplexQuarkMassBroken; - std::vector> ComplexLeptonMassBroken; - TransformedVEV.clear(); - TransformedVEV=modelPointer->MinimizeOrderVEV(vev_critical); - ComplexQuarkMassBroken=modelPointer->QuarkMasses(TransformedVEV); - ComplexLeptonMassBroken=modelPointer->LeptonMasses(TransformedVEV); - - broken_CP_violating_phase = std::arg(ComplexQuarkMassBroken.at(ComplexQuarkMassBroken.size()-1)); - TOP_broken_CP_violating_phase = std::arg(ComplexQuarkMassBroken.at(ComplexQuarkMassBroken.size()-1)); - BOT_broken_CP_violating_phase = std::arg(ComplexQuarkMassBroken.at(ComplexQuarkMassBroken.size()-3)); - TAU_broken_CP_violating_phase = std::arg(ComplexLeptonMassBroken.at(ComplexLeptonMassBroken.size()-1)); - if(std::abs(broken_CP_violating_phase) > 0.5*M_PI){ - broken_CP_violating_phase = std::arg(ComplexQuarkMassBroken.at(ComplexQuarkMassBroken.size()-2)); - TOP_broken_CP_violating_phase = std::arg(ComplexQuarkMassBroken.at(ComplexQuarkMassBroken.size()-2)); - } - if(std::abs(BOT_broken_CP_violating_phase) > 0.5*M_PI){ - BOT_broken_CP_violating_phase = std::arg(ComplexQuarkMassBroken.at(ComplexQuarkMassBroken.size()-4)); - } - if(std::abs(TAU_broken_CP_violating_phase)> 0.5*M_PI){ - TAU_broken_CP_violating_phase = std::arg(ComplexLeptonMassBroken.at(ComplexLeptonMassBroken.size()-2)); - } - //Numerical Stability Check - if(std::abs(TOP_broken_CP_violating_phase)<1e-14) TOP_broken_CP_violating_phase=0; - if(std::abs(BOT_broken_CP_violating_phase)<1e-14) BOT_broken_CP_violating_phase=0; - if(std::abs(TAU_broken_CP_violating_phase)<1e-14) TAU_broken_CP_violating_phase=0; - set_vev_sym_theta(MinimumPlane); -} - -transport_equations::transport_equations(const struct GSL_integration_mubl& params) - : UseVelocityTransportEquations{params.getUseVelocityTransportEquations()}, - vw{params.getvw()}, LW{params.getLW()}, - TC{params.getTC()}, - symmetric_CP_violating_phase{params.getSymmetricCPViolatingPhase()}, - broken_CP_violating_phase{params.getBrokenCPViolatingPhase()}, - modelPointer{params.getModelPointer()}, - vev_critical{modelPointer->MinimizeOrderVEV(params.getVEVCritical())} + } + std::vector TransformedVEV; + std::vector> ComplexQuarkMassMinimumPlane; + std::vector> ComplexLeptonMassMinimumPlane; + TransformedVEV = modelPointer->MinimizeOrderVEV(MinimumPlane); + ComplexQuarkMassMinimumPlane = modelPointer->QuarkMasses(TransformedVEV); + ComplexLeptonMassMinimumPlane = modelPointer->LeptonMasses(TransformedVEV); + symmetric_CP_violating_phase = std::arg( + ComplexQuarkMassMinimumPlane.at(ComplexQuarkMassMinimumPlane.size() - 1)); + TOP_symmetric_CP_violating_phase = std::arg( + ComplexQuarkMassMinimumPlane.at(ComplexQuarkMassMinimumPlane.size() - 1)); + BOT_symmetric_CP_violating_phase = std::arg( + ComplexQuarkMassMinimumPlane.at(ComplexQuarkMassMinimumPlane.size() - 3)); + TAU_symmetric_CP_violating_phase = std::arg(ComplexLeptonMassMinimumPlane.at( + ComplexLeptonMassMinimumPlane.size() - 1)); + if (std::abs(symmetric_CP_violating_phase) > 0.5 * M_PI) + { + symmetric_CP_violating_phase = std::arg(ComplexQuarkMassMinimumPlane.at( + ComplexQuarkMassMinimumPlane.size() - 2)); + TOP_symmetric_CP_violating_phase = std::arg(ComplexQuarkMassMinimumPlane.at( + ComplexQuarkMassMinimumPlane.size() - 2)); + } + if (std::abs(BOT_symmetric_CP_violating_phase) > 0.5 * M_PI) + { + BOT_symmetric_CP_violating_phase = std::arg(ComplexQuarkMassMinimumPlane.at( + ComplexQuarkMassMinimumPlane.size() - 4)); + } + if (std::abs(TAU_symmetric_CP_violating_phase) > 0.5 * M_PI) + { + TAU_symmetric_CP_violating_phase = + std::arg(ComplexLeptonMassMinimumPlane.at( + ComplexLeptonMassMinimumPlane.size() - 2)); + } + // Numerical Stability Check + if (std::abs(TOP_symmetric_CP_violating_phase) < 1e-14) + TOP_symmetric_CP_violating_phase = 0; + if (std::abs(BOT_symmetric_CP_violating_phase) < 1e-14) + BOT_symmetric_CP_violating_phase = 0; + if (std::abs(TAU_symmetric_CP_violating_phase) < 1e-14) + TAU_symmetric_CP_violating_phase = 0; + + std::vector> ComplexQuarkMassBroken; + std::vector> ComplexLeptonMassBroken; + TransformedVEV.clear(); + TransformedVEV = modelPointer->MinimizeOrderVEV(vev_critical); + ComplexQuarkMassBroken = modelPointer->QuarkMasses(TransformedVEV); + ComplexLeptonMassBroken = modelPointer->LeptonMasses(TransformedVEV); + + broken_CP_violating_phase = + std::arg(ComplexQuarkMassBroken.at(ComplexQuarkMassBroken.size() - 1)); + TOP_broken_CP_violating_phase = + std::arg(ComplexQuarkMassBroken.at(ComplexQuarkMassBroken.size() - 1)); + BOT_broken_CP_violating_phase = + std::arg(ComplexQuarkMassBroken.at(ComplexQuarkMassBroken.size() - 3)); + TAU_broken_CP_violating_phase = + std::arg(ComplexLeptonMassBroken.at(ComplexLeptonMassBroken.size() - 1)); + if (std::abs(broken_CP_violating_phase) > 0.5 * M_PI) + { + broken_CP_violating_phase = + std::arg(ComplexQuarkMassBroken.at(ComplexQuarkMassBroken.size() - 2)); + TOP_broken_CP_violating_phase = + std::arg(ComplexQuarkMassBroken.at(ComplexQuarkMassBroken.size() - 2)); + } + if (std::abs(BOT_broken_CP_violating_phase) > 0.5 * M_PI) + { + BOT_broken_CP_violating_phase = + std::arg(ComplexQuarkMassBroken.at(ComplexQuarkMassBroken.size() - 4)); + } + if (std::abs(TAU_broken_CP_violating_phase) > 0.5 * M_PI) + { + TAU_broken_CP_violating_phase = std::arg( + ComplexLeptonMassBroken.at(ComplexLeptonMassBroken.size() - 2)); + } + // Numerical Stability Check + if (std::abs(TOP_broken_CP_violating_phase) < 1e-14) + TOP_broken_CP_violating_phase = 0; + if (std::abs(BOT_broken_CP_violating_phase) < 1e-14) + BOT_broken_CP_violating_phase = 0; + if (std::abs(TAU_broken_CP_violating_phase) < 1e-14) + TAU_broken_CP_violating_phase = 0; + set_vev_sym_theta(MinimumPlane); +} + +transport_equations::transport_equations( + const struct GSL_integration_mubl ¶ms) + : UseVelocityTransportEquations{params.getUseVelocityTransportEquations()} + , vw{params.getvw()} + , LW{params.getLW()} + , TC{params.getTC()} + , symmetric_CP_violating_phase{params.getSymmetricCPViolatingPhase()} + , broken_CP_violating_phase{params.getBrokenCPViolatingPhase()} + , modelPointer{params.getModelPointer()} + , vev_critical{modelPointer->MinimizeOrderVEV(params.getVEVCritical())} { - // TODO Auto-generated constructor stub - + // TODO Auto-generated constructor stub } -transport_equations::~transport_equations() { - // TODO Auto-generated destructor stub +transport_equations::~transport_equations() +{ + // TODO Auto-generated destructor stub } - - - - -double transport_equations::get_W_mass(const std::vector& vev, const double &T) const{ - std::vector res; - res=modelPointer->GaugeMassesSquared(vev,T); - std::vector nrepeat(modelPointer->get_NGauge()); - for(std::size_t i=0;iget_NGauge();i++) +double transport_equations::get_W_mass(const std::vector &vev, + const double &T) const +{ + std::vector res; + res = modelPointer->GaugeMassesSquared(vev, T); + std::vector nrepeat(modelPointer->get_NGauge()); + for (std::size_t i = 0; i < modelPointer->get_NGauge(); i++) + { + nrepeat[i] = 0; + for (std::size_t j = 0; j < modelPointer->get_NGauge(); j++) { - nrepeat[i]=0; - for(std::size_t j=0;jget_NGauge();j++){ - if(std::abs(res.at(i)- res.at(j)) <= 1e-5) nrepeat[i]++; - } - } - - for(int j=modelPointer->get_NGauge()-1;j>=0;j--){ - // std::cout << res.at(j) << std::endl; - if(nrepeat[j]>1) { - if(std::isnan(res.at(j))){ - std::string retmessage = "Nan found in "; - retmessage+= __func__; - throw std::runtime_error(retmessage); - } - return res.at(j); - } + if (std::abs(res.at(i) - res.at(j)) <= 1e-5) nrepeat[i]++; } - return 0; -} - + } -std::vector transport_equations::get_top_mass_and_derivative(const std::vector& vev) const -{ - std::vector restmp; - std::vector res; - int postop=modelPointer->get_NQuarks() -1; - int posdifftop=2*modelPointer->get_NQuarks() -1; - double topmasssquared=-1; - std::vector topderivatives; - for(std::size_t i=1;i<=modelPointer->get_NHiggs();i++) + for (int j = modelPointer->get_NGauge() - 1; j >= 0; j--) + { + // std::cout << res.at(j) << std::endl; + if (nrepeat[j] > 1) { - restmp.clear(); - restmp=modelPointer->QuarkMassesSquared(vev,i); - if(topmasssquared==-1) topmasssquared = restmp.at(postop); - topderivatives.push_back(restmp.at(posdifftop)); - } - res.push_back(topmasssquared); - if(std::isnan(topmasssquared)){ - for(std::size_t i=0;i transport_equations::calculate_vev(const double &z) const +std::vector transport_equations::get_top_mass_and_derivative( + const std::vector &vev) const { - std::vector vev; - if(std::isnan(std::tanh(z/LW))){ - std::string retmessage = "Nan found in "; - retmessage+= __func__; - throw std::runtime_error(retmessage); - } - for(std::size_t i=0;iget_NHiggs();i++){ - vev.push_back(0.5*vev_critical.at(i) *(1-std::tanh(z/LW))); + std::vector restmp; + std::vector res; + int postop = modelPointer->get_NQuarks() - 1; + int posdifftop = 2 * modelPointer->get_NQuarks() - 1; + double topmasssquared = -1; + std::vector topderivatives; + for (std::size_t i = 1; i <= modelPointer->get_NHiggs(); i++) + { + restmp.clear(); + restmp = modelPointer->QuarkMassesSquared(vev, i); + if (topmasssquared == -1) topmasssquared = restmp.at(postop); + topderivatives.push_back(restmp.at(posdifftop)); + } + res.push_back(topmasssquared); + if (std::isnan(topmasssquared)) + { + for (std::size_t i = 0; i < vev.size(); i++) + std::cout << vev.at(i) << sep; + std::cout << std::endl; + std::string retmessage = "Nan found in "; + retmessage += __func__; + throw std::runtime_error(retmessage); + } + for (std::size_t i = 0; i < topderivatives.size(); i++) + { + res.push_back(topderivatives.at(i)); + if (std::isnan(topderivatives.at(i))) + { + std::string retmessage = "Nan found in "; + retmessage += __func__; + retmessage += " at deriv number "; + retmessage += std::to_string(i); + for (std::size_t j = 0; j < vev.size(); j++) + std::cout << vev.at(j) << sep; + throw std::runtime_error(retmessage); } - return vev; + } + return res; } -std::vector transport_equations::calculate_vev_derivative(const double &z) const +std::vector transport_equations::calculate_vev(const double &z) const { - std::vector vev; - double tanhv=std::tanh(z/LW); - double diffval = -(1-tanhv*tanhv)/LW; - for(std::size_t i=0;iget_NHiggs();i++){ - vev.push_back(0.5*vev_critical.at(i) *diffval); - } - return vev; -} - - -double transport_equations::calculate_theta(const double& z, const int& diff) const + std::vector vev; + if (std::isnan(std::tanh(z / LW))) + { + std::string retmessage = "Nan found in "; + retmessage += __func__; + throw std::runtime_error(retmessage); + } + for (std::size_t i = 0; i < modelPointer->get_NHiggs(); i++) + { + vev.push_back(0.5 * vev_critical.at(i) * (1 - std::tanh(z / LW))); + } + return vev; +} + +std::vector +transport_equations::calculate_vev_derivative(const double &z) const { - double res = 0; - double thetasym = symmetric_CP_violating_phase; - if(modelPointer->get_Model() != ModelID::ModelIDs::C2HDM) std::cerr << "This is only programmed for the C2HDM" << std::endl; - double thetabrk = broken_CP_violating_phase; - double difftheta = thetabrk - thetasym; - double tanhv = std::tanh(z/LW); - if(diff == 0){ - res = thetabrk - 0.5*difftheta*(1+tanhv); - } - else if(diff == 1){ - res = -difftheta/(2*LW) *(1-tanhv*tanhv); - } - else if(diff == 2){ - res = difftheta*tanhv/(LW*LW) *(1-tanhv*tanhv); - } - - if(std::isnan(res)){ - std::string retmessage = "Nan found in "; - retmessage+= __func__; - throw std::runtime_error(retmessage); - } - - double v3c=vev_critical.at(7), v2c=vev_critical.at(6), v1c=vev_critical.at(4); - double tanbeta_temp_sq=(std::pow(v3c,2)+std::pow(v2c,2))/std::pow(v1c,2); - - if(UseTanBetaSuppression) res *= 1.0/(1+tanbeta_temp_sq); // Eq 27 of 0605242 - - return res; -} - - -transport_equations &transport_equations::operator()(const state_type &x , state_type &dxdt , const double z ){ - std::cout << std::scientific; - std::vector topres; - std::vector vev,vevdiff; - - vev=calculate_vev(z); - - vevdiff=calculate_vev_derivative(z); - - topres=get_top_mass_and_derivative(vev); - - double mws = get_W_mass(vev,TC); - - double mtsquared = topres.at(0); - - double dmtsquared = 0; - for(std::size_t i=0;i calculateTransportEquation( - const double& z, - const std::vector& parStart, - const struct GSL_integration_mubl& params) + std::vector vev; + double tanhv = std::tanh(z / LW); + double diffval = -(1 - tanhv * tanhv) / LW; + for (std::size_t i = 0; i < modelPointer->get_NHiggs(); i++) + { + vev.push_back(0.5 * vev_critical.at(i) * diffval); + } + return vev; +} + +double transport_equations::calculate_theta(const double &z, + const int &diff) const { - using namespace boost::numeric::odeint; - const double C_AbsErr = 1e-10; //1.0e-10 - const double C_RelErr = 1e-3; // 1.0e-6 - - std::size_t dim = 8; - // dim = 1; - state_type x(dim); - for(std::size_t i=0;i x_vec; - std::vector times; - - double zInitial=params.getZMAX(); - - double stepsize_initial=(z-zInitial)*1e-5; - if(stepsize_initial == 0) stepsize_initial=-1e-7; - double abs_err = C_AbsErr; - double rel_err = C_RelErr; - - - - // steps = integrate(transport,x,zInitial,z,stepsize_initial); - // steps = integrate_adaptive( make_controlled( abs_err , rel_err , error_stepper_type() ) ,RGE , x , EnergyStart , EnergyEnd , stepsize_initial ); - - integrate_adaptive( make_controlled( abs_err , rel_err , error_stepper_type() ) ,transport , - x , zInitial , z , stepsize_initial,push_back_state_and_time( x_vec , times ) ); - - std::vector parEnd; - for(std::size_t i=0;i topres,vev; - vev=transport.calculate_vev(z); - topres=transport.get_top_mass_and_derivative(vev); - double mtsquared = topres.at(0); - double K1t = Kfactors::K1fermion_normalized(mtsquared,params.getTC()); - double K1b = Kfactors::K1fermion_normalized(0,params.getTC()); - - parEnd.push_back(K1t); - parEnd.push_back(K1b); - - if(std::isnan(parEnd.at(0))){ - std::cout << "Nan in " << __func__ << std::endl - << "parEnd.size() = " << parEnd.size() << "\nparEnd = "; - for(std::size_t i=0;i parStart,parEnd; - for(int i=0;i<8;i++) parStart.push_back(0); - - parEnd=calculateTransportEquation(z,parStart,*params); - double K1t = parEnd.at(8); - double K1b = parEnd.at(9); - double mut2 = parEnd.at(0); - double mub2 = parEnd.at(1); - double mutc2 = parEnd.at(2); - - double res = 0.5*(1+4*K1t)*mut2 + 0.5*(1+4*K1b)*mub2-2*K1t*mutc2; - if(std::isnan(res)){ - std::cout << "res = nan at z = " << z << std::endl; - std::cout << "K1t = " << K1t << "\nK1b = " << K1b << "\nmut2 = " << mut2 << "\nmub2 = " << mub2 - << "\nmutc2 = " << mutc2 << std::endl; - } - return res; -} - - - -double eta_integrand_func(double z, void *p){ - struct GSL_integration_mubl * params = static_cast(p); - double mubl = mubl_func(z,p); - double GWS = 1e-6*params->getTC(); - double nu = 45*GWS/(4*params->getvw()); - double damping = std::exp(-nu*z); - double res = mubl*damping; - return res; + double res = 0; + double thetasym = symmetric_CP_violating_phase; + if (modelPointer->get_Model() != ModelID::ModelIDs::C2HDM) + std::cerr << "This is only programmed for the C2HDM" << std::endl; + double thetabrk = broken_CP_violating_phase; + double difftheta = thetabrk - thetasym; + double tanhv = std::tanh(z / LW); + if (diff == 0) + { + res = thetabrk - 0.5 * difftheta * (1 + tanhv); + } + else if (diff == 1) + { + res = -difftheta / (2 * LW) * (1 - tanhv * tanhv); + } + else if (diff == 2) + { + res = difftheta * tanhv / (LW * LW) * (1 - tanhv * tanhv); + } + + if (std::isnan(res)) + { + std::string retmessage = "Nan found in "; + retmessage += __func__; + throw std::runtime_error(retmessage); + } + + double v3c = vev_critical.at(7), v2c = vev_critical.at(6), + v1c = vev_critical.at(4); + double tanbeta_temp_sq = + (std::pow(v3c, 2) + std::pow(v2c, 2)) / std::pow(v1c, 2); + + if (UseTanBetaSuppression) + res *= 1.0 / (1 + tanbeta_temp_sq); // Eq 27 of 0605242 + + return res; +} + +transport_equations &transport_equations::operator()(const state_type &x, + state_type &dxdt, + const double z) +{ + std::cout << std::scientific; + std::vector topres; + std::vector vev, vevdiff; + + vev = calculate_vev(z); + + vevdiff = calculate_vev_derivative(z); + + topres = get_top_mass_and_derivative(vev); + + double mws = get_W_mass(vev, TC); + + double mtsquared = topres.at(0); + + double dmtsquared = 0; + for (std::size_t i = 0; i < vevdiff.size(); i++) + { + dmtsquared += vevdiff.at(i) * topres.at(i + 1); + } + + double K1t = Kfactors::K1fermion_normalized( + mtsquared, TC); // K1_fermion_interp(mtsquared,TC,PyLoad)/norm1; + double K2t = Kfactors::K2fermion_normalized( + mtsquared, TC); // K2_fermion_interp(mtsquared,TC,PyLoad)/norm1; + double K4t = Kfactors::K4fermion_normalized( + mtsquared, TC); // K4_fermion_interp(mtsquared,TC,PyLoad)/norm1; + double K5t = Kfactors::K5fermion_normalized( + mtsquared, TC); // K5_fermion_interp(mtsquared,TC,PyLoad)/norm2; + double K6t = Kfactors::K6fermion_normalized( + mtsquared, TC); // K6_fermion_interp(mtsquared,TC,PyLoad)/norm2; + double K8t = Kfactors::K8fermion_normalized( + mtsquared, TC); // K8_fermion_interp(mtsquared,TC,PyLoad)/norm1; + double K9t = Kfactors::K9fermion_normalized( + mtsquared, TC); // K9_fermion_interp(mtsquared,TC,PyLoad)/norm1; + + double K1b = Kfactors::K1fermion_normalized( + 0, TC); // K1_fermion_interp(0,TC,PyLoad)/norm1; + double K4b = Kfactors::K4fermion_normalized( + 0, TC); // K4_fermion_interp(0,TC,PyLoad)/norm1; + double K5b = Kfactors::K5fermion_normalized( + 0, TC); // K5_fermion_interp(0,TC,PyLoad)/norm2; + + double K1h = Kfactors::K1boson_normalized( + 0, TC); // K1_boson_interp(0,TC,PyLoad)/norm1; + double K4h = Kfactors::K4boson_normalized( + 0, TC); // K4_boson_interp(0,TC,PyLoad)/norm1; + double K5h = Kfactors::K5boson_normalized( + 0, TC); // K5_boson_interp(0,TC,PyLoad)/norm2; + + double Dh = 20.0 / TC; + double Dt = 6.0 / TC; + + double GH = mws / (50.0 * TC); + double GY = 4.2e-3 * TC; + double GM = mtsquared / (63 * TC); + double GSS = 4.9e-4 * TC; + + double GHTot = K4h / (K1h * Dh); + double GTTot = K4t / (K1t * Dt); + double GBTot = K4b / (K1b * Dt); + double GW = GHTot; + + double dtheta = calculate_theta(z, 1); + double d2theta = calculate_theta(z, 2); + + double St = -vw * K8t * (mtsquared * d2theta + dmtsquared * dtheta) + + vw * K9t * dtheta * mtsquared * dmtsquared; + + if (UseVelocityTransportEquations) + { + double mut2 = x[0]; + double mub2 = x[1]; + double mutc2 = x[2]; + double muh2 = x[3]; + double ut2 = x[4]; + double ub2 = x[5]; + double utc2 = x[6]; + double uh2 = x[7]; + + dxdt[0] = + (double)((-3 * K2t * K5t * mut2 * vw * vw * dmtsquared + + 27 * GSS * K1b * K5t * mub2 * vw + + 27 * GSS * K1t * K5t * mut2 * vw - + 27 * GSS * K1t * K5t * mutc2 * vw + 6 * GM * K5t * mut2 * vw + + 6 * GM * K5t * mutc2 * vw + 3 * GSS * K5t * mub2 * vw + + 3 * GSS * K5t * mut2 * vw + 3 * GSS * K5t * mutc2 * vw - + 3 * GW * K5t * mub2 * vw + 3 * GW * K5t * mut2 * vw + + 3 * GY * K5t * muh2 * vw + 3 * GY * K5t * mut2 * vw + + 3 * GY * K5t * mutc2 * vw + 3 * K6t * ut2 * vw * dmtsquared + + 3 * GTTot * ut2 - St) / + (K1t * K5t * vw * vw + K4t)) / + 0.3e1; + dxdt[1] = + (9 * GSS * K1b * K5b * mub2 * vw + 9 * GSS * K1t * K5b * mut2 * vw - + 9 * GSS * K1t * K5b * mutc2 * vw + GSS * K5b * mub2 * vw + + GSS * K5b * mut2 * vw + GSS * K5b * mutc2 * vw + GW * K5b * mub2 * vw - + GW * K5b * mut2 * vw + GY * K5b * mub2 * vw + GY * K5b * muh2 * vw + + GY * K5b * mutc2 * vw + GBTot * ub2) / + (K1b * K5b * vw * vw + K4b); + dxdt[2] = + (double)((-3 * K2t * K5t * mutc2 * vw * vw * dmtsquared + + 27 * GSS * K1b * K5t * mub2 * vw + + 27 * GSS * K1t * K5t * mut2 * vw - + 27 * GSS * K1t * K5t * mutc2 * vw + 6 * GM * K5t * mut2 * vw + + 6 * GM * K5t * mutc2 * vw + 3 * GSS * K5t * mub2 * vw + + 3 * GSS * K5t * mut2 * vw + 3 * GSS * K5t * mutc2 * vw + + 3 * GY * K5t * mub2 * vw + 6 * GY * K5t * muh2 * vw + + 3 * GY * K5t * mut2 * vw + 6 * GY * K5t * mutc2 * vw + + 3 * K6t * utc2 * vw * dmtsquared + 3 * GTTot * utc2 - St) / + (K1t * K5t * vw * vw + K4t)) / + 0.3e1; + dxdt[3] = (double)((4 * GH * K5h * muh2 * vw + 3 * GY * K5h * mub2 * vw + + 6 * GY * K5h * muh2 * vw + 3 * GY * K5h * mut2 * vw + + 6 * GY * K5h * mutc2 * vw + 4 * GHTot * uh2) / + (K1h * K5h * vw * vw + K4h)) / + 0.4e1; + dxdt[4] = + (double)((-3 * K1t * K6t * ut2 * vw * vw * dmtsquared - + 3 * K2t * K4t * mut2 * vw * dmtsquared + + 27 * GSS * K1b * K4t * mub2 + 27 * GSS * K1t * K4t * mut2 - + 27 * GSS * K1t * K4t * mutc2 - 3 * GTTot * K1t * ut2 * vw + + 6 * GM * K4t * mut2 + 6 * GM * K4t * mutc2 + + 3 * GSS * K4t * mub2 + 3 * GSS * K4t * mut2 + + 3 * GSS * K4t * mutc2 - 3 * GW * K4t * mub2 + + 3 * GW * K4t * mut2 + 3 * GY * K4t * muh2 + + 3 * GY * K4t * mut2 + 3 * GY * K4t * mutc2 + K1t * St * vw) / + (K1t * K5t * vw * vw + K4t)) / + 0.3e1; + dxdt[5] = -(GBTot * K1b * ub2 * vw - 9 * GSS * K1b * K4b * mub2 - + 9 * GSS * K1t * K4b * mut2 + 9 * GSS * K1t * K4b * mutc2 - + GSS * K4b * mub2 - GSS * K4b * mut2 - GSS * K4b * mutc2 - + GW * K4b * mub2 + GW * K4b * mut2 - GY * K4b * mub2 - + GY * K4b * muh2 - GY * K4b * mutc2) / + (K1b * K5b * vw * vw + K4b); + dxdt[6] = + (double)((-3 * K1t * K6t * utc2 * vw * vw * dmtsquared - + 3 * K2t * K4t * mutc2 * vw * dmtsquared + + 27 * GSS * K1b * K4t * mub2 + 27 * GSS * K1t * K4t * mut2 - + 27 * GSS * K1t * K4t * mutc2 - 3 * GTTot * K1t * utc2 * vw + + 6 * GM * K4t * mut2 + 6 * GM * K4t * mutc2 + + 3 * GSS * K4t * mub2 + 3 * GSS * K4t * mut2 + + 3 * GSS * K4t * mutc2 + 3 * GY * K4t * mub2 + + 6 * GY * K4t * muh2 + 3 * GY * K4t * mut2 + + 6 * GY * K4t * mutc2 + K1t * St * vw) / + (K1t * K5t * vw * vw + K4t)) / + 0.3e1; + dxdt[7] = (double)((-4 * GHTot * K1h * uh2 * vw + 4 * GH * K4h * muh2 + + 3 * GY * K4h * mub2 + 6 * GY * K4h * muh2 + + 3 * GY * K4h * mut2 + 6 * GY * K4h * mutc2) / + (K1h * K5h * vw * vw + K4h)) / + 0.4e1; + } + else + { + double mut2 = x[0]; + double mub2 = x[1]; + double mutc2 = x[2]; + double muh2 = x[3]; + double dmut2 = x[4]; + double dmub2 = x[5]; + double dmutc2 = x[6]; + double dmuh2 = x[7]; + + dxdt[0] = dmut2; + dxdt[1] = dmub2; + dxdt[2] = dmutc2; + dxdt[3] = dmuh2; + + double dSt = + -vw * K8t * (2 * dmtsquared * d2theta) + + vw * K9t * (d2theta * mtsquared + dtheta * dmtsquared) * dmtsquared; + + double ddmut2, ddmutc2, ddmuh2, ddmub2; + + ddmut2 = ((-3 * K2t * K6t * mut2 * vw * vw * dmtsquared * dmtsquared + + 27 * GSS * K1b * K6t * mub2 * vw * dmtsquared + + 27 * GSS * K1t * K6t * mut2 * vw * dmtsquared - + 27 * GSS * K1t * K6t * mutc2 * vw * dmtsquared - + 3 * K1t * K6t * dmut2 * vw * vw * dmtsquared + + 6 * GM * K6t * mut2 * vw * dmtsquared + + 6 * GM * K6t * mutc2 * vw * dmtsquared + + 3 * GSS * K6t * mub2 * vw * dmtsquared + + 3 * GSS * K6t * mut2 * vw * dmtsquared + + 3 * GSS * K6t * mutc2 * vw * dmtsquared - + 3 * GTTot * K2t * mut2 * vw * dmtsquared - + 3 * GW * K6t * mub2 * vw * dmtsquared + + 3 * GW * K6t * mut2 * vw * dmtsquared + + 3 * GY * K6t * muh2 * vw * dmtsquared + + 3 * GY * K6t * mut2 * vw * dmtsquared + + 3 * GY * K6t * mutc2 * vw * dmtsquared + + 27 * GSS * GTTot * K1b * mub2 + 27 * GSS * GTTot * K1t * mut2 - + 27 * GSS * GTTot * K1t * mutc2 - 3 * GTTot * K1t * dmut2 * vw + + 6 * GM * GTTot * mut2 + 6 * GM * GTTot * mutc2 + + 3 * GSS * GTTot * mub2 + 3 * GSS * GTTot * mut2 + + 3 * GSS * GTTot * mutc2 - 3 * GTTot * GW * mub2 + + 3 * GTTot * GW * mut2 + 3 * GTTot * GY * muh2 + + 3 * GTTot * GY * mut2 + 3 * GTTot * GY * mutc2 - dSt) / + K4t) / + 0.3e1; + ddmutc2 = ((-3 * K2t * K6t * mutc2 * vw * vw * dmtsquared * dmtsquared + + 27 * GSS * K1b * K6t * mub2 * vw * dmtsquared + + 27 * GSS * K1t * K6t * mut2 * vw * dmtsquared - + 27 * GSS * K1t * K6t * mutc2 * vw * dmtsquared - + 3 * K1t * K6t * dmutc2 * vw * vw * dmtsquared + + 6 * GM * K6t * mut2 * vw * dmtsquared + + 6 * GM * K6t * mutc2 * vw * dmtsquared + + 3 * GSS * K6t * mub2 * vw * dmtsquared + + 3 * GSS * K6t * mut2 * vw * dmtsquared + + 3 * GSS * K6t * mutc2 * vw * dmtsquared - + 3 * GTTot * K2t * mutc2 * vw * dmtsquared + + 3 * GY * K6t * mub2 * vw * dmtsquared + + 6 * GY * K6t * muh2 * vw * dmtsquared + + 3 * GY * K6t * mut2 * vw * dmtsquared + + 6 * GY * K6t * mutc2 * vw * dmtsquared + + 27 * GSS * GTTot * K1b * mub2 + 27 * GSS * GTTot * K1t * mut2 - + 27 * GSS * GTTot * K1t * mutc2 - 3 * GTTot * K1t * dmutc2 * vw + + 6 * GM * GTTot * mut2 + 6 * GM * GTTot * mutc2 + + 3 * GSS * GTTot * mub2 + 3 * GSS * GTTot * mut2 + + 3 * GSS * GTTot * mutc2 + 3 * GTTot * GY * mub2 + + 6 * GTTot * GY * muh2 + 3 * GTTot * GY * mut2 + + 6 * GTTot * GY * mutc2 - dSt) / + K4t) / + 0.3e1; + + ddmuh2 = (GHTot * + (-4 * vw * K1h * dmuh2 + 4 * GH * muh2 + 3 * mub2 * GY + + 6 * GY * muh2 + 3 * mut2 * GY + 6 * GY * mutc2) / + K4h) / + 0.4e1; + + ddmub2 = + GBTot * + (9 * GSS * K1b * mub2 + 9 * GSS * K1t * mut2 - 9 * GSS * K1t * mutc2 - + vw * K1b * dmub2 + GSS * mub2 + GSS * mut2 + GSS * mutc2 + mub2 * GW - + mut2 * GW + GY * mub2 + muh2 * GY + mutc2 * GY) / + K4b; + + dxdt[4] = ddmut2; + dxdt[6] = ddmutc2; + dxdt[7] = ddmuh2; + dxdt[5] = ddmub2; + + // //ddmut2 + // dxdt[4] = (double) ((-3 * K2t * K6t * mut2 * vw * vw * dmtsquared * + //dmtsquared + 27 * GSS * K1b * K6t * mub2 * vw * dmtsquared + 27 * GSS * + //K1t * K6t * mut2 * vw * dmtsquared - 27 * GSS * K1t * K6t * mutc2 * vw * + //dmtsquared - 3 * K1t * K6t * dmut2 * vw * vw * dmtsquared + 6 * GM * K6t * + //mut2 * vw * dmtsquared + 6 * GM * K6t * mutc2 * vw * dmtsquared + 3 * GSS + //* K6t * mub2 * vw * dmtsquared + 3 * GSS * K6t * mut2 * vw * dmtsquared + + //3 * GSS * K6t * mutc2 * vw * dmtsquared - 3 * GTTot * K2t * mut2 * vw * + //dmtsquared - 3 * GW * K6t * mub2 * vw * dmtsquared + 3 * GW * K6t * mut2 * + //vw * dmtsquared + 3 * GY * K6t * muh2 * vw * dmtsquared + 3 * GY * K6t * + //mut2 * vw * dmtsquared + 3 * GY * K6t * mutc2 * vw * dmtsquared + 27 * GSS + //* GTTot * K1b * mub2 + 27 * GSS * GTTot * K1t * mut2 - 27 * GSS * GTTot * + //K1t * mutc2 - 3 * GTTot * K1t * dmut2 * vw + 6 * GM * GTTot * mut2 + 6 * + //GM * GTTot * mutc2 + 3 * GSS * GTTot * mub2 + 3 * GSS * GTTot * mut2 + 3 * + //GSS * GTTot * mutc2 - 3 * GTTot * GW * mub2 + 3 * GTTot * GW * mut2 + 3 * + //GTTot * GY * muh2 + 3 * GTTot * GY * mut2 + 3 * GTTot * GY * mutc2 - dSt) + /// K4t) / 0.3e1; + // //ddmutc2 + // dxdt[6] = (double) ((-3 * vw * vw * K2t * dmtsquared * dmtsquared * + //mutc2 * K6t + 27 * GSS * K1b * K6t * mub2 * vw * dmtsquared + 27 * GSS * + //K1t * K6t * mut2 * vw * dmtsquared - 27 * GSS * K1t * K6t * mutc2 * vw * + //dmtsquared - 3 * vw * vw * K1t * dmutc2 * K6t * dmtsquared + 6 * GM * K6t + //* mut2 * vw * dmtsquared + 6 * GM * K6t * mutc2 * vw * dmtsquared + 3 * + //GSS * K6t * mub2 * vw * dmtsquared + 3 * GSS * K6t * mut2 * vw * + //dmtsquared + 3 * GSS * K6t * mutc2 * vw * dmtsquared + 3 * GY * K6t * vw * + //dmtsquared * mub2 + 6 * GY * K6t * muh2 * vw * dmtsquared + 3 * GY * K6t * + //mut2 * vw * dmtsquared + 6 * GY * K6t * mutc2 * vw * dmtsquared - dSt) / + //K4t) / 0.3e1; + // //ddmuh2 + // dxdt[7] = (double) (GHTot * (-4 * vw * K1h * dmuh2 + 3 * mub2 * GY + 6 + //* muh2 * GY + 3 * mut2 * GY + 6 * mutc2 * GY + 4 * GH * muh2) / K4h) / + //0.4e1; + // //ddmub2 + // dxdt[5] = GBTot * (9 * GSS * mub2 * K1b + 9 * mut2 * GSS * K1t - 9 * + //GSS * mutc2 * K1t - vw * K1b * dmub2 + GSS * mub2 + mut2 * GSS + GSS * + //mutc2 + mub2 * GW - mut2 * GW + mub2 * GY + muh2 * GY + mutc2 * GY) / K4b; + } + + return *this; +} + +std::vector +calculateTransportEquation(const double &z, + const std::vector &parStart, + const struct GSL_integration_mubl ¶ms) +{ + using namespace boost::numeric::odeint; + const double C_AbsErr = 1e-10; // 1.0e-10 + const double C_RelErr = 1e-3; // 1.0e-6 + + std::size_t dim = 8; + // dim = 1; + state_type x(dim); + for (std::size_t i = 0; i < dim; i++) + x[i] = parStart[i]; + + transport_equations transport(params); + std::vector x_vec; + std::vector times; + + double zInitial = params.getZMAX(); + + double stepsize_initial = (z - zInitial) * 1e-5; + if (stepsize_initial == 0) stepsize_initial = -1e-7; + double abs_err = C_AbsErr; + double rel_err = C_RelErr; + + // steps = integrate(transport,x,zInitial,z,stepsize_initial); + // steps = integrate_adaptive( make_controlled( abs_err , rel_err , + //error_stepper_type() ) ,RGE , x , EnergyStart , EnergyEnd , stepsize_initial + //); + + integrate_adaptive(make_controlled(abs_err, rel_err, error_stepper_type()), + transport, + x, + zInitial, + z, + stepsize_initial, + push_back_state_and_time(x_vec, times)); + + std::vector parEnd; + for (std::size_t i = 0; i < dim; i++) + parEnd.push_back(x[i]); + for (std::size_t i = 0; i < dim; i++) + { + if (std::abs(parEnd[i]) <= std::pow(10, -16)) parEnd[i] = 0; + } + + std::vector topres, vev; + vev = transport.calculate_vev(z); + topres = transport.get_top_mass_and_derivative(vev); + double mtsquared = topres.at(0); + double K1t = Kfactors::K1fermion_normalized(mtsquared, params.getTC()); + double K1b = Kfactors::K1fermion_normalized(0, params.getTC()); + + parEnd.push_back(K1t); + parEnd.push_back(K1b); + + if (std::isnan(parEnd.at(0))) + { + std::cout << "Nan in " << __func__ << std::endl + << "parEnd.size() = " << parEnd.size() << "\nparEnd = "; + for (std::size_t i = 0; i < parEnd.size(); i++) + std::cout << parEnd.at(i) << sep; + std::cout << std::endl; + } + return parEnd; +} + +double mubl_func(double z, void *p) +{ + struct GSL_integration_mubl *params = (struct GSL_integration_mubl *)p; + std::vector parStart, parEnd; + for (int i = 0; i < 8; i++) + parStart.push_back(0); + + parEnd = calculateTransportEquation(z, parStart, *params); + double K1t = parEnd.at(8); + double K1b = parEnd.at(9); + double mut2 = parEnd.at(0); + double mub2 = parEnd.at(1); + double mutc2 = parEnd.at(2); + + double res = + 0.5 * (1 + 4 * K1t) * mut2 + 0.5 * (1 + 4 * K1b) * mub2 - 2 * K1t * mutc2; + if (std::isnan(res)) + { + std::cout << "res = nan at z = " << z << std::endl; + std::cout << "K1t = " << K1t << "\nK1b = " << K1b << "\nmut2 = " << mut2 + << "\nmub2 = " << mub2 << "\nmutc2 = " << mutc2 << std::endl; + } + return res; +} + +double eta_integrand_func(double z, void *p) +{ + struct GSL_integration_mubl *params = static_cast(p); + double mubl = mubl_func(z, p); + double GWS = 1e-6 * params->getTC(); + double nu = 45 * GWS / (4 * params->getvw()); + double damping = std::exp(-nu * z); + double res = mubl * damping; + return res; } +double Integrate_mubl(const struct GSL_integration_mubl &pIn) +{ + std::size_t workspace_size = 1000; + gsl_integration_workspace *w = + gsl_integration_workspace_alloc(workspace_size); + double result, error; + GSL_integration_mubl p = pIn; + gsl_function F; + F.function = &eta_integrand_func; + F.params = &p; -double Integrate_mubl(const struct GSL_integration_mubl& pIn){ - std::size_t workspace_size = 1000; - gsl_integration_workspace *w = gsl_integration_workspace_alloc(workspace_size); - double result, error; - GSL_integration_mubl p = pIn; - gsl_function F; - F.function=&eta_integrand_func; - F.params=&p; - - double zmax = p.getZMAX(); - - gsl_integration_qags(&F,0,zmax,0,1e-7,workspace_size,w,&result,&error); + double zmax = p.getZMAX(); - gsl_integration_workspace_free(w); + gsl_integration_qags( + &F, 0, zmax, 0, 1e-7, workspace_size, w, &result, &error); + gsl_integration_workspace_free(w); - return result; + return result; } - -GSL_mubl_interpolation generate_mubl_spline(const struct GSL_integration_mubl& p, int nstep) +GSL_mubl_interpolation +generate_mubl_spline(const struct GSL_integration_mubl &p, int nstep) { - double MaxZ = p.getZMAX(); - double stepsize= (MaxZ-0)/nstep; - std::vector ydata; - struct GSL_integration_mubl pIn; - - pIn = p; - for(int i=0;i<=nstep;i++){ - double z = i*stepsize; - double resmubl = mubl_func(z,&pIn); - ydata.push_back(resmubl); - - } - - boost_cubic_b_spline splinef(ydata.data(),ydata.size(),0,stepsize); - GSL_mubl_interpolation spline; - spline.spline = splinef; - spline.vw = p.getvw(); - spline.TC = p.getTC(); - return spline; -} - - -double mubl_interpolation(double z,void *p){ - struct GSL_mubl_interpolation * params = static_cast(p); - double GWS = 1e-6*params->TC; - double nu = 45*GWS/(4*params->vw); - double res = params->spline(z)*std::exp(-nu*z); - return res; + double MaxZ = p.getZMAX(); + double stepsize = (MaxZ - 0) / nstep; + std::vector ydata; + struct GSL_integration_mubl pIn; + + pIn = p; + for (int i = 0; i <= nstep; i++) + { + double z = i * stepsize; + double resmubl = mubl_func(z, &pIn); + ydata.push_back(resmubl); + } + + boost_cubic_b_spline splinef(ydata.data(), ydata.size(), 0, stepsize); + GSL_mubl_interpolation spline; + spline.spline = splinef; + spline.vw = p.getvw(); + spline.TC = p.getTC(); + return spline; +} + +double mubl_interpolation(double z, void *p) +{ + struct GSL_mubl_interpolation *params = + static_cast(p); + double GWS = 1e-6 * params->TC; + double nu = 45 * GWS / (4 * params->vw); + double res = params->spline(z) * std::exp(-nu * z); + return res; } +double Integrate_mubl_interpolated(const struct GSL_integration_mubl &p) +{ -double Integrate_mubl_interpolated(const struct GSL_integration_mubl& p){ - - double vw = p.getvw(); - - int nstep=100; - auto spline = generate_mubl_spline(p, nstep); + double vw = p.getvw(); - std::size_t workspace_size = 1000; - gsl_integration_workspace *w = gsl_integration_workspace_alloc(workspace_size); - double result, error; - gsl_function F; - F.function=&mubl_interpolation; - F.params=&spline; + int nstep = 100; + auto spline = generate_mubl_spline(p, nstep); - double zmax = p.getZMAX(); + std::size_t workspace_size = 1000; + gsl_integration_workspace *w = + gsl_integration_workspace_alloc(workspace_size); + double result, error; + gsl_function F; + F.function = &mubl_interpolation; + F.params = &spline; - gsl_integration_qags(&F,0,zmax,0,1e-9,workspace_size,w,&result,&error); + double zmax = p.getZMAX(); - gsl_integration_workspace_free(w); + gsl_integration_qags( + &F, 0, zmax, 0, 1e-9, workspace_size, w, &result, &error); + gsl_integration_workspace_free(w); - double GWS = 1e-6*p.getTC(); - double gstar = 106.75; - double prefac = 405*GWS/(4*M_PI*M_PI*vw*gstar*p.getTC()); + double GWS = 1e-6 * p.getTC(); + double gstar = 106.75; + double prefac = 405 * GWS / (4 * M_PI * M_PI * vw * gstar * p.getTC()); - result *= prefac; - return result; + result *= prefac; + return result; } -} -} +} // namespace Baryo +} // namespace BSMPT diff --git a/src/minimizer/LibCMAES/MinimizeLibCMAES.cpp b/src/minimizer/LibCMAES/MinimizeLibCMAES.cpp index b9d36539..a8d6cd5d 100644 --- a/src/minimizer/LibCMAES/MinimizeLibCMAES.cpp +++ b/src/minimizer/LibCMAES/MinimizeLibCMAES.cpp @@ -22,148 +22,140 @@ */ #include -#include #include +#include -#include // for Candidate -#include // for cmaes -#include // for CMAParameters -#include // for CMASolutions -#include // for aCMAES -#include // for FitFunc -#include // for GenoPheno -#include // for libcmaes - -namespace BSMPT { -namespace Minimizer{ -namespace LibCMAES { +#include // for Candidate +#include // for cmaes +#include // for CMAParameters +#include // for CMASolutions +#include // for aCMAES +#include // for FitFunc +#include // for GenoPheno +#include // for libcmaes + +namespace BSMPT +{ +namespace Minimizer +{ +namespace LibCMAES +{ using namespace libcmaes; -LibCMAESReturn min_cmaes_gen_all( - const std::shared_ptr& modelPointer, - const double& Temp, - const std::vector& Start){ - - auto dim = modelPointer->get_nVEV(); - - std::vector x0 = Start; - - - double sigma; - sigma = 5; +LibCMAESReturn +min_cmaes_gen_all(const std::shared_ptr &modelPointer, + const double &Temp, + const std::vector &Start) +{ + auto dim = modelPointer->get_nVEV(); - //sigma *= 0.5;//0.5; - double ftol=1e-5; + std::vector x0 = Start; + double sigma; + sigma = 5; - //CMAParameters<> cmaparams(dim,&x0.front(),sigma); - CMAParameters<> cmaparams(x0,sigma); + // sigma *= 0.5;//0.5; + double ftol = 1e-5; + // CMAParameters<> cmaparams(dim,&x0.front(),sigma); + CMAParameters<> cmaparams(x0, sigma); - //cmaparams.set_mt_feval(true); - cmaparams.set_algo(aCMAES); - //cmaparams.set_elitism(1); - //cmaparams.set_noisy(); - cmaparams.set_ftolerance(ftol); + // cmaparams.set_mt_feval(true); + cmaparams.set_algo(aCMAES); + // cmaparams.set_elitism(1); + // cmaparams.set_noisy(); + cmaparams.set_ftolerance(ftol); + FitFunc cmafunc = [=](const double *v, const int &N) { + (void)N; + std::vector vev; + for (std::size_t i{0}; i < modelPointer->get_nVEV(); ++i) + vev.push_back(v[i]); + return modelPointer->VEff(modelPointer->MinimizeOrderVEV(vev), Temp); + }; - FitFunc cmafunc = [=](const double*v, const int& N){ - (void) N; - std::vector vev; - for(std::size_t i{0};iget_nVEV();++i) vev.push_back(v[i]); - return modelPointer->VEff(modelPointer->MinimizeOrderVEV(vev),Temp); - }; + CMASolutions cmasols = cmaes<>(cmafunc, cmaparams); - CMASolutions cmasols = cmaes<>(cmafunc,cmaparams); + Candidate bcand = cmasols.best_candidate(); - Candidate bcand = cmasols.best_candidate(); + std::vector xsol = bcand.get_x(); - std::vector xsol = bcand.get_x(); + std::vector sol; + for (std::size_t i = 0; i < dim; i++) + { + sol.push_back(xsol.at(i)); + } - std::vector sol; - - for(std::size_t i = 0;i &Start) +{ -LibCMAESReturn CMAES_Minimize_Plane_gen_all( - const struct PointerContainerMinPlane& params, - const std::vector& Start){ - + std::shared_ptr modelPointer; - std::shared_ptr modelPointer; + modelPointer = params.modelPointer; - modelPointer=params.modelPointer; + auto dim = params.nVEV - 1; + std::vector x0(dim); - auto dim = params.nVEV - 1; - std::vector x0(dim); + double sigma; + sigma = 5; + for (std::size_t i = 0; i < dim; i++) + x0[i] = Start.at(i); - double sigma; - sigma = 5; + double ftol = 1e-5; - for(std::size_t i=0;i cmaparams(x0, sigma); - double ftol=1e-5; + cmaparams.set_algo(aCMAES); + cmaparams.set_ftolerance(ftol); + FitFunc CMAES_VEFF_Minimize_Plane = [=](const double *v, const int &N) { + (void)N; + std::size_t nVEVs = params.modelPointer->get_nVEV(); - CMAParameters<> cmaparams(x0,sigma); + std::vector vMinTilde; + vMinTilde.resize(nVEVs - 1); + for (std::size_t i = 0; i < nVEVs - 1; i++) + vMinTilde[i] = v[i]; + auto vev = TransformCoordinates(vMinTilde, params); - cmaparams.set_algo(aCMAES); - cmaparams.set_ftolerance(ftol); - - FitFunc CMAES_VEFF_Minimize_Plane = [=](const double* v, const int& N) - { - (void) N; - std::size_t nVEVs = params.modelPointer->get_nVEV(); - - std::vector vMinTilde; - vMinTilde.resize(nVEVs-1); - for(std::size_t i=0;iVEff(params.modelPointer->MinimizeOrderVEV(vev),params.Temp); - return res; - }; - - - CMASolutions cmasols = cmaes<>(CMAES_VEFF_Minimize_Plane,cmaparams); - - Candidate bcand = cmasols.best_candidate(); + double res = params.modelPointer->VEff( + params.modelPointer->MinimizeOrderVEV(vev), params.Temp); + return res; + }; - std::vector xsol = bcand.get_x(); + CMASolutions cmasols = cmaes<>(CMAES_VEFF_Minimize_Plane, cmaparams); - std::vector sol; + Candidate bcand = cmasols.best_candidate(); - for(std::size_t i = 0;i xsol = bcand.get_x(); - LibCMAESReturn res; - res.result = TransformCoordinates(sol,params); - res.CMAESStatus = cmasols.run_status(); + std::vector sol; - return res; + for (std::size_t i = 0; i < dim; i++) + { + sol.push_back(xsol.at(i)); + } + LibCMAESReturn res; + res.result = TransformCoordinates(sol, params); + res.CMAESStatus = cmasols.run_status(); + return res; } -} -} -} +} // namespace LibCMAES +} // namespace Minimizer +} // namespace BSMPT diff --git a/src/minimizer/LibNLOPT/MinimizeNLOPT.cpp b/src/minimizer/LibNLOPT/MinimizeNLOPT.cpp index 8094d3f4..bcccbcd3 100644 --- a/src/minimizer/LibNLOPT/MinimizeNLOPT.cpp +++ b/src/minimizer/LibNLOPT/MinimizeNLOPT.cpp @@ -1,132 +1,150 @@ #include +#include #include #include -#include #include /** *@file */ -namespace BSMPT { -namespace Minimizer { -namespace LibNLOPT { - - +namespace BSMPT +{ +namespace Minimizer +{ +namespace LibNLOPT +{ -double NLOPTVEff(const std::vector& x, std::vector& grad, void* data) +double +NLOPTVEff(const std::vector &x, std::vector &grad, void *data) { - auto settings = *static_cast(data); - (void) grad; - auto PotVEV = settings.model->MinimizeOrderVEV(x); - return settings.model->VEff(PotVEV,settings.Temp); + auto settings = *static_cast(data); + (void)grad; + auto PotVEV = settings.model->MinimizeOrderVEV(x); + return settings.model->VEff(PotVEV, settings.Temp); } -NLOPTReturnType MinimizeUsingNLOPT( - const std::shared_ptr& model, - const double& Temp) +NLOPTReturnType +MinimizeUsingNLOPT(const std::shared_ptr &model, + const double &Temp) { - ShareInformationNLOPT settings(model,Temp); - std::vector VEV(model->get_nVEV()); - - nlopt::opt opt(nlopt::GN_ORIG_DIRECT_L,static_cast(model->get_nVEV())); - std::vector LowerBound(model->get_nVEV(),-300), UpperBound(model->get_nVEV(),300); - for(std::size_t i{0};iget_nVEV();++i) + ShareInformationNLOPT settings(model, Temp); + std::vector VEV(model->get_nVEV()); + + nlopt::opt opt(nlopt::GN_ORIG_DIRECT_L, + static_cast(model->get_nVEV())); + std::vector LowerBound(model->get_nVEV(), -300), + UpperBound(model->get_nVEV(), 300); + for (std::size_t i{0}; i < model->get_nVEV(); ++i) + { + if (std::abs(model->get_vevTreeMin(i)) > UpperBound.at(i)) { - if(std::abs(model->get_vevTreeMin(i)) > UpperBound.at(i)) - { - UpperBound.at(i) = 1.5 * model->get_vevTreeMin(i); - } - if(-std::abs(model->get_vevTreeMin(i)) < LowerBound.at(i) ) - { - LowerBound.at(i) = -1.5*std::abs(model->get_vevTreeMin(i)); - } + UpperBound.at(i) = 1.5 * model->get_vevTreeMin(i); } - opt.set_lower_bounds(LowerBound); - opt.set_upper_bounds(UpperBound); - - opt.set_min_objective(NLOPTVEff,&settings); - opt.set_xtol_rel(1e-4); - double minf; - auto result = opt.optimize(VEV,minf); - bool Success = (result == nlopt::SUCCESS) or (result == nlopt::FTOL_REACHED) or (result == nlopt::XTOL_REACHED); - NLOPTReturnType res(VEV,minf,result,Success); - return res; + if (-std::abs(model->get_vevTreeMin(i)) < LowerBound.at(i)) + { + LowerBound.at(i) = -1.5 * std::abs(model->get_vevTreeMin(i)); + } + } + opt.set_lower_bounds(LowerBound); + opt.set_upper_bounds(UpperBound); + + opt.set_min_objective(NLOPTVEff, &settings); + opt.set_xtol_rel(1e-4); + double minf; + auto result = opt.optimize(VEV, minf); + bool Success = (result == nlopt::SUCCESS) or + (result == nlopt::FTOL_REACHED) or + (result == nlopt::XTOL_REACHED); + NLOPTReturnType res(VEV, minf, result, Success); + return res; } -double NLOPTVEffPlane(const std::vector& x, std::vector& grad, void* data) +double NLOPTVEffPlane(const std::vector &x, + std::vector &grad, + void *data) { - (void) grad; - auto params = *static_cast(data); - std::vector vMinTilde(std::begin(x),std::end(x)); - auto vev = TransformCoordinates(vMinTilde,params); - return params.modelPointer->VEff(params.modelPointer->MinimizeOrderVEV(vev),params.Temp); + (void)grad; + auto params = *static_cast(data); + std::vector vMinTilde(std::begin(x), std::end(x)); + auto vev = TransformCoordinates(vMinTilde, params); + return params.modelPointer->VEff(params.modelPointer->MinimizeOrderVEV(vev), + params.Temp); } -NLOPTReturnType MinimizePlaneUsingNLOPT( - const struct PointerContainerMinPlane& params) +NLOPTReturnType +MinimizePlaneUsingNLOPT(const struct PointerContainerMinPlane ¶ms) { - auto dim = params.modelPointer->get_nVEV()-1; - nlopt::opt opt(nlopt::GN_ORIG_DIRECT_L,static_cast(dim)); - std::vector LowerBound(dim,-300), UpperBound(dim,300); - for(std::size_t i{0};iget_nVEV();++i) + auto dim = params.modelPointer->get_nVEV() - 1; + nlopt::opt opt(nlopt::GN_ORIG_DIRECT_L, static_cast(dim)); + std::vector LowerBound(dim, -300), UpperBound(dim, 300); + for (std::size_t i{0}; i < params.modelPointer->get_nVEV(); ++i) + { + if (i < params.Index) { - if(iget_vevTreeMin(i)) > UpperBound.at(i)) - { - UpperBound.at(i) = 1.5 * params.modelPointer->get_vevTreeMin(i); - } - if(-std::abs(params.modelPointer->get_vevTreeMin(i)) < LowerBound.at(i) ) - { - LowerBound.at(i) = -1.5*std::abs(params.modelPointer->get_vevTreeMin(i)); - } - } - else if(i>params.Index) - { - if(std::abs(params.modelPointer->get_vevTreeMin(i)) > UpperBound.at(i-1)) - { - UpperBound.at(i-1) = 1.5 * params.modelPointer->get_vevTreeMin(i); - } - if(-std::abs(params.modelPointer->get_vevTreeMin(i)) < LowerBound.at(i-1) ) - { - LowerBound.at(i-1) = -1.5*std::abs(params.modelPointer->get_vevTreeMin(i)); - } - } + if (std::abs(params.modelPointer->get_vevTreeMin(i)) > UpperBound.at(i)) + { + UpperBound.at(i) = 1.5 * params.modelPointer->get_vevTreeMin(i); + } + if (-std::abs(params.modelPointer->get_vevTreeMin(i)) < LowerBound.at(i)) + { + LowerBound.at(i) = + -1.5 * std::abs(params.modelPointer->get_vevTreeMin(i)); + } } - opt.set_lower_bounds(LowerBound); - opt.set_upper_bounds(UpperBound); - - std::vector VEV(params.modelPointer->get_nVEV()-1); - auto copy = params; - opt.set_min_objective(NLOPTVEffPlane,©); - opt.set_xtol_rel(1e-4); - double minf; - auto result = opt.optimize(VEV,minf); - auto minimum = TransformCoordinates(VEV,params); - bool Success = (result == nlopt::SUCCESS) or (result == nlopt::FTOL_REACHED) or (result == nlopt::XTOL_REACHED); - NLOPTReturnType res(minimum,minf,result,Success); - return res; + else if (i > params.Index) + { + if (std::abs(params.modelPointer->get_vevTreeMin(i)) > + UpperBound.at(i - 1)) + { + UpperBound.at(i - 1) = 1.5 * params.modelPointer->get_vevTreeMin(i); + } + if (-std::abs(params.modelPointer->get_vevTreeMin(i)) < + LowerBound.at(i - 1)) + { + LowerBound.at(i - 1) = + -1.5 * std::abs(params.modelPointer->get_vevTreeMin(i)); + } + } + } + opt.set_lower_bounds(LowerBound); + opt.set_upper_bounds(UpperBound); + + std::vector VEV(params.modelPointer->get_nVEV() - 1); + auto copy = params; + opt.set_min_objective(NLOPTVEffPlane, ©); + opt.set_xtol_rel(1e-4); + double minf; + auto result = opt.optimize(VEV, minf); + auto minimum = TransformCoordinates(VEV, params); + bool Success = (result == nlopt::SUCCESS) or + (result == nlopt::FTOL_REACHED) or + (result == nlopt::XTOL_REACHED); + NLOPTReturnType res(minimum, minf, result, Success); + return res; } -NLOPTReturnType FindLocalMinimum(const std::shared_ptr& model, const std::vector& Start, - const double& Temp) +NLOPTReturnType +FindLocalMinimum(const std::shared_ptr &model, + const std::vector &Start, + const double &Temp) { - nlopt::opt opt(nlopt::LN_COBYLA,static_cast(model->get_nVEV())); - ShareInformationNLOPT settings(model,Temp); - auto VEV = Start; - opt.set_min_objective(NLOPTVEff,&settings); - opt.set_xtol_rel(1e-4); - - - double minf; - auto result = opt.optimize(VEV,minf); - bool Success = (result == nlopt::SUCCESS) or (result == nlopt::FTOL_REACHED) or (result == nlopt::XTOL_REACHED); - NLOPTReturnType res(VEV,minf,result,Success); - - return res; - + nlopt::opt opt(nlopt::LN_COBYLA, + static_cast(model->get_nVEV())); + ShareInformationNLOPT settings(model, Temp); + auto VEV = Start; + opt.set_min_objective(NLOPTVEff, &settings); + opt.set_xtol_rel(1e-4); + + double minf; + auto result = opt.optimize(VEV, minf); + bool Success = (result == nlopt::SUCCESS) or + (result == nlopt::FTOL_REACHED) or + (result == nlopt::XTOL_REACHED); + NLOPTReturnType res(VEV, minf, result, Success); + + return res; } -} -} -} +} // namespace LibNLOPT +} // namespace Minimizer +} // namespace BSMPT diff --git a/src/minimizer/Minfunc_gen.cpp b/src/minimizer/Minfunc_gen.cpp index 386fc6d1..a9dae44f 100644 --- a/src/minimizer/Minfunc_gen.cpp +++ b/src/minimizer/Minfunc_gen.cpp @@ -3,47 +3,44 @@ * * Copyright (C) 2018 Philipp Basler and Margarete Mühlleitner - This program 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. - - This program 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 this program. If not, see . + This program 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. + + This program 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 this program. If not, see . */ -#include // for Candidate -#include // for cmaes -#include // for CMAParameters -#include // for CMASolutions -#include // for aCMAES -#include // for FitFunc -#include // for GenoPheno -#include // for libcmaes -#include // for copy, max -#include // for operator<<, endl, cout -#include // for shared_ptr, __shared_... -#include // for vector -#include // for Class_Potential_Origin #include +#include // for Class_Potential_Origin +#include // for copy, max +#include // for operator<<, endl, cout +#include // for Candidate +#include // for cmaes +#include // for CMAParameters +#include // for CMASolutions +#include // for aCMAES +#include // for FitFunc +#include // for GenoPheno +#include // for libcmaes +#include // for shared_ptr, __shared_... +#include // for vector /** * @file * Finding a candidate for the global minimum using the CMA-ES algorithm */ -namespace BSMPT { -namespace Minimizer{ - - +namespace BSMPT +{ +namespace Minimizer +{ - - - -} } +} // namespace BSMPT diff --git a/src/minimizer/MinimizeGSL.cpp b/src/minimizer/MinimizeGSL.cpp index ee74a898..ad83174b 100644 --- a/src/minimizer/MinimizeGSL.cpp +++ b/src/minimizer/MinimizeGSL.cpp @@ -3,280 +3,289 @@ * * Copyright (C) 2018 Philipp Basler and Margarete Mühlleitner - This program 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. - - This program 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 this program. If not, see . + This program 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. + + This program 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 this program. If not, see . */ /** * @file - * Using the Nelder-Mead Simplex algorithm, implemented in gsl, to find multiple local minima of the model - * and compare them to find a candidate for the global minimum. + * Using the Nelder-Mead Simplex algorithm, implemented in gsl, to find multiple + * local minima of the model and compare them to find a candidate for the global + * minimum. */ - #include -#include // for gsl_set_error_handler... -#include // for gsl_multimin_fminimizer -#include // for gsl_vector_get, gsl_v... -#include // for printf -#include // for time, NULL, std::size_t -#include // for copy, max -#include // for operator<<, endl, bas... -#include // for numeric_limits, numer... -#include // for shared_ptr, __shared_... -#include // for default_random_engine -#include // for vector -#include // for Class_Potential_Origin #include +#include // for Class_Potential_Origin +#include // for copy, max +#include // for gsl_set_error_handler... +#include // for gsl_multimin_fminimizer +#include // for gsl_vector_get, gsl_v... +#include // for operator<<, endl, bas... +#include // for numeric_limits, numer... +#include // for shared_ptr, __shared_... +#include // for default_random_engine +#include // for printf +#include // for time, NULL, std::size_t +#include // for vector - -#include #include #include #include +#include - -namespace BSMPT { -namespace Minimizer{ - - +namespace BSMPT +{ +namespace Minimizer +{ double GSL_VEFF_gen_all(const gsl_vector *v, void *p) { - struct GSL_params * params = static_cast(p); - - std::vector vMin; - auto nVEVs = params->modelPointer->get_nVEV(); + struct GSL_params *params = static_cast(p); - for(std::size_t i=0;i vMin; + auto nVEVs = params->modelPointer->get_nVEV(); - auto vIn=params->modelPointer->MinimizeOrderVEV(vMin); + for (std::size_t i = 0; i < nVEVs; i++) + { + vMin.push_back(gsl_vector_get(v, i)); + } - double res = params->modelPointer->VEff(vIn,params->Temp,0); + auto vIn = params->modelPointer->MinimizeOrderVEV(vMin); - return res; + double res = params->modelPointer->VEff(vIn, params->Temp, 0); + return res; } - - -int GSL_Minimize_From_S_gen_all(struct GSL_params& params, std::vector& sol,const std::vector& start) +int GSL_Minimize_From_S_gen_all(struct GSL_params ¶ms, + std::vector &sol, + const std::vector &start) { - gsl_set_error_handler_off(); - - // struct GSL_params * params = (struct GSL_params *) p; - const gsl_multimin_fminimizer_type *T = gsl_multimin_fminimizer_nmsimplex2; - gsl_multimin_fminimizer *s = nullptr; - gsl_vector *ss, *x; - gsl_multimin_function minex_func; - - double ftol = GSL_Tolerance; - std::size_t MaxIter = 600; - - std::size_t iter = 0; - int status; - double size; - - std::size_t dim = params.modelPointer->get_nVEV(); - - /* Starting point */ - x = gsl_vector_alloc (dim); - for(std::size_t k=0;kx,k)); - } - else{ - for(std::size_t k=0;kget_nVEV(); + + /* Starting point */ + x = gsl_vector_alloc(dim); + for (std::size_t k = 0; k < dim; k++) + gsl_vector_set(x, k, start.at(k)); + ss = gsl_vector_alloc(dim); + gsl_vector_set_all(ss, 1.0); + + /* Initialize method and iterate */ + minex_func.n = dim; + minex_func.f = &GSL_VEFF_gen_all; + minex_func.params = ¶ms; + s = gsl_multimin_fminimizer_alloc(T, dim); + gsl_multimin_fminimizer_set(s, &minex_func, x, ss); + + do + { + iter++; + status = gsl_multimin_fminimizer_iterate(s); + + if (status) break; + + size = gsl_multimin_fminimizer_size(s); + status = gsl_multimin_test_size(size, ftol); + + } while (status == GSL_CONTINUE && iter < MaxIter); + + if (status == GSL_SUCCESS) + { + for (std::size_t k = 0; k < dim; k++) + sol.push_back(gsl_vector_get(s->x, k)); + } + else + { + for (std::size_t k = 0; k < dim; k++) + sol.push_back(0); + } + + gsl_vector_free(x); + gsl_vector_free(ss); + gsl_multimin_fminimizer_free(s); + + return status; } - - -std::pair,bool> GSL_Minimize_gen_all( - const std::shared_ptr& modelPointer, - const double& Temp, - const int& seed, - const std::size_t& MaxSol){ - std::vector> saveAllMinima; - auto result = GSL_Minimize_gen_all(modelPointer,Temp, seed ,saveAllMinima, MaxSol); - return result; +std::pair, bool> GSL_Minimize_gen_all( + const std::shared_ptr &modelPointer, + const double &Temp, + const int &seed, + const std::size_t &MaxSol) +{ + std::vector> saveAllMinima; + auto result = + GSL_Minimize_gen_all(modelPointer, Temp, seed, saveAllMinima, MaxSol); + return result; } - -std::pair,bool> GSL_Minimize_gen_all( - const std::shared_ptr& modelPointer, - const double& Temp, - const int& seed){ - std::vector> saveAllMinima; - std::size_t MaxSol = 20; - auto result = GSL_Minimize_gen_all(modelPointer,Temp, seed ,saveAllMinima, MaxSol); - return result; +std::pair, bool> GSL_Minimize_gen_all( + const std::shared_ptr &modelPointer, + const double &Temp, + const int &seed) +{ + std::vector> saveAllMinima; + std::size_t MaxSol = 20; + auto result = + GSL_Minimize_gen_all(modelPointer, Temp, seed, saveAllMinima, MaxSol); + return result; } -std::pair,bool> GSL_Minimize_gen_all( - const std::shared_ptr& modelPointer, - const double& Temp, - const int& seed , - std::vector>& saveAllMinima, - const std::size_t& MaxSol) +std::pair, bool> GSL_Minimize_gen_all( + const std::shared_ptr &modelPointer, + const double &Temp, + const int &seed, + std::vector> &saveAllMinima, + const std::size_t &MaxSol) { - struct GSL_params params(modelPointer,Temp); - - std::size_t dim = modelPointer->get_nVEV(); - - std::default_random_engine randGen(seed); - double RNDMax= 500; - std::size_t MaxTries = 600; - std::atomic tries {0}; - std::size_t nCol = dim+2; - - struct MinimizeParams{ - std::vector start; - std::vector sol; - int GSL_status; - }; - - std::atomic FoundSolutions{0}; - std::vector MinThreads; - std::mutex WriteResultLock; - std::queue> Results; - - auto thread_Job = []( - std::atomic& mFoundSolutions, - std::size_t mMaxSol, - std::atomic& mtries, - std::size_t mMaxTries, - std::size_t mdim, - double mRNDMax, - std::default_random_engine& mrandGen, - GSL_params& mparams, - std::mutex& mWriteResultLock, - std::queue>& mResults){ - while(mFoundSolutions < mMaxSol and mtries <= mMaxTries) - { - - std::vector start(mdim); - std::vector sol; - for(std::size_t j=0;j::digits>(mrandGen)); - } - auto status = GSL_Minimize_From_S_gen_all(mparams, sol, start); - if(status == GSL_SUCCESS) - { - std::unique_lock lock(mWriteResultLock); - ++mFoundSolutions; - mResults.push(sol); - } - } - }; - - for(std::size_t i=0;iMinimizeOrderVEV(res); - std::vector row(nCol); - for(std::size_t i=0;iEWSBVEV(vpot); - row.at(dim+1) = modelPointer->VEff(vpot,Temp,0); - saveAllMinima.push_back(row); - } - - - if(saveAllMinima.size() == 0) + struct GSL_params params(modelPointer, Temp); + + std::size_t dim = modelPointer->get_nVEV(); + + std::default_random_engine randGen(seed); + double RNDMax = 500; + std::size_t MaxTries = 600; + std::atomic tries{0}; + std::size_t nCol = dim + 2; + + struct MinimizeParams + { + std::vector start; + std::vector sol; + int GSL_status; + }; + + std::atomic FoundSolutions{0}; + std::vector MinThreads; + std::mutex WriteResultLock; + std::queue> Results; + + auto thread_Job = [](std::atomic &mFoundSolutions, + std::size_t mMaxSol, + std::atomic &mtries, + std::size_t mMaxTries, + std::size_t mdim, + double mRNDMax, + std::default_random_engine &mrandGen, + GSL_params &mparams, + std::mutex &mWriteResultLock, + std::queue> &mResults) { + while (mFoundSolutions < mMaxSol and mtries <= mMaxTries) { - std::cerr << "No solutions found during the GSL minimization at T = " << Temp << " GeV " << "\n"; - return std::make_pair(std::vector{}, false); - } - if(saveAllMinima.size() < MaxSol) - { - std::cerr << "Found " << saveAllMinima.size() << " of " << MaxSol << " solutions at T = " << Temp << std::endl; + std::vector start(mdim); + std::vector sol; + for (std::size_t j = 0; j < mdim; ++j) + { + start.at(j) = + mRNDMax * + (-1 + + 2 * std::generate_canonical::digits>( + mrandGen)); + } + auto status = GSL_Minimize_From_S_gen_all(mparams, sol, start); + if (status == GSL_SUCCESS) + { + std::unique_lock lock(mWriteResultLock); + ++mFoundSolutions; + mResults.push(sol); + } } - - std::size_t minIndex = 0; - double VMin = saveAllMinima[0][dim+1]; - for(std::size_t k=1;kMinimizeOrderVEV(res); + std::vector row(nCol); + for (std::size_t i = 0; i < dim; ++i) + row.at(i) = res.at(i); + row.at(dim) = modelPointer->EWSBVEV(vpot); + row.at(dim + 1) = modelPointer->VEff(vpot, Temp, 0); + saveAllMinima.push_back(row); + } + + if (saveAllMinima.size() == 0) + { + std::cerr << "No solutions found during the GSL minimization at T = " + << Temp << " GeV " + << "\n"; + return std::make_pair(std::vector{}, false); + } + + if (saveAllMinima.size() < MaxSol) + { + std::cerr << "Found " << saveAllMinima.size() << " of " << MaxSol + << " solutions at T = " << Temp << std::endl; + } + + std::size_t minIndex = 0; + double VMin = saveAllMinima[0][dim + 1]; + for (std::size_t k = 1; k < saveAllMinima.size(); k++) + { + if (saveAllMinima[k][dim + 1] <= VMin) { - if(saveAllMinima[k][dim+1] <= VMin) - { - VMin = saveAllMinima[k][dim+1]; - minIndex = k; - } + VMin = saveAllMinima[k][dim + 1]; + minIndex = k; } + } - std::vector solV; - for(std::size_t k=0;k solV; + for (std::size_t k = 0; k < dim; k++) + solV.push_back(saveAllMinima[minIndex][k]); + return std::make_pair(solV, true); } - - - - -} -} +} // namespace Minimizer +} // namespace BSMPT diff --git a/src/minimizer/MinimizePlane.cpp b/src/minimizer/MinimizePlane.cpp index 7f888894..5599a161 100644 --- a/src/minimizer/MinimizePlane.cpp +++ b/src/minimizer/MinimizePlane.cpp @@ -3,39 +3,38 @@ * * Copyright (C) 2018 Philipp Basler and Margarete Mühlleitner - This program 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. - - This program 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 this program. If not, see . + This program 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. + + This program 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 this program. If not, see . */ - /** * @file */ #include -#include // for gsl_set_error_handler... -#include // for gsl_multimin_fminimizer - -#include // for printf -#include // for std::size_t, time, NULL -#include // for setprecision -#include // for operator<<, endl, ost... -#include // for numeric_limits, numer... -#include // for default_random_engine -#include // for runtime_error -#include // for string, operator+ -#include // for Class_Potential_Origin -#include // for FChoose +#include // for gsl_set_error_handler... +#include // for gsl_multimin_fminimizer + +#include // for Class_Potential_Origin +#include // for FChoose +#include // for setprecision +#include // for operator<<, endl, ost... +#include // for numeric_limits, numer... +#include // for default_random_engine +#include // for runtime_error +#include // for printf +#include // for string, operator+ +#include // for std::size_t, time, NULL #include @@ -47,325 +46,352 @@ #include #endif +namespace BSMPT +{ +namespace Minimizer +{ -namespace BSMPT { -namespace Minimizer{ - +std::vector +TransformCoordinates(const std::vector &vMinTilde, + const struct PointerContainerMinPlane ¶ms) +{ -std::vector TransformCoordinates( - const std::vector& vMinTilde, - const struct PointerContainerMinPlane& params){ + if (vMinTilde.size() != params.nVEV - 1) + { + std::string throwstring = "No valid input in "; + throwstring += __func__; + throwstring += ". Expected " + std::to_string(params.nVEV - 1); + throwstring += " but found " + std::to_string(vMinTilde.size()) + "."; + throw std::runtime_error(throwstring.c_str()); + } - if(vMinTilde.size() != params.nVEV-1) { - std::string throwstring = "No valid input in "; - throwstring+= __func__; - throwstring+= ". Expected " + std::to_string(params.nVEV-1); - throwstring+= " but found " + std::to_string(vMinTilde.size()) + "."; - throw std::runtime_error(throwstring.c_str()) ; - } + std::vector vMin; - std::vector vMin; + std::size_t nVEVs = params.modelPointer->get_nVEV(); + vMin.resize(nVEVs); + for (std::size_t i = 0; i < params.Index; i++) + { + vMin[i] = vMinTilde.at(i); + } + vMin[params.Index] = 0; + for (std::size_t i = 1 + params.Index; i < nVEVs; i++) + { + vMin[i] = vMinTilde.at(i - 1); + } - std::size_t nVEVs = params.modelPointer->get_nVEV(); - vMin.resize(nVEVs); - for(std::size_t i=0;i &basepoint, + const std::vector &VEVSymmetric, + const std::vector &VEVBroken, + const ModelID::ModelIDs &Model, + const std::vector &par, + const std::vector &parCT, + const double &Temp, + const int &WhichMinimizer) +{ + std::shared_ptr modelPointer = + ModelID::FChoose(Model); + modelPointer->set_All(par, parCT); + return MinimizePlane( + basepoint, VEVSymmetric, VEVBroken, modelPointer, Temp, WhichMinimizer); } +MinimizePlaneReturn +MinimizePlane(const std::vector &basepoint, + const std::vector &VEVSymmetric, + const std::vector &VEVBroken, + const std::shared_ptr &modelPointer, + const double &Temp, + const int &WhichMinimizer) +{ + const auto UseMinimizer = GetMinimizers(WhichMinimizer); + std::vector PotValues; + std::vector> Minima; + std::vector normalvector; + for (std::size_t i = 0; i < VEVBroken.size(); i++) + normalvector.push_back(VEVBroken.at(i) - VEVSymmetric.at(i)); -MinimizePlaneReturn MinimizePlane(const std::vector& basepoint, - const std::vector& VEVSymmetric, - const std::vector& VEVBroken, - const ModelID::ModelIDs& Model, - const std::vector& par, - const std::vector& parCT, - const double& Temp, - const int& WhichMinimizer){ - std::shared_ptr modelPointer = ModelID::FChoose(Model); - modelPointer->set_All(par,parCT); - return MinimizePlane(basepoint,VEVSymmetric,VEVBroken,modelPointer,Temp,WhichMinimizer); -} + struct PointerContainerMinPlane params; + params.Temp = Temp; + params.nVEV = modelPointer->get_nVEV(); + params.modelPointer = modelPointer; + params.normalvector = normalvector; + params.Point = basepoint; + params.VEVSymmetric = VEVSymmetric; + params.VEVBroken = VEVBroken; -MinimizePlaneReturn MinimizePlane(const std::vector& basepoint, - const std::vector& VEVSymmetric, - const std::vector& VEVBroken, - const std::shared_ptr& modelPointer, - const double& Temp, - const int& WhichMinimizer){ - - const auto UseMinimizer = GetMinimizers(WhichMinimizer); - - std::vector PotValues; - std::vector> Minima; - - std::vector normalvector; - for(std::size_t i=0;iget_nVEV(); - params.modelPointer = modelPointer; - params.normalvector = normalvector; - params.Point = basepoint; - params.VEVSymmetric = VEVSymmetric; - params.VEVBroken = VEVBroken; - - int IndexNorm = -1; - for(std::size_t i=0;i= 1e-3) { - IndexNorm = static_cast(i); - break; - } - } - if(IndexNorm == -1){ - throw std::runtime_error("The normalvector in the minimization of the plane is zero. \ + int IndexNorm = -1; + for (std::size_t i = 0; i < normalvector.size(); i++) + { + if (std::abs(normalvector.at(i)) >= 1e-3) + { + IndexNorm = static_cast(i); + break; + } + } + if (IndexNorm == -1) + { + throw std::runtime_error( + "The normalvector in the minimization of the plane is zero. \ This means the broken and symmetric minimum are identical and\ no tunnelpath exists"); - } - - params.Index = static_cast(IndexNorm); - + } + params.Index = static_cast(IndexNorm); + auto dimensionnames = modelPointer->addLegendTemp(); - auto dimensionnames = modelPointer->addLegendTemp(); + if (UseMinimizer.UseGSL) + { + // Find the minimum provided by GSL + auto GSLResult = GSL_Minimize_Plane_gen_all(params, 3, 50); + PotValues.push_back(GSLResult.PotVal); + Minima.push_back(GSLResult.Minimum); + } - if(UseMinimizer.UseGSL) +#ifdef libcmaes_FOUND + if (UseMinimizer.UseCMAES and modelPointer->get_nVEV() >= 3) + { + std::vector startCMAES(params.nVEV - 1); + for (std::size_t i = 0; i < params.Index; i++) { - // Find the minimum provided by GSL - auto GSLResult = GSL_Minimize_Plane_gen_all(params, 3,50); - PotValues.push_back(GSLResult.PotVal); - Minima.push_back(GSLResult.Minimum); + startCMAES.at(i) = params.VEVBroken.at(i); } - -#ifdef libcmaes_FOUND - if(UseMinimizer.UseCMAES and modelPointer->get_nVEV() >= 3) + for (std::size_t i = static_cast(params.Index); i < params.nVEV - 1; + i++) { - std::vector startCMAES(params.nVEV-1); - for(std::size_t i=0;i(params.Index);iVEff(modelPointer->MinimizeOrderVEV(LibCMAESResult.result),params.Temp)); - Minima.push_back(LibCMAESResult.result); + startCMAES.at(i) = params.VEVBroken.at(i + 1); } + auto LibCMAESResult = + LibCMAES::CMAES_Minimize_Plane_gen_all(params, startCMAES); + PotValues.push_back(modelPointer->VEff( + modelPointer->MinimizeOrderVEV(LibCMAESResult.result), params.Temp)); + Minima.push_back(LibCMAESResult.result); + } #endif #ifdef NLopt_FOUND - if(UseMinimizer.UseNLopt) - { - auto NLOPTResult = LibNLOPT::MinimizePlaneUsingNLOPT(params); - PotValues.push_back(NLOPTResult.PotVal); - Minima.push_back(NLOPTResult.Minimum); - } + if (UseMinimizer.UseNLopt) + { + auto NLOPTResult = LibNLOPT::MinimizePlaneUsingNLOPT(params); + PotValues.push_back(NLOPTResult.PotVal); + Minima.push_back(NLOPTResult.Minimum); + } #endif - std::size_t MinIndex=0; - for(std::size_t i=1;i(p); - std::vector vMinTilde; - std::size_t nVEVs = params->nVEV; - for(std::size_t i=0;imodelPointer->MinimizeOrderVEV(vMin); - double res = params->modelPointer->VEff(vIn,params->Temp,0); - return res; + struct PointerContainerMinPlane *params = + static_cast(p); + std::vector vMinTilde; + std::size_t nVEVs = params->nVEV; + for (std::size_t i = 0; i < nVEVs - 1; i++) + { + vMinTilde.push_back(gsl_vector_get(v, i)); + } + auto vMin = TransformCoordinates(vMinTilde, *params); + auto vIn = params->modelPointer->MinimizeOrderVEV(vMin); + double res = params->modelPointer->VEff(vIn, params->Temp, 0); + return res; } -int GSL_Minimize_Plane_From_S_gen_all(const struct PointerContainerMinPlane& params, std::vector& sol, - const std::vector& start) +int GSL_Minimize_Plane_From_S_gen_all( + const struct PointerContainerMinPlane ¶ms, + std::vector &sol, + const std::vector &start) { - const double GSL_Tolerance=std::pow(10,-6); - gsl_set_error_handler_off(); - - const gsl_multimin_fminimizer_type *T = gsl_multimin_fminimizer_nmsimplex2; - gsl_multimin_fminimizer *s = nullptr; - gsl_vector *ss, *x; - gsl_multimin_function minex_func; - - const double ftol = GSL_Tolerance; - std::size_t MinIter = 600; - - std::size_t iter = 0; - int status; - double size; - - std::size_t dim = params.nVEV-1; - - /* Starting point */ - x = gsl_vector_alloc (dim); - for(std::size_t k=0;kx,k)); + for (std::size_t k = 0; k < dim; k++) + sol.push_back(gsl_vector_get(s->x, k)); } - else{ - for(std::size_t k=0;k> saveAllMinima; - auto result = GSL_Minimize_Plane_gen_all(params, seed ,saveAllMinima, MinSol); - return result; +GSLPlaneReturn +GSL_Minimize_Plane_gen_all(const struct PointerContainerMinPlane ¶ms, + std::size_t seed, + std::size_t MinSol) +{ + std::vector> saveAllMinima; + auto result = GSL_Minimize_Plane_gen_all(params, seed, saveAllMinima, MinSol); + return result; } - -GSLPlaneReturn GSL_Minimize_Plane_gen_all(const struct PointerContainerMinPlane& params, std::size_t seed){ - std::vector> saveAllMinima; - std::size_t MinSol = 20; - auto result = GSL_Minimize_Plane_gen_all(params, seed ,saveAllMinima, MinSol); - return result; +GSLPlaneReturn +GSL_Minimize_Plane_gen_all(const struct PointerContainerMinPlane ¶ms, + std::size_t seed) +{ + std::vector> saveAllMinima; + std::size_t MinSol = 20; + auto result = GSL_Minimize_Plane_gen_all(params, seed, saveAllMinima, MinSol); + return result; } -GSLPlaneReturn GSL_Minimize_Plane_gen_all(const struct PointerContainerMinPlane& params, - std::size_t seed , - std::vector>& saveAllMinima, - std::size_t MinSol) +GSLPlaneReturn +GSL_Minimize_Plane_gen_all(const struct PointerContainerMinPlane ¶ms, + std::size_t seed, + std::vector> &saveAllMinima, + std::size_t MinSol) { - GSLPlaneReturn res; - - std::shared_ptr modelPointer; - modelPointer=params.modelPointer; - - std::size_t dim = modelPointer->get_nVEV() - 1; - - std::default_random_engine randGen(seed); - double RNDMin= 500; - std::size_t MinTries = 600; - std::size_t tries = 0; - std::size_t numOfSol = 0; - std::size_t nCol = dim+2 +1 ; - std::vector start,vPot,soltilde; - do{ - start.resize(dim); - for(std::size_t i=0;i::digits>(randGen)); - - - GSL_Minimize_Plane_From_S_gen_all(params,soltilde,start); - - vPot.resize(modelPointer->get_NHiggs()); - auto sol = TransformCoordinates(soltilde,params); - vPot=modelPointer->MinimizeOrderVEV(sol); - - - std::vector row(nCol); - for(std::size_t i=0;iEWSBVEV(vPot); - row.at(dim+2) = modelPointer->VEff(vPot,params.Temp,0); - - saveAllMinima.push_back(row); - - - numOfSol ++; - if(numOfSol == MinSol) break; - - - start.clear(); - sol.clear(); - soltilde.clear(); - tries++; - }while(tries <= MinTries); - if(numOfSol == 0) - { - std::cerr << "No solutions found during the GSL minimization at T = " << params.Temp << " GeV " << "\n"; - res.StatusFlag = false; - return res; - } - - std::size_t minIndex = 0; - double VMin = saveAllMinima[0][dim+2]; - for(std::size_t k=1;k Minimum; - for(std::size_t i=0;i modelPointer; + modelPointer = params.modelPointer; + std::size_t dim = modelPointer->get_nVEV() - 1; + std::default_random_engine randGen(seed); + double RNDMin = 500; + std::size_t MinTries = 600; + std::size_t tries = 0; + std::size_t numOfSol = 0; + std::size_t nCol = dim + 2 + 1; + std::vector start, vPot, soltilde; + do + { + start.resize(dim); + for (std::size_t i = 0; i < dim; i++) + start[i] = + RNDMin * + (-1 + + 2 * std::generate_canonical::digits>( + randGen)); + + GSL_Minimize_Plane_From_S_gen_all(params, soltilde, start); + + vPot.resize(modelPointer->get_NHiggs()); + auto sol = TransformCoordinates(soltilde, params); + vPot = modelPointer->MinimizeOrderVEV(sol); + + std::vector row(nCol); + for (std::size_t i = 0; i < dim + 1; i++) + row.at(i) = sol.at(i); + row.at(dim + 1) = modelPointer->EWSBVEV(vPot); + row.at(dim + 2) = modelPointer->VEff(vPot, params.Temp, 0); + + saveAllMinima.push_back(row); + + numOfSol++; + if (numOfSol == MinSol) break; + + start.clear(); + sol.clear(); + soltilde.clear(); + tries++; + } while (tries <= MinTries); + if (numOfSol == 0) + { + std::cerr << "No solutions found during the GSL minimization at T = " + << params.Temp << " GeV " + << "\n"; + res.StatusFlag = false; + return res; + } + + std::size_t minIndex = 0; + double VMin = saveAllMinima[0][dim + 2]; + for (std::size_t k = 1; k < numOfSol; k++) + { + if (saveAllMinima[k][dim + 2] <= VMin) + { + VMin = saveAllMinima[k][dim + 2]; + minIndex = k; + } + } + res.StatusFlag = true; + res.PotVal = saveAllMinima[minIndex][dim + 2]; + res.vc = saveAllMinima[minIndex][dim + 1]; + std::vector Minimum; + for (std::size_t i = 0; i < dim + 1; i++) + Minimum.push_back(saveAllMinima[minIndex][i]); + res.Minimum = Minimum; + return res; } -} + +} // namespace Minimizer +} // namespace BSMPT diff --git a/src/minimizer/Minimizer.cpp b/src/minimizer/Minimizer.cpp index b908e8e0..2dde9421 100644 --- a/src/minimizer/Minimizer.cpp +++ b/src/minimizer/Minimizer.cpp @@ -4,32 +4,31 @@ * * Copyright (C) 2018 Philipp Basler and Margarete Mühlleitner - This program 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. - - This program 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 this program. If not, see . + This program 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. + + This program 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 this program. If not, see . */ - -#include -#include -#include // for abs, log10 -#include // for time, NULL -#include // for copy, max -#include // for operator<<, cout, endl -#include // for Class_Potential_Origin -#include // for FChoose #include +#include // for Class_Potential_Origin +#include // for FChoose +#include // for copy, max +#include // for operator<<, cout, endl +#include // for abs, log10 +#include #include #include +#include // for time, NULL +#include #include @@ -43,7 +42,6 @@ #include #endif - /** * @file * @param WhichMinimizer = 1/2 for single minimizer, sum of those for multiple @@ -62,417 +60,439 @@ * @param parCT Array with Counterterm values used for set_CT_pot_par * @param TempStart Starting value of the Temperature for the bisection Method * @param TempEnde End value of the Temperature for the bisection Method - * @param sol std::vector in which the solution of the PTFinder will be stored in the format (T_C,v_C,-+1, single vevs) where +1 means sucessfull find of v_c/T_c > 1 and -1 hit one of the abortion criteria + * @param sol std::vector in which the solution of the PTFinder will be + * stored in the format (T_C,v_C,-+1, single vevs) where +1 means sucessfull + * find of v_c/T_c > 1 and -1 hit one of the abortion criteria * */ - -namespace BSMPT { -namespace Minimizer { +namespace BSMPT +{ +namespace Minimizer +{ MinimizersToUse GetMinimizers(int WhichMinimizer) { - bool UseCMAES = (WhichMinimizer % 2 == 1); - WhichMinimizer/= 2; - bool UseGSL = (WhichMinimizer %2 == 1); - WhichMinimizer/= 2; - bool UseNLopt = (WhichMinimizer%2 == 1); + bool UseCMAES = (WhichMinimizer % 2 == 1); + WhichMinimizer /= 2; + bool UseGSL = (WhichMinimizer % 2 == 1); + WhichMinimizer /= 2; + bool UseNLopt = (WhichMinimizer % 2 == 1); #ifndef libcmaes_FOUND - UseCMAES = false; + UseCMAES = false; #endif #ifndef NLopt_FOUND - UseNLopt = false; + UseNLopt = false; #endif - return MinimizersToUse(UseCMAES,UseGSL,UseNLopt); + return MinimizersToUse(UseCMAES, UseGSL, UseNLopt); } /** * @brief Minimization of the Model -* Minimizes the given Potential with parameters par and CT-parameters parCT at a given Temperature Temp and writes the solution in the std::vector sol. -* The Minimization Debugging Options are written in the std::vector Check. -* The std::vector Start gives the start value for the CMA-ES Minimization. -*/ -std::vector Minimize_gen_all( - const std::shared_ptr& modelPointer, - const double& Temp, - std::vector& Check, - const std::vector& start, - const int& WhichMinimizer) + * Minimizes the given Potential with parameters par and CT-parameters parCT at + * a given Temperature Temp and writes the solution in the std::vector sol. The + * Minimization Debugging Options are written in the std::vector Check. The + * std::vector Start gives the start value for the CMA-ES Minimization. + */ +std::vector +Minimize_gen_all(const std::shared_ptr &modelPointer, + const double &Temp, + std::vector &Check, + const std::vector &start, + const int &WhichMinimizer) { - std::vector PotValues; - std::vector> Minima; + std::vector PotValues; + std::vector> Minima; - auto UseMinimizer = GetMinimizers(WhichMinimizer); + auto UseMinimizer = GetMinimizers(WhichMinimizer); - bool CheckZero = true; // Check if zero is the global minimum explicitly - if(CheckZero){ - PotValues.push_back(modelPointer->VEff(std::vector(modelPointer->get_NHiggs(),0),Temp)); - Minima.push_back(std::vector(modelPointer->get_nVEV(),0)); - } - - if(modelPointer->get_nVEV() <=2) - { - UseMinimizer.UseCMAES = false; - UseMinimizer.UseGSL = true; - } - - std::vector solGSLMin,solGSLMinPot; - - bool gslMinSuc = false; - std::thread thread_GSL; - if(UseMinimizer.UseGSL) { - - if(UseMinimizer.UseCMAES or UseMinimizer.UseNLopt) { - thread_GSL = std::thread([&solGSLMin, &gslMinSuc,&modelPointer,&Temp](){ - std::tie(solGSLMin,gslMinSuc) = GSL_Minimize_gen_all(modelPointer, Temp, 5); // If additionally CMAES is minimising GSL does not need as much solutions - }); - } - else { - std::size_t MaxSol = 50; - thread_GSL = std::thread([&solGSLMin,&gslMinSuc,&modelPointer,&Temp,&MaxSol](){ - std::tie(solGSLMin,gslMinSuc) = GSL_Minimize_gen_all(modelPointer, Temp, 5, MaxSol); - }); - } + bool CheckZero = true; // Check if zero is the global minimum explicitly + if (CheckZero) + { + PotValues.push_back(modelPointer->VEff( + std::vector(modelPointer->get_NHiggs(), 0), Temp)); + Minima.push_back(std::vector(modelPointer->get_nVEV(), 0)); + } + if (modelPointer->get_nVEV() <= 2) + { + UseMinimizer.UseCMAES = false; + UseMinimizer.UseGSL = true; + } + std::vector solGSLMin, solGSLMinPot; + bool gslMinSuc = false; + std::thread thread_GSL; + if (UseMinimizer.UseGSL) + { + if (UseMinimizer.UseCMAES or UseMinimizer.UseNLopt) + { + thread_GSL = + std::thread([&solGSLMin, &gslMinSuc, &modelPointer, &Temp]() { + std::tie(solGSLMin, gslMinSuc) = GSL_Minimize_gen_all( + modelPointer, Temp, 5); // If additionally CMAES is minimising + // GSL does not need as much solutions + }); } -#ifdef libcmaes_FOUND - std::thread thread_CMAES; - LibCMAES::LibCMAESReturn LibCMAES; - if(UseMinimizer.UseCMAES) { - thread_CMAES = std::thread([&modelPointer,&Temp,&start,&LibCMAES](){ - LibCMAES = LibCMAES::min_cmaes_gen_all(modelPointer,Temp,start); - }); + else + { + std::size_t MaxSol = 50; + thread_GSL = std::thread( + [&solGSLMin, &gslMinSuc, &modelPointer, &Temp, &MaxSol]() { + std::tie(solGSLMin, gslMinSuc) = + GSL_Minimize_gen_all(modelPointer, Temp, 5, MaxSol); + }); } + } +#ifdef libcmaes_FOUND + std::thread thread_CMAES; + LibCMAES::LibCMAESReturn LibCMAES; + if (UseMinimizer.UseCMAES) + { + thread_CMAES = std::thread([&modelPointer, &Temp, &start, &LibCMAES]() { + LibCMAES = LibCMAES::min_cmaes_gen_all(modelPointer, Temp, start); + }); + } #else - (void) start; + (void)start; #endif #ifdef NLopt_FOUND - LibNLOPT::NLOPTReturnType NLOPTResult; - std::thread thread_NLopt; - if(UseMinimizer.UseNLopt) - { - thread_NLopt = std::thread( [&NLOPTResult, &modelPointer, &Temp](){ - NLOPTResult = LibNLOPT::MinimizeUsingNLOPT(modelPointer,Temp); - } ); - - } + LibNLOPT::NLOPTReturnType NLOPTResult; + std::thread thread_NLopt; + if (UseMinimizer.UseNLopt) + { + thread_NLopt = std::thread([&NLOPTResult, &modelPointer, &Temp]() { + NLOPTResult = LibNLOPT::MinimizeUsingNLOPT(modelPointer, Temp); + }); + } #endif - #ifdef NLopt_FOUND - if(thread_NLopt.joinable()) - { - thread_NLopt.join(); - } - - if(NLOPTResult.Success) - { - PotValues.push_back(NLOPTResult.PotVal); - Minima.push_back(NLOPTResult.Minimum); - } + if (thread_NLopt.joinable()) + { + thread_NLopt.join(); + } + + if (NLOPTResult.Success) + { + PotValues.push_back(NLOPTResult.PotVal); + Minima.push_back(NLOPTResult.Minimum); + } #endif - #ifdef libcmaes_FOUND - if(thread_CMAES.joinable()) - { - thread_CMAES.join(); - auto errC = LibCMAES.CMAESStatus; - auto solCMAES = LibCMAES.result; - auto solCMAESPotIn=modelPointer->MinimizeOrderVEV(solCMAES); - PotValues.push_back(modelPointer->VEff(solCMAESPotIn,Temp)); - Minima.push_back(solCMAES); - Check.push_back(errC); - } + if (thread_CMAES.joinable()) + { + thread_CMAES.join(); + auto errC = LibCMAES.CMAESStatus; + auto solCMAES = LibCMAES.result; + auto solCMAESPotIn = modelPointer->MinimizeOrderVEV(solCMAES); + PotValues.push_back(modelPointer->VEff(solCMAESPotIn, Temp)); + Minima.push_back(solCMAES); + Check.push_back(errC); + } #endif - if(thread_GSL.joinable()) - { - thread_GSL.join(); - } - - if(gslMinSuc){ - solGSLMinPot=modelPointer->MinimizeOrderVEV(solGSLMin); - PotValues.push_back(modelPointer->VEff(solGSLMinPot,Temp)); - Minima.push_back(solGSLMin); - } - - std::size_t minIndex=0; - for(std::size_t i=1;iEWSBVEV(modelPointer->MinimizeOrderVEV(sol)); - if(EWVEV <= 0.5) sol = std::vector(modelPointer->get_nVEV(),0); - - solGSLMin.clear(); - if(UseMinimizer.UseGSL and gslMinSuc) Check.push_back(1); - else Check.push_back(-1); - - return sol; - + if (thread_GSL.joinable()) + { + thread_GSL.join(); + } + + if (gslMinSuc) + { + solGSLMinPot = modelPointer->MinimizeOrderVEV(solGSLMin); + PotValues.push_back(modelPointer->VEff(solGSLMinPot, Temp)); + Minima.push_back(solGSLMin); + } + + std::size_t minIndex = 0; + for (std::size_t i = 1; i < PotValues.size(); i++) + { + if (PotValues.at(i) < PotValues.at(minIndex)) minIndex = i; + } + + auto sol = Minima.at(minIndex); + auto EWVEV = modelPointer->EWSBVEV(modelPointer->MinimizeOrderVEV(sol)); + if (EWVEV <= 0.5) sol = std::vector(modelPointer->get_nVEV(), 0); + + solGSLMin.clear(); + if (UseMinimizer.UseGSL and gslMinSuc) + Check.push_back(1); + else + Check.push_back(-1); + + return sol; } - - - -EWPTReturnType PTFinder_gen_all( - const std::shared_ptr& modelPointer, - const double& TempStart, - const double& TempEnd, - const int& WhichMinimizer) +EWPTReturnType +PTFinder_gen_all(const std::shared_ptr &modelPointer, + const double &TempStart, + const double &TempEnd, + const int &WhichMinimizer) { - EWPTReturnType result; - - std::size_t dim = modelPointer->get_nVEV(); - - double vStart,vEnd,vMitte; - std::vector solStart,solMitte,solEnd; - std::vector solStartPot,solMittePot,solEndPot; - std::vector checkStart,checkMitte,checkEnde; - std::vector startStart,startMitte,startEnde; - double Distance=1e-2; - double TA = TempStart; - double TM; - double TE = TempEnd; - - std::vector pSol(dim+1); - - for(std::size_t k=0;kget_vevTreeMin(k)); - solEnd = Minimize_gen_all(modelPointer,TempEnd,checkEnde,startEnde,WhichMinimizer); - solEndPot=modelPointer->MinimizeOrderVEV(solEnd); - vEnd = modelPointer->EWSBVEV(solEndPot); - - - - if(vEnd > C_threshold) + EWPTReturnType result; + + std::size_t dim = modelPointer->get_nVEV(); + + double vStart, vEnd, vMitte; + std::vector solStart, solMitte, solEnd; + std::vector solStartPot, solMittePot, solEndPot; + std::vector checkStart, checkMitte, checkEnde; + std::vector startStart, startMitte, startEnde; + double Distance = 1e-2; + double TA = TempStart; + double TM; + double TE = TempEnd; + + std::vector pSol(dim + 1); + + for (std::size_t k = 0; k < dim; k++) + startEnde.push_back(modelPointer->get_vevTreeMin(k)); + solEnd = Minimize_gen_all( + modelPointer, TempEnd, checkEnde, startEnde, WhichMinimizer); + solEndPot = modelPointer->MinimizeOrderVEV(solEnd); + vEnd = modelPointer->EWSBVEV(solEndPot); + + if (vEnd > C_threshold) + { + result.Tc = TempEnd; + result.vc = vEnd; + result.StatusFlag = MinimizerStatus::NOTVANISHINGATFINALTEMP; + result.EWMinimum = solEnd; + return result; + } + + for (std::size_t k = 0; k < dim; k++) + startStart.push_back(modelPointer->get_vevTreeMin(k)); + solStart = Minimize_gen_all( + modelPointer, TempStart, checkStart, startStart, WhichMinimizer); + solStartPot = modelPointer->MinimizeOrderVEV(solStart); + vStart = modelPointer->EWSBVEV(solStartPot); + + bool SurviveNLO = modelPointer->CheckNLOVEV(solStart); + + if (not SurviveNLO and TempStart == 0) + { + result.Tc = TempEnd; + result.vc = vStart; + result.StatusFlag = MinimizerStatus::NOTNLOSTABLE; + result.EWMinimum = solStart; + return result; + } + + if (vStart <= C_threshold or vStart >= 255.0) + { + result.Tc = TempEnd; + result.vc = 0; + result.StatusFlag = MinimizerStatus::NLOVEVZEROORINF; + result.EWMinimum = std::vector(dim, 0); + return result; + } + + for (std::size_t k = 0; k < dim; k++) + startMitte.push_back(modelPointer->get_vevTreeMin(k)); + do + { + TM = 0.5 * (TA + TE); + solMitte.clear(); + checkMitte.clear(); + solMittePot.clear(); + solMitte = Minimize_gen_all( + modelPointer, TM, checkMitte, startMitte, WhichMinimizer); + solMittePot = modelPointer->MinimizeOrderVEV(solMitte); + vMitte = modelPointer->EWSBVEV(solMittePot); + + if (vMitte >= 255.0) { - result.Tc = TempEnd; - result.vc = vEnd; - result.StatusFlag = MinimizerStatus::NOTVANISHINGATFINALTEMP; - result.EWMinimum = solEnd; - return result; + result.Tc = TM; + result.vc = vMitte; + result.StatusFlag = MinimizerStatus::NUMERICALLYUNSTABLE; + result.EWMinimum = solMitte; + return result; } - - for(std::size_t k=0;kget_vevTreeMin(k)); - solStart=Minimize_gen_all(modelPointer,TempStart,checkStart,startStart,WhichMinimizer); - solStartPot=modelPointer->MinimizeOrderVEV(solStart); - vStart = modelPointer->EWSBVEV(solStartPot); - - - - bool SurviveNLO = modelPointer->CheckNLOVEV(solStart); - - if(not SurviveNLO and TempStart == 0 ) + else if (vMitte != 0 and vMitte / TM < C_PT) { - result.Tc = TempEnd; - result.vc = vStart; - result.StatusFlag = MinimizerStatus::NOTNLOSTABLE; - result.EWMinimum = solStart; - return result; - + result.Tc = TM; + result.vc = vMitte; + result.StatusFlag = MinimizerStatus::BELOWTHRESHOLD; + result.EWMinimum = solMitte; + return result; } - - if(vStart <= C_threshold or vStart >= 255.0) + if (vMitte >= Distance) + { + TA = TM; + startMitte.clear(); + for (std::size_t k = 0; k < dim; k++) + pSol[k + 1] = solMitte.at(k); + pSol[0] = vMitte; + for (std::size_t k = 0; k < dim; k++) + startMitte.push_back(pSol[k + 1]); + vStart = vMitte; + } + else { - result.Tc = TempEnd; - result.vc = 0; - result.StatusFlag = MinimizerStatus::NLOVEVZEROORINF; - result.EWMinimum = std::vector(dim,0); - return result; + TE = TM; } - for(std::size_t k=0;kget_vevTreeMin(k)); - do{ - TM = 0.5*(TA+TE); - solMitte.clear(); - checkMitte.clear(); - solMittePot.clear(); - solMitte=Minimize_gen_all(modelPointer,TM,checkMitte,startMitte,WhichMinimizer); - solMittePot=modelPointer->MinimizeOrderVEV(solMitte); - vMitte = modelPointer->EWSBVEV(solMittePot); - - - if(vMitte >= 255.0) - { - result.Tc = TM; - result.vc = vMitte; - result.StatusFlag = MinimizerStatus::NUMERICALLYUNSTABLE; - result.EWMinimum = solMitte; - return result; - } - else if(vMitte != 0 and vMitte/TM < C_PT) - { - result.Tc = TM; - result.vc = vMitte; - result.StatusFlag = MinimizerStatus::BELOWTHRESHOLD; - result.EWMinimum = solMitte; - return result; - - } - if(vMitte >= Distance) - { - TA = TM; - startMitte.clear(); - for(std::size_t k=0;k Distance); - - result.Tc = TA; - result.vc = pSol[0]; - result.StatusFlag = MinimizerStatus::SUCCESS; - std::vector SolMin; - result.EWMinimum.clear(); - for(std::size_t k=1;k<=dim;k++) result.EWMinimum.push_back(pSol[k]); - return result; -} + } while (std::abs(TE - TA) > Distance); + result.Tc = TA; + result.vc = pSol[0]; + result.StatusFlag = MinimizerStatus::SUCCESS; + std::vector SolMin; + result.EWMinimum.clear(); + for (std::size_t k = 1; k <= dim; k++) + result.EWMinimum.push_back(pSol[k]); + return result; +} -std::vector Minimize_gen_all_tree_level( - const ModelID::ModelIDs& Model, - const std::vector& par, - const std::vector& parCT, - std::vector& Check, - const std::vector& start, - int WhichMinimizer) +std::vector +Minimize_gen_all_tree_level(const ModelID::ModelIDs &Model, + const std::vector &par, + const std::vector &parCT, + std::vector &Check, + const std::vector &start, + int WhichMinimizer) { - std::shared_ptr modelPointer = ModelID::FChoose(Model); - modelPointer->set_All(par,parCT); - modelPointer->SetUseTreeLevel(true); - auto sol=Minimize_gen_all(modelPointer,0,Check,start,WhichMinimizer); - modelPointer->SetUseTreeLevel(false); - return sol; + std::shared_ptr modelPointer = + ModelID::FChoose(Model); + modelPointer->set_All(par, parCT); + modelPointer->SetUseTreeLevel(true); + auto sol = Minimize_gen_all(modelPointer, 0, Check, start, WhichMinimizer); + modelPointer->SetUseTreeLevel(false); + return sol; } - -std::vector> FindNextLocalMinima( - const std::shared_ptr& model, - const std::vector& StartingPoint, - const double& temperature, - int WhichMinimizer) +std::vector> +FindNextLocalMinima(const std::shared_ptr &model, + const std::vector &StartingPoint, + const double &temperature, + int WhichMinimizer) { - const auto UseMinimizer = GetMinimizers(WhichMinimizer); + const auto UseMinimizer = GetMinimizers(WhichMinimizer); - std::vector> Minima; + std::vector> Minima; - if(UseMinimizer.UseGSL) + if (UseMinimizer.UseGSL) + { + std::vector GSLSolution; + std::size_t tries{0}, MaxTries{600}; + int status; + GSL_params params(model, temperature); + do + { + GSLSolution.clear(); + status = GSL_Minimize_From_S_gen_all(params, GSLSolution, StartingPoint); + tries++; + } while (status != GSL_SUCCESS and tries < MaxTries); + if (status == GSL_SUCCESS) { - std::vector GSLSolution; - std::size_t tries{0}, MaxTries{600}; - int status; - GSL_params params(model,temperature); - do{ - GSLSolution.clear(); - status = GSL_Minimize_From_S_gen_all(params,GSLSolution,StartingPoint); - tries++; - }while(status != GSL_SUCCESS and tries < MaxTries); - if(status == GSL_SUCCESS) - { - Minima.push_back(GSLSolution); - } + Minima.push_back(GSLSolution); } + } #ifdef NLopt_FOUND - if(UseMinimizer.UseNLopt) + if (UseMinimizer.UseNLopt) + { + auto NLOPTres = + LibNLOPT::FindLocalMinimum(model, StartingPoint, temperature); + if (NLOPTres.Success) { - auto NLOPTres = LibNLOPT::FindLocalMinimum(model,StartingPoint,temperature); - if(NLOPTres.Success) - { - Minima.push_back(NLOPTres.Minimum); - } + Minima.push_back(NLOPTres.Minimum); } + } #endif - return Minima; + return Minima; } - -std::vector>>> +std::vector>>> MinimaDevelopmentWithTemperature( -const std::shared_ptr& model, -const double& StartingTemperature, -const double& FinalTemperature, -const double& StepsizeTemperature, -const std::vector>& RNGRanges, -const std::size_t& seed, -const std::size_t& NumberOfStartingPoints, -const int& WhichMinimizer - ) + const std::shared_ptr &model, + const double &StartingTemperature, + const double &FinalTemperature, + const double &StepsizeTemperature, + const std::vector> &RNGRanges, + const std::size_t &seed, + const std::size_t &NumberOfStartingPoints, + const int &WhichMinimizer) { - using MinimaDevelopmentType = std::vector>>; - std::vector res; - std::default_random_engine randGen(seed); - - - std::vector> StartingPoints; - for(std::size_t i{0}; i < NumberOfStartingPoints; ++i) + using MinimaDevelopmentType = + std::vector>>; + std::vector res; + std::default_random_engine randGen(seed); + + std::vector> StartingPoints; + for (std::size_t i{0}; i < NumberOfStartingPoints; ++i) + { + std::vector Point; + for (const auto &el : RNGRanges) { - std::vector Point; - for(const auto& el: RNGRanges) - { - Point.push_back(el.first - + (el.second - el.first) * std::generate_canonical::digits>(randGen) ); - } - StartingPoints.push_back(Point); + Point.push_back( + el.first + + (el.second - el.first) * + std::generate_canonical::digits>( + randGen)); } - - for(const auto& StartingPoint: StartingPoints) + StartingPoints.push_back(Point); + } + + for (const auto &StartingPoint : StartingPoints) + { + auto LocalMinima = FindNextLocalMinima( + model, StartingPoint, StartingTemperature, WhichMinimizer); + for (const auto &el : LocalMinima) { - auto LocalMinima = FindNextLocalMinima(model,StartingPoint,StartingTemperature,WhichMinimizer); - for(const auto& el: LocalMinima) - { - auto Min = std::make_pair(StartingTemperature,el); - res.push_back(MinimaDevelopmentType{Min}); - } + auto Min = std::make_pair(StartingTemperature, el); + res.push_back(MinimaDevelopmentType{Min}); } + } - auto StoppingCriteria = [&](const double& Temp){ - double epsilon = std::abs((FinalTemperature-StartingTemperature)/StepsizeTemperature)*1e-2; // because 1+1 = 2.0000000000000001 - if(StartingTemperature < FinalTemperature) - { - return Temp < FinalTemperature + epsilon; - } - else{ - return Temp > FinalTemperature - epsilon; - } - }; - - for(double Temp = StartingTemperature + StepsizeTemperature; StoppingCriteria(Temp); Temp+=StepsizeTemperature ) + auto StoppingCriteria = [&](const double &Temp) { + double epsilon = std::abs((FinalTemperature - StartingTemperature) / + StepsizeTemperature) * + 1e-2; // because 1+1 = 2.0000000000000001 + if (StartingTemperature < FinalTemperature) + { + return Temp < FinalTemperature + epsilon; + } + else + { + return Temp > FinalTemperature - epsilon; + } + }; + + for (double Temp = StartingTemperature + StepsizeTemperature; + StoppingCriteria(Temp); + Temp += StepsizeTemperature) + { + auto resOld = std::move(res); + res.clear(); + for (const auto &Point : resOld) { - auto resOld = std::move(res); - res.clear(); - for(const auto& Point: resOld) - { - auto LatestMinima = Point.at(Point.size()-1); - auto NextMinima = FindNextLocalMinima(model,LatestMinima.second,Temp,WhichMinimizer); - for(const auto& NM : NextMinima) - { - auto base{Point}; - base.push_back(std::make_pair(Temp,NM)); - res.push_back(base); - } - } + auto LatestMinima = Point.at(Point.size() - 1); + auto NextMinima = + FindNextLocalMinima(model, LatestMinima.second, Temp, WhichMinimizer); + for (const auto &NM : NextMinima) + { + auto base{Point}; + base.push_back(std::make_pair(Temp, NM)); + res.push_back(base); + } } + } - return res; + return res; } -} -} +} // namespace Minimizer +} // namespace BSMPT diff --git a/src/models/ClassPotentialC2HDM.cpp b/src/models/ClassPotentialC2HDM.cpp index c371f26f..8be1ee6e 100644 --- a/src/models/ClassPotentialC2HDM.cpp +++ b/src/models/ClassPotentialC2HDM.cpp @@ -77,8 +77,7 @@ Class_Potential_C2HDM::~Class_Potential_C2HDM() * returns a string which tells the user the chronological order of the * counterterms. Use this to complement the legend of the given inputfile */ -std::vector -Class_Potential_C2HDM::addLegendCT() const +std::vector Class_Potential_C2HDM::addLegendCT() const { std::vector labels; labels.push_back("Dm11sq"); @@ -102,8 +101,7 @@ Class_Potential_C2HDM::addLegendCT() const * the critical temperature. Use this to complement the legend of the given * inputfile */ -std::vector -Class_Potential_C2HDM::addLegendTemp() const +std::vector Class_Potential_C2HDM::addLegendTemp() const { std::vector labels; labels.push_back("T_c"); @@ -122,8 +120,7 @@ Class_Potential_C2HDM::addLegendTemp() const * * */ -std::vector -Class_Potential_C2HDM::addLegendTripleCouplings() const +std::vector Class_Potential_C2HDM::addLegendTripleCouplings() const { std::vector labels; std::vector particles; @@ -169,8 +166,7 @@ Class_Potential_C2HDM::addLegendTripleCouplings() const * returns a list of labels which tells the user the chronological order of the * VEVs. Use this to complement the legend of the given inputfile */ -std::vector -Class_Potential_C2HDM::addLegendVEV() const +std::vector Class_Potential_C2HDM::addLegendVEV() const { std::vector labels; if (IncludeChargeBreakingVEV) labels.push_back("omega_CB"); @@ -180,9 +176,8 @@ Class_Potential_C2HDM::addLegendVEV() const return labels; } -void -Class_Potential_C2HDM::ReadAndSet(const std::string &linestr, - std::vector &par) +void Class_Potential_C2HDM::ReadAndSet(const std::string &linestr, + std::vector &par) { std::stringstream ss(linestr); double tmp; @@ -229,8 +224,7 @@ Class_Potential_C2HDM::ReadAndSet(const std::string &linestr, return; } -void -Class_Potential_C2HDM::set_gen(const std::vector &p) +void Class_Potential_C2HDM::set_gen(const std::vector &p) { // double *p = (double *)par; @@ -302,8 +296,7 @@ Class_Potential_C2HDM::set_gen(const std::vector &p) if (!SetCurvatureDone) SetCurvatureArrays(); } -void -Class_Potential_C2HDM::set_CT_Pot_Par(const std::vector &p) +void Class_Potential_C2HDM::set_CT_Pot_Par(const std::vector &p) { // double *p = (double *)par; @@ -523,8 +516,7 @@ Class_Potential_C2HDM::set_CT_Pot_Par(const std::vector &p) /** * Console-Output of all Parameters */ -void -Class_Potential_C2HDM::write() const +void Class_Potential_C2HDM::write() const { typedef std::numeric_limits dbl; std::cout.precision(dbl::max_digits10); @@ -723,8 +715,7 @@ Class_Potential_C2HDM::write() const * Calculates the counterterms in the 2HDM (CP violating as well as CP * conserving) */ -std::vector -Class_Potential_C2HDM::calc_CT() const +std::vector Class_Potential_C2HDM::calc_CT() const { std::vector parCT; @@ -822,8 +813,7 @@ Class_Potential_C2HDM::calc_CT() const return parCT; } -void -Class_Potential_C2HDM::TripleHiggsCouplings() +void Class_Potential_C2HDM::TripleHiggsCouplings() { if (!SetCurvatureDone) SetCurvatureArrays(); if (!CalcCouplingsdone) CalculatePhysicalCouplings(); @@ -1002,8 +992,7 @@ Class_Potential_C2HDM::TripleHiggsCouplings() } } -void -Class_Potential_C2HDM::SetCurvatureArrays() +void Class_Potential_C2HDM::SetCurvatureArrays() { initVectors(); @@ -1480,8 +1469,7 @@ Class_Potential_C2HDM::SetCurvatureArrays() SetCurvatureDone = true; } -bool -Class_Potential_C2HDM::CalculateDebyeSimplified() +bool Class_Potential_C2HDM::CalculateDebyeSimplified() { double cb = 0; @@ -1521,8 +1509,7 @@ Class_Potential_C2HDM::CalculateDebyeSimplified() return true; } -bool -Class_Potential_C2HDM::CalculateDebyeGaugeSimplified() +bool Class_Potential_C2HDM::CalculateDebyeGaugeSimplified() { DebyeGauge[0][0] = 2 * C_g * C_g; DebyeGauge[1][1] = 2 * C_g * C_g; @@ -1602,9 +1589,8 @@ Class_Potential_C2HDM::VCounterSimplified(const std::vector &v) const return res; } -void -Class_Potential_C2HDM::Debugging(const std::vector &input, - std::vector &output) const +void Class_Potential_C2HDM::Debugging(const std::vector &input, + std::vector &output) const { (void)input; (void)output; diff --git a/src/models/ClassPotentialCxSM.cpp b/src/models/ClassPotentialCxSM.cpp index 415c78d1..ab00d94d 100644 --- a/src/models/ClassPotentialCxSM.cpp +++ b/src/models/ClassPotentialCxSM.cpp @@ -73,8 +73,7 @@ Class_CxSM::~Class_CxSM() * returns a string which tells the user the chronological order of the * counterterms. Use this to complement the legend of the given input file */ -std::vector -Class_CxSM::addLegendCT() const +std::vector Class_CxSM::addLegendCT() const { std::vector labels; labels.push_back("dms"); @@ -100,8 +99,7 @@ Class_CxSM::addLegendCT() const * the critical temperature. Use this to complement the legend of the given * input file */ -std::vector -Class_CxSM::addLegendTemp() const +std::vector Class_CxSM::addLegendTemp() const { std::vector labels; labels.push_back("T_c"); @@ -118,8 +116,7 @@ Class_CxSM::addLegendTemp() const * Higgs couplings. Use this to complement the legend of the given input file * */ -std::vector -Class_CxSM::addLegendTripleCouplings() const +std::vector Class_CxSM::addLegendTripleCouplings() const { std::vector labels; std::vector particles; @@ -156,8 +153,7 @@ Class_CxSM::addLegendTripleCouplings() const * returns a string which tells the user the chronological order of the VEVs. * Use this to complement the legend of the given input file */ -std::vector -Class_CxSM::addLegendVEV() const +std::vector Class_CxSM::addLegendVEV() const { std::vector labels; labels.push_back("omega"); @@ -169,8 +165,8 @@ Class_CxSM::addLegendVEV() const /** * Reads the string linestr and sets the parameter point */ -void -Class_CxSM::ReadAndSet(const std::string &linestr, std::vector &par) +void Class_CxSM::ReadAndSet(const std::string &linestr, + std::vector &par) { // std::cout << linestr << std::endl; std::stringstream ss(linestr); @@ -215,8 +211,7 @@ Class_CxSM::ReadAndSet(const std::string &linestr, std::vector &par) return; } -void -Class_CxSM::set_gen(const std::vector &par) +void Class_CxSM::set_gen(const std::vector &par) { vh = par[0]; @@ -291,8 +286,7 @@ Class_CxSM::set_gen(const std::vector &par) * set your counterterm parameters from the entries of par as well as the * entries of Curvature_Higgs_CT_L1 to Curvature_Higgs_CT_L4. */ -void -Class_CxSM::set_CT_Pot_Par(const std::vector &par) +void Class_CxSM::set_CT_Pot_Par(const std::vector &par) { dmsq = par[0]; @@ -428,8 +422,7 @@ Class_CxSM::set_CT_Pot_Par(const std::vector &par) /** * console output of all Parameters */ -void -Class_CxSM::write() const +void Class_CxSM::write() const { std::cout << "The parameters are : " << std::endl; std::cout << "\tlambda = " << lambda << std::endl @@ -593,8 +586,7 @@ Class_CxSM::write() const * Calculates the counterterms. Here you need to work out the scheme and * implement the formulas. */ -std::vector -Class_CxSM::calc_CT() const +std::vector Class_CxSM::calc_CT() const { std::vector parCT; parCT.resize(nParCT); @@ -781,8 +773,7 @@ Class_CxSM::calc_CT() const return parCT; } -void -Class_CxSM::TripleHiggsCouplings() +void Class_CxSM::TripleHiggsCouplings() { if (!SetCurvatureDone) SetCurvatureArrays(); if (!CalcCouplingsdone) CalculatePhysicalCouplings(); @@ -878,8 +869,7 @@ Class_CxSM::TripleHiggsCouplings() } } -void -Class_CxSM::SetCurvatureArrays() +void Class_CxSM::SetCurvatureArrays() { /* * Here you have to set the vectors @@ -1198,8 +1188,7 @@ Class_CxSM::SetCurvatureArrays() SetCurvatureDone = true; } -bool -Class_CxSM::CalculateDebyeSimplified() +bool Class_CxSM::CalculateDebyeSimplified() { return false; /* @@ -1209,8 +1198,7 @@ Class_CxSM::CalculateDebyeSimplified() */ } -bool -Class_CxSM::CalculateDebyeGaugeSimplified() +bool Class_CxSM::CalculateDebyeGaugeSimplified() { /* * Use this function if you calculated the Debye corrections to the gauge mass @@ -1220,25 +1208,22 @@ Class_CxSM::CalculateDebyeGaugeSimplified() return false; } -double -Class_CxSM::VTreeSimplified(const std::vector &v) const +double Class_CxSM::VTreeSimplified(const std::vector &v) const { (void)v; return 0; } -double -Class_CxSM::VCounterSimplified(const std::vector &v) const +double Class_CxSM::VCounterSimplified(const std::vector &v) const { (void)v; if (not UseVCounterSimplified) return 0; return 0; } -void -Class_CxSM::Debugging(const std::vector &input, - std::vector &output) const +void Class_CxSM::Debugging(const std::vector &input, + std::vector &output) const { (void)input; diff --git a/src/models/ClassPotentialOrigin.cpp b/src/models/ClassPotentialOrigin.cpp index aa0ff49f..220481ec 100644 --- a/src/models/ClassPotentialOrigin.cpp +++ b/src/models/ClassPotentialOrigin.cpp @@ -49,9 +49,8 @@ Class_Potential_Origin::~Class_Potential_Origin() * This will call set_gen(par), SetCurvatureArrays, set_CT_Pot_Par(parCT), * CalculateDebye() as well as CalculateDebyeGauge() */ -void -Class_Potential_Origin::set_All(const std::vector &par, - const std::vector &parCT) +void Class_Potential_Origin::set_All(const std::vector &par, + const std::vector &parCT) { set_gen(par); @@ -61,8 +60,7 @@ Class_Potential_Origin::set_All(const std::vector &par, CalculateDebyeGauge(); } -void -Class_Potential_Origin::Prepare_Triple() +void Class_Potential_Origin::Prepare_Triple() { for (std::size_t a = 0; a < NHiggs; a++) { @@ -81,8 +79,7 @@ Class_Potential_Origin::Prepare_Triple() } } -double -Class_Potential_Origin::FCW(double MassSquared) const +double Class_Potential_Origin::FCW(double MassSquared) const { double res = 0; double x; @@ -114,11 +111,10 @@ Class_Potential_Origin::CWTerm(double MassSquared, double cb, int diff) const return PotVal; } -double -Class_Potential_Origin::boson(double MassSquared, - double Temp, - double cb, - int diff) const +double Class_Potential_Origin::boson(double MassSquared, + double Temp, + double cb, + int diff) const { double res = 0; if (diff >= 0) res = CWTerm(std::abs(MassSquared), cb, diff); @@ -173,8 +169,7 @@ Class_Potential_Origin::fermion(double MassSquared, double Temp, int diff) const return res; } -std::vector -Class_Potential_Origin::FirstDerivativeOfEigenvalues( +std::vector Class_Potential_Origin::FirstDerivativeOfEigenvalues( const Ref M, const Ref MDiff) const { @@ -295,10 +290,9 @@ Class_Potential_Origin::FirstDerivativeOfEigenvalues( return res; } -double -Class_Potential_Origin::fbaseTri(double MassSquaredA, - double MassSquaredB, - double MassSquaredC) const +double Class_Potential_Origin::fbaseTri(double MassSquaredA, + double MassSquaredB, + double MassSquaredC) const { double res = 0; double mas = MassSquaredA; @@ -398,8 +392,8 @@ Class_Potential_Origin::fbaseTri(double MassSquaredA, return res; } -double -Class_Potential_Origin::fbase(double MassSquaredA, double MassSquaredB) const +double Class_Potential_Origin::fbase(double MassSquaredA, + double MassSquaredB) const { double res = 0; double LogA = 0; @@ -501,8 +495,7 @@ Class_Potential_Origin::SecondDerivativeOfEigenvaluesNonRepeated( return res; } -void -Class_Potential_Origin::CalculatePhysicalCouplings() +void Class_Potential_Origin::CalculatePhysicalCouplings() { if (!SetCurvatureDone) SetCurvatureArrays(); const double ZeroMass = std::pow(10, -5); @@ -943,8 +936,7 @@ Class_Potential_Origin::CalculatePhysicalCouplings() return; } -std::vector -Class_Potential_Origin::WeinbergFirstDerivative() const +std::vector Class_Potential_Origin::WeinbergFirstDerivative() const { std::vector res; if (!CalcCouplingsdone) @@ -1038,8 +1030,7 @@ Class_Potential_Origin::WeinbergFirstDerivative() const return res; } -std::vector -Class_Potential_Origin::WeinbergSecondDerivative() const +std::vector Class_Potential_Origin::WeinbergSecondDerivative() const { if (!CalcCouplingsdone) { @@ -1192,8 +1183,7 @@ Class_Potential_Origin::WeinbergSecondDerivative() const return res; } -std::vector -Class_Potential_Origin::WeinbergThirdDerivative() const +std::vector Class_Potential_Origin::WeinbergThirdDerivative() const { if (not CalcCouplingsdone) @@ -1870,10 +1860,9 @@ Class_Potential_Origin::LeptonMassesSquared(const std::vector &v, return res; } -double -Class_Potential_Origin::VTree(const std::vector &v, - int diff, - bool ForceExplicitCalculation) const +double Class_Potential_Origin::VTree(const std::vector &v, + int diff, + bool ForceExplicitCalculation) const { double res = 0; @@ -1937,10 +1926,9 @@ Class_Potential_Origin::VTree(const std::vector &v, return res; } -double -Class_Potential_Origin::CounterTerm(const std::vector &v, - int diff, - bool ForceExplicitCalculation) const +double Class_Potential_Origin::CounterTerm(const std::vector &v, + int diff, + bool ForceExplicitCalculation) const { double res = 0; if (not ForceExplicitCalculation) @@ -1993,11 +1981,10 @@ Class_Potential_Origin::CounterTerm(const std::vector &v, return res; } -double -Class_Potential_Origin::VEff(const std::vector &v, - double Temp, - int diff, - int Order) const +double Class_Potential_Origin::VEff(const std::vector &v, + double Temp, + int diff, + int Order) const { if (v.size() != nVEV and v.size() != NHiggs) { @@ -2035,10 +2022,9 @@ Class_Potential_Origin::VEff(const std::vector &v, return resOut; } -double -Class_Potential_Origin::V1Loop(const std::vector &v, - double Temp, - int diff) const +double Class_Potential_Origin::V1Loop(const std::vector &v, + double Temp, + int diff) const { double res = 0; @@ -2261,8 +2247,7 @@ Class_Potential_Origin::V1Loop(const std::vector &v, return res; } -void -Class_Potential_Origin::CalculateDebye() +void Class_Potential_Origin::CalculateDebye() { if (!SetCurvatureDone) SetCurvatureArrays(); @@ -2337,8 +2322,7 @@ Class_Potential_Origin::CalculateDebye() } } -void -Class_Potential_Origin::CalculateDebyeGauge() +void Class_Potential_Origin::CalculateDebyeGauge() { for (std::size_t i = 0; i < NGauge; i++) { @@ -2378,8 +2362,7 @@ Class_Potential_Origin::CalculateDebyeGauge() } } -void -Class_Potential_Origin::initVectors() +void Class_Potential_Origin::initVectors() { using vec2 = std::vector>; using vec3 = std::vector>>; @@ -2439,8 +2422,7 @@ Class_Potential_Origin::initVectors() HiggsVev = std::vector(NHiggs, 0); } -void -Class_Potential_Origin::resetbools() +void Class_Potential_Origin::resetbools() { SetCurvatureDone = false; CalcCouplingsdone = false; @@ -2449,8 +2431,7 @@ Class_Potential_Origin::resetbools() parCTStored.clear(); } -bool -Class_Potential_Origin::CheckNLOVEV(const std::vector &v) const +bool Class_Potential_Origin::CheckNLOVEV(const std::vector &v) const { // std::vector vPotential; double MaxDiff = 0; @@ -2464,8 +2445,7 @@ Class_Potential_Origin::CheckNLOVEV(const std::vector &v) const return (MaxDiff < AllowedDifference); } -double -Class_Potential_Origin::EWSBVEV(const std::vector &v) const +double Class_Potential_Origin::EWSBVEV(const std::vector &v) const { double res = 0; for (std::size_t i = 0; i < NHiggs; i++) @@ -2486,14 +2466,13 @@ Class_Potential_Origin::EWSBVEV(const std::vector &v) const return res; } -void -Class_Potential_Origin::setUseIndexCol(std::string legend) +void Class_Potential_Origin::setUseIndexCol(std::string legend) { UseIndexCol = legend.rfind(sep, 0) == 0; } -void -Class_Potential_Origin::CheckImplementation(const int &WhichMinimizer) const +void Class_Potential_Origin::CheckImplementation( + const int &WhichMinimizer) const { using std::pow; @@ -3032,8 +3011,7 @@ Class_Potential_Origin::CheckImplementation(const int &WhichMinimizer) const } } -void -Class_Potential_Origin::FindSignSymmetries() +void Class_Potential_Origin::FindSignSymmetries() { SignSymmetries.clear(); std::vector testvev, testvevPotential; @@ -3069,8 +3047,7 @@ Class_Potential_Origin::FindSignSymmetries() } } -void -Class_Potential_Origin::SetUseTreeLevel(bool val) +void Class_Potential_Origin::SetUseTreeLevel(bool val) { UseTreeLevel = val; } @@ -3111,8 +3088,7 @@ Class_Potential_Origin::initModel(const std::vector &par) return parCT; } -std::vector -Class_Potential_Origin::resetScale(const double &newScale) +std::vector Class_Potential_Origin::resetScale(const double &newScale) { scale = newScale; auto parCT = calc_CT(); @@ -3271,8 +3247,7 @@ Class_Potential_Origin::LeptonMasses(const std::vector &v) const return res; } -double -Class_Potential_Origin::CalculateRatioAlpha( +double Class_Potential_Origin::CalculateRatioAlpha( const std::vector &vev_symmetric, const std::vector &vev_broken, const double &Temp) const @@ -3291,8 +3266,7 @@ Class_Potential_Origin::CalculateRatioAlpha( return res; } -std::vector -Class_Potential_Origin::MinimizeOrderVEV( +std::vector Class_Potential_Origin::MinimizeOrderVEV( const std::vector &vevMinimizer) const { std::vector vevFunction; diff --git a/src/models/ClassPotentialOrigin_deprecated.cpp b/src/models/ClassPotentialOrigin_deprecated.cpp index bd4a6ed5..f70e8da3 100644 --- a/src/models/ClassPotentialOrigin_deprecated.cpp +++ b/src/models/ClassPotentialOrigin_deprecated.cpp @@ -39,11 +39,10 @@ using namespace Eigen; namespace BSMPT { -double -Class_Potential_Origin::Vl(double MassSquared, - double Temp, - int n, - int diff) const +double Class_Potential_Origin::Vl(double MassSquared, + double Temp, + int n, + int diff) const { double Mass = std::sqrt((MassSquared)); @@ -92,11 +91,10 @@ Class_Potential_Origin::Vl(double MassSquared, return PotVal; } -double -Class_Potential_Origin::Vsf(double MassSquared, - double Temp, - int n, - int diff) const +double Class_Potential_Origin::Vsf(double MassSquared, + double Temp, + int n, + int diff) const { double PotVal = 0; // std::cout << scale << std::endl; @@ -161,11 +159,10 @@ Class_Potential_Origin::Vsf(double MassSquared, return PotVal; } -double -Class_Potential_Origin::Vsb(double MassSquaredIn, - double Temp, - int n, - int diff) const +double Class_Potential_Origin::Vsb(double MassSquaredIn, + double Temp, + int n, + int diff) const { double MassSquared = (MassSquaredIn); double PotVal = 0; @@ -234,11 +231,10 @@ Class_Potential_Origin::Vsb(double MassSquaredIn, return PotVal; } -double -Class_Potential_Origin::boson_legacy(double MassSquared, - double Temp, - double cb, - int diff) const +double Class_Potential_Origin::boson_legacy(double MassSquared, + double Temp, + double cb, + int diff) const { double resPotVal = 0; long double PotVal = 0; @@ -328,10 +324,9 @@ Class_Potential_Origin::boson_legacy(double MassSquared, return resPotVal; } -double -Class_Potential_Origin::fermion_legacy(double MassSquared, - double Temp, - int diff) const +double Class_Potential_Origin::fermion_legacy(double MassSquared, + double Temp, + int diff) const { long double PotVal = 0; long double PotCW = CWTerm(MassSquared, C_CWcbFermion, diff); diff --git a/src/models/ClassPotentialR2HDM.cpp b/src/models/ClassPotentialR2HDM.cpp index aca2305b..3fa05349 100644 --- a/src/models/ClassPotentialR2HDM.cpp +++ b/src/models/ClassPotentialR2HDM.cpp @@ -67,8 +67,7 @@ Class_Potential_R2HDM::~Class_Potential_R2HDM() * returns a string which tells the user the chronological order of the * counterterms. Use this to complement the legend of the given inputfile */ -std::vector -Class_Potential_R2HDM::addLegendCT() const +std::vector Class_Potential_R2HDM::addLegendCT() const { std::vector labels; labels.push_back("Dm11sq"); @@ -90,8 +89,7 @@ Class_Potential_R2HDM::addLegendCT() const * the critical temperature. Use this to complement the legend of the given * inputfile */ -std::vector -Class_Potential_R2HDM::addLegendTemp() const +std::vector Class_Potential_R2HDM::addLegendTemp() const { std::vector labels; labels.push_back("T_c"); @@ -109,8 +107,7 @@ Class_Potential_R2HDM::addLegendTemp() const * returns a string which tells the user the chronological order of the VEVs. * Use this to complement the legend of the given inputfile */ -std::vector -Class_Potential_R2HDM::addLegendVEV() const +std::vector Class_Potential_R2HDM::addLegendVEV() const { std::vector labels; labels.push_back("omega_CB"); @@ -125,8 +122,7 @@ Class_Potential_R2HDM::addLegendVEV() const * higgs couplings. Use this to complement the legend of the given inputfile * */ -std::vector -Class_Potential_R2HDM::addLegendTripleCouplings() const +std::vector Class_Potential_R2HDM::addLegendTripleCouplings() const { std::vector labels; std::vector particles; @@ -159,9 +155,8 @@ Class_Potential_R2HDM::addLegendTripleCouplings() const return labels; } -void -Class_Potential_R2HDM::ReadAndSet(const std::string &linestr, - std::vector &par) +void Class_Potential_R2HDM::ReadAndSet(const std::string &linestr, + std::vector &par) { std::stringstream ss(linestr); double tmp; @@ -225,8 +220,7 @@ Class_Potential_R2HDM::ReadAndSet(const std::string &linestr, /** * Set Class Object with an CP-Conserving Point */ -void -Class_Potential_R2HDM::set_gen(const std::vector &par) +void Class_Potential_R2HDM::set_gen(const std::vector &par) { // double *p = (double *)par; @@ -296,8 +290,7 @@ Class_Potential_R2HDM::set_gen(const std::vector &par) vevTree = MinimizeOrderVEV(vevTreeMin); } -void -Class_Potential_R2HDM::set_CT_Pot_Par(const std::vector &p) +void Class_Potential_R2HDM::set_CT_Pot_Par(const std::vector &p) { // double *p = (double *)par; @@ -519,8 +512,7 @@ Class_Potential_R2HDM::set_CT_Pot_Par(const std::vector &p) /** * Console-Output of all Parameters */ -void -Class_Potential_R2HDM::write() const +void Class_Potential_R2HDM::write() const { typedef std::numeric_limits dbl; std::cout.precision(dbl::max_digits10); @@ -638,8 +630,7 @@ Class_Potential_R2HDM::write() const /** * Calculates the counterterms in the 2HDM */ -std::vector -Class_Potential_R2HDM::calc_CT() const +std::vector Class_Potential_R2HDM::calc_CT() const { std::vector parCT; @@ -750,8 +741,7 @@ Class_Potential_R2HDM::calc_CT() const * Use the vector TripleHiggsCorrectionsCWPhysical to save your couplings and * set the nTripleCouplings to the number of couplings you want as output. */ -void -Class_Potential_R2HDM::TripleHiggsCouplings() +void Class_Potential_R2HDM::TripleHiggsCouplings() { if (!SetCurvatureDone) SetCurvatureArrays(); if (!CalcCouplingsdone) CalculatePhysicalCouplings(); @@ -882,8 +872,7 @@ Class_Potential_R2HDM::TripleHiggsCouplings() } } -void -Class_Potential_R2HDM::SetCurvatureArrays() +void Class_Potential_R2HDM::SetCurvatureArrays() { initVectors(); @@ -1359,8 +1348,7 @@ Class_Potential_R2HDM::SetCurvatureArrays() SetCurvatureDone = true; } -bool -Class_Potential_R2HDM::CalculateDebyeSimplified() +bool Class_Potential_R2HDM::CalculateDebyeSimplified() { double cb = 0; @@ -1400,8 +1388,7 @@ Class_Potential_R2HDM::CalculateDebyeSimplified() return true; } -bool -Class_Potential_R2HDM::CalculateDebyeGaugeSimplified() +bool Class_Potential_R2HDM::CalculateDebyeGaugeSimplified() { DebyeGauge[0][0] = 2 * C_g * C_g; DebyeGauge[1][1] = 2 * C_g * C_g; @@ -1429,9 +1416,8 @@ Class_Potential_R2HDM::VCounterSimplified(const std::vector &v) const return res; } -void -Class_Potential_R2HDM::Debugging(const std::vector &input, - std::vector &output) const +void Class_Potential_R2HDM::Debugging(const std::vector &input, + std::vector &output) const { (void)input; (void)output; diff --git a/src/models/ClassPotentialRN2HDM.cpp b/src/models/ClassPotentialRN2HDM.cpp index e6799e16..dc1ab1e3 100644 --- a/src/models/ClassPotentialRN2HDM.cpp +++ b/src/models/ClassPotentialRN2HDM.cpp @@ -74,8 +74,7 @@ Class_Potential_RN2HDM::~Class_Potential_RN2HDM() * returns a string which tells the user the chronological order of the * counterterms. Use this to complement the legend of the given inputfile */ -std::vector -Class_Potential_RN2HDM::addLegendCT() const +std::vector Class_Potential_RN2HDM::addLegendCT() const { std::vector labels; labels.push_back("Du11sq"); @@ -101,8 +100,7 @@ Class_Potential_RN2HDM::addLegendCT() const * the critical temperature. Use this to complement the legend of the given * inputfile */ -std::vector -Class_Potential_RN2HDM::addLegendTemp() const +std::vector Class_Potential_RN2HDM::addLegendTemp() const { std::vector labels; labels.push_back("T_c"); @@ -162,8 +160,7 @@ Class_Potential_RN2HDM::addLegendTripleCouplings() const * returns a string which tells the user the chronological order of the VEVs. * Use this to complement the legend of the given inputfile */ -std::vector -Class_Potential_RN2HDM::addLegendVEV() const +std::vector Class_Potential_RN2HDM::addLegendVEV() const { std::vector labels; labels.push_back("omega_{CB"); @@ -174,9 +171,8 @@ Class_Potential_RN2HDM::addLegendVEV() const return labels; } -void -Class_Potential_RN2HDM::ReadAndSet(const std::string &linestr, - std::vector &par) +void Class_Potential_RN2HDM::ReadAndSet(const std::string &linestr, + std::vector &par) { std::stringstream ss(linestr); double tmp; @@ -234,8 +230,7 @@ Class_Potential_RN2HDM::ReadAndSet(const std::string &linestr, return; } -void -Class_Potential_RN2HDM::set_gen(const std::vector &p) +void Class_Potential_RN2HDM::set_gen(const std::vector &p) { L1 = p[0]; @@ -284,8 +279,7 @@ Class_Potential_RN2HDM::set_gen(const std::vector &p) * * */ -void -Class_Potential_RN2HDM::set_CT_Pot_Par(const std::vector &p) +void Class_Potential_RN2HDM::set_CT_Pot_Par(const std::vector &p) { // double *p = (double *)par; @@ -451,8 +445,7 @@ Class_Potential_RN2HDM::set_CT_Pot_Par(const std::vector &p) /** * Console-Output of all Parameters */ -void -Class_Potential_RN2HDM::write() const +void Class_Potential_RN2HDM::write() const { typedef std::numeric_limits dbl; std::cout.precision(dbl::max_digits10); @@ -638,8 +631,7 @@ Class_Potential_RN2HDM::write() const std::cout << std::abs(NeutralMixing(2, 2)) << " zeta_3 \n"; } -std::vector -Class_Potential_RN2HDM::calc_CT() const +std::vector Class_Potential_RN2HDM::calc_CT() const { std::vector parCT; @@ -800,8 +792,7 @@ Class_Potential_RN2HDM::calc_CT() const return parCT; } -void -Class_Potential_RN2HDM::TripleHiggsCouplings() +void Class_Potential_RN2HDM::TripleHiggsCouplings() { if (!SetCurvatureDone) SetCurvatureArrays(); if (!CalcCouplingsdone) CalculatePhysicalCouplings(); @@ -967,8 +958,7 @@ Class_Potential_RN2HDM::TripleHiggsCouplings() } } -void -Class_Potential_RN2HDM::SetCurvatureArrays() +void Class_Potential_RN2HDM::SetCurvatureArrays() { initVectors(); @@ -3109,8 +3099,7 @@ Class_Potential_RN2HDM::SetCurvatureArrays() SetCurvatureDone = true; } -bool -Class_Potential_RN2HDM::CalculateDebyeSimplified() +bool Class_Potential_RN2HDM::CalculateDebyeSimplified() { double cb = 0; @@ -3155,8 +3144,7 @@ Class_Potential_RN2HDM::CalculateDebyeSimplified() return true; } -bool -Class_Potential_RN2HDM::CalculateDebyeGaugeSimplified() +bool Class_Potential_RN2HDM::CalculateDebyeGaugeSimplified() { DebyeGauge[0][0] = 2 * C_g * C_g; DebyeGauge[1][1] = 2 * C_g * C_g; @@ -3184,9 +3172,8 @@ Class_Potential_RN2HDM::VCounterSimplified(const std::vector &v) const return res; } -void -Class_Potential_RN2HDM::Debugging(const std::vector &input, - std::vector &output) const +void Class_Potential_RN2HDM::Debugging(const std::vector &input, + std::vector &output) const { (void)input; (void)output; diff --git a/src/models/ClassTemplate.cpp b/src/models/ClassTemplate.cpp index 6ca307cd..d30c3d7c 100644 --- a/src/models/ClassTemplate.cpp +++ b/src/models/ClassTemplate.cpp @@ -81,8 +81,7 @@ Class_Template::~Class_Template() * returns a string which tells the user the chronological order of the * counterterms. Use this to complement the legend of the given input file */ -std::vector -Class_Template::addLegendCT() const +std::vector Class_Template::addLegendCT() const { std::vector labels; labels.push_back("dT"); @@ -96,8 +95,7 @@ Class_Template::addLegendCT() const * the critical temperature. Use this to complement the legend of the given * input file */ -std::vector -Class_Template::addLegendTemp() const +std::vector Class_Template::addLegendTemp() const { std::vector labels; labels.push_back("T_c"); // Label for the critical temperature @@ -114,8 +112,7 @@ Class_Template::addLegendTemp() const * Higgs couplings. Use this to complement the legend of the given input file * */ -std::vector -Class_Template::addLegendTripleCouplings() const +std::vector Class_Template::addLegendTripleCouplings() const { std::vector labels; std::vector particles; @@ -148,8 +145,7 @@ Class_Template::addLegendTripleCouplings() const * returns a string which tells the user the chronological order of the VEVs. * Use this to complement the legend of the given input file */ -std::vector -Class_Template::addLegendVEV() const +std::vector Class_Template::addLegendVEV() const { std::vector labels; // out = "Your VEV order"; @@ -160,8 +156,8 @@ Class_Template::addLegendVEV() const /** * Reads the string linestr and sets the parameter point */ -void -Class_Template::ReadAndSet(const std::string &linestr, std::vector &par) +void Class_Template::ReadAndSet(const std::string &linestr, + std::vector &par) { std::stringstream ss(linestr); double tmp; @@ -191,8 +187,7 @@ Class_Template::ReadAndSet(const std::string &linestr, std::vector &par) /** * Set Class Object as well as the VEV configuration */ -void -Class_Template::set_gen(const std::vector &par) +void Class_Template::set_gen(const std::vector &par) { ms = par[0]; // Class member is set accordingly to the input parameters lambda = par[1]; // Class member is set accordingly to the input parameters @@ -212,8 +207,7 @@ Class_Template::set_gen(const std::vector &par) * set your counterterm parameters from the entries of par as well as the * entries of Curvature_Higgs_CT_L1 to Curvature_Higgs_CT_L4. */ -void -Class_Template::set_CT_Pot_Par(const std::vector &par) +void Class_Template::set_CT_Pot_Par(const std::vector &par) { dT = par[0]; @@ -228,8 +222,7 @@ Class_Template::set_CT_Pot_Par(const std::vector &par) /** * console output of all Parameters */ -void -Class_Template::write() const +void Class_Template::write() const { std::cout << "Model = " << Model << std::endl; @@ -250,8 +243,7 @@ Class_Template::write() const * Calculates the counterterms. Here you need to work out the scheme and * implement the formulas. */ -std::vector -Class_Template::calc_CT() const +std::vector Class_Template::calc_CT() const { std::vector parCT; @@ -295,8 +287,7 @@ Class_Template::calc_CT() const return parCT; } -void -Class_Template::TripleHiggsCouplings() +void Class_Template::TripleHiggsCouplings() { if (!SetCurvatureDone) SetCurvatureArrays(); if (!CalcCouplingsdone) CalculatePhysicalCouplings(); @@ -392,8 +383,7 @@ Class_Template::TripleHiggsCouplings() } } -void -Class_Template::SetCurvatureArrays() +void Class_Template::SetCurvatureArrays() { /* * Here you have to set the vectors @@ -417,8 +407,7 @@ Class_Template::SetCurvatureArrays() Curvature_Quark_F2H1[0][1][0] = yt; } -bool -Class_Template::CalculateDebyeSimplified() +bool Class_Template::CalculateDebyeSimplified() { return false; /* @@ -428,8 +417,7 @@ Class_Template::CalculateDebyeSimplified() */ } -bool -Class_Template::CalculateDebyeGaugeSimplified() +bool Class_Template::CalculateDebyeGaugeSimplified() { /* * Use this function if you calculated the Debye corrections to the gauge mass @@ -439,8 +427,7 @@ Class_Template::CalculateDebyeGaugeSimplified() return false; } -double -Class_Template::VTreeSimplified(const std::vector &v) const +double Class_Template::VTreeSimplified(const std::vector &v) const { if (not UseVTreeSimplified) return 0; double res = 0; @@ -451,8 +438,7 @@ Class_Template::VTreeSimplified(const std::vector &v) const return res; } -double -Class_Template::VCounterSimplified(const std::vector &v) const +double Class_Template::VCounterSimplified(const std::vector &v) const { if (not UseVCounterSimplified) return 0; double res = 0; @@ -462,9 +448,8 @@ Class_Template::VCounterSimplified(const std::vector &v) const return res; } -void -Class_Template::Debugging(const std::vector &input, - std::vector &output) const +void Class_Template::Debugging(const std::vector &input, + std::vector &output) const { (void)input; (void)output; diff --git a/src/models/IncludeAllModels.cpp b/src/models/IncludeAllModels.cpp index 38fc3049..f00dce14 100644 --- a/src/models/IncludeAllModels.cpp +++ b/src/models/IncludeAllModels.cpp @@ -35,8 +35,7 @@ namespace BSMPT namespace ModelID { -std::unique_ptr -FChoose(ModelIDs choice) +std::unique_ptr FChoose(ModelIDs choice) { using namespace Models; switch (choice) @@ -52,8 +51,7 @@ FChoose(ModelIDs choice) } } -ModelIDs -getModel(const std::string &s) +ModelIDs getModel(const std::string &s) { std::string ModelInput = s; std::transform( @@ -70,8 +68,7 @@ getModel(const std::string &s) return ModelIDs::NotSet; } -std::unordered_map -InvertModelNames() +std::unordered_map InvertModelNames() { std::unordered_map IMN; for (const auto &el : ModelNames) @@ -88,8 +85,7 @@ InvertModelNames() } // namespace ModelID -void -ShowInputError() +void ShowInputError() { std::cerr << "The chosen Method for the thermal mass corrections is "; if (C_UseParwani) diff --git a/src/prog/BSMPT.cpp b/src/prog/BSMPT.cpp index 16979825..58b4cbc5 100644 --- a/src/prog/BSMPT.cpp +++ b/src/prog/BSMPT.cpp @@ -2,326 +2,373 @@ * BSMPT.cpp * * - * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller + * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas + Müller - This program 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. + This program 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. - This program 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. + This program 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 this program. If not, see . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ /** * @file - * Calculates the electroweak phase transition for a given Inputfile for a given subset of lines in the file - * and adds it at the end of the line in the format + * Calculates the electroweak phase transition for a given Inputfile for a given + * subset of lines in the file and adds it at the end of the line in the format * T_c v_c all single vevs. One parameter point per line. * */ - -#include // for atoi, EXIT_FAILURE -#include // for copy, max -#include // for shared_ptr, __shared_... -#include // for string, operator<< -#include // for pair -#include // for vector -#include // for Class_Potential_Origin -#include #include +#include // for Class_Potential_Origin +#include #include -#include -#include +#include // for copy, max #include +#include +#include +#include // for shared_ptr, __shared_... +#include // for atoi, EXIT_FAILURE +#include // for string, operator<< +#include // for pair +#include // for vector using namespace std; using namespace BSMPT; -struct CLIOptions{ - BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; - int FirstLine{0}, LastLine{0}; - std::string InputFile, OutputFile; - bool TerminalOutput{false}; - bool UseGSL { Minimizer::UseGSLDefault}; - bool UseCMAES {Minimizer::UseLibCMAESDefault}; - bool UseNLopt{Minimizer::UseNLoptDefault}; - int WhichMinimizer{Minimizer::WhichMinimizerDefault}; +struct CLIOptions +{ + BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; + int FirstLine{0}, LastLine{0}; + std::string InputFile, OutputFile; + bool TerminalOutput{false}; + bool UseGSL{Minimizer::UseGSLDefault}; + bool UseCMAES{Minimizer::UseLibCMAESDefault}; + bool UseNLopt{Minimizer::UseNLoptDefault}; + int WhichMinimizer{Minimizer::WhichMinimizerDefault}; - CLIOptions(int argc, char *argv[]); - bool good() const; + CLIOptions(int argc, char *argv[]); + bool good() const; }; -int main(int argc, char *argv[]) try{ - - /** - * PrintErrorLines decides if parameter points with no valid EWPT (no NLO stability or T=300 vanishing VEV) - * are printed in the output file - */ - bool PrintErrorLines=true; - - const CLIOptions args(argc,argv); - if(not args.good()) - { - return EXIT_FAILURE; - } +int main(int argc, char *argv[]) +try +{ + /** + * PrintErrorLines decides if parameter points with no valid EWPT (no NLO + * stability or T=300 vanishing VEV) are printed in the output file + */ + bool PrintErrorLines = true; - int linecounter = 1; - std::ifstream infile(args.InputFile); - if(!infile.good()) { - std::cout << "Input file " << args.InputFile << " not found " << std::endl; - return EXIT_FAILURE; - } + const CLIOptions args(argc, argv); + if (not args.good()) + { + return EXIT_FAILURE; + } - std::ofstream outfile(args.OutputFile); - if(!outfile.good()) - { - std::cout << "Can not create file " << args.OutputFile << std::endl; - return EXIT_FAILURE; - } - std::string linestr; - std::shared_ptr modelPointer = ModelID::FChoose(args.Model); - while(getline(infile,linestr)) - { - if(linecounter > args.LastLine) break; + int linecounter = 1; + std::ifstream infile(args.InputFile); + if (!infile.good()) + { + std::cout << "Input file " << args.InputFile << " not found " << std::endl; + return EXIT_FAILURE; + } - if(linecounter == 1) - { - outfile << linestr << sep << modelPointer->addLegendCT() - << sep << modelPointer->addLegendTemp() << std::endl; + std::ofstream outfile(args.OutputFile); + if (!outfile.good()) + { + std::cout << "Can not create file " << args.OutputFile << std::endl; + return EXIT_FAILURE; + } + std::string linestr; + std::shared_ptr modelPointer = + ModelID::FChoose(args.Model); + while (getline(infile, linestr)) + { + if (linecounter > args.LastLine) break; - modelPointer->setUseIndexCol(linestr); - } - if(linecounter >= args.FirstLine and linecounter <= args.LastLine and linecounter != 1) - { - if(args.TerminalOutput) - { - std::cout << "Currently at line " << linecounter << std::endl; - } - std::pair,std::vector> parameters = modelPointer->initModel(linestr); - if(args.FirstLine == args.LastLine ) { - modelPointer->write(); - } + if (linecounter == 1) + { + outfile << linestr << sep << modelPointer->addLegendCT() << sep + << modelPointer->addLegendTemp() << std::endl; - auto EWPT = Minimizer::PTFinder_gen_all(modelPointer,0,300,args.WhichMinimizer); - std::vector vevsymmetricSolution,checksym, startpoint; - for(const auto& el: EWPT.EWMinimum) startpoint.push_back(0.5*el); - auto VEVsym = Minimizer::Minimize_gen_all(modelPointer,EWPT.Tc+1,checksym,startpoint,args.WhichMinimizer); + modelPointer->setUseIndexCol(linestr); + } + if (linecounter >= args.FirstLine and linecounter <= args.LastLine and + linecounter != 1) + { + if (args.TerminalOutput) + { + std::cout << "Currently at line " << linecounter << std::endl; + } + std::pair, std::vector> parameters = + modelPointer->initModel(linestr); + if (args.FirstLine == args.LastLine) + { + modelPointer->write(); + } + auto EWPT = Minimizer::PTFinder_gen_all( + modelPointer, 0, 300, args.WhichMinimizer); + std::vector vevsymmetricSolution, checksym, startpoint; + for (const auto &el : EWPT.EWMinimum) + startpoint.push_back(0.5 * el); + auto VEVsym = Minimizer::Minimize_gen_all( + modelPointer, EWPT.Tc + 1, checksym, startpoint, args.WhichMinimizer); - if(args.FirstLine == args.LastLine) { - auto dimensionnames = modelPointer->addLegendTemp(); - std::cout << "Success ? " << static_cast(EWPT.StatusFlag) - << sep << " (1 = Yes , -1 = No, v/T reached a value below " << C_PT << " during the calculation) \n"; - if(EWPT.StatusFlag == Minimizer::MinimizerStatus::SUCCESS){ - std::cout << dimensionnames.at(1) << " = " << EWPT.vc << " GeV\n"; - std::cout << dimensionnames.at(0) << " = " << EWPT.Tc << " GeV\n"; - std::cout << "xi_c = " << dimensionnames.at(2) << " = " << EWPT.vc/EWPT.Tc << std::endl; - for(std::size_t i=0;iget_nVEV(); i++){ - std::cout << dimensionnames.at(i+3) << " = " << EWPT.EWMinimum.at(i) << " GeV\n"; - } - std::cout<< "Symmetric VEV config"<get_nVEV(); i++){ - std::cout << dimensionnames.at(i+3) << " = " << VEVsym.at(i) << " GeV\n"; - } - } - else if(EWPT.Tc == 300){ - std::cout << dimensionnames.at(1) << " != 0 GeV at T = 300 GeV." << std::endl; - } - else if(EWPT.Tc == 0){ - std::cout << "This point is not vacuum stable." << std::endl; - } - } - if(PrintErrorLines){ - outfile << linestr; - outfile << sep <C_PT*EWPT.Tc and EWPT.StatusFlag==Minimizer::MinimizerStatus::SUCCESS) outfile << sep << EWPT.vc/EWPT.Tc; - else outfile << sep << static_cast(EWPT.StatusFlag); - outfile << sep << EWPT.EWMinimum; - outfile << std::endl; - } - else if(EWPT.StatusFlag == Minimizer::MinimizerStatus::SUCCESS) - { - if(C_PT* EWPT.Tc < EWPT.vc) - { - outfile << linestr << sep << parameters.second; - outfile << sep << EWPT.Tc << sep << EWPT.vc; - outfile << sep << EWPT.vc / EWPT.Tc; - outfile << sep << EWPT.EWMinimum; - outfile << std::endl; - } - } - } - linecounter++; - if(infile.eof()) break; - } - if(args.TerminalOutput) std::cout << std::endl; - outfile.close(); - return EXIT_SUCCESS; + if (args.FirstLine == args.LastLine) + { + auto dimensionnames = modelPointer->addLegendTemp(); + std::cout << "Success ? " << static_cast(EWPT.StatusFlag) << sep + << " (1 = Yes , -1 = No, v/T reached a value below " << C_PT + << " during the calculation) \n"; + if (EWPT.StatusFlag == Minimizer::MinimizerStatus::SUCCESS) + { + std::cout << dimensionnames.at(1) << " = " << EWPT.vc << " GeV\n"; + std::cout << dimensionnames.at(0) << " = " << EWPT.Tc << " GeV\n"; + std::cout << "xi_c = " << dimensionnames.at(2) << " = " + << EWPT.vc / EWPT.Tc << std::endl; + for (std::size_t i = 0; i < modelPointer->get_nVEV(); i++) + { + std::cout << dimensionnames.at(i + 3) << " = " + << EWPT.EWMinimum.at(i) << " GeV\n"; + } + std::cout << "Symmetric VEV config" << std::endl; + for (std::size_t i = 0; i < modelPointer->get_nVEV(); i++) + { + std::cout << dimensionnames.at(i + 3) << " = " << VEVsym.at(i) + << " GeV\n"; + } + } + else if (EWPT.Tc == 300) + { + std::cout << dimensionnames.at(1) << " != 0 GeV at T = 300 GeV." + << std::endl; + } + else if (EWPT.Tc == 0) + { + std::cout << "This point is not vacuum stable." << std::endl; + } + } + if (PrintErrorLines) + { + outfile << linestr; + outfile << sep << parameters.second; + outfile << sep << EWPT.Tc << sep << EWPT.vc; + if (EWPT.vc > C_PT * EWPT.Tc and + EWPT.StatusFlag == Minimizer::MinimizerStatus::SUCCESS) + outfile << sep << EWPT.vc / EWPT.Tc; + else + outfile << sep << static_cast(EWPT.StatusFlag); + outfile << sep << EWPT.EWMinimum; + outfile << std::endl; + } + else if (EWPT.StatusFlag == Minimizer::MinimizerStatus::SUCCESS) + { + if (C_PT * EWPT.Tc < EWPT.vc) + { + outfile << linestr << sep << parameters.second; + outfile << sep << EWPT.Tc << sep << EWPT.vc; + outfile << sep << EWPT.vc / EWPT.Tc; + outfile << sep << EWPT.EWMinimum; + outfile << std::endl; + } + } + } + linecounter++; + if (infile.eof()) break; + } + if (args.TerminalOutput) std::cout << std::endl; + outfile.close(); + return EXIT_SUCCESS; } -catch(int) +catch (int) { - return EXIT_SUCCESS; + return EXIT_SUCCESS; } -catch(exception& e){ - std::cerr << e.what() << std::endl; - return EXIT_FAILURE; +catch (exception &e) +{ + std::cerr << e.what() << std::endl; + return EXIT_FAILURE; } CLIOptions::CLIOptions(int argc, char *argv[]) { + std::vector args; + for (int i{1}; i < argc; ++i) + args.push_back(argv[i]); - std::vector args; - for(int i{1};i 0 and args.at(0) == "--help") + { + throw int{0}; + } + else if (argc < 6) + { + throw std::runtime_error("Too few arguments."); + } - if(args.size() > 0 and args.at(0)=="--help") - { - throw int{0}; - } - else if(argc < 6) + std::string prefix{"--"}; + bool UsePrefix = StringStartsWith(args.at(0), prefix); + if (UsePrefix) + { + for (const auto &arg : args) { - throw std::runtime_error("Too few arguments."); + auto el = arg; + std::transform(el.begin(), el.end(), el.begin(), ::tolower); + if (StringStartsWith(el, "--model=")) + { + Model = + BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); + } + else if (StringStartsWith(el, "--input=")) + { + InputFile = arg.substr(std::string("--input=").size()); + } + else if (StringStartsWith(el, "--output=")) + { + OutputFile = arg.substr(std::string("--output=").size()); + } + else if (StringStartsWith(el, "--firstline=")) + { + FirstLine = std::stoi(el.substr(std::string("--firstline=").size())); + } + else if (StringStartsWith(el, "--lastline=")) + { + LastLine = std::stoi(el.substr(std::string("--lastline=").size())); + } + else if (StringStartsWith(el, "--terminaloutput=")) + { + TerminalOutput = + el.substr(std::string("--terminaloutput=").size()) == "y"; + } + else if (StringStartsWith(el, "--usegsl=")) + { + UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; + } + else if (StringStartsWith(el, "--usecmaes=")) + { + UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; + } + else if (StringStartsWith(el, "--usenlopt=")) + { + UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; + } } - - std::string prefix{"--"}; - bool UsePrefix = StringStartsWith(args.at(0),prefix); - if(UsePrefix) + WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL, UseCMAES, UseNLopt); + } + else + { + Model = ModelID::getModel(args.at(0)); + InputFile = args.at(1); + OutputFile = args.at(2); + FirstLine = std::stoi(args.at(3)); + LastLine = std::stoi(args.at(4)); + if (argc == 7) { - for(const auto& arg: args) - { - auto el = arg; - std::transform(el.begin(), el.end(), el.begin(), ::tolower); - if(StringStartsWith(el,"--model=")) - { - Model = BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); - } - else if(StringStartsWith(el,"--input=")) - { - InputFile = arg.substr(std::string("--input=").size()); - } - else if(StringStartsWith(el,"--output=")) - { - OutputFile = arg.substr(std::string("--output=").size()); - } - else if(StringStartsWith(el,"--firstline=")) - { - FirstLine = std::stoi(el.substr(std::string("--firstline=").size())); - } - else if(StringStartsWith(el,"--lastline=")) - { - LastLine = std::stoi(el.substr(std::string("--lastline=").size())); - } - else if(StringStartsWith(el,"--terminaloutput=")) - { - TerminalOutput = el.substr(std::string("--terminaloutput=").size()) == "y"; - } - else if(StringStartsWith(el,"--usegsl=")) - { - UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; - } - else if(StringStartsWith(el,"--usecmaes=")) - { - UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; - } - else if(StringStartsWith(el,"--usenlopt=")) - { - UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; - } - } - WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL,UseCMAES,UseNLopt); - } - else{ - Model = ModelID::getModel(args.at(0)); - InputFile = args.at(1); - OutputFile = args.at(2); - FirstLine = std::stoi(args.at(3)); - LastLine = std::stoi(args.at(4)); - if(argc == 7) { - TerminalOutput = ("y" == std::string(argv[6])); - } + TerminalOutput = ("y" == std::string(argv[6])); } + } } bool CLIOptions::good() const { - if(UseGSL and not Minimizer::UseGSLDefault) - { - throw std::runtime_error("You set --UseGSL=true but GSL was not found during compilation."); - } - if(UseCMAES and not Minimizer::UseLibCMAESDefault) - { - throw std::runtime_error("You set --UseCMAES=true but CMAES was not found during compilation."); - } - if(UseNLopt and not Minimizer::UseNLoptDefault) - { - throw std::runtime_error("You set --UseNLopt=true but NLopt was not found during compilation."); - } - if(WhichMinimizer == 0) - { - throw std::runtime_error("You disabled all minimizers. You need at least one."); - } + if (UseGSL and not Minimizer::UseGSLDefault) + { + throw std::runtime_error( + "You set --UseGSL=true but GSL was not found during compilation."); + } + if (UseCMAES and not Minimizer::UseLibCMAESDefault) + { + throw std::runtime_error( + "You set --UseCMAES=true but CMAES was not found during compilation."); + } + if (UseNLopt and not Minimizer::UseNLoptDefault) + { + throw std::runtime_error( + "You set --UseNLopt=true but NLopt was not found during compilation."); + } + if (WhichMinimizer == 0) + { + throw std::runtime_error( + "You disabled all minimizers. You need at least one."); + } - if(Model==ModelID::ModelIDs::NotSet) { + if (Model == ModelID::ModelIDs::NotSet) + { - std::cerr << "Your Model parameter does not match with the implemented Models." << std::endl; - ShowInputError(); - return false; - } - if(FirstLine < 1) - { - std::cout << "Start line counting with 1" << std::endl; - return false; - } - if(FirstLine > LastLine) - { - std::cout << "Firstline is smaller then LastLine " << std::endl; - return false; - } - return true; + std::cerr + << "Your Model parameter does not match with the implemented Models." + << std::endl; + ShowInputError(); + return false; + } + if (FirstLine < 1) + { + std::cout << "Start line counting with 1" << std::endl; + return false; + } + if (FirstLine > LastLine) + { + std::cout << "Firstline is smaller then LastLine " << std::endl; + return false; + } + return true; } diff --git a/src/prog/CalcCT.cpp b/src/prog/CalcCT.cpp index d34c0498..bf34823e 100644 --- a/src/prog/CalcCT.cpp +++ b/src/prog/CalcCT.cpp @@ -2,208 +2,233 @@ * CalcCT.cpp * * - * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller + * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas + Müller - This program 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. + This program 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. - This program 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. + This program 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 this program. If not, see . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ /** * @file - * Calculates the Counterterms for mulitple points and adds them at the end of the line. The sequence is the - * same as used in Potential::set_CT_Pot_Par + * Calculates the Counterterms for mulitple points and adds them at the end of + * the line. The sequence is the same as used in Potential::set_CT_Pot_Par */ -#include // for atoi, EXIT_FAILURE -#include // for unique_ptr -#include // for operator<<, getline -#include // for pair -#include // for vector -#include // for Class_Potential_Origin +#include // for Class_Potential_Origin #include #include #include -#include #include +#include +#include // for unique_ptr +#include // for atoi, EXIT_FAILURE +#include // for operator<<, getline +#include // for pair +#include // for vector using namespace std; using namespace BSMPT; -struct CLIOptions{ - BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; - int FirstLine{}, LastLine{}; - std::string InputFile, OutputFile; - bool TerminalOutput{false}; +struct CLIOptions +{ + BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; + int FirstLine{}, LastLine{}; + std::string InputFile, OutputFile; + bool TerminalOutput{false}; - CLIOptions(int argc, char *argv[]); - bool good() const; + CLIOptions(int argc, char *argv[]); + bool good() const; }; -int main(int argc, char *argv[]) try{ - - const CLIOptions args(argc,argv); +int main(int argc, char *argv[]) +try +{ - if(not args.good()) + const CLIOptions args(argc, argv); + + if (not args.good()) + { + return EXIT_FAILURE; + } + + int linecounter = 1; + std::ifstream infile(args.InputFile); + if (!infile.good()) + { + std::cout << "Input file not found " << std::endl; + return EXIT_FAILURE; + } + std::ofstream outfile(args.OutputFile); + if (!outfile.good()) + { + std::cout << "Can not create file " << args.OutputFile << std::endl; + return EXIT_FAILURE; + } + std::string linestr; + + std::unique_ptr modelPointer = + ModelID::FChoose(args.Model); + + while (getline(infile, linestr)) + { + if (linecounter > args.LastLine) break; + if (linecounter == 1) { - return EXIT_FAILURE; + modelPointer->setUseIndexCol(linestr); + outfile << linestr; + outfile << sep << modelPointer->addLegendCT(); + outfile << std::endl; } - int linecounter = 1; - std::ifstream infile(args.InputFile); - if(!infile.good()) { - std::cout << "Input file not found " << std::endl; - return EXIT_FAILURE; - } - std::ofstream outfile(args.OutputFile); - if(!outfile.good()) - { - std::cout << "Can not create file " << args.OutputFile << std::endl; - return EXIT_FAILURE; - } - std::string linestr; - - std::unique_ptr modelPointer = ModelID::FChoose(args.Model); - - while(getline(infile,linestr)) - { - if(linecounter > args.LastLine) break; - if(linecounter == 1) - { - modelPointer->setUseIndexCol(linestr); - outfile << linestr; - outfile << sep << modelPointer->addLegendCT(); - outfile << std::endl; - } - - if(linecounter >= args.FirstLine and linecounter <= args.LastLine and linecounter != 1) - { - std::pair,std::vector> parameters = modelPointer->initModel(linestr); - outfile << linestr << sep << parameters.second << std::endl; - } - linecounter++; - if(infile.eof()) break; - } - outfile.close(); - return EXIT_SUCCESS; + if (linecounter >= args.FirstLine and linecounter <= args.LastLine and + linecounter != 1) + { + std::pair, std::vector> parameters = + modelPointer->initModel(linestr); + outfile << linestr << sep << parameters.second << std::endl; + } + linecounter++; + if (infile.eof()) break; + } + outfile.close(); + return EXIT_SUCCESS; } -catch(int) +catch (int) { - return EXIT_SUCCESS; + return EXIT_SUCCESS; } -catch(exception& e){ - std::cerr << e.what() << std::endl; - return EXIT_FAILURE; +catch (exception &e) +{ + std::cerr << e.what() << std::endl; + return EXIT_FAILURE; } CLIOptions::CLIOptions(int argc, char *argv[]) { - std::vector args; - for(int i{1};i args; + for (int i{1}; i < argc; ++i) + args.push_back(argv[i]); + + if (argc < 6 or args.at(0) == "--help") + { + int SizeOfFirstColumn = std::string("--TerminalOutput= ").size(); + std::cout << "CalcCT calculates the counterterm parameters for the given " + "paramter points" + << std::endl + << "It is called either by " << std::endl + << "./CalcCT model input output FirstLine LastLine" << std::endl + << "or with the following arguments" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--help" + << "Shows this menu" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--model=" + << "The model you want to investigate" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--input=" + << "The input file in tsv format" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--output=" + << "The output file in tsv format" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--FirstLine=" + << "The first line in the input file to calculate the EWPT. " + "Expects line 1 to be a legend." + << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--LastLine=" + << "The last line in the input file to calculate the EWPT." + << std::endl + << std::setw(SizeOfFirstColumn) << std::left + << "--TerminalOutput=" + << "y/n Turns on additional information in the terminal during " + "the calculation." + << std::endl; + ShowInputError(); + } + + if (args.size() > 0 and args.at(0) == "--help") + { + throw int{0}; + } + else if (argc < 6) + { + throw std::runtime_error("Too few arguments."); + } + + std::string prefix{"--"}; + bool UsePrefix = StringStartsWith(args.at(0), prefix); + if (UsePrefix) + { + for (const auto &arg : args) { - int SizeOfFirstColumn = std::string("--TerminalOutput= ").size(); - std::cout << "CalcCT calculates the counterterm parameters for the given paramter points" << std::endl - << "It is called either by " << std::endl - << "./CalcCT model input output FirstLine LastLine" << std::endl - << "or with the following arguments" << std::endl - << std::setw(SizeOfFirstColumn) << std::left<< "--help" - << "Shows this menu" << std::endl - << std::setw(SizeOfFirstColumn) << std::left << "--model=" - << "The model you want to investigate"< 0 and args.at(0)=="--help") + } + else + { + Model = ModelID::getModel(args.at(0)); + InputFile = args.at(1); + OutputFile = args.at(2); + FirstLine = std::stoi(args.at(3)); + LastLine = std::stoi(args.at(4)); + if (argc == 7) { - throw int{0}; - } - else if(argc < 6) - { - throw std::runtime_error("Too few arguments."); - } - - std::string prefix{"--"}; - bool UsePrefix = StringStartsWith(args.at(0),prefix); - if(UsePrefix) - { - for(const auto& arg: args) - { - auto el = arg; - std::transform(el.begin(), el.end(), el.begin(), ::tolower); - if(StringStartsWith(el,"--model=")) - { - Model = BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); - } - else if(StringStartsWith(el,"--input=")) - { - InputFile = arg.substr(std::string("--input=").size()); - } - else if(StringStartsWith(el,"--output=")) - { - OutputFile = arg.substr(std::string("--output=").size()); - } - else if(StringStartsWith(el,"--firstline=")) - { - FirstLine = std::stoi(el.substr(std::string("--firstline=").size())); - } - else if(StringStartsWith(el,"--lastline=")) - { - LastLine = std::stoi(el.substr(std::string("--lastline=").size())); - } - else if(StringStartsWith(el,"--terminaloutput=")) - { - TerminalOutput = el.substr(std::string("--terminaloutput=").size()) == "y"; - } - } - } - else{ - Model = ModelID::getModel(args.at(0)); - InputFile = args.at(1); - OutputFile = args.at(2); - FirstLine = std::stoi(args.at(3)); - LastLine = std::stoi(args.at(4)); - if(argc == 7) { - TerminalOutput = ("y" == std::string(argv[6])); - } + TerminalOutput = ("y" == std::string(argv[6])); } + } } bool CLIOptions::good() const { - if(Model==ModelID::ModelIDs::NotSet) { - std::cerr << "Your Model parameter does not match with the implemented Models." << std::endl; - ShowInputError(); - return false; - } - if(FirstLine < 1) - { - std::cout << "Start line counting with 1" << std::endl; - return false; - } - if(FirstLine > LastLine) - { - std::cout << "Firstline is smaller then LastLine " << std::endl; - return false; - } - return true; + if (Model == ModelID::ModelIDs::NotSet) + { + std::cerr + << "Your Model parameter does not match with the implemented Models." + << std::endl; + ShowInputError(); + return false; + } + if (FirstLine < 1) + { + std::cout << "Start line counting with 1" << std::endl; + return false; + } + if (FirstLine > LastLine) + { + std::cout << "Firstline is smaller then LastLine " << std::endl; + return false; + } + return true; } diff --git a/src/prog/Calc_eta_fluid.cpp b/src/prog/Calc_eta_fluid.cpp index ae3f37fa..78a37776 100644 --- a/src/prog/Calc_eta_fluid.cpp +++ b/src/prog/Calc_eta_fluid.cpp @@ -1,280 +1,329 @@ -#include -#include #include +#include +#include #include #include ////////Included Models for the transport equations//////// +#include #include #include -#include -#include #include +#include ////////////////////////////////////////////////////////// - using namespace boost::numeric::odeint; ///////////////OPTIONS////////////////// - /* - method_transport == 0 --> Every method is calculated - method_transport == 1 --> top only included in transport equations - method_transport == 2 --> top+bot included in transport equations - method_transport == 3 --> top+bot+tau included in transport equations - */ - const int method_transport = 0 ; - - /* - bot_mass_flag ==1 --> non-zero bot mass - bot_mass_flag ==2 --> zero bot mass - */ - const int bot_mass_flag = 1 ; +/* + method_transport == 0 --> Every method is calculated + method_transport == 1 --> top only included in transport equations + method_transport == 2 --> top+bot included in transport equations + method_transport == 3 --> top+bot+tau included in transport equations +*/ +const int method_transport = 0; + +/* + bot_mass_flag ==1 --> non-zero bot mass + bot_mass_flag ==2 --> zero bot mass +*/ +const int bot_mass_flag = 1; /////////////////////////////////////// -int main(int argc, char *argv[]) try{ - +int main(int argc, char *argv[]) +try +{ bool debug = true; - int Model=-1; - - if(!( argc == 7 or argc == 8) ) - { - std::cerr << "./Calc_eta_fluid Model Inputfile Outputfile LineStart LineEnd v_W \n"; - ShowInputError(); - return EXIT_FAILURE; - } - - - Model=ModelID::getModel(argv[1]); - if(Model==-1) { - std::cerr << "Your Model parameter does not match with the implemented Models." << std::endl; - ShowInputError(); - return EXIT_FAILURE; - } - - double LineStart,LineEnd; - char* in_file;char* out_file; - - in_file = argv[2]; - out_file = argv[3]; - - if(Model == -1) Model = atoi(argv[1]); - LineStart = atoi(argv[4]); - LineEnd = atoi(argv[5]); - double vw = atof(argv[6]); - - bool TerminalOutput = false; - if(argc == 8) { - std::string s7 = argv[7]; - std::cout << s7 << std::endl; - TerminalOutput = ("y" == s7); - } - - if(LineStart < 1) - { - std::cout << "Start line counting with 1" << std::endl; - return EXIT_FAILURE; - } - if(LineStart > LineEnd) - { - std::cout << "LineEnd is smaller then LineStart " << std::endl; - return EXIT_FAILURE; - } - - int linecounter = 1; - std::ifstream infile(in_file); - if(!infile.good()) { - std::cout << "Input file not found " << std::endl; - return EXIT_FAILURE; - } - - std::ofstream outfile(out_file); - if(!outfile.good()) - { - std::cout << "Can not create file " << out_file << std::endl; - return EXIT_FAILURE; - } - std::string linestr; - std::shared_ptr modelPointer = ModelID::FChoose(Model); - // int Type; - // double tmp; - int nPar,nParCT; - nPar = modelPointer->nPar; - nParCT = modelPointer->nParCT; - std::size_t ndim = modelPointer->nVEV; - std::vector par(nPar); - std::vector parCT(nParCT); - //Declare the vector for the PTFinder algorithm - std::vector sol; - - //Initialise the polarisation for the KFACTORs ---> Not needed in the fluid type ansatz - Kfactors_interpolated_GSL Kfunctions; - Kfunctions.init(); - - /* - Declaration of all needed parameters - */ - double LW =0; - - - if(debug) std::cout << "Begin of Inputread" < LineEnd) break; - - if(linecounter == 1) - { - // outfile << linestr << sep << modelPointer->addLegendCT() << sep; - // outfile << modelPointer->addLegendTemp(); - // outfile << std::endl; - - //Assuming we already read a BSMPT Output file - modelPointer->setUseIndexCol(linestr); - outfile << linestr; - outfile << sep <<"LW_J"<= LineStart and linecounter <= LineEnd and linecounter != 1) - { - if(TerminalOutput) - { - std::cout << "Currently at line " << linecounter << std::endl; - } - std::pair,std::vector> parameters = modelPointer->initModel(linestr); - par=parameters.first; - parCT = parameters.second; - modelPointer->FindSignSymmetries(); - - if(LineStart == LineEnd ) modelPointer->write(); - sol.clear(); - - if(debug) std::cout<< "End of parameter inputread -> PTFinder_gen_all called"< vcritical,vbarrier; - for(std::size_t i=3;i 0.5*M_PI) - { - for(auto symmetry : modelPointer->SignSymmetries) - { - double tmpphase=std::atan2(symmetry.at(CPoddIndex)*vcritical.at(CPoddIndex), symmetry.at(CPevenIndex)*vcritical.at(CPevenIndex) ); - if(std::abs(tmpphase) <= 0.5*M_PI) - { - for(std::size_t i=0;iCalculated at TC+1 - std::vector vevsymmetricSolutiontmp,checksym, startpoint; - for(std::size_t i=0;inVEV;i++) startpoint.push_back(0.5*vcritical.at(i)); - Minimize_gen_all(modelPointer,TC+1,vevsymmetricSolutiontmp,checksym,startpoint); - - if(debug) - { - std::cout << "Solution for the symmetric phase : " << std::endl; - for(std::size_t i=0;i vev_sym_theta - GSL_integration_mubl_container.init(vw,vcritical,vevsymmetricSolutiontmp,TC,modelPointer,Kfunctions); - if(debug) std::cout<<"End init container"< , std::vector > arr_nL; - switch(GSL_integration_mubl_container.get_transport_method()) - { - case 1: arr_nL = set_up_nL_grid(n_step , GSL_integration_mubl_container , C_top ); - break; - case 2: arr_nL = set_up_nL_grid(n_step , GSL_integration_mubl_container , C_bot ); - break; - case 3: arr_nL = set_up_nL_grid(n_step , GSL_integration_mubl_container , C_tau ); - break; - default: throw std::runtime_error("No valid transport method chosen \n"); - - } - - // //Initialisation of the eta class for the numercial evaluation of eta - Calc_eta C_eta; - C_eta.set_class(arr_nL,TC,vw); - eta = Nintegrate_eta(C_eta,0 , GSL_integration_mubl_container.getZMAX()); - if(TerminalOutput) std::cout<<"eta = n_b/s = "< LineEnd) + { + std::cout << "LineEnd is smaller then LineStart " << std::endl; + return EXIT_FAILURE; + } + + int linecounter = 1; + std::ifstream infile(in_file); + if (!infile.good()) + { + std::cout << "Input file not found " << std::endl; + return EXIT_FAILURE; + } + + std::ofstream outfile(out_file); + if (!outfile.good()) + { + std::cout << "Can not create file " << out_file << std::endl; + return EXIT_FAILURE; + } + std::string linestr; + std::shared_ptr modelPointer = + ModelID::FChoose(Model); + // int Type; + // double tmp; + int nPar, nParCT; + nPar = modelPointer->nPar; + nParCT = modelPointer->nParCT; + std::size_t ndim = modelPointer->nVEV; + std::vector par(nPar); + std::vector parCT(nParCT); + // Declare the vector for the PTFinder algorithm + std::vector sol; + + // Initialise the polarisation for the KFACTORs ---> Not needed in the fluid + // type ansatz + Kfactors_interpolated_GSL Kfunctions; + Kfunctions.init(); + + /* + Declaration of all needed parameters + */ + double LW = 0; + + if (debug) std::cout << "Begin of Inputread" << std::endl; + while (getline(infile, linestr)) + { + if (linecounter > LineEnd) break; + + if (linecounter == 1) + { + // outfile << linestr << sep << modelPointer->addLegendCT() << sep; + // outfile << modelPointer->addLegendTemp(); + // outfile << std::endl; + + // Assuming we already read a BSMPT Output file + modelPointer->setUseIndexCol(linestr); + outfile << linestr; + outfile << sep << "LW_J" << sep << "vw_J" << sep << "eta_J"; + outfile << std::endl; + } + if (linecounter >= LineStart and linecounter <= LineEnd and + linecounter != 1) + { + if (TerminalOutput) + { + std::cout << "Currently at line " << linecounter << std::endl; + } + std::pair, std::vector> parameters = + modelPointer->initModel(linestr); + par = parameters.first; + parCT = parameters.second; + modelPointer->FindSignSymmetries(); + + if (LineStart == LineEnd) modelPointer->write(); + sol.clear(); + + if (debug) + std::cout << "End of parameter inputread -> PTFinder_gen_all called" + << std::endl; + + PTFinder_gen_all(modelPointer, 0, 300, sol, 3); + // Define parameters for eta and vw + double eta = 0; + // Struct Container for the parameters needed for the calculation + struct GSL_integration_mubl GSL_integration_mubl_container; + + if (TerminalOutput) std::cout << "PFTinder_gen_all END" << std::endl; + // START: SFOEWPT is found at given line + if (sol.at(2) == 1 and C_PT * sol.at(0) < sol.at(1)) + { + // Calculation of LW + std::vector vcritical, vbarrier; + for (std::size_t i = 3; i < ndim + 3; i++) + vcritical.push_back(sol.at(i)); + int CPoddIndex = 3, CPevenIndex = 2; + double brokenPhase = + std::atan2(vcritical.at(CPoddIndex), vcritical.at(CPevenIndex)); + // Sign Check for the broken phase + if (std::abs(brokenPhase) > 0.5 * M_PI) + { + for (auto symmetry : modelPointer->SignSymmetries) + { + double tmpphase = std::atan2( + symmetry.at(CPoddIndex) * vcritical.at(CPoddIndex), + symmetry.at(CPevenIndex) * vcritical.at(CPevenIndex)); + if (std::abs(tmpphase) <= 0.5 * M_PI) + { + for (std::size_t i = 0; i < vcritical.size(); i++) + vcritical.at(i) *= symmetry.at(i); + break; + } + } + } + double TC = sol.at(0); + // Symmetric Phase (symmetric minimum)-->Calculated at TC+1 + std::vector vevsymmetricSolutiontmp, checksym, startpoint; + for (std::size_t i = 0; i < modelPointer->nVEV; i++) + startpoint.push_back(0.5 * vcritical.at(i)); + Minimize_gen_all(modelPointer, + TC + 1, + vevsymmetricSolutiontmp, + checksym, + startpoint); + + if (debug) + { + std::cout << "Solution for the symmetric phase : " << std::endl; + for (std::size_t i = 0; i < vevsymmetricSolutiontmp.size(); i++) + { + std::cout << "vevsymmetricSolution[" << i + << "] = " << vevsymmetricSolutiontmp.at(i) << std::endl; + } + } + double absVEVSymmetricSolutionTmp = 0; + for (auto x : vevsymmetricSolutiontmp) + absVEVSymmetricSolutionTmp += std::pow(x, 2); + if (absVEVSymmetricSolutionTmp != 0) + std::cout << "Check for sign of non vanishing components of " + "symmetric vacuum : " + << std::endl; + // TODO Implementation for the CN2HDM ?! + // Initialisation for the parameter container + if (debug) std::cout << "Start init container" << std::endl; + // init needs vevsymmetricSolutiontmp! The real vevconfig for the actual + // top phase is calculated in init() --> vev_sym_theta + GSL_integration_mubl_container.init(vw, + vcritical, + vevsymmetricSolutiontmp, + TC, + modelPointer, + Kfunctions); + if (debug) std::cout << "End init container" << std::endl; + GSL_integration_mubl_container.setZMAX(5, true); + if (debug) + std::cout << "zmax = " << GSL_integration_mubl_container.getZMAX() + << std::endl; + + // START: mu_bl calculation + int n_step = 50; + std::vector vec_mubl; + std::vector vec_z; + vec_mubl.resize(n_step); + vec_z.resize(n_step); + + if (TerminalOutput) std::cout << "___Set Up nL Grid___ " << std::endl; + // Initialisation of Gam_M class for the numerical evaluation of Gamma_M + Calc_Gam_M Calc_Gam_inp; + // Initialisation of S_CP class for the numerical evaluation of S_CP + Calc_Scp Calc_Scp_inp; + // Initialisation of kappa class for the numerical evaluation of kappa + Calc_kappa_t Calc_kappa_inp; + + // Initialisation of fluid transport class for the numerical evaluation + // of the transport equations + + // TOP only + top_source C_top; + C_top.set_class(bot_mass_flag, + GSL_integration_mubl_container, + Calc_Gam_inp, + Calc_Scp_inp, + Calc_kappa_inp); + // //BOT+TOP + bot_source C_bot; + C_bot.set_class(bot_mass_flag, + GSL_integration_mubl_container, + Calc_Gam_inp, + Calc_Scp_inp, + Calc_kappa_inp); + // //TAU+BOT+TOP + tau_source C_tau; + C_tau.set_class(bot_mass_flag, + GSL_integration_mubl_container, + Calc_Gam_inp, + Calc_Scp_inp, + Calc_kappa_inp); + // Decide which method + std::pair, std::vector> arr_nL; + switch (GSL_integration_mubl_container.get_transport_method()) + { + case 1: + arr_nL = + set_up_nL_grid(n_step, GSL_integration_mubl_container, C_top); + break; + case 2: + arr_nL = + set_up_nL_grid(n_step, GSL_integration_mubl_container, C_bot); + break; + case 3: + arr_nL = + set_up_nL_grid(n_step, GSL_integration_mubl_container, C_tau); + break; + default: + throw std::runtime_error("No valid transport method chosen \n"); + } + + // //Initialisation of the eta class for the numercial evaluation of + // eta + Calc_eta C_eta; + C_eta.set_class(arr_nL, TC, vw); + eta = + Nintegrate_eta(C_eta, 0, GSL_integration_mubl_container.getZMAX()); + if (TerminalOutput) std::cout << "eta = n_b/s = " << eta << std::endl; + } // END: SFOEWPT + /* + Start of outfile + */ + outfile << linestr; + outfile << sep << LW << sep << vw << sep << eta << std::endl; + } // END: Valid Line Number + linecounter++; + if (infile.eof()) break; + } // END: Line Calculation + if (TerminalOutput) std::cout << std::endl; + + outfile.close(); return EXIT_SUCCESS; - } -catch(std::exception& e){ - std::cerr << e.what() << std::endl; - return EXIT_FAILURE; +catch (std::exception &e) +{ + std::cerr << e.what() << std::endl; + return EXIT_FAILURE; } diff --git a/src/prog/CalculateEWBG.cpp b/src/prog/CalculateEWBG.cpp index 88bd906a..ae93333b 100644 --- a/src/prog/CalculateEWBG.cpp +++ b/src/prog/CalculateEWBG.cpp @@ -2,378 +2,433 @@ * CalculateEWBG.cpp * * - * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller + * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas + Müller - This program 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. + This program 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. - This program 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. + This program 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 this program. If not, see . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ /** * @file - * Calculates the electroweak baryogenesis for a given Inputfile for a given subset of lines in the file - * and adds it at the end of the line in the format + * Calculates the electroweak baryogenesis for a given Inputfile for a given + * subset of lines in the file and adds it at the end of the line in the format * T_c v_c all single vevs. One parameter point per line. * */ -#include // for atoi, std::size_t -#include // for max, copy -#include // for shared_ptr -#include // for string -#include // for vector -#include // for GSL_integ... -#include // for Class_Pot... -#include -#include -#include #include +#include // for GSL_integ... +#include +#include // for Class_Pot... +#include #include +#include // for max, copy #include +#include +#include // for shared_ptr +#include // for atoi, std::size_t +#include // for string +#include // for vector using namespace std; using namespace BSMPT; -struct CLIOptions{ - BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; - int FirstLine{}, LastLine{}; - std::string InputFile, OutputFile,ConfigFile; - bool TerminalOutput{false}; - double vw{0.1}; - bool UseGSL { Minimizer::UseGSLDefault}; - bool UseCMAES {Minimizer::UseLibCMAESDefault}; - bool UseNLopt{Minimizer::UseNLoptDefault}; - int WhichMinimizer{Minimizer::WhichMinimizerDefault}; +struct CLIOptions +{ + BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; + int FirstLine{}, LastLine{}; + std::string InputFile, OutputFile, ConfigFile; + bool TerminalOutput{false}; + double vw{0.1}; + bool UseGSL{Minimizer::UseGSLDefault}; + bool UseCMAES{Minimizer::UseLibCMAESDefault}; + bool UseNLopt{Minimizer::UseNLoptDefault}; + int WhichMinimizer{Minimizer::WhichMinimizerDefault}; - CLIOptions(int argc, char *argv[]); - bool good() const; + CLIOptions(int argc, char *argv[]); + bool good() const; }; -int main(int argc, char *argv[]) try{ - - const CLIOptions args(argc,argv); - - if(not args.good()) - { - return EXIT_FAILURE; - } +int main(int argc, char *argv[]) +try +{ + const CLIOptions args(argc, argv); -//Init: Interface Class for the different transport methods - Baryo::CalculateEtaInterface EtaInterface(args.ConfigFile); + if (not args.good()) + { + return EXIT_FAILURE; + } + // Init: Interface Class for the different transport methods + Baryo::CalculateEtaInterface EtaInterface(args.ConfigFile); - int linecounter = 1; - std::ifstream infile(args.InputFile); - if(!infile.good()) - { - std::cout << "Input file not found " << std::endl; - return EXIT_FAILURE; - } + int linecounter = 1; + std::ifstream infile(args.InputFile); + if (!infile.good()) + { + std::cout << "Input file not found " << std::endl; + return EXIT_FAILURE; + } - std::ofstream outfile(args.OutputFile); - if(!outfile.good()) - { - std::cout << "Can not create file " << args.OutputFile << std::endl; - return EXIT_FAILURE; - } - std::string linestr; - std::shared_ptr modelPointer = ModelID::FChoose(args.Model);// Declare the model pointer with the necessary parameters - std::vector etaLegend = EtaInterface.legend();// Declare the vector for the PTFinder algorithm -//Begin: Input Read - while(getline(infile,linestr)) - { - if(linecounter > args.LastLine) break; - else if(linecounter == 1) - { - // Write legend - modelPointer->setUseIndexCol(linestr); - outfile << linestr; - for(const auto& x: modelPointer->addLegendCT()) outfile << sep << x+"_EWBG"; - for(const auto& x: modelPointer->addLegendTemp()) outfile << sep << x+"_EWBG"; - outfile << sep << "vw"; - outfile << sep << "L_W"; - outfile << sep << "top_sym_phase"; - outfile << sep << "top_brk_phase"; - outfile << sep << "bot_sym_phase"; - outfile << sep << "bot_brk_phase"; - outfile << sep << "tau_sym_phase"; - outfile << sep << "tau_brk_phase"; - outfile << sep << etaLegend; - outfile << std::endl; - } - else if(linecounter >= args.FirstLine and linecounter <= args.LastLine and linecounter != 1) - { - if(args.TerminalOutput) - { - std::cout << "Currently at line " << linecounter << std::endl; - } -//Begin: Parameter Set Up for BSMPT - auto parameters = modelPointer->initModel(linestr); - modelPointer->FindSignSymmetries(); - if(args.FirstLine == args.LastLine ) { - modelPointer->write(); - std::cout << "vw = " << args.vw << std::endl; - } - if(args.TerminalOutput) std::cout<<"Calling PTFinder"< modelPointer = ModelID::FChoose( + args.Model); // Declare the model pointer with the necessary parameters + std::vector etaLegend = + EtaInterface.legend(); // Declare the vector for the PTFinder algorithm + // Begin: Input Read + while (getline(infile, linestr)) + { + if (linecounter > args.LastLine) + break; + else if (linecounter == 1) + { + // Write legend + modelPointer->setUseIndexCol(linestr); + outfile << linestr; + for (const auto &x : modelPointer->addLegendCT()) + outfile << sep << x + "_EWBG"; + for (const auto &x : modelPointer->addLegendTemp()) + outfile << sep << x + "_EWBG"; + outfile << sep << "vw"; + outfile << sep << "L_W"; + outfile << sep << "top_sym_phase"; + outfile << sep << "top_brk_phase"; + outfile << sep << "bot_sym_phase"; + outfile << sep << "bot_brk_phase"; + outfile << sep << "tau_sym_phase"; + outfile << sep << "tau_brk_phase"; + outfile << sep << etaLegend; + outfile << std::endl; + } + else if (linecounter >= args.FirstLine and linecounter <= args.LastLine and + linecounter != 1) + { + if (args.TerminalOutput) + { + std::cout << "Currently at line " << linecounter << std::endl; + } + // Begin: Parameter Set Up for BSMPT + auto parameters = modelPointer->initModel(linestr); + modelPointer->FindSignSymmetries(); + if (args.FirstLine == args.LastLine) + { + modelPointer->write(); + std::cout << "vw = " << args.vw << std::endl; + } + if (args.TerminalOutput) std::cout << "Calling PTFinder" << std::endl; -//Call: BSMPT - auto EWPT = Minimizer::PTFinder_gen_all(modelPointer,0,300,args.WhichMinimizer); -//Define parameters for eta - std::vector eta; - if(EWPT.StatusFlag == Minimizer::MinimizerStatus::SUCCESS and C_PT*EWPT.Tc < EWPT.vc){ - if(args.TerminalOutput) std::cout<<"SFOEWPT found..."< vevsymmetricSolution,checksym, startpoint; - for(const auto& el: EWPT.EWMinimum) startpoint.push_back(0.5*el); - vevsymmetricSolution=Minimizer::Minimize_gen_all(modelPointer,EWPT.Tc+1,checksym,startpoint,args.WhichMinimizer); -//Call: Calculation of eta in the different implemented approaches - if(args.TerminalOutput) std::cout<<"Calling CalcEta..."< eta; + if (EWPT.StatusFlag == Minimizer::MinimizerStatus::SUCCESS and + C_PT * EWPT.Tc < EWPT.vc) + { + if (args.TerminalOutput) std::cout << "SFOEWPT found..." << std::endl; + // Find the minimum in the symmetric phase. For this minimise at T = Tc + // + 1 + std::vector vevsymmetricSolution, checksym, startpoint; + for (const auto &el : EWPT.EWMinimum) + startpoint.push_back(0.5 * el); + vevsymmetricSolution = Minimizer::Minimize_gen_all(modelPointer, + EWPT.Tc + 1, + checksym, + startpoint, + args.WhichMinimizer); + // Call: Calculation of eta in the different implemented approaches + if (args.TerminalOutput) std::cout << "Calling CalcEta..." << std::endl; + eta = EtaInterface.CalcEta(args.vw, + EWPT.EWMinimum, + vevsymmetricSolution, + EWPT.Tc, + modelPointer, + args.WhichMinimizer); + // Outfile + outfile << linestr; + outfile << sep << parameters.second; + outfile << sep << EWPT.Tc << sep << EWPT.vc; + outfile << sep << EWPT.vc / EWPT.Tc; + outfile << sep << EWPT.EWMinimum; + outfile << sep << args.vw; + outfile << sep << EtaInterface.getLW(); + outfile << sep << EtaInterface.getSymmetricCPViolatingPhase_top(); + outfile << sep << EtaInterface.getBrokenCPViolatingPhase_top(); + outfile << sep << EtaInterface.getSymmetricCPViolatingPhase_bot(); + outfile << sep << EtaInterface.getBrokenCPViolatingPhase_bot(); + outfile << sep << EtaInterface.getSymmetricCPViolatingPhase_tau(); + outfile << sep << EtaInterface.getBrokenCPViolatingPhase_tau(); + outfile << sep << eta; + outfile << std::endl; + } // END: SFOEWPT found + else + { // No SFOEWPT provided + outfile << linestr; + outfile << sep << parameters.second; + outfile << sep << EWPT.Tc << sep << EWPT.vc; + outfile << sep << EWPT.EWMinimum; + outfile << sep << EWPT.vc / EWPT.Tc; + outfile << sep << args.vw; + outfile << sep << -1; // LW + outfile << sep << -50; // top sym CP phase + outfile << sep << -50; // top brk CP phase + outfile << sep << -50; // bot sym CP phase + outfile << sep << -50; // bot brk CP phase + outfile << sep << -50; // tau sym CP phase + outfile << sep << -50; // tau brk CP phase + for (std::size_t i = 0; i < etaLegend.size(); i++) + outfile << sep << 0; + outfile << std::endl; + } // END: No SFOEWPT - if(args.FirstLine == args.LastLine) { - auto dimensionnames = modelPointer->addLegendTemp(); - std::cout << "Succeded ? " << static_cast(EWPT.StatusFlag) - << sep << " (1 = Success , -1 = v/T reached a value below " << C_PT << " during the calculation) \n"; - if(EWPT.StatusFlag==Minimizer::MinimizerStatus::SUCCESS) - { - std::cout << std::scientific; - std::cout << dimensionnames.at(1) << " = " << EWPT.vc << " GeV\n"; - std::cout << dimensionnames.at(0) << " = " << EWPT.Tc << " GeV\n"; - std::cout << "xi_c = " << dimensionnames.at(2) << " = " << EWPT.vc/EWPT.Tc << std::endl; - for(std::size_t i=0;iget_nVEV(); i++){ - std::cout << dimensionnames.at(i+3) << " = " << EWPT.EWMinimum.at(i) << " GeV\n"; - } - std::cout << "The Wall thickness is given by L_W = " << EtaInterface.getLW() - << "GeV^-2\n" - << "L_W * T = " << EtaInterface.getLW() * EWPT.Tc << "\n"; - for(std::size_t i=0;i(EWPT.StatusFlag) << sep + << " (1 = Success , -1 = v/T reached a value below " << C_PT + << " during the calculation) \n"; + if (EWPT.StatusFlag == Minimizer::MinimizerStatus::SUCCESS) + { + std::cout << std::scientific; + std::cout << dimensionnames.at(1) << " = " << EWPT.vc << " GeV\n"; + std::cout << dimensionnames.at(0) << " = " << EWPT.Tc << " GeV\n"; + std::cout << "xi_c = " << dimensionnames.at(2) << " = " + << EWPT.vc / EWPT.Tc << std::endl; + for (std::size_t i = 0; i < modelPointer->get_nVEV(); i++) + { + std::cout << dimensionnames.at(i + 3) << " = " + << EWPT.EWMinimum.at(i) << " GeV\n"; + } + std::cout << "The Wall thickness is given by L_W = " + << EtaInterface.getLW() << "GeV^-2\n" + << "L_W * T = " << EtaInterface.getLW() * EWPT.Tc << "\n"; + for (std::size_t i = 0; i < etaLegend.size(); i++) + std::cout << etaLegend.at(i) << " = " << eta.at(i) << std::endl; + } - }//END: LineStart == LineEnd - }//END: Valid Line - linecounter++; - if(infile.eof()) break; - }//END: Input Read - if(args.TerminalOutput) std::cout << std::endl; -//Closing & Free - outfile.close(); - return EXIT_SUCCESS; -}//END: Try -catch(int) + } // END: LineStart == LineEnd + } // END: Valid Line + linecounter++; + if (infile.eof()) break; + } // END: Input Read + if (args.TerminalOutput) std::cout << std::endl; + // Closing & Free + outfile.close(); + return EXIT_SUCCESS; +} // END: Try +catch (int) { - return EXIT_SUCCESS; + return EXIT_SUCCESS; } -catch(exception& e){ - std::cerr << e.what() << std::endl; - return EXIT_FAILURE; +catch (exception &e) +{ + std::cerr << e.what() << std::endl; + return EXIT_FAILURE; } CLIOptions::CLIOptions(int argc, char *argv[]) { + std::vector args; + for (int i{1}; i < argc; ++i) + args.push_back(argv[i]); - std::vector args; - for(int i{1};i 0 and args.at(0) == "--help") + { + throw int{0}; + } + else if (argc < 7) + { + throw std::runtime_error("Too few arguments."); + } - if(args.size() > 0 and args.at(0)=="--help") - { - throw int{0}; - } - else if(argc < 7) + std::string prefix{"--"}; + bool UsePrefix = StringStartsWith(args.at(0), prefix); + if (UsePrefix) + { + for (const auto &arg : args) { - throw std::runtime_error("Too few arguments."); + auto el = arg; + std::transform(el.begin(), el.end(), el.begin(), ::tolower); + if (StringStartsWith(el, "--model=")) + { + Model = + BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); + } + else if (StringStartsWith(el, "--input=")) + { + InputFile = arg.substr(std::string("--input=").size()); + } + else if (StringStartsWith(el, "--output=")) + { + OutputFile = arg.substr(std::string("--output=").size()); + } + else if (StringStartsWith(el, "--firstline=")) + { + FirstLine = std::stoi(el.substr(std::string("--firstline=").size())); + } + else if (StringStartsWith(el, "--lastline=")) + { + LastLine = std::stoi(el.substr(std::string("--lastline=").size())); + } + else if (StringStartsWith(el, "--terminaloutput=")) + { + TerminalOutput = + el.substr(std::string("--terminaloutput=").size()) == "y"; + } + else if (StringStartsWith(el, "--vw=")) + { + vw = std::stod(el.substr(std::string("--vw=").size())); + } + else if (StringStartsWith(el, "--config=")) + { + ConfigFile = arg.substr(std::string("--config=").size()); + } + else if (StringStartsWith(el, "--usegsl=")) + { + UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; + } + else if (StringStartsWith(el, "--usecmaes=")) + { + UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; + } + else if (StringStartsWith(el, "--usenlopt=")) + { + UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; + } } - - std::string prefix{"--"}; - bool UsePrefix = StringStartsWith(args.at(0),prefix); - if(UsePrefix) + WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL, UseCMAES, UseNLopt); + } + else + { + Model = ModelID::getModel(args.at(0)); + InputFile = args.at(1); + OutputFile = args.at(2); + FirstLine = std::stoi(args.at(3)); + LastLine = std::stoi(args.at(4)); + ConfigFile = args.at(5); + if (argc == 8) { - for(const auto& arg: args) - { - auto el = arg; - std::transform(el.begin(), el.end(), el.begin(), ::tolower); - if(StringStartsWith(el,"--model=")) - { - Model = BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); - } - else if(StringStartsWith(el,"--input=")) - { - InputFile = arg.substr(std::string("--input=").size()); - } - else if(StringStartsWith(el,"--output=")) - { - OutputFile = arg.substr(std::string("--output=").size()); - } - else if(StringStartsWith(el,"--firstline=")) - { - FirstLine = std::stoi(el.substr(std::string("--firstline=").size())); - } - else if(StringStartsWith(el,"--lastline=")) - { - LastLine = std::stoi(el.substr(std::string("--lastline=").size())); - } - else if(StringStartsWith(el,"--terminaloutput=")) - { - TerminalOutput = el.substr(std::string("--terminaloutput=").size()) == "y"; - } - else if(StringStartsWith(el,"--vw=")) - { - vw = std::stod(el.substr(std::string("--vw=").size())); - } - else if(StringStartsWith(el,"--config=")) - { - ConfigFile = arg.substr(std::string("--config=").size()); - } - else if(StringStartsWith(el,"--usegsl=")) - { - UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; - } - else if(StringStartsWith(el,"--usecmaes=")) - { - UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; - } - else if(StringStartsWith(el,"--usenlopt=")) - { - UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; - } - } - WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL,UseCMAES,UseNLopt); - } - else{ - Model = ModelID::getModel(args.at(0)); - InputFile = args.at(1); - OutputFile = args.at(2); - FirstLine = std::stoi(args.at(3)); - LastLine = std::stoi(args.at(4)); - ConfigFile = args.at(5); - if(argc == 8) { - std::string s7 = argv[6]; - TerminalOutput = ("y" == std::string(args.at(6))); - } + std::string s7 = argv[6]; + TerminalOutput = ("y" == std::string(args.at(6))); } + } } bool CLIOptions::good() const { - if(UseGSL and not Minimizer::UseGSLDefault) - { - throw std::runtime_error("You set --UseGSL=true but GSL was not found during compilation."); - } - if(UseCMAES and not Minimizer::UseLibCMAESDefault) - { - throw std::runtime_error("You set --UseCMAES=true but CMAES was not found during compilation."); - } - if(UseNLopt and not Minimizer::UseNLoptDefault) - { - throw std::runtime_error("You set --UseNLopt=true but NLopt was not found during compilation."); - } - if(WhichMinimizer == 0) - { - throw std::runtime_error("You disabled all minimizers. You need at least one."); - } - if(vw <= 0 or vw > 1) - { - throw std::runtime_error("The wall velocity has to be between 0 and 1."); - } - if(Model==ModelID::ModelIDs::NotSet) { - std::cerr << "Your Model parameter does not match with the implemented Models." << std::endl; - ShowInputError(); - return false; - } - if(FirstLine < 1) - { - std::cout << "Start line counting with 1" << std::endl; - return false; - } - if(FirstLine > LastLine) - { - std::cout << "Firstline is smaller then LastLine " << std::endl; - return false; - } + if (UseGSL and not Minimizer::UseGSLDefault) + { + throw std::runtime_error( + "You set --UseGSL=true but GSL was not found during compilation."); + } + if (UseCMAES and not Minimizer::UseLibCMAESDefault) + { + throw std::runtime_error( + "You set --UseCMAES=true but CMAES was not found during compilation."); + } + if (UseNLopt and not Minimizer::UseNLoptDefault) + { + throw std::runtime_error( + "You set --UseNLopt=true but NLopt was not found during compilation."); + } + if (WhichMinimizer == 0) + { + throw std::runtime_error( + "You disabled all minimizers. You need at least one."); + } + if (vw <= 0 or vw > 1) + { + throw std::runtime_error("The wall velocity has to be between 0 and 1."); + } + if (Model == ModelID::ModelIDs::NotSet) + { + std::cerr + << "Your Model parameter does not match with the implemented Models." + << std::endl; + ShowInputError(); + return false; + } + if (FirstLine < 1) + { + std::cout << "Start line counting with 1" << std::endl; + return false; + } + if (FirstLine > LastLine) + { + std::cout << "Firstline is smaller then LastLine " << std::endl; + return false; + } - return true; + return true; } diff --git a/src/prog/CreateMuGrid.cpp b/src/prog/CreateMuGrid.cpp index 72d11a1f..52def482 100644 --- a/src/prog/CreateMuGrid.cpp +++ b/src/prog/CreateMuGrid.cpp @@ -2,285 +2,325 @@ * CreateMuGrid.cpp * * - * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller + * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas + Müller - This program 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. + This program 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. - This program 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. + This program 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 this program. If not, see . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ /** * @file - * Calculates the electroweak phase transition for a given Inputfile for a given subset of lines in the file - * and adds it at the end of the line in the format + * Calculates the electroweak phase transition for a given Inputfile for a given + * subset of lines in the file and adds it at the end of the line in the format * T_c v_c all single vevs. One parameter point per line. * */ -#include // for EXIT_FAILURE -#include // for copy, max -#include // for shared_ptr -#include // for getline -#include // for pair -#include // for vector -#include "BSMPT/models/ClassPotentialOrigin.h" // for Class_Poten... -#include -#include +#include "BSMPT/models/ClassPotentialOrigin.h" // for Class_Poten... #include +#include +#include #include -#include -#include +#include // for copy, max #include +#include +#include +#include // for shared_ptr +#include // for EXIT_FAILURE +#include // for getline +#include // for pair +#include // for vector using namespace std; using namespace BSMPT; -struct CLIOptions{ - BSMPT::ModelID::ModelIDs Model{}; - int Line{}; - std::string InputFile, OutputFile; - double vw{0.1}; - bool UseGSL { Minimizer::UseGSLDefault}; - bool UseCMAES {Minimizer::UseLibCMAESDefault}; - bool UseNLopt{Minimizer::UseNLoptDefault}; - int WhichMinimizer{Minimizer::WhichMinimizerDefault}; +struct CLIOptions +{ + BSMPT::ModelID::ModelIDs Model{}; + int Line{}; + std::string InputFile, OutputFile; + double vw{0.1}; + bool UseGSL{Minimizer::UseGSLDefault}; + bool UseCMAES{Minimizer::UseLibCMAESDefault}; + bool UseNLopt{Minimizer::UseNLoptDefault}; + int WhichMinimizer{Minimizer::WhichMinimizerDefault}; - CLIOptions(int argc, char *argv[]); - bool good() const; + CLIOptions(int argc, char *argv[]); + bool good() const; }; -int main(int argc, char *argv[]) try{ - const CLIOptions args(argc,argv); +int main(int argc, char *argv[]) +try +{ + const CLIOptions args(argc, argv); + + if (not args.good()) + { + return EXIT_FAILURE; + } - if(not args.good()) + std::shared_ptr modelPointer = + ModelID::FChoose(args.Model); + std::ifstream infile(args.InputFile); + if (!infile.good()) + { + std::cout << "Input file not found " << std::endl; + return EXIT_FAILURE; + } + std::ofstream outfile(args.OutputFile); + if (!outfile.good()) + { + std::cout << "Can not create file " << args.OutputFile << std::endl; + return EXIT_FAILURE; + } + std::string linestr; + int linecounter = 1; + bool found = false; + while (true) + { + if (infile.eof()) break; + std::getline(infile, linestr); + if (linecounter == 1) { - return EXIT_FAILURE; + modelPointer->setUseIndexCol(linestr); + } + else if (linecounter == args.Line) + { + modelPointer->initModel(linestr); + found = true; } - std::shared_ptr modelPointer = ModelID::FChoose(args.Model); - std::ifstream infile(args.InputFile); - if(!infile.good()) { - std::cout << "Input file not found " << std::endl; - return EXIT_FAILURE; - } - std::ofstream outfile(args.OutputFile); - if(!outfile.good()) - { - std::cout << "Can not create file " << args.OutputFile << std::endl; - return EXIT_FAILURE; - } - std::string linestr; - int linecounter = 1; - bool found=false; - while(true) - { - if(infile.eof()) break; - std::getline(infile,linestr); - if(linecounter == 1){ - modelPointer->setUseIndexCol(linestr); - } - else if(linecounter == args.Line) - { - modelPointer->initModel(linestr); - found=true; - } - - else if(linecounter > args.Line) break; - linecounter++; - if(infile.eof()) break; - } - infile.close(); - if(!found) {std::cout << "Line not found !\n"; return EXIT_FAILURE;} - - std::vector parStart,parEnd; - parStart = std::vector(modelPointer->get_NHiggs(),0); - auto EWPT = Minimizer::PTFinder_gen_all(modelPointer,0,300,args.WhichMinimizer); - - - // find the minimum in the symmetric phase. For this minimise at T = Tc + 1 - std::vector vevsymmetricSolution,checksym, startpoint; - for(const auto& el: EWPT.EWMinimum) startpoint.push_back(0.5*el); - vevsymmetricSolution=Minimizer::Minimize_gen_all(modelPointer,EWPT.Tc+1,checksym,startpoint,args.WhichMinimizer); - + else if (linecounter > args.Line) + break; + linecounter++; + if (infile.eof()) break; + } + infile.close(); + if (!found) + { + std::cout << "Line not found !\n"; + return EXIT_FAILURE; + } - double absvevsymmetricSolution = 0; - for(const auto& x:vevsymmetricSolution) absvevsymmetricSolution+=std::pow(x,2); + std::vector parStart, parEnd; + parStart = std::vector(modelPointer->get_NHiggs(), 0); + auto EWPT = + Minimizer::PTFinder_gen_all(modelPointer, 0, 300, args.WhichMinimizer); - if(absvevsymmetricSolution != 0){ - std::cout << "Check for sign of non vanishing components of symmetric vacuum : " << std::endl; - } + // find the minimum in the symmetric phase. For this minimise at T = Tc + 1 + std::vector vevsymmetricSolution, checksym, startpoint; + for (const auto &el : EWPT.EWMinimum) + startpoint.push_back(0.5 * el); + vevsymmetricSolution = Minimizer::Minimize_gen_all( + modelPointer, EWPT.Tc + 1, checksym, startpoint, args.WhichMinimizer); + double absvevsymmetricSolution = 0; + for (const auto &x : vevsymmetricSolution) + absvevsymmetricSolution += std::pow(x, 2); + if (absvevsymmetricSolution != 0) + { + std::cout + << "Check for sign of non vanishing components of symmetric vacuum : " + << std::endl; + } - struct Baryo::GSL_integration_mubl p; - p.init(args.vw,EWPT.EWMinimum,vevsymmetricSolution,EWPT.Tc,modelPointer,args.WhichMinimizer); + struct Baryo::GSL_integration_mubl p; + p.init(args.vw, + EWPT.EWMinimum, + vevsymmetricSolution, + EWPT.Tc, + modelPointer, + args.WhichMinimizer); - std::cout << "vw = " << args.vw << std::endl; - std::cout << "LW = " << p.getLW()*EWPT.Tc << "/TC" << std::endl; - std::cout << "T_C = " << EWPT.Tc << std::endl; - for(std::size_t i=0;iget_nVEV();i++) std::cout << "v_" << i << " = " << EWPT.EWMinimum.at(i) << std::endl; + std::cout << "vw = " << args.vw << std::endl; + std::cout << "LW = " << p.getLW() * EWPT.Tc << "/TC" << std::endl; + std::cout << "T_C = " << EWPT.Tc << std::endl; + for (std::size_t i = 0; i < modelPointer->get_nVEV(); i++) + std::cout << "v_" << i << " = " << EWPT.EWMinimum.at(i) << std::endl; - std::size_t nstep = 1000; - double zmin = 0; - double stepsize = (p.getZMAX()-zmin)/nstep; - outfile << "z\tmu_{B_L}" << std::endl; - for(std::size_t i=0;i<=nstep;i++){ - double z= zmin + stepsize*i; - outfile << z << sep << Baryo::mubl_func(z,&p) << std::endl; - } - outfile.close(); - return EXIT_SUCCESS; + std::size_t nstep = 1000; + double zmin = 0; + double stepsize = (p.getZMAX() - zmin) / nstep; + outfile << "z\tmu_{B_L}" << std::endl; + for (std::size_t i = 0; i <= nstep; i++) + { + double z = zmin + stepsize * i; + outfile << z << sep << Baryo::mubl_func(z, &p) << std::endl; + } + outfile.close(); + return EXIT_SUCCESS; } -catch(int) +catch (int) { - return EXIT_SUCCESS; + return EXIT_SUCCESS; } -catch(exception& e){ - std::cerr << e.what() << std::endl; - return EXIT_FAILURE; +catch (exception &e) +{ + std::cerr << e.what() << std::endl; + return EXIT_FAILURE; } CLIOptions::CLIOptions(int argc, char *argv[]) { - std::vector args; - for(int i{1};i args; + for (int i{1}; i < argc; ++i) + args.push_back(argv[i]); - if(argc < 5 or args.at(0) == "--help") - { - int SizeOfFirstColumn = std::string("--TerminalOutput= ").size(); - std::cout << "CreateMuGrid calculates the mu_{BL} potential in front of the bubble wall" << std::endl - << "It is called either by " << std::endl - << "./CreateMuGrid model input output Line" << std::endl - << "or with the following arguments" << std::endl - << std::setw(SizeOfFirstColumn) << std::left<< "--help" - << "Shows this menu" << std::endl - << std::setw(SizeOfFirstColumn) << std::left << "--model=" - << "The model you want to investigate"< 0 and args.at(0)=="--help") - { - throw int{0}; - } - else if(argc < 5) - { - throw std::runtime_error("Too few arguments."); - } + if (args.size() > 0 and args.at(0) == "--help") + { + throw int{0}; + } + else if (argc < 5) + { + throw std::runtime_error("Too few arguments."); + } - const std::string prefix{"--"}; - bool UsePrefix = StringStartsWith(args.at(0),prefix); - if(UsePrefix) + const std::string prefix{"--"}; + bool UsePrefix = StringStartsWith(args.at(0), prefix); + if (UsePrefix) + { + for (const auto &arg : args) { - for(const auto& arg: args) - { - auto el = arg; - std::transform(el.begin(), el.end(), el.begin(), ::tolower); - if(StringStartsWith(el,"--model=")) - { - Model = BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); - } - else if(StringStartsWith(el,"--input=")) - { - InputFile = arg.substr(std::string("--input=").size()); - } - else if(StringStartsWith(el,"--output=")) - { - OutputFile = arg.substr(std::string("--output=").size()); - } - else if(StringStartsWith(el,"--line=")) - { - Line = std::stoi(el.substr(std::string("--line=").size())); - } - else if(StringStartsWith(el,"--vw=")) - { - vw = std::stod(el.substr(std::string("--vw=").size())); - } - else if(StringStartsWith(el,"--usegsl=")) - { - UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; - } - else if(StringStartsWith(el,"--usecmaes=")) - { - UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; - } - else if(StringStartsWith(el,"--usenlopt=")) - { - UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; - } - } - WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL,UseCMAES,UseNLopt); - } - else{ - Model = ModelID::getModel(args.at(0)); - InputFile = args.at(1); - OutputFile = args.at(2); - Line = std::stoi(args.at(3)); + auto el = arg; + std::transform(el.begin(), el.end(), el.begin(), ::tolower); + if (StringStartsWith(el, "--model=")) + { + Model = + BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); + } + else if (StringStartsWith(el, "--input=")) + { + InputFile = arg.substr(std::string("--input=").size()); + } + else if (StringStartsWith(el, "--output=")) + { + OutputFile = arg.substr(std::string("--output=").size()); + } + else if (StringStartsWith(el, "--line=")) + { + Line = std::stoi(el.substr(std::string("--line=").size())); + } + else if (StringStartsWith(el, "--vw=")) + { + vw = std::stod(el.substr(std::string("--vw=").size())); + } + else if (StringStartsWith(el, "--usegsl=")) + { + UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; + } + else if (StringStartsWith(el, "--usecmaes=")) + { + UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; + } + else if (StringStartsWith(el, "--usenlopt=")) + { + UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; + } } + WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL, UseCMAES, UseNLopt); + } + else + { + Model = ModelID::getModel(args.at(0)); + InputFile = args.at(1); + OutputFile = args.at(2); + Line = std::stoi(args.at(3)); + } } - bool CLIOptions::good() const { - if(UseGSL and not Minimizer::UseGSLDefault) - { - throw std::runtime_error("You set --UseGSL=true but GSL was not found during compilation."); - } - if(UseCMAES and not Minimizer::UseLibCMAESDefault) - { - throw std::runtime_error("You set --UseCMAES=true but CMAES was not found during compilation."); - } - if(UseNLopt and not Minimizer::UseNLoptDefault) - { - throw std::runtime_error("You set --UseNLopt=true but NLopt was not found during compilation."); - } - if(WhichMinimizer == 0) - { - throw std::runtime_error("You disabled all minimizers. You need at least one."); - } + if (UseGSL and not Minimizer::UseGSLDefault) + { + throw std::runtime_error( + "You set --UseGSL=true but GSL was not found during compilation."); + } + if (UseCMAES and not Minimizer::UseLibCMAESDefault) + { + throw std::runtime_error( + "You set --UseCMAES=true but CMAES was not found during compilation."); + } + if (UseNLopt and not Minimizer::UseNLoptDefault) + { + throw std::runtime_error( + "You set --UseNLopt=true but NLopt was not found during compilation."); + } + if (WhichMinimizer == 0) + { + throw std::runtime_error( + "You disabled all minimizers. You need at least one."); + } - if(vw <= 0 or vw > 1) - { - throw std::runtime_error("The wall velocity has to be between 0 and 1."); - } - if(Model==ModelID::ModelIDs::NotSet) { + if (vw <= 0 or vw > 1) + { + throw std::runtime_error("The wall velocity has to be between 0 and 1."); + } + if (Model == ModelID::ModelIDs::NotSet) + { - std::cerr << "Your Model parameter does not match with the implemented Models." << std::endl; - ShowInputError(); - return false; - } - if(Line < 1) - { - std::cerr << "Start line counting with 1" << std::endl; - return false; - } - return true; + std::cerr + << "Your Model parameter does not match with the implemented Models." + << std::endl; + ShowInputError(); + return false; + } + if (Line < 1) + { + std::cerr << "Start line counting with 1" << std::endl; + return false; + } + return true; } diff --git a/src/prog/Kfactor_grid.cpp b/src/prog/Kfactor_grid.cpp index 894b779f..d71e1662 100644 --- a/src/prog/Kfactor_grid.cpp +++ b/src/prog/Kfactor_grid.cpp @@ -2,361 +2,475 @@ * Kfactor_grid.cpp * * - * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller + * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas + Müller - This program 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. + This program 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. - This program 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. + This program 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 this program. If not, see . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ /** * @file - * Calculates the electroweak phase transition for a given Inputfile for a given subset of lines in the file - * and adds it at the end of the line in the format + * Calculates the electroweak phase transition for a given Inputfile for a given + * subset of lines in the file and adds it at the end of the line in the format * T_c v_c all single vevs. One parameter point per line. * */ -#include // for std::size_t, atoi, EXIT_FAILURE -#include // for max, copy -#include // for allocator_traits<>::value... -#include // for string, operator==, opera... -#include // for vector -#include #include -#include +#include +#include // for max, copy +#include #include +#include +#include // for allocator_traits<>::value... #include -#include +#include // for std::size_t, atoi, EXIT_FAILURE +#include // for string, operator==, opera... +#include // for vector using namespace std; using namespace BSMPT; void CreateKtildeInterpolationData(); void CreateKfunctionsgrid(); +void CreateKtildeInterpolationData() +{ + std::vector msquaredTsquared, KtildeNormBoson, KtildeNormFermion; + for (int i = 0; i <= 400; i++) + { + msquaredTsquared.push_back(i); + KtildeNormBoson.push_back(Kfactors::Ktilde_normalization(1, -1, i)); + KtildeNormFermion.push_back(Kfactors::Ktilde_normalization(1, 1, i)); + } + + std::ofstream outputNormalisation("KtildeInterpolation.h"); + + outputNormalisation + << "/*" + << "\n" + << " * KtildeInterpolation.h" + << "\n" + << " *" + << "\n" + << " * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and " + "Jonas Müller" + << "\n" + << "" + << "\n" + << " This program is free software: you can redistribute it and/or " + "modify" + << "\n" + << " it under the terms of the GNU General Public License as " + "published by" + << "\n" + << " the Free Software Foundation, either version 3 of the License, " + "or" + << "\n" + << " (at your option) any later version." + << "\n" + << "" + << "\n" + << " This program is distributed in the hope that it will be useful," + << "\n" + << " but WITHOUT ANY WARRANTY; without even the implied warranty of" + << "\n" + << " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" + << "\n" + << " GNU General Public License for more details." + << "\n" + << "" + << "\n" + << " You should have received a copy of the GNU General Public " + "License" + << "\n" + << " along with this program. If not, see " + "." + << "\n" + << " */" + << "\n"; + + outputNormalisation + << "#ifndef SRC_BARYO_CALCULATION_KFACTORS_GRID_KtildeInterpolation_H_ " + << "\n" + << "#define SRC_BARYO_CALCULATION_KFACTORS_GRID_KtildeInterpolation_H_" + << "\n"; + + outputNormalisation << std::endl; + + outputNormalisation + << "/**" + << "\n" + << "* @file" + << "\n" + << "* Data points for the interpolation of the normalisation of Ktile" + << "\n" + << "*/" << std::endl; + + outputNormalisation << "namespace BSMPT { \n" + << "namespace Kfactors { \n" + << "namespace Data{ \n" + << std::endl; + + outputNormalisation << "const int KtildeInterpolationSize = " + << msquaredTsquared.size() << ";" << std::endl; + + outputNormalisation + << "const std::vector msquaredTsquared{"; //<< + //msquaredTsquared.size() + //<< "] = {"; + for (std::size_t i = 0; i < msquaredTsquared.size(); i++) + { + outputNormalisation << msquaredTsquared.at(i); + if (i < msquaredTsquared.size() - 1) outputNormalisation << ","; + } + outputNormalisation << "};" << std::endl; + + outputNormalisation + << "const std::vector KtildeNormBoson_grid{"; // << + // KtildeNormBoson.size() + // << "] = {"; + for (std::size_t i = 0; i < KtildeNormBoson.size(); i++) + { + outputNormalisation << KtildeNormBoson.at(i); + if (i < KtildeNormBoson.size() - 1) outputNormalisation << ","; + } + outputNormalisation << "};" << std::endl; + + outputNormalisation + << "const std::vector KtildeNormFermion_grid{"; //<< + //KtildeNormFermion.size() + //<< "] = {"; + for (std::size_t i = 0; i < KtildeNormFermion.size(); i++) + { + outputNormalisation << KtildeNormFermion.at(i); + if (i < KtildeNormFermion.size() - 1) outputNormalisation << ","; + } + outputNormalisation << "};" << std::endl; + + outputNormalisation << "}\n}\n}" << std::endl; + + outputNormalisation + << "\n" + << "#endif /* SRC_BARYO_CALCULATION_KFACTORS_GRID_KtildeInterpolation_H_ " + "*/" + << std::endl; + + outputNormalisation.close(); +} -void CreateKtildeInterpolationData(){ - std::vector msquaredTsquared, KtildeNormBoson, KtildeNormFermion; - for(int i=0;i<=400;i++){ - msquaredTsquared.push_back(i); - KtildeNormBoson.push_back(Kfactors::Ktilde_normalization(1,-1,i)); - KtildeNormFermion.push_back(Kfactors::Ktilde_normalization(1,1,i)); - } - - std::ofstream outputNormalisation("KtildeInterpolation.h"); - - outputNormalisation << "/*" << "\n" - << " * KtildeInterpolation.h"<< "\n" - << " *"<< "\n" - << " * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller"<< "\n" - << ""<< "\n" - << " This program is free software: you can redistribute it and/or modify"<< "\n" - << " it under the terms of the GNU General Public License as published by"<< "\n" - << " the Free Software Foundation, either version 3 of the License, or"<< "\n" - << " (at your option) any later version."<< "\n" - << ""<< "\n" - << " This program is distributed in the hope that it will be useful,"<< "\n" - << " but WITHOUT ANY WARRANTY; without even the implied warranty of"<< "\n" - << " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"<< "\n" - << " GNU General Public License for more details."<< "\n" - << ""<< "\n" - << " You should have received a copy of the GNU General Public License"<< "\n" - << " along with this program. If not, see ."<< "\n" - << " */" << "\n"; - - outputNormalisation << "#ifndef SRC_BARYO_CALCULATION_KFACTORS_GRID_KtildeInterpolation_H_ " << "\n" - << "#define SRC_BARYO_CALCULATION_KFACTORS_GRID_KtildeInterpolation_H_" << "\n"; - - outputNormalisation << std::endl; - - outputNormalisation << "/**" << "\n" - << "* @file" << "\n" - << "* Data points for the interpolation of the normalisation of Ktile" << "\n" - << "*/" << std::endl; - - outputNormalisation << "namespace BSMPT { \n" - << "namespace Kfactors { \n" - << "namespace Data{ \n" - << std::endl; - - outputNormalisation << "const int KtildeInterpolationSize = " << msquaredTsquared.size() << ";"<< std::endl; - - outputNormalisation << "const std::vector msquaredTsquared{"; //<< msquaredTsquared.size() << "] = {"; - for(std::size_t i=0;i KtildeNormBoson_grid{" ;// << KtildeNormBoson.size() << "] = {"; - for(std::size_t i=0;i> K1p, K2p, K4p, K5p, K6p, K8p, K9p, K1m, K4m, + K5m; + + std::vector masslist, Tlist; + for (double im = 0; im <= 5; im += 1e-3) + masslist.push_back(im); + for (double im = 10; im <= std::pow(200, 2); im += 5) + masslist.push_back(im); + for (double it = 10; it <= 250; it += 2) + Tlist.push_back(it); + + for (auto im : masslist) + { + std::vector K1p_row, K2p_row, K4p_row, K5p_row, K6p_row, K8p_row, + K9p_row, K1m_row, K4m_row, K5m_row; + for (auto it : Tlist) + { + K1p_row.push_back(Kfactors::K_integration(im, it, 1, 1)); + K2p_row.push_back(Kfactors::K_integration(im, it, 2, 1)); + K4p_row.push_back(Kfactors::K_integration(im, it, 4, 1)); + K5p_row.push_back(Kfactors::K_integration(im, it, 5, 1)); + K6p_row.push_back(Kfactors::K_integration(im, it, 6, 1)); + K8p_row.push_back(Kfactors::K_integration(im, it, 8, 1)); + K9p_row.push_back(Kfactors::K_integration(std::max(im, 1e-15), it, 9, 1)); + K1m_row.push_back(Kfactors::K_integration(im, it, 1, -1)); + K4m_row.push_back(Kfactors::K_integration(im, it, 4, -1)); + K5m_row.push_back(Kfactors::K_integration(im, it, 5, -1)); } - outputNormalisation << "};" << std::endl; - - outputNormalisation << "const std::vector KtildeNormFermion_grid{" ; //<< KtildeNormFermion.size() << "] = {"; - for(std::size_t i=0;i." + << "\n" + << " */" + << "\n"; + + header << "#ifndef SRC_BARYO_CALCULATION_KFACTORS_GRID_KFUNCTIONS_GRID_H_NEW" + << std::endl + << "#define SRC_BARYO_CALCULATION_KFACTORS_GRID_KFUNCTIONS_GRID_H_NEW" + << std::endl; + header << "namespace BSMPT {" << std::endl + << "namespace Kfactors {" << std::endl + << "namespace Data {" << std::endl; + + header << "const int msg_size = " << masslist.size() << ";" << std::endl; + header << "const int Tg_size = " << Tlist.size() << ";" << std::endl; + header << "const double msg[" << masslist.size() << "] = {"; + first = true; + for (const auto &x : masslist) + { + if (first) + { + first = false; } - outputNormalisation << "};" << std::endl; - - outputNormalisation << "}\n}\n}" << std::endl; - - outputNormalisation << "\n" - << "#endif /* SRC_BARYO_CALCULATION_KFACTORS_GRID_KtildeInterpolation_H_ */" - << std::endl; - - outputNormalisation.close(); -} - - -void CreateKfunctionsgrid(){ - - bool first=true; - - std::vector> K1p,K2p,K4p,K5p,K6p,K8p,K9p,K1m,K4m,K5m; - - std::vector masslist, Tlist; - for(double im = 0;im <= 5; im+= 1e-3) masslist.push_back(im); - for(double im = 10;im <= std::pow(200,2); im+= 5) masslist.push_back(im); - for(double it=10;it<=250;it+=2) Tlist.push_back(it); - - for(auto im: masslist){ - std::vector K1p_row, K2p_row, K4p_row, K5p_row, K6p_row, K8p_row, K9p_row, K1m_row, K4m_row, K5m_row; - for( auto it: Tlist){ - K1p_row.push_back(Kfactors::K_integration(im,it,1,1)); - K2p_row.push_back(Kfactors::K_integration(im,it,2,1)); - K4p_row.push_back(Kfactors::K_integration(im,it,4,1)); - K5p_row.push_back(Kfactors::K_integration(im,it,5,1)); - K6p_row.push_back(Kfactors::K_integration(im,it,6,1)); - K8p_row.push_back(Kfactors::K_integration(im,it,8,1)); - K9p_row.push_back(Kfactors::K_integration(std::max(im,1e-15),it,9,1)); - K1m_row.push_back(Kfactors::K_integration(im,it,1,-1)); - K4m_row.push_back(Kfactors::K_integration(im,it,4,-1)); - K5m_row.push_back(Kfactors::K_integration(im,it,5,-1)); - } - K1p.push_back(K1p_row); - K2p.push_back(K2p_row); - K4p.push_back(K4p_row); - K5p.push_back(K5p_row); - K6p.push_back(K6p_row); - K8p.push_back(K8p_row); - K9p.push_back(K9p_row); - K1m.push_back(K1m_row); - K4m.push_back(K4m_row); - K5m.push_back(K5m_row); + else + { + header << ","; } - - std::ofstream header("Kfunctions_grid.h"); - header << "/*" << "\n" - << " * Kfunctions_grid.h"<< "\n" - << " *"<< "\n" - << " * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller"<< "\n" - << ""<< "\n" - << " This program is free software: you can redistribute it and/or modify"<< "\n" - << " it under the terms of the GNU General Public License as published by"<< "\n" - << " the Free Software Foundation, either version 3 of the License, or"<< "\n" - << " (at your option) any later version."<< "\n" - << ""<< "\n" - << " This program is distributed in the hope that it will be useful,"<< "\n" - << " but WITHOUT ANY WARRANTY; without even the implied warranty of"<< "\n" - << " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"<< "\n" - << " GNU General Public License for more details."<< "\n" - << ""<< "\n" - << " You should have received a copy of the GNU General Public License"<< "\n" - << " along with this program. If not, see ."<< "\n" - << " */" << "\n"; - - header << "#ifndef SRC_BARYO_CALCULATION_KFACTORS_GRID_KFUNCTIONS_GRID_H_NEW" << std::endl - << "#define SRC_BARYO_CALCULATION_KFACTORS_GRID_KFUNCTIONS_GRID_H_NEW" << std::endl; - header << "namespace BSMPT {" << std::endl - << "namespace Kfactors {" << std::endl - << "namespace Data {" << std::endl; - - header << "const int msg_size = " << masslist.size() << ";" << std::endl; - header << "const int Tg_size = " << Tlist.size() << ";" << std::endl; - header << "const double msg[" << masslist.size() << "] = {"; - first=true; - for(const auto& x: masslist) { - if(first){ - first = false; - } - else{ - header << ","; - } - header << x; + header << x; + } + header << "};" << std::endl; + + first = true; + header << "const double Tg[" << Tlist.size() << "] = {"; + for (const auto &x : Tlist) + { + if (first) + { + first = false; } - header << "};" << std::endl; - - first = true; - header << "const double Tg[" << Tlist.size() << "] = {"; - for(const auto& x : Tlist){ - if(first){ - first = false; - } - else{ - header << ","; - } - header << x; + else + { + header << ","; } - header << "};" << std::endl; - - header << "const double K1p[" << masslist.size() << "][" << Tlist.size() << "] = {"; - for(std::size_t i=0;i. + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ - - /** * @file - * Calculates the VEV at T = 0 at NLO for a given Inputfile for a given subset of lines in the file and - * adds it at the end of the line . One parameter point per line. + * Calculates the VEV at T = 0 at NLO for a given Inputfile for a given subset + * of lines in the file and adds it at the end of the line . One parameter point + * per line. * */ -#include // for atoi, EXIT_FAILURE -#include // for copy, max -#include // for shared_ptr, __shared_... -#include // for string, operator<< -#include // for pair -#include // for vector -#include // for Class_Potential_Origin -#include #include +#include // for Class_Potential_Origin +#include #include -#include +#include // for copy, max #include #include +#include +#include // for shared_ptr, __shared_... +#include // for atoi, EXIT_FAILURE +#include // for string, operator<< +#include // for pair +#include // for vector using namespace std; using namespace BSMPT; -struct CLIOptions{ - BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; - int FirstLine{}, LastLine{}; - std::string InputFile, OutputFile; - bool UseGSL { Minimizer::UseGSLDefault}; - bool UseCMAES {Minimizer::UseLibCMAESDefault}; - bool UseNLopt{Minimizer::UseNLoptDefault}; - int WhichMinimizer{Minimizer::WhichMinimizerDefault}; +struct CLIOptions +{ + BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; + int FirstLine{}, LastLine{}; + std::string InputFile, OutputFile; + bool UseGSL{Minimizer::UseGSLDefault}; + bool UseCMAES{Minimizer::UseLibCMAESDefault}; + bool UseNLopt{Minimizer::UseNLoptDefault}; + int WhichMinimizer{Minimizer::WhichMinimizerDefault}; - CLIOptions(int argc, char *argv[]); - bool good() const; + CLIOptions(int argc, char *argv[]); + bool good() const; }; -int main(int argc, char *argv[]) try{ - - const CLIOptions args(argc,argv); - if(not args.good()) - { - return EXIT_FAILURE; - } - - int linecounter = 1; - std::ifstream infile(args.InputFile); - if(!infile.good()) { - std::cerr << "Input file not found " << std::endl; - return EXIT_FAILURE; - } - std::ofstream outfile(args.OutputFile); - if(!outfile.good()) - { - std::cerr << "Can not create file " << args.OutputFile << std::endl; - return EXIT_FAILURE; - } - std::string linestr; +int main(int argc, char *argv[]) +try +{ + const CLIOptions args(argc, argv); + if (not args.good()) + { + return EXIT_FAILURE; + } - std::shared_ptr modelPointer = ModelID::FChoose(args.Model); - std::vector Check; - while(true) - { + int linecounter = 1; + std::ifstream infile(args.InputFile); + if (!infile.good()) + { + std::cerr << "Input file not found " << std::endl; + return EXIT_FAILURE; + } + std::ofstream outfile(args.OutputFile); + if (!outfile.good()) + { + std::cerr << "Can not create file " << args.OutputFile << std::endl; + return EXIT_FAILURE; + } + std::string linestr; - getline(infile,linestr); - if(linecounter > args.LastLine) break; - if(linecounter == 1) - { - modelPointer->setUseIndexCol(linestr); - outfile << linestr; - auto legendCT = modelPointer->addLegendCT(); - for(auto x: legendCT) outfile << sep << x; - auto legendVEV = modelPointer->addLegendVEV(); - for(auto x: legendVEV) outfile << sep << x; - outfile << sep << "v_NLO"; - outfile << std::endl; - } - if(linecounter >= args.FirstLine and linecounter <= args.LastLine and linecounter != 1) - { - std::pair,std::vector> parameters = modelPointer->initModel(linestr); + std::shared_ptr modelPointer = + ModelID::FChoose(args.Model); + std::vector Check; + while (true) + { - if(args.FirstLine == args.LastLine ) modelPointer->write(); - Check.clear(); - auto sol = Minimizer::Minimize_gen_all(modelPointer,0,Check,modelPointer->get_vevTreeMin(),args.WhichMinimizer); + getline(infile, linestr); + if (linecounter > args.LastLine) break; + if (linecounter == 1) + { + modelPointer->setUseIndexCol(linestr); + outfile << linestr; + auto legendCT = modelPointer->addLegendCT(); + for (auto x : legendCT) + outfile << sep << x; + auto legendVEV = modelPointer->addLegendVEV(); + for (auto x : legendVEV) + outfile << sep << x; + outfile << sep << "v_NLO"; + outfile << std::endl; + } + if (linecounter >= args.FirstLine and linecounter <= args.LastLine and + linecounter != 1) + { + std::pair, std::vector> parameters = + modelPointer->initModel(linestr); + if (args.FirstLine == args.LastLine) modelPointer->write(); + Check.clear(); + auto sol = Minimizer::Minimize_gen_all(modelPointer, + 0, + Check, + modelPointer->get_vevTreeMin(), + args.WhichMinimizer); - std::vector solPot,solSym; - solPot=modelPointer->MinimizeOrderVEV(sol); - double vev = modelPointer->EWSBVEV(solPot); + std::vector solPot, solSym; + solPot = modelPointer->MinimizeOrderVEV(sol); + double vev = modelPointer->EWSBVEV(solPot); - outfile << linestr; - outfile << sep << parameters.second << sep << sol << sep << vev << std::endl; + outfile << linestr; + outfile << sep << parameters.second << sep << sol << sep << vev + << std::endl; - if(args.FirstLine==args.LastLine){ - auto dimensionnames = modelPointer->addLegendVEV(); - for(std::size_t i=0;iget_nVEV();i++){ - std::cout << dimensionnames.at(i) << " = " << sol.at(i) << " GeV" << std::endl; - } - } - } - linecounter++; - if(infile.eof()) break; - } + if (args.FirstLine == args.LastLine) + { + auto dimensionnames = modelPointer->addLegendVEV(); + for (std::size_t i = 0; i < modelPointer->get_nVEV(); i++) + { + std::cout << dimensionnames.at(i) << " = " << sol.at(i) << " GeV" + << std::endl; + } + } + } + linecounter++; + if (infile.eof()) break; + } - outfile.close(); + outfile.close(); - return EXIT_SUCCESS; + return EXIT_SUCCESS; } -catch(int) +catch (int) { - return EXIT_SUCCESS; + return EXIT_SUCCESS; } -catch(exception& e){ - std::cerr << e.what() << std::endl; - return EXIT_FAILURE; +catch (exception &e) +{ + std::cerr << e.what() << std::endl; + return EXIT_FAILURE; } - CLIOptions::CLIOptions(int argc, char *argv[]) { - std::vector args; - for(int i{1};i args; + for (int i{1}; i < argc; ++i) + args.push_back(argv[i]); - if(argc < 6 or args.at(0) == "--help") - { - int SizeOfFirstColumn = std::string("--TerminalOutput= ").size(); - std::cout << "NLOVEV calculates the EW VEV at NLO" << std::endl - << "It is called either by " << std::endl - << "./NLOVEV model input output FirstLine LastLine" << std::endl - << "or with the following arguments" << std::endl - << std::setw(SizeOfFirstColumn) << std::left<< "--help" - << "Shows this menu" << std::endl - << std::setw(SizeOfFirstColumn) << std::left << "--model=" - << "The model you want to investigate"< 0 and args.at(0)=="--help") - { - throw int{0}; - } - else if(argc < 6) - { - throw std::runtime_error("Too few arguments."); - } + if (args.size() > 0 and args.at(0) == "--help") + { + throw int{0}; + } + else if (argc < 6) + { + throw std::runtime_error("Too few arguments."); + } - const std::string prefix{"--"}; - bool UsePrefix = StringStartsWith(args.at(0),prefix); - if(UsePrefix) + const std::string prefix{"--"}; + bool UsePrefix = StringStartsWith(args.at(0), prefix); + if (UsePrefix) + { + for (const auto &arg : args) { - for(const auto& arg: args) - { - auto el = arg; - std::transform(el.begin(), el.end(), el.begin(), ::tolower); - if(StringStartsWith(el,"--model=")) - { - Model = BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); - } - else if(StringStartsWith(el,"--input=")) - { - InputFile = arg.substr(std::string("--input=").size()); - } - else if(StringStartsWith(el,"--output=")) - { - OutputFile = arg.substr(std::string("--output=").size()); - } - else if(StringStartsWith(el,"--firstline=")) - { - FirstLine = std::stoi(el.substr(std::string("--firstline=").size())); - } - else if(StringStartsWith(el,"--lastline=")) - { - LastLine = std::stoi(el.substr(std::string("--lastline=").size())); - } - else if(StringStartsWith(el,"--usegsl=")) - { - UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; - } - else if(StringStartsWith(el,"--usecmaes=")) - { - UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; - } - else if(StringStartsWith(el,"--usenlopt=")) - { - UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; - } - } - WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL,UseCMAES,UseNLopt); - } - else{ - Model = ModelID::getModel(args.at(0)); - InputFile = args.at(1); - OutputFile = args.at(2); - FirstLine = std::stoi(args.at(3)); - LastLine = std::stoi(args.at(4)); + auto el = arg; + std::transform(el.begin(), el.end(), el.begin(), ::tolower); + if (StringStartsWith(el, "--model=")) + { + Model = + BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); + } + else if (StringStartsWith(el, "--input=")) + { + InputFile = arg.substr(std::string("--input=").size()); + } + else if (StringStartsWith(el, "--output=")) + { + OutputFile = arg.substr(std::string("--output=").size()); + } + else if (StringStartsWith(el, "--firstline=")) + { + FirstLine = std::stoi(el.substr(std::string("--firstline=").size())); + } + else if (StringStartsWith(el, "--lastline=")) + { + LastLine = std::stoi(el.substr(std::string("--lastline=").size())); + } + else if (StringStartsWith(el, "--usegsl=")) + { + UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; + } + else if (StringStartsWith(el, "--usecmaes=")) + { + UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; + } + else if (StringStartsWith(el, "--usenlopt=")) + { + UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; + } } + WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL, UseCMAES, UseNLopt); + } + else + { + Model = ModelID::getModel(args.at(0)); + InputFile = args.at(1); + OutputFile = args.at(2); + FirstLine = std::stoi(args.at(3)); + LastLine = std::stoi(args.at(4)); + } } bool CLIOptions::good() const { - if(UseGSL and not Minimizer::UseGSLDefault) - { - throw std::runtime_error("You set --UseGSL=true but GSL was not found during compilation."); - } - if(UseCMAES and not Minimizer::UseLibCMAESDefault) - { - throw std::runtime_error("You set --UseCMAES=true but CMAES was not found during compilation."); - } - if(UseNLopt and not Minimizer::UseNLoptDefault) - { - throw std::runtime_error("You set --UseNLopt=true but NLopt was not found during compilation."); - } - if(WhichMinimizer == 0) - { - throw std::runtime_error("You disabled all minimizers. You need at least one."); - } - if(Model==ModelID::ModelIDs::NotSet) { - std::cerr << "Your Model parameter does not match with the implemented Models." << std::endl; - ShowInputError(); - return false; - } - if(FirstLine < 1) - { - std::cout << "Start line counting with 1" << std::endl; - return false; - } - if(FirstLine > LastLine) - { - std::cout << "Firstline is smaller then LastLine " << std::endl; - return false; - } - return true; + if (UseGSL and not Minimizer::UseGSLDefault) + { + throw std::runtime_error( + "You set --UseGSL=true but GSL was not found during compilation."); + } + if (UseCMAES and not Minimizer::UseLibCMAESDefault) + { + throw std::runtime_error( + "You set --UseCMAES=true but CMAES was not found during compilation."); + } + if (UseNLopt and not Minimizer::UseNLoptDefault) + { + throw std::runtime_error( + "You set --UseNLopt=true but NLopt was not found during compilation."); + } + if (WhichMinimizer == 0) + { + throw std::runtime_error( + "You disabled all minimizers. You need at least one."); + } + if (Model == ModelID::ModelIDs::NotSet) + { + std::cerr + << "Your Model parameter does not match with the implemented Models." + << std::endl; + ShowInputError(); + return false; + } + if (FirstLine < 1) + { + std::cout << "Start line counting with 1" << std::endl; + return false; + } + if (FirstLine > LastLine) + { + std::cout << "Firstline is smaller then LastLine " << std::endl; + return false; + } + return true; } diff --git a/src/prog/Plot1D.cpp b/src/prog/Plot1D.cpp index c2c8c93d..d7eb8ffe 100644 --- a/src/prog/Plot1D.cpp +++ b/src/prog/Plot1D.cpp @@ -7,134 +7,141 @@ /** * @file - * This program calculates the Minimum for a given parameterpoint at a given Temperature and plots - * the potential as a function V(t*v,Temp) where v is the vector showing to the minimum coming from 0. - * t is in the range of [FacStart,FacEnd] with FacStep number of Steps. + * This program calculates the Minimum for a given parameterpoint at a given + * Temperature and plots the potential as a function V(t*v,Temp) where v is the + * vector showing to the minimum coming from 0. t is in the range of + * [FacStart,FacEnd] with FacStep number of Steps. */ -#include #include +#include #include using namespace std; -int main(int argc, char *argv[]) { - - - bool Debug = true; - if(!(argc == 9)) - { - std::cout << "./Plot1D InputType Infile Outfile LinNum Temp FacStart FacEnd FacStep \n"; - return -1; - } - char* in_file; char* out_file; - double InputType; - sscanf(argv[1],"%lf",&InputType); - in_file = argv[2]; - out_file = argv[3]; - double LineNumb,Temp,FacStart,FacEnd,FacStep; - sscanf(argv[4],"%lf",&LineNumb); - sscanf(argv[5],"%lf",&Temp); - FacStart = atof(argv[6]); - FacEnd = atof(argv[7]); - FacStep = atof(argv[8]); - - - - std::vector sol,start; - std::vector Weinberg,parCTVec; - - Class_Potential_Origin * modelPointer; - Fchoose(modelPointer,InputType); - - std::ifstream infile(in_file); - if(!infile.good()) return -1; - - - std::string linestr; - int linecounter = 1; - - double tmp; - int nPar,nParCT; - nPar = modelPointer->nPar; - nParCT = modelPointer->nParCT; - - int dim = modelPointer->nVEV; - double par[nPar]; - double parCT[nParCT]; - - bool found=false; - - - while(true) - { - if(infile.eof()) break; - std::getline(infile,linestr); - if(linecounter == 1){ - modelPointer->setUseIndexCol(linestr); - } - else if(linecounter == LineNumb) - { - modelPointer->ReadAndSet(linestr,par); - found=true; - } - - else if(linecounter > LineNumb) break; - linecounter++; - if(infile.eof()) break; - } - infile.close(); - if(!found) {std::cout << "Line not found!" << std::endl; return -1;} - std::pair,std::vector> parameters = modelPointer->initModel(linestr); - par=parameters.first; - parCT = parameters.second; - - modelPointer->write(); - std::ofstream outfile(out_file); - std::vector vTree; - for(int k=0;kvevTreeMin.at(k)); - - std::vector Check; - double vev=0; - double v1T,v2T,v3T; - std::vector NTempMass; - std::vector zero; - for(int k=0;k point,pointPot; - if(Debug) std::cout << "Start of Minimization" << std::endl; - Minimize_gen_all(InputType,par,parCT,Temp,sol,Check,vTree); - if(Debug) std::cout << "End of Minimization" << std::endl; - double VR1=0,VR2=0; - std::vector solPot; - modelPointer->MinimizeOrderVEV(sol,solPot); - vev = modelPointer->EWSBVeV(solPot); - if(vev == 0) - { - std::cout << "Set to Tree-Level " << std::endl; - for(int i=0;ivevTreeMin.at(i); - } - - for(int i=0;iMinimizeOrderVEV(point,pointPot); - VR1 = modelPointer->VEff(pointPot,Temp,0); - point.clear(); - outfile << tStep; - outfile << sep << VR1; - outfile << std::endl; - } - - outfile.close(); - delete modelPointer; - - - - return 0; +int main(int argc, char *argv[]) +{ + + bool Debug = true; + if (!(argc == 9)) + { + std::cout << "./Plot1D InputType Infile Outfile LinNum Temp FacStart " + "FacEnd FacStep \n"; + return -1; + } + char *in_file; + char *out_file; + double InputType; + sscanf(argv[1], "%lf", &InputType); + in_file = argv[2]; + out_file = argv[3]; + double LineNumb, Temp, FacStart, FacEnd, FacStep; + sscanf(argv[4], "%lf", &LineNumb); + sscanf(argv[5], "%lf", &Temp); + FacStart = atof(argv[6]); + FacEnd = atof(argv[7]); + FacStep = atof(argv[8]); + + std::vector sol, start; + std::vector Weinberg, parCTVec; + + Class_Potential_Origin *modelPointer; + Fchoose(modelPointer, InputType); + + std::ifstream infile(in_file); + if (!infile.good()) return -1; + + std::string linestr; + int linecounter = 1; + + double tmp; + int nPar, nParCT; + nPar = modelPointer->nPar; + nParCT = modelPointer->nParCT; + + int dim = modelPointer->nVEV; + double par[nPar]; + double parCT[nParCT]; + + bool found = false; + + while (true) + { + if (infile.eof()) break; + std::getline(infile, linestr); + if (linecounter == 1) + { + modelPointer->setUseIndexCol(linestr); + } + else if (linecounter == LineNumb) + { + modelPointer->ReadAndSet(linestr, par); + found = true; + } + + else if (linecounter > LineNumb) + break; + linecounter++; + if (infile.eof()) break; + } + infile.close(); + if (!found) + { + std::cout << "Line not found!" << std::endl; + return -1; + } + std::pair, std::vector> parameters = + modelPointer->initModel(linestr); + par = parameters.first; + parCT = parameters.second; + + modelPointer->write(); + std::ofstream outfile(out_file); + std::vector vTree; + for (int k = 0; k < dim; k++) + vTree.push_back(modelPointer->vevTreeMin.at(k)); + + std::vector Check; + double vev = 0; + double v1T, v2T, v3T; + std::vector NTempMass; + std::vector zero; + for (int k = 0; k < dim; k++) + zero.push_back(0); + std::vector point, pointPot; + if (Debug) std::cout << "Start of Minimization" << std::endl; + Minimize_gen_all(InputType, par, parCT, Temp, sol, Check, vTree); + if (Debug) std::cout << "End of Minimization" << std::endl; + double VR1 = 0, VR2 = 0; + std::vector solPot; + modelPointer->MinimizeOrderVEV(sol, solPot); + vev = modelPointer->EWSBVeV(solPot); + if (vev == 0) + { + std::cout << "Set to Tree-Level " << std::endl; + for (int i = 0; i < dim; i++) + sol[i] = modelPointer->vevTreeMin.at(i); + } + + for (int i = 0; i < dim; i++) + outfile << sol.at(i) << sep; + outfile << std::endl; + for (int nStep = 0; nStep <= FacStep; nStep++) + { + double tStep = FacStart + (FacEnd - FacStart) / FacStep * nStep; + point.clear(); + pointPot.clear(); + for (int i = 0; i < dim; i++) + point.push_back(tStep * sol.at(i)); + modelPointer->MinimizeOrderVEV(point, pointPot); + VR1 = modelPointer->VEff(pointPot, Temp, 0); + point.clear(); + outfile << tStep; + outfile << sep << VR1; + outfile << std::endl; + } + + outfile.close(); + delete modelPointer; + + return 0; } - - diff --git a/src/prog/PlotEWBG_mu.cpp b/src/prog/PlotEWBG_mu.cpp index 877afadf..46225617 100644 --- a/src/prog/PlotEWBG_mu.cpp +++ b/src/prog/PlotEWBG_mu.cpp @@ -2,7 +2,8 @@ * PlotEWBG_mu.cpp * * - * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller + * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas + Müller This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,315 +20,371 @@ */ /** * @file - * Calculates eta as a function of the renormalised scale mu. The renormalisation scale mu is varied from 1/2 to 1.5 C_vev0 in NumberOfStep steps. + * Calculates eta as a function of the renormalised scale mu. The + * renormalisation scale mu is varied from 1/2 to 1.5 C_vev0 in NumberOfStep + * steps. */ -#include // for atoi, EXIT_FAILURE -#include // for copy, max -#include // for shared_ptr, __shared_... -#include // for string, operator<< -#include // for pair -#include // for vector -#include // for Class_Potential_Origin -#include -#include -#include #include +#include +#include +#include // for Class_Potential_Origin +#include #include -#include -#include +#include // for copy, max #include +#include +#include +#include // for shared_ptr, __shared_... +#include // for atoi, EXIT_FAILURE +#include // for string, operator<< +#include // for pair +#include // for vector using namespace std; using namespace BSMPT; -struct CLIOptions{ - BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; - int Line{}, NumberOfSteps{}; - std::string InputFile, OutputFile,ConfigFile; - bool TerminalOutput{false}; - double vw{0.1}; - bool UseGSL { Minimizer::UseGSLDefault}; - bool UseCMAES {Minimizer::UseLibCMAESDefault}; - bool UseNLopt{Minimizer::UseNLoptDefault}; - int WhichMinimizer{Minimizer::WhichMinimizerDefault}; +struct CLIOptions +{ + BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; + int Line{}, NumberOfSteps{}; + std::string InputFile, OutputFile, ConfigFile; + bool TerminalOutput{false}; + double vw{0.1}; + bool UseGSL{Minimizer::UseGSLDefault}; + bool UseCMAES{Minimizer::UseLibCMAESDefault}; + bool UseNLopt{Minimizer::UseNLoptDefault}; + int WhichMinimizer{Minimizer::WhichMinimizerDefault}; - CLIOptions(int argc, char *argv[]); - bool good() const; + CLIOptions(int argc, char *argv[]); + bool good() const; }; -int main(int argc, char *argv[]) try{ +int main(int argc, char *argv[]) +try +{ - const CLIOptions args(argc,argv); - if(not args.good()) - { - return EXIT_FAILURE; - } + const CLIOptions args(argc, argv); + if (not args.good()) + { + return EXIT_FAILURE; + } - //Init: Interface Class for the different transport methods - Baryo::CalculateEtaInterface EtaInterface(args.ConfigFile); - int linecounter = 1; - std::ifstream infile(args.InputFile); - if(!infile.good()) { - std::cout << "Input file not found " << std::endl; - return EXIT_FAILURE; - } - std::ofstream outfile(args.OutputFile); - if(!outfile.good()) + // Init: Interface Class for the different transport methods + Baryo::CalculateEtaInterface EtaInterface(args.ConfigFile); + int linecounter = 1; + std::ifstream infile(args.InputFile); + if (!infile.good()) + { + std::cout << "Input file not found " << std::endl; + return EXIT_FAILURE; + } + std::ofstream outfile(args.OutputFile); + if (!outfile.good()) + { + std::cout << "Can not create file " << args.OutputFile << std::endl; + return EXIT_FAILURE; + } + std::string linestr; + std::shared_ptr modelPointer = + ModelID::FChoose(args.Model); + std::vector etaLegend = + EtaInterface.legend(); // Declare the vector for the PTFinder algorithm + while (getline(infile, linestr)) + { + if (linecounter > args.Line) break; + + if (linecounter == 1) { - std::cout << "Can not create file " << args.OutputFile << std::endl; - return EXIT_FAILURE; + outfile << linestr << sep << "mu_factor" << sep << "mu"; + for (const auto &x : modelPointer->addLegendTemp()) + outfile << sep << x + "_mu"; + outfile << sep << "BSMPT_StatusFlag"; + outfile << sep << "vw"; + outfile << sep << "L_W"; + outfile << sep << "top_sym_phase"; + outfile << sep << "top_brk_phase"; + outfile << sep << "bot_sym_phase"; + outfile << sep << "bot_brk_phase"; + outfile << sep << "tau_sym_phase"; + outfile << sep << "tau_brk_phase"; + for (const auto &x : etaLegend) + outfile << sep << x + "_muvar"; + outfile << std::endl; + + modelPointer->setUseIndexCol(linestr); } - std::string linestr; - std::shared_ptr modelPointer = ModelID::FChoose(args.Model); - std::vector etaLegend = EtaInterface.legend();// Declare the vector for the PTFinder algorithm - while(getline(infile,linestr)) + if (args.Line == linecounter) { - if(linecounter > args.Line) break; - - if(linecounter == 1) - { - outfile << linestr<addLegendTemp()) outfile << sep <setUseIndexCol(linestr); - } - if(args.Line==linecounter) + std::pair, std::vector> parameters = + modelPointer->initModel(linestr); + if (args.TerminalOutput) modelPointer->write(); + if (args.TerminalOutput) + { + std::cout << "Calculating EWPT in default settings with:\n mu = " + << modelPointer->get_scale() << std::endl; + } + if (args.TerminalOutput) + std::cout << "Start of mu variation" << std::endl; + for (int step = 0; step <= args.NumberOfSteps; step++) + { + double mu_factor = + 1 / 2. + (step / static_cast(args.NumberOfSteps)); + if (args.TerminalOutput) + std::cout << "\r currently mu_factor = " << mu_factor << std::endl; + auto VEVnames = modelPointer->addLegendTemp(); + auto CT_mu = modelPointer->resetScale(C_vev0 * mu_factor); + auto EWPT_mu = Minimizer::PTFinder_gen_all( + modelPointer, 0, 300, args.WhichMinimizer); + std::vector startpoint; + for (const auto &x : EWPT_mu.EWMinimum) + startpoint.push_back(x / 2.); + if (EWPT_mu.StatusFlag == Minimizer::MinimizerStatus::SUCCESS) { - std::pair,std::vector> parameters = modelPointer->initModel(linestr); - if(args.TerminalOutput) modelPointer->write(); - if(args.TerminalOutput) - { - std::cout<<"Calculating EWPT in default settings with:\n mu = "<get_scale() - <(args.NumberOfSteps)); - if(args.TerminalOutput) std::cout<<"\r currently mu_factor = "<addLegendTemp(); - auto CT_mu=modelPointer->resetScale(C_vev0*mu_factor); - auto EWPT_mu = Minimizer::PTFinder_gen_all(modelPointer,0,300,args.WhichMinimizer); - std::vector startpoint; - for(const auto& x : EWPT_mu.EWMinimum) startpoint.push_back(x/2.); - if(EWPT_mu.StatusFlag== Minimizer::MinimizerStatus::SUCCESS ){ - std::vectorcheckmu; - auto VEV_mu_sym = Minimizer::Minimize_gen_all(modelPointer,EWPT_mu.Tc+1,checkmu,startpoint,args.WhichMinimizer); - auto VEV_mu_brk = EWPT_mu.EWMinimum; - auto eta_mu = EtaInterface.CalcEta(args.vw,EWPT_mu.EWMinimum,VEV_mu_sym,EWPT_mu.Tc,modelPointer,args.WhichMinimizer); + std::vector checkmu; + auto VEV_mu_sym = Minimizer::Minimize_gen_all(modelPointer, + EWPT_mu.Tc + 1, + checkmu, + startpoint, + args.WhichMinimizer); + auto VEV_mu_brk = EWPT_mu.EWMinimum; + auto eta_mu = EtaInterface.CalcEta(args.vw, + EWPT_mu.EWMinimum, + VEV_mu_sym, + EWPT_mu.Tc, + modelPointer, + args.WhichMinimizer); - outfile << linestr; - outfile << sep << mu_factor <(EWPT_mu.StatusFlag); - outfile << sep << args.vw; - outfile << sep << EtaInterface.getLW(); - outfile << sep << EtaInterface.getSymmetricCPViolatingPhase_top(); - outfile << sep << EtaInterface.getBrokenCPViolatingPhase_top(); - outfile << sep << EtaInterface.getSymmetricCPViolatingPhase_bot(); - outfile << sep << EtaInterface.getBrokenCPViolatingPhase_bot(); - outfile << sep << EtaInterface.getSymmetricCPViolatingPhase_tau(); - outfile << sep << EtaInterface.getBrokenCPViolatingPhase_tau(); - outfile << sep << eta_mu; + outfile << linestr; + outfile << sep << mu_factor << sep << mu_factor * C_vev0; + outfile << sep << EWPT_mu.Tc << sep << EWPT_mu.vc << sep + << EWPT_mu.vc / EWPT_mu.Tc << sep << EWPT_mu.EWMinimum; + outfile << sep << static_cast(EWPT_mu.StatusFlag); + outfile << sep << args.vw; + outfile << sep << EtaInterface.getLW(); + outfile << sep << EtaInterface.getSymmetricCPViolatingPhase_top(); + outfile << sep << EtaInterface.getBrokenCPViolatingPhase_top(); + outfile << sep << EtaInterface.getSymmetricCPViolatingPhase_bot(); + outfile << sep << EtaInterface.getBrokenCPViolatingPhase_bot(); + outfile << sep << EtaInterface.getSymmetricCPViolatingPhase_tau(); + outfile << sep << EtaInterface.getBrokenCPViolatingPhase_tau(); + outfile << sep << eta_mu; - outfile << std::endl; + outfile << std::endl; + } // EWPT@mu found + else + { + if (args.TerminalOutput) + std::cout << "\tNo SFOEWPT found for given scale" << std::endl; + continue; + } + } // END: Mu Factor + } // END:LineCounter + linecounter++; + if (infile.eof()) break; + } + if (args.TerminalOutput) std::cout << std::endl; + outfile.close(); - }//EWPT@mu found - else { - if(args.TerminalOutput) std::cout<<"\tNo SFOEWPT found for given scale"< args; + for (int i{1}; i < argc; ++i) + args.push_back(argv[i]); - std::vector args; - for(int i{1};i 0 and args.at(0) == "--help") + { + throw int{0}; + } + else if (argc < 7) + { + throw std::runtime_error("Too few arguments."); + } - if(args.size() > 0 and args.at(0)=="--help") - { - throw int{0}; - } - else if(argc < 7) + const std::string prefix{"--"}; + bool UsePrefix = StringStartsWith(args.at(0), prefix); + if (UsePrefix) + { + for (const auto &arg : args) { - throw std::runtime_error("Too few arguments."); + auto el = arg; + std::transform(el.begin(), el.end(), el.begin(), ::tolower); + if (StringStartsWith(el, "--model=")) + { + Model = + BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); + } + else if (StringStartsWith(el, "--input=")) + { + InputFile = arg.substr(std::string("--input=").size()); + } + else if (StringStartsWith(el, "--output=")) + { + OutputFile = arg.substr(std::string("--output=").size()); + } + else if (StringStartsWith(el, "--line=")) + { + Line = std::stoi(el.substr(std::string("--line=").size())); + } + else if (StringStartsWith(el, "--numberofsteps=")) + { + NumberOfSteps = + std::stoi(el.substr(std::string("--numberofsteps=").size())); + } + else if (StringStartsWith(el, "--terminaloutput=")) + { + TerminalOutput = + el.substr(std::string("--terminaloutput=").size()) == "y"; + } + else if (StringStartsWith(el, "--vw=")) + { + vw = std::stod(el.substr(std::string("--vw=").size())); + } + else if (StringStartsWith(el, "--config=")) + { + ConfigFile = arg.substr(std::string("--config=").size()); + } + else if (StringStartsWith(el, "--usegsl=")) + { + UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; + } + else if (StringStartsWith(el, "--usecmaes=")) + { + UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; + } + else if (StringStartsWith(el, "--usenlopt=")) + { + UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; + } } - - const std::string prefix{"--"}; - bool UsePrefix = StringStartsWith(args.at(0),prefix); - if(UsePrefix) + WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL, UseCMAES, UseNLopt); + } + else + { + Model = ModelID::getModel(args.at(0)); + InputFile = args.at(1); + OutputFile = args.at(2); + Line = std::stoi(args.at(3)); + NumberOfSteps = std::stoi(args.at(4)); + ConfigFile = args.at(5); + if (argc == 8) { - for(const auto& arg: args) - { - auto el = arg; - std::transform(el.begin(), el.end(), el.begin(), ::tolower); - if(StringStartsWith(el,"--model=")) - { - Model = BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); - } - else if(StringStartsWith(el,"--input=")) - { - InputFile = arg.substr(std::string("--input=").size()); - } - else if(StringStartsWith(el,"--output=")) - { - OutputFile = arg.substr(std::string("--output=").size()); - } - else if(StringStartsWith(el,"--line=")) - { - Line = std::stoi(el.substr(std::string("--line=").size())); - } - else if(StringStartsWith(el,"--numberofsteps=")) - { - NumberOfSteps = std::stoi(el.substr(std::string("--numberofsteps=").size())); - } - else if(StringStartsWith(el,"--terminaloutput=")) - { - TerminalOutput = el.substr(std::string("--terminaloutput=").size()) == "y"; - } - else if(StringStartsWith(el,"--vw=")) - { - vw = std::stod(el.substr(std::string("--vw=").size())); - } - else if(StringStartsWith(el,"--config=")) - { - ConfigFile = arg.substr(std::string("--config=").size()); - } - else if(StringStartsWith(el,"--usegsl=")) - { - UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; - } - else if(StringStartsWith(el,"--usecmaes=")) - { - UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; - } - else if(StringStartsWith(el,"--usenlopt=")) - { - UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; - } - } - WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL,UseCMAES,UseNLopt); - } - else{ - Model = ModelID::getModel(args.at(0)); - InputFile = args.at(1); - OutputFile = args.at(2); - Line = std::stoi(args.at(3)); - NumberOfSteps = std::stoi(args.at(4)); - ConfigFile = args.at(5); - if(argc == 8) { - TerminalOutput = ("y" == std::string(args.at(6))); - } + TerminalOutput = ("y" == std::string(args.at(6))); } + } } bool CLIOptions::good() const { - if(NumberOfSteps == 0) - { - throw std::runtime_error("You have set the number of steps to zero."); - } - if(UseGSL and not Minimizer::UseGSLDefault) - { - throw std::runtime_error("You set --UseGSL=true but GSL was not found during compilation."); - } - if(UseCMAES and not Minimizer::UseLibCMAESDefault) - { - throw std::runtime_error("You set --UseCMAES=true but CMAES was not found during compilation."); - } - if(UseNLopt and not Minimizer::UseNLoptDefault) - { - throw std::runtime_error("You set --UseNLopt=true but NLopt was not found during compilation."); - } - if(WhichMinimizer == 0) - { - throw std::runtime_error("You disabled all minimizers. You need at least one."); - } - if(vw < 0 or vw > 1) - { - throw std::runtime_error("The wall velocity has to be between 0 and 1."); - } - if(Model==ModelID::ModelIDs::NotSet) { - std::cerr << "Your Model parameter does not match with the implemented Models." << std::endl; - ShowInputError(); - return false; - } - if(Line < 1) - { - std::cerr << "Start line counting with 1" << std::endl; - return false; - } - return true; + if (NumberOfSteps == 0) + { + throw std::runtime_error("You have set the number of steps to zero."); + } + if (UseGSL and not Minimizer::UseGSLDefault) + { + throw std::runtime_error( + "You set --UseGSL=true but GSL was not found during compilation."); + } + if (UseCMAES and not Minimizer::UseLibCMAESDefault) + { + throw std::runtime_error( + "You set --UseCMAES=true but CMAES was not found during compilation."); + } + if (UseNLopt and not Minimizer::UseNLoptDefault) + { + throw std::runtime_error( + "You set --UseNLopt=true but NLopt was not found during compilation."); + } + if (WhichMinimizer == 0) + { + throw std::runtime_error( + "You disabled all minimizers. You need at least one."); + } + if (vw < 0 or vw > 1) + { + throw std::runtime_error("The wall velocity has to be between 0 and 1."); + } + if (Model == ModelID::ModelIDs::NotSet) + { + std::cerr + << "Your Model parameter does not match with the implemented Models." + << std::endl; + ShowInputError(); + return false; + } + if (Line < 1) + { + std::cerr << "Start line counting with 1" << std::endl; + return false; + } + return true; } diff --git a/src/prog/PlotEWBG_nL.cpp b/src/prog/PlotEWBG_nL.cpp index 6e501a26..5e4c5ee2 100644 --- a/src/prog/PlotEWBG_nL.cpp +++ b/src/prog/PlotEWBG_nL.cpp @@ -2,335 +2,388 @@ * PlotEWBG_nL.cpp * * - * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller + * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas + Müller - This program 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. + This program 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. This program 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 this program. If not, see . + You should have received a copy of the GNU General Public + License along with this program. If not, see . */ - /** * @file - * This program calculates the left-handed density in front of the bubble wall as a function of the distance z in both approaches. + * This program calculates the left-handed density in front of the bubble wall + * as a function of the distance z in both approaches. */ - -#include // for atof, EXI... -#include // for copy, max -#include // for shared_ptr -#include // for operator<< -#include // for vector -#include // for Class_Pot... -#include -#include #include -#include #include -#include +#include +#include // for Class_Pot... +#include +#include +#include // for copy, max #include +#include +#include // for shared_ptr +#include // for atof, EXI... +#include // for operator<< +#include // for vector using namespace std; using namespace BSMPT; using namespace Baryo; -struct CLIOptions{ - BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; - int Line{}; - std::string InputFile, OutputFile,ConfigFile; - bool TerminalOutput{false}; - double vw{0.1}; - bool UseGSL { Minimizer::UseGSLDefault}; - bool UseCMAES {Minimizer::UseLibCMAESDefault}; - bool UseNLopt{Minimizer::UseNLoptDefault}; - int WhichMinimizer{Minimizer::WhichMinimizerDefault}; - - CLIOptions(int argc, char *argv[]); - bool good() const; +struct CLIOptions +{ + BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; + int Line{}; + std::string InputFile, OutputFile, ConfigFile; + bool TerminalOutput{false}; + double vw{0.1}; + bool UseGSL{Minimizer::UseGSLDefault}; + bool UseCMAES{Minimizer::UseLibCMAESDefault}; + bool UseNLopt{Minimizer::UseNLoptDefault}; + int WhichMinimizer{Minimizer::WhichMinimizerDefault}; + + CLIOptions(int argc, char *argv[]); + bool good() const; }; -int main(int argc, char *argv[]) try{ - const CLIOptions args(argc,argv); - if(not args.good()) +int main(int argc, char *argv[]) +try +{ + const CLIOptions args(argc, argv); + if (not args.good()) + { + return EXIT_FAILURE; + } + + // Set up of BSMPT/Baryo Classes + Baryo::CalculateEtaInterface EtaInterface(args.ConfigFile); + std::shared_ptr modelPointer = + ModelID::FChoose(args.Model); + + std::vector start, solPot; + + std::ifstream infile(args.InputFile); + if (!infile.good()) + { + std::cout << "Input file not found " << std::endl; + return EXIT_FAILURE; + } + + std::ofstream outfile(args.OutputFile); + if (!outfile.good()) + { + std::cout << "Can not create file " << args.OutputFile << std::endl; + return EXIT_FAILURE; + } + + std::string linestr; + int linecounter = 1; + bool found = false; + + while (true) + { + if (infile.eof()) break; + std::getline(infile, linestr); + if (linecounter == 1) { - return EXIT_FAILURE; + modelPointer->setUseIndexCol(linestr); + outfile << linestr << sep; + outfile << "T_c_nLvar" << sep << "omega_c_nLvar" << sep << "vw_nLvar" + << sep << "LW_nLvar" << sep; + outfile << "z" << sep << "z/LW" << sep << "nL_VIA" << sep << "muL_FH" + << sep << "nL_FH"; + outfile << std::endl; } - -//Set up of BSMPT/Baryo Classes - Baryo::CalculateEtaInterface EtaInterface(args.ConfigFile); - std::shared_ptr modelPointer = ModelID::FChoose(args.Model); - - std::vector start,solPot; - - std::ifstream infile(args.InputFile); - if(!infile.good()) { - std::cout << "Input file not found " << std::endl; - return EXIT_FAILURE; - } - - std::ofstream outfile(args.OutputFile); - if(!outfile.good()) + else if (linecounter == args.Line) { - std::cout << "Can not create file " << args.OutputFile << std::endl; - return EXIT_FAILURE; + modelPointer->initModel(linestr); + modelPointer->FindSignSymmetries(); + found = true; + break; } - - std::string linestr; - int linecounter = 1; - bool found=false; - - - while(true) + else if (linecounter > args.Line) + break; + linecounter++; + if (infile.eof()) break; + } + infile.close(); + if (!found) + { + std::cout << "Line not found !\n"; + return -1; + } + + if (args.TerminalOutput) modelPointer->write(); + // CALL: BSMPT-->Phasetransition + if (args.TerminalOutput) std::cout << "PTFinder called..." << std::endl; + auto EWPT = + Minimizer::PTFinder_gen_all(modelPointer, 0, 300, args.WhichMinimizer); + // SFOEWPT FOUND + if (EWPT.StatusFlag == Minimizer::MinimizerStatus::SUCCESS and + C_PT * EWPT.Tc < EWPT.vc) + { + if (args.TerminalOutput) std::cout << "SFOEWPT found..." << std::endl; + std::vector vcritical, vbarrier; + vcritical = EWPT.EWMinimum; + double TC = EWPT.Tc; + std::vector MinimumPlane; + // Find the minimum in the symmetric phase. For this minimise at T = Tc + 1 + std::vector vevsymmetricSolution, checksym, startpoint; + for (std::size_t i = 0; i < modelPointer->get_nVEV(); i++) + startpoint.push_back(0.5 * vcritical.at(i)); + vevsymmetricSolution = Minimizer::Minimize_gen_all( + modelPointer, TC + 1, checksym, startpoint, args.WhichMinimizer); + + ///////////////////////////////////////////////////////////////////////////////// + std::size_t nstep = 100; + + if (args.TerminalOutput) std::cout << "Set up the numerics " << std::endl; + EtaInterface.setNumerics( + args.vw, + EWPT.EWMinimum, + vevsymmetricSolution, + TC, + modelPointer, + args.WhichMinimizer); // Set up parameter container for Baryo + // Calculation-->Calls container.init + if (args.TerminalOutput) + std::cout << "Starting setting the class instances" << std::endl; + BSMPT::Baryo::tau_source C_tau; + EtaInterface.set_transport_method( + TransportMethod::tau); // setting to tau class + bool botflag = true; + auto class_GamM = EtaInterface.get_class_CalcGamM(); + auto class_ScP = EtaInterface.get_class_Scp(); + auto class_kappa = EtaInterface.get_class_kappa(); + auto Integration_mubl{EtaInterface.getGSL_integration_mubl_container()}; + C_tau.set_class( + botflag, Integration_mubl, class_GamM, class_ScP, class_kappa); + + auto tau_arr_nL = set_up_nL_grid(nstep, Integration_mubl, C_tau); + auto FH_GSL = + generate_mubl_spline(Integration_mubl, static_cast(nstep)); + + /////// + /// Outfile + /////// + for (std::size_t i = 0; i < nstep; i++) { - if(infile.eof()) break; - std::getline(infile,linestr); - if(linecounter == 1){ - modelPointer->setUseIndexCol(linestr); - outfile << linestr<initModel(linestr); - modelPointer->FindSignSymmetries(); - found = true; - break; - } - else if(linecounter > args.Line) break; - linecounter++; - if(infile.eof()) break; + outfile << linestr << sep; + outfile << TC << sep << EWPT.vc << sep << args.vw << sep + << EtaInterface.getLW() << sep; + outfile << tau_arr_nL.first.at(i) << sep; + outfile << tau_arr_nL.first.at(i) / EtaInterface.getLW() << sep; + outfile << tau_arr_nL.second.at(i) << sep; + outfile << FH_GSL.spline(tau_arr_nL.first.at(i)) << sep; + outfile << FH_GSL.spline(tau_arr_nL.first.at(i)) * std::pow(TC, 2); + outfile << std::endl; } - infile.close(); - if(!found) {std::cout << "Line not found !\n"; return -1;} - - if(args.TerminalOutput) modelPointer->write(); -//CALL: BSMPT-->Phasetransition - if(args.TerminalOutput) std::cout<<"PTFinder called..."< vcritical,vbarrier; - vcritical = EWPT.EWMinimum; - double TC = EWPT.Tc; - std::vector MinimumPlane; -//Find the minimum in the symmetric phase. For this minimise at T = Tc + 1 - std::vector vevsymmetricSolution,checksym, startpoint; - for(std::size_t i=0;iget_nVEV();i++) startpoint.push_back(0.5*vcritical.at(i)); - vevsymmetricSolution=Minimizer::Minimize_gen_all(modelPointer,TC+1,checksym,startpoint,args.WhichMinimizer); - -///////////////////////////////////////////////////////////////////////////////// - std::size_t nstep = 100; - - if(args.TerminalOutput) std::cout<<"Set up the numerics "<Calls container.init - if(args.TerminalOutput) std::cout<<"Starting setting the class instances"<(nstep)); - -/////// -/// Outfile -/////// - for(std::size_t i=0;i args; - for(int i{1};i args; + for (int i{1}; i < argc; ++i) + args.push_back(argv[i]); + + if (argc < 7 or args.at(0) == "--help") + { + int SizeOfFirstColumn = std::string("--TerminalOutput= ").size(); + std::cout << "Calculation of the left-handed chemical potentials or " + "particle densities triggering the EW" + << " sphaleron transitions as a function of the wall distance z ." + << std::endl + << "It is called either by " << std::endl + << "./PlotEWBG_nL Model Inputfile Outputfile Line vw " + "EWBGConfigFile TerminalOutput(y/n)" + << std::endl + << "or with the following arguments" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--help" + << "Shows this menu" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--model=" + << "The model you want to investigate" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--input=" + << "The input file in tsv format" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--output=" + << "The output file in tsv format" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--Line=" + << "The line with the given parameter point. Expects line 1 to " + "be a legend." + << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--config=" + << "The EWBG config file." << std::endl + << std::setw(SizeOfFirstColumn) << std::left + << "--TerminalOutput=" + << "y/n Turns on additional information in the terminal during " + "the calculation." + << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--vw=" + << "The wall velocity. Default value of 0.1." << std::endl; + std::string GSLhelp{"--UseGSL="}; + GSLhelp += Minimizer::UseGSLDefault ? "true" : "false"; + std::cout << std::setw(SizeOfFirstColumn) << std::left << GSLhelp + << "Use the GSL library to minimize the effective potential" + << std::endl; + std::string CMAEShelp{"--UseCMAES="}; + CMAEShelp += Minimizer::UseLibCMAESDefault ? "true" : "false"; + std::cout << std::setw(SizeOfFirstColumn) << std::left << CMAEShelp + << "Use the CMAES library to minimize the effective potential" + << std::endl; + std::string NLoptHelp{"--UseNLopt="}; + NLoptHelp += Minimizer::UseNLoptDefault ? "true" : "false"; + std::cout << std::setw(SizeOfFirstColumn) << std::left << NLoptHelp + << "Use the NLopt library to minimize the effective potential" + << std::endl; + ShowInputError(); + } + + if (args.size() > 0 and args.at(0) == "--help") + { + throw int{0}; + } + else if (argc < 7) + { + throw std::runtime_error("Too few arguments."); + } + + const std::string prefix{"--"}; + bool UsePrefix = StringStartsWith(args.at(0), prefix); + if (UsePrefix) + { + for (const auto &arg : args) { - int SizeOfFirstColumn = std::string("--TerminalOutput= ").size(); - std::cout << "Calculation of the left-handed chemical potentials or particle densities triggering the EW" - << " sphaleron transitions as a function of the wall distance z ." << std::endl - << "It is called either by " << std::endl - << "./PlotEWBG_nL Model Inputfile Outputfile Line vw EWBGConfigFile TerminalOutput(y/n)" << std::endl - << "or with the following arguments" << std::endl - << std::setw(SizeOfFirstColumn) << std::left<< "--help" - << "Shows this menu" << std::endl - << std::setw(SizeOfFirstColumn) << std::left << "--model=" - << "The model you want to investigate"< 0 and args.at(0)=="--help") + WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL, UseCMAES, UseNLopt); + } + else + { + Model = ModelID::getModel(args.at(0)); + InputFile = args.at(1); + OutputFile = args.at(2); + Line = std::stoi(args.at(3)); + vw = std::stod(args.at(4)); + ConfigFile = args.at(5); + if (argc == 8) { - throw int{0}; - } - else if(argc < 7) - { - throw std::runtime_error("Too few arguments."); - } - - const std::string prefix{"--"}; - bool UsePrefix = StringStartsWith(args.at(0),prefix); - if(UsePrefix) - { - for(const auto& arg: args) - { - auto el = arg; - std::transform(el.begin(), el.end(), el.begin(), ::tolower); - if(StringStartsWith(el,"--model=")) - { - Model = BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); - } - else if(StringStartsWith(el,"--input=")) - { - InputFile = arg.substr(std::string("--input=").size()); - } - else if(StringStartsWith(el,"--output=")) - { - OutputFile = arg.substr(std::string("--output=").size()); - } - else if(StringStartsWith(el,"--line=")) - { - Line = std::stoi(el.substr(std::string("--line=").size())); - } - else if(StringStartsWith(el,"--terminaloutput=")) - { - TerminalOutput = el.substr(std::string("--terminaloutput=").size()) == "y"; - } - else if(StringStartsWith(el,"--vw=")) - { - vw = std::stod(el.substr(std::string("--vw=").size())); - } - else if(StringStartsWith(el,"--config=")) - { - ConfigFile = arg.substr(std::string("--config=").size()); - } - else if(StringStartsWith(el,"--usegsl=")) - { - UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; - } - else if(StringStartsWith(el,"--usecmaes=")) - { - UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; - } - else if(StringStartsWith(el,"--usenlopt=")) - { - UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; - } - } - WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL,UseCMAES,UseNLopt); - } - else{ - Model = ModelID::getModel(args.at(0)); - InputFile = args.at(1); - OutputFile = args.at(2); - Line = std::stoi(args.at(3)); - vw = std::stod(args.at(4)); - ConfigFile = args.at(5); - if(argc == 8) { - TerminalOutput = ("y" == std::string(args.at(6))); - } + TerminalOutput = ("y" == std::string(args.at(6))); } + } } bool CLIOptions::good() const { - if(UseGSL and not Minimizer::UseGSLDefault) - { - throw std::runtime_error("You set --UseGSL=true but GSL was not found during compilation."); - } - if(UseCMAES and not Minimizer::UseLibCMAESDefault) - { - throw std::runtime_error("You set --UseCMAES=true but CMAES was not found during compilation."); - } - if(UseNLopt and not Minimizer::UseNLoptDefault) - { - throw std::runtime_error("You set --UseNLopt=true but NLopt was not found during compilation."); - } - if(WhichMinimizer == 0) - { - throw std::runtime_error("You disabled all minimizers. You need at least one."); - } - if(vw <= 0 or vw > 1) - { - throw std::runtime_error("The wall velocity has to be between 0 and 1."); - } - if(Model==ModelID::ModelIDs::NotSet) { - std::cerr << "Your Model parameter does not match with the implemented Models." << std::endl; - ShowInputError(); - return false; - } - if(Line < 1) - { - std::cerr << "Start line counting with 1" << std::endl; - return false; - } - return true; + if (UseGSL and not Minimizer::UseGSLDefault) + { + throw std::runtime_error( + "You set --UseGSL=true but GSL was not found during compilation."); + } + if (UseCMAES and not Minimizer::UseLibCMAESDefault) + { + throw std::runtime_error( + "You set --UseCMAES=true but CMAES was not found during compilation."); + } + if (UseNLopt and not Minimizer::UseNLoptDefault) + { + throw std::runtime_error( + "You set --UseNLopt=true but NLopt was not found during compilation."); + } + if (WhichMinimizer == 0) + { + throw std::runtime_error( + "You disabled all minimizers. You need at least one."); + } + if (vw <= 0 or vw > 1) + { + throw std::runtime_error("The wall velocity has to be between 0 and 1."); + } + if (Model == ModelID::ModelIDs::NotSet) + { + std::cerr + << "Your Model parameter does not match with the implemented Models." + << std::endl; + ShowInputError(); + return false; + } + if (Line < 1) + { + std::cerr << "Start line counting with 1" << std::endl; + return false; + } + return true; } - diff --git a/src/prog/PlotEWBG_vw.cpp b/src/prog/PlotEWBG_vw.cpp index f441aa06..1910f3c6 100644 --- a/src/prog/PlotEWBG_vw.cpp +++ b/src/prog/PlotEWBG_vw.cpp @@ -2,353 +2,381 @@ * PlotEWBG_vw.cpp * * - * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller + * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas + Müller - This program 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. + This program 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. - This program 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. + This program 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 this program. If not, see . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ /** * @file - * This program calculates the EWBG eta as a function of vw and varies vw over a given array. + * This program calculates the EWBG eta as a function of vw and varies vw over a + * given array. */ -#include // for atof, EXI... -#include // for copy, max -#include // for shared_ptr -#include // for operator<< -#include // for vector +#include +#include #include // for Class_Pot... #include -#include -#include #include -#include +#include // for copy, max #include +#include +#include // for shared_ptr +#include // for atof, EXI... +#include // for operator<< +#include // for vector using namespace std; using namespace BSMPT; struct CLIOptions { - BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; - int Line{}; - std::string InputFile, OutputFile, ConfigFile; - bool TerminalOutput{false}; - double vw_min{}, vw_max{}, vw_Stepsize{}; - bool UseGSL{Minimizer::UseGSLDefault}; - bool UseCMAES{Minimizer::UseLibCMAESDefault}; - bool UseNLopt{Minimizer::UseNLoptDefault}; - int WhichMinimizer{Minimizer::WhichMinimizerDefault}; + BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; + int Line{}; + std::string InputFile, OutputFile, ConfigFile; + bool TerminalOutput{false}; + double vw_min{}, vw_max{}, vw_Stepsize{}; + bool UseGSL{Minimizer::UseGSLDefault}; + bool UseCMAES{Minimizer::UseLibCMAESDefault}; + bool UseNLopt{Minimizer::UseNLoptDefault}; + int WhichMinimizer{Minimizer::WhichMinimizerDefault}; - CLIOptions(int argc, char *argv[]); - bool good() const; + CLIOptions(int argc, char *argv[]); + bool good() const; }; int main(int argc, char *argv[]) try { - const CLIOptions args(argc, argv); - if (not args.good()) - { - return EXIT_FAILURE; - } + const CLIOptions args(argc, argv); + if (not args.good()) + { + return EXIT_FAILURE; + } - //Set up of BSMPT/Baryo Classes - Baryo::CalculateEtaInterface EtaInterface(args.ConfigFile); - std::shared_ptr modelPointer = ModelID::FChoose(args.Model); + // Set up of BSMPT/Baryo Classes + Baryo::CalculateEtaInterface EtaInterface(args.ConfigFile); + std::shared_ptr modelPointer = + ModelID::FChoose(args.Model); - std::ifstream infile(args.InputFile); - if (!infile.good()) - { - std::cout << "Input file not found " << std::endl; - return EXIT_FAILURE; - } + std::ifstream infile(args.InputFile); + if (!infile.good()) + { + std::cout << "Input file not found " << std::endl; + return EXIT_FAILURE; + } - std::ofstream outfile(args.OutputFile); - if (!outfile.good()) - { - std::cout << "Can not create file " << args.OutputFile << std::endl; - return EXIT_FAILURE; - } + std::ofstream outfile(args.OutputFile); + if (!outfile.good()) + { + std::cout << "Can not create file " << args.OutputFile << std::endl; + return EXIT_FAILURE; + } - std::string linestr; - int linecounter = 1; - bool found = false; + std::string linestr; + int linecounter = 1; + bool found = false; - while (true) + while (true) + { + if (infile.eof()) break; + std::getline(infile, linestr); + if (linecounter == 1) { - if (infile.eof()) - break; - std::getline(infile, linestr); - if (linecounter == 1) - { - modelPointer->setUseIndexCol(linestr); - outfile << linestr << sep; - outfile << "T_c_var" << sep << "omega_c_var" << sep << "vw_var" << sep << "LW_var"; - for (const auto &x : EtaInterface.legend()) - outfile << sep << x + "_var"; - outfile << std::endl; - } - else if (linecounter == args.Line) - { - modelPointer->initModel(linestr); - modelPointer->FindSignSymmetries(); - found = true; - break; - } - else if (linecounter > args.Line) - break; - linecounter++; - if (infile.eof()) - break; + modelPointer->setUseIndexCol(linestr); + outfile << linestr << sep; + outfile << "T_c_var" << sep << "omega_c_var" << sep << "vw_var" << sep + << "LW_var"; + for (const auto &x : EtaInterface.legend()) + outfile << sep << x + "_var"; + outfile << std::endl; } - infile.close(); - if (!found) + else if (linecounter == args.Line) { - std::cout << "Line not found !\n"; - return -1; + modelPointer->initModel(linestr); + modelPointer->FindSignSymmetries(); + found = true; + break; } + else if (linecounter > args.Line) + break; + linecounter++; + if (infile.eof()) break; + } + infile.close(); + if (!found) + { + std::cout << "Line not found !\n"; + return -1; + } - if (args.TerminalOutput) - modelPointer->write(); - //CALL: BSMPT-->Phasetransition - if (args.TerminalOutput) - std::cout << "PTFinder called..." << std::endl; - auto EWPT = Minimizer::PTFinder_gen_all(modelPointer, 0, 300); + if (args.TerminalOutput) modelPointer->write(); + // CALL: BSMPT-->Phasetransition + if (args.TerminalOutput) std::cout << "PTFinder called..." << std::endl; + auto EWPT = Minimizer::PTFinder_gen_all(modelPointer, 0, 300); - //SFOEWPT FOUND - if (EWPT.StatusFlag == Minimizer::MinimizerStatus::SUCCESS and C_PT * EWPT.Tc < EWPT.vc) - { - if (args.TerminalOutput) - std::cout << "SFOEWPT found..." << std::endl; - std::vector vcritical, vbarrier; - vcritical = EWPT.EWMinimum; - double TC = EWPT.Tc; - double vc = EWPT.vc; - std::vector MinimumPlane; - //Find the minimum in the symmetric phase. For this minimise at T = Tc + 1 - std::vector vevsymmetricSolution, checksym, startpoint; - for (std::size_t i = 0; i < modelPointer->get_nVEV(); i++) - startpoint.push_back(0.5 * vcritical.at(i)); - vevsymmetricSolution = Minimizer::Minimize_gen_all(modelPointer, TC + 1, checksym, startpoint); - double vw = 0; - if (args.TerminalOutput) - std::cout << "Currently calculating vw:" << std::endl; - for (vw = args.vw_min; vw <= args.vw_max; vw += args.vw_Stepsize) - { - std::cout << "\rvw = " << vw << "\n"; - auto eta = EtaInterface.CalcEta(vw, vcritical, vevsymmetricSolution, TC, modelPointer, args.WhichMinimizer); - outfile << linestr << sep; - outfile << TC << sep << vc << sep << vw << sep << EtaInterface.getLW(); - for (auto x : eta) - outfile << sep << x; - outfile << std::endl; - } //END: vw loop - } //END: SFOEWPT FOUND - else + // SFOEWPT FOUND + if (EWPT.StatusFlag == Minimizer::MinimizerStatus::SUCCESS and + C_PT * EWPT.Tc < EWPT.vc) + { + if (args.TerminalOutput) std::cout << "SFOEWPT found..." << std::endl; + std::vector vcritical, vbarrier; + vcritical = EWPT.EWMinimum; + double TC = EWPT.Tc; + double vc = EWPT.vc; + std::vector MinimumPlane; + // Find the minimum in the symmetric phase. For this minimise at T = Tc + 1 + std::vector vevsymmetricSolution, checksym, startpoint; + for (std::size_t i = 0; i < modelPointer->get_nVEV(); i++) + startpoint.push_back(0.5 * vcritical.at(i)); + vevsymmetricSolution = + Minimizer::Minimize_gen_all(modelPointer, TC + 1, checksym, startpoint); + double vw = 0; + if (args.TerminalOutput) + std::cout << "Currently calculating vw:" << std::endl; + for (vw = args.vw_min; vw <= args.vw_max; vw += args.vw_Stepsize) { - outfile << -1 << -1 << -1 << -1 << -1 << std::endl; - } //NO SFOEWPT - outfile.close(); + std::cout << "\rvw = " << vw << "\n"; + auto eta = EtaInterface.CalcEta(vw, + vcritical, + vevsymmetricSolution, + TC, + modelPointer, + args.WhichMinimizer); + outfile << linestr << sep; + outfile << TC << sep << vc << sep << vw << sep << EtaInterface.getLW(); + for (auto x : eta) + outfile << sep << x; + outfile << std::endl; + } // END: vw loop + } // END: SFOEWPT FOUND + else + { + outfile << -1 << -1 << -1 << -1 << -1 << std::endl; + } // NO SFOEWPT + outfile.close(); - return EXIT_SUCCESS; -} //END: Try + return EXIT_SUCCESS; +} // END: Try catch (int) { - return EXIT_SUCCESS; + return EXIT_SUCCESS; } catch (exception &e) { - std::cerr << e.what() << std::endl; - return EXIT_FAILURE; + std::cerr << e.what() << std::endl; + return EXIT_FAILURE; } CLIOptions::CLIOptions(int argc, char *argv[]) { - std::vector args; - for (int i{1}; i < argc; ++i) - args.push_back(argv[i]); + std::vector args; + for (int i{1}; i < argc; ++i) + args.push_back(argv[i]); - if (argc < 9 or args.at(0) == "--help") - { - int SizeOfFirstColumn = std::string("--TerminalOutput= ").size(); - std::cout << "PlotEWBG_vw calculates the EWBG for varying wall velocity for a given parameter point." << std::endl - << "It is called either by " << std::endl - << "./PlotEWBG_vw Model Inputfile Outputfile Line vwMin vwStepsize vwMax EWBGConfigFile TerminalOutput(y/n)" << std::endl - << "or with the following arguments" << std::endl - << std::setw(SizeOfFirstColumn) << std::left << "--help" - << "Shows this menu" << std::endl - << std::setw(SizeOfFirstColumn) << std::left << "--model=" - << "The model you want to investigate" << std::endl - << std::setw(SizeOfFirstColumn) << std::left << "--input=" - << "The input file in tsv format" << std::endl - << std::setw(SizeOfFirstColumn) << std::left << "--output=" - << "The output file in tsv format" << std::endl - << std::setw(SizeOfFirstColumn) << std::left << "--Line=" - << "The line with the given parameter point. Expects line 1 to be a legend." << std::endl - << std::setw(SizeOfFirstColumn) << std::left << "--config=" - << "The EWBG config file." << std::endl - << std::setw(SizeOfFirstColumn) << std::left << "--TerminalOutput=" - << "y/n Turns on additional information in the terminal during the calculation." << std::endl - << std::setw(SizeOfFirstColumn) << std::left << "--vw_min=" - << "The minimum wall velocity." << std::endl - << std::setw(SizeOfFirstColumn) << std::left << "--vw_max=" - << "The maximum wall velocity." << std::endl - << std::setw(SizeOfFirstColumn) << std::left << "--vw_Stepsize=" - << "The stepsize to increase the wall velocity." << std::endl; - std::string GSLhelp{"--UseGSL="}; - GSLhelp += Minimizer::UseGSLDefault ? "true" : "false"; - std::cout << std::setw(SizeOfFirstColumn) << std::left << GSLhelp - << "Use the GSL library to minimize the effective potential" << std::endl; - std::string CMAEShelp{"--UseCMAES="}; - CMAEShelp += Minimizer::UseLibCMAESDefault ? "true" : "false"; - std::cout << std::setw(SizeOfFirstColumn) << std::left << CMAEShelp - << "Use the CMAES library to minimize the effective potential" << std::endl; - std::string NLoptHelp{"--UseNLopt="}; - NLoptHelp += Minimizer::UseNLoptDefault ? "true" : "false"; - std::cout << std::setw(SizeOfFirstColumn) << std::left << NLoptHelp - << "Use the NLopt library to minimize the effective potential" << std::endl; - ShowInputError(); - } + if (argc < 9 or args.at(0) == "--help") + { + int SizeOfFirstColumn = std::string("--TerminalOutput= ").size(); + std::cout << "PlotEWBG_vw calculates the EWBG for varying wall velocity " + "for a given parameter point." + << std::endl + << "It is called either by " << std::endl + << "./PlotEWBG_vw Model Inputfile Outputfile Line vwMin " + "vwStepsize vwMax EWBGConfigFile TerminalOutput(y/n)" + << std::endl + << "or with the following arguments" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--help" + << "Shows this menu" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--model=" + << "The model you want to investigate" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--input=" + << "The input file in tsv format" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--output=" + << "The output file in tsv format" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--Line=" + << "The line with the given parameter point. Expects line 1 to " + "be a legend." + << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--config=" + << "The EWBG config file." << std::endl + << std::setw(SizeOfFirstColumn) << std::left + << "--TerminalOutput=" + << "y/n Turns on additional information in the terminal during " + "the calculation." + << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--vw_min=" + << "The minimum wall velocity." << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--vw_max=" + << "The maximum wall velocity." << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--vw_Stepsize=" + << "The stepsize to increase the wall velocity." << std::endl; + std::string GSLhelp{"--UseGSL="}; + GSLhelp += Minimizer::UseGSLDefault ? "true" : "false"; + std::cout << std::setw(SizeOfFirstColumn) << std::left << GSLhelp + << "Use the GSL library to minimize the effective potential" + << std::endl; + std::string CMAEShelp{"--UseCMAES="}; + CMAEShelp += Minimizer::UseLibCMAESDefault ? "true" : "false"; + std::cout << std::setw(SizeOfFirstColumn) << std::left << CMAEShelp + << "Use the CMAES library to minimize the effective potential" + << std::endl; + std::string NLoptHelp{"--UseNLopt="}; + NLoptHelp += Minimizer::UseNLoptDefault ? "true" : "false"; + std::cout << std::setw(SizeOfFirstColumn) << std::left << NLoptHelp + << "Use the NLopt library to minimize the effective potential" + << std::endl; + ShowInputError(); + } - if (args.size() > 0 and args.at(0) == "--help") - { - throw int{0}; - } - else if (argc < 9) - { - throw std::runtime_error("Too few arguments."); - } + if (args.size() > 0 and args.at(0) == "--help") + { + throw int{0}; + } + else if (argc < 9) + { + throw std::runtime_error("Too few arguments."); + } - const std::string prefix{"--"}; - bool UsePrefix = StringStartsWith(args.at(0), prefix); - if (UsePrefix) + const std::string prefix{"--"}; + bool UsePrefix = StringStartsWith(args.at(0), prefix); + if (UsePrefix) + { + for (const auto &arg : args) { - for (const auto &arg : args) - { - auto el = arg; - std::transform(el.begin(), el.end(), el.begin(), ::tolower); - if (StringStartsWith(el, "--model=")) - { - Model = BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); - } - else if (StringStartsWith(el, "--input=")) - { - InputFile = arg.substr(std::string("--input=").size()); - } - else if (StringStartsWith(el, "--output=")) - { - OutputFile = arg.substr(std::string("--output=").size()); - } - else if (StringStartsWith(el, "--line=")) - { - Line = std::stoi(el.substr(std::string("--line=").size())); - } - else if (StringStartsWith(el, "--terminaloutput=")) - { - TerminalOutput = el.substr(std::string("--terminaloutput=").size()) == "y"; - } - else if (StringStartsWith(el, "--vw_min=")) - { - vw_min = std::stod(el.substr(std::string("--vw_min=").size())); - } - else if (StringStartsWith(el, "--vw_max=")) - { - vw_max = std::stod(el.substr(std::string("--vw_max=").size())); - } - else if (StringStartsWith(el, "--vw_stepsize=")) - { - vw_Stepsize = std::stod(el.substr(std::string("--vw_stepsize=").size())); - } - else if (StringStartsWith(el, "--config=")) - { - ConfigFile = arg.substr(std::string("--config=").size()); - } - else if (StringStartsWith(el, "--usegsl=")) - { - UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; - } - else if (StringStartsWith(el, "--usecmaes=")) - { - UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; - } - else if (StringStartsWith(el, "--usenlopt=")) - { - UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; - } - } - WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL, UseCMAES, UseNLopt); + auto el = arg; + std::transform(el.begin(), el.end(), el.begin(), ::tolower); + if (StringStartsWith(el, "--model=")) + { + Model = + BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); + } + else if (StringStartsWith(el, "--input=")) + { + InputFile = arg.substr(std::string("--input=").size()); + } + else if (StringStartsWith(el, "--output=")) + { + OutputFile = arg.substr(std::string("--output=").size()); + } + else if (StringStartsWith(el, "--line=")) + { + Line = std::stoi(el.substr(std::string("--line=").size())); + } + else if (StringStartsWith(el, "--terminaloutput=")) + { + TerminalOutput = + el.substr(std::string("--terminaloutput=").size()) == "y"; + } + else if (StringStartsWith(el, "--vw_min=")) + { + vw_min = std::stod(el.substr(std::string("--vw_min=").size())); + } + else if (StringStartsWith(el, "--vw_max=")) + { + vw_max = std::stod(el.substr(std::string("--vw_max=").size())); + } + else if (StringStartsWith(el, "--vw_stepsize=")) + { + vw_Stepsize = + std::stod(el.substr(std::string("--vw_stepsize=").size())); + } + else if (StringStartsWith(el, "--config=")) + { + ConfigFile = arg.substr(std::string("--config=").size()); + } + else if (StringStartsWith(el, "--usegsl=")) + { + UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; + } + else if (StringStartsWith(el, "--usecmaes=")) + { + UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; + } + else if (StringStartsWith(el, "--usenlopt=")) + { + UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; + } } - else + WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL, UseCMAES, UseNLopt); + } + else + { + Model = ModelID::getModel(args.at(0)); + InputFile = args.at(1); + OutputFile = args.at(2); + Line = std::stoi(args.at(3)); + vw_min = std::stod(args.at(4)); + vw_Stepsize = std::stod(args.at(5)); + vw_max = std::stod(args.at(6)); + ConfigFile = args.at(7); + if (argc == 10) { - Model = ModelID::getModel(args.at(0)); - InputFile = args.at(1); - OutputFile = args.at(2); - Line = std::stoi(args.at(3)); - vw_min = std::stod(args.at(4)); - vw_Stepsize = std::stod(args.at(5)); - vw_max = std::stod(args.at(6)); - ConfigFile = args.at(7); - if (argc == 10) - { - TerminalOutput = ("y" == std::string(args[8])); - } + TerminalOutput = ("y" == std::string(args[8])); } + } } bool CLIOptions::good() const { - if (UseGSL and not Minimizer::UseGSLDefault) - { - throw std::runtime_error("You set --UseGSL=true but GSL was not found during compilation."); - } - if (UseCMAES and not Minimizer::UseLibCMAESDefault) - { - throw std::runtime_error("You set --UseCMAES=true but CMAES was not found during compilation."); - } - if (UseNLopt and not Minimizer::UseNLoptDefault) - { - throw std::runtime_error("You set --UseNLopt=true but NLopt was not found during compilation."); - } - if (WhichMinimizer == 0) - { - throw std::runtime_error("You disabled all minimizers. You need at least one."); - } - if (vw_min <= 0 or vw_min > 1 or vw_max <= 0 or vw_max > 1) - { - throw std::runtime_error("The wall velocity has to be between 0 and 1."); - } - if (vw_Stepsize == 0) - { - throw std::runtime_error("The stepsize has to be larger than 0."); - } - if (vw_min > vw_max) - { - throw std::runtime_error("The minimal wall velocity has to be smaller than the maximal."); - } - if (Model == ModelID::ModelIDs::NotSet) - { - std::cerr << "Your Model parameter does not match with the implemented Models." << std::endl; - ShowInputError(); - return false; - } - if (Line < 1) - { - std::cerr << "Start line counting with 1" << std::endl; - return false; - } + if (UseGSL and not Minimizer::UseGSLDefault) + { + throw std::runtime_error( + "You set --UseGSL=true but GSL was not found during compilation."); + } + if (UseCMAES and not Minimizer::UseLibCMAESDefault) + { + throw std::runtime_error( + "You set --UseCMAES=true but CMAES was not found during compilation."); + } + if (UseNLopt and not Minimizer::UseNLoptDefault) + { + throw std::runtime_error( + "You set --UseNLopt=true but NLopt was not found during compilation."); + } + if (WhichMinimizer == 0) + { + throw std::runtime_error( + "You disabled all minimizers. You need at least one."); + } + if (vw_min <= 0 or vw_min > 1 or vw_max <= 0 or vw_max > 1) + { + throw std::runtime_error("The wall velocity has to be between 0 and 1."); + } + if (vw_Stepsize == 0) + { + throw std::runtime_error("The stepsize has to be larger than 0."); + } + if (vw_min > vw_max) + { + throw std::runtime_error( + "The minimal wall velocity has to be smaller than the maximal."); + } + if (Model == ModelID::ModelIDs::NotSet) + { + std::cerr + << "Your Model parameter does not match with the implemented Models." + << std::endl; + ShowInputError(); + return false; + } + if (Line < 1) + { + std::cerr << "Start line counting with 1" << std::endl; + return false; + } - return true; + return true; } diff --git a/src/prog/RenormScale.cpp b/src/prog/RenormScale.cpp index 51352b1c..37895a27 100644 --- a/src/prog/RenormScale.cpp +++ b/src/prog/RenormScale.cpp @@ -2,7 +2,8 @@ * RenormScale.cpp * * - * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller + * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas + Müller This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,303 +20,352 @@ */ /** * @file - * Calculates xi_C as a function of the renormalised scale mu. The renormalisation scale mu is varied from 1/2 to 1.5 C_vev0 in NumberOfStep steps. + * Calculates xi_C as a function of the renormalised scale mu. The + * renormalisation scale mu is varied from 1/2 to 1.5 C_vev0 in NumberOfStep + * steps. */ -#include // for atoi, EXIT_FAILURE -#include // for copy, max -#include // for shared_ptr, __shared_... -#include // for string, operator<< -#include // for pair -#include // for vector -#include // for Class_Potential_Origin -#include #include +#include // for Class_Potential_Origin +#include #include -#include -#include +#include // for copy, max #include +#include +#include +#include // for shared_ptr, __shared_... +#include // for atoi, EXIT_FAILURE +#include // for string, operator<< +#include // for pair +#include // for vector using namespace std; using namespace BSMPT; -struct CLIOptions{ - BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; - int Line{}; - std::string InputFile, OutputFile; - int NumberOfSteps{}; - bool TerminalOutput{false}; - bool UseGSL { Minimizer::UseGSLDefault}; - bool UseCMAES {Minimizer::UseLibCMAESDefault}; - bool UseNLopt{Minimizer::UseNLoptDefault}; - int WhichMinimizer{Minimizer::WhichMinimizerDefault}; +struct CLIOptions +{ + BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; + int Line{}; + std::string InputFile, OutputFile; + int NumberOfSteps{}; + bool TerminalOutput{false}; + bool UseGSL{Minimizer::UseGSLDefault}; + bool UseCMAES{Minimizer::UseLibCMAESDefault}; + bool UseNLopt{Minimizer::UseNLoptDefault}; + int WhichMinimizer{Minimizer::WhichMinimizerDefault}; - CLIOptions(int argc, char *argv[]); - bool good() const; + CLIOptions(int argc, char *argv[]); + bool good() const; }; -int main(int argc, char *argv[]) try{ - /** - * PrintErrorLines decides if parameter points with no valid EWPT (no NLO stability or T=300 vanishing VEV) - * are printed in the output file - */ - bool PrintErrorLines=true; +int main(int argc, char *argv[]) +try +{ + /** + * PrintErrorLines decides if parameter points with no valid EWPT (no NLO + * stability or T=300 vanishing VEV) are printed in the output file + */ + bool PrintErrorLines = true; - const CLIOptions args(argc,argv); - if(not args.good()) - { - return EXIT_FAILURE; - } - int linecounter = 1; - std::ifstream infile(args.InputFile); - if(!infile.good()) { - std::cout << "Input file not found " << std::endl; - return EXIT_FAILURE; - } - std::ofstream outfile(args.OutputFile); - if(!outfile.good()) - { - std::cout << "Can not create file " << args.OutputFile << std::endl; - return EXIT_FAILURE; - } - std::string linestr; - std::shared_ptr modelPointer = ModelID::FChoose(args.Model); - std::size_t nPar,nParCT; - nPar = modelPointer->get_nPar(); - nParCT = modelPointer->get_nParCT(); - std::vector par(nPar); - std::vector parCT(nParCT); + const CLIOptions args(argc, argv); + if (not args.good()) + { + return EXIT_FAILURE; + } + int linecounter = 1; + std::ifstream infile(args.InputFile); + if (!infile.good()) + { + std::cout << "Input file not found " << std::endl; + return EXIT_FAILURE; + } + std::ofstream outfile(args.OutputFile); + if (!outfile.good()) + { + std::cout << "Can not create file " << args.OutputFile << std::endl; + return EXIT_FAILURE; + } + std::string linestr; + std::shared_ptr modelPointer = + ModelID::FChoose(args.Model); + std::size_t nPar, nParCT; + nPar = modelPointer->get_nPar(); + nParCT = modelPointer->get_nParCT(); + std::vector par(nPar); + std::vector parCT(nParCT); - while(getline(infile,linestr)) + while (getline(infile, linestr)) + { + if (linecounter > args.Line) break; + + if (linecounter == 1) { - if(linecounter > args.Line) break; - if(linecounter == 1) - { + outfile << linestr << sep << "mu_factor" << sep << "mu" << sep + << modelPointer->addLegendTemp() << sep + << modelPointer->addLegendVEV() << sep + << modelPointer->addLegendCT() << sep << "BSMPT_StatusFlag" + << std::endl; - outfile << linestr<addLegendTemp()<addLegendVEV()<addLegendCT()<setUseIndexCol(linestr); + } + if (args.Line == linecounter) + { + auto parameters = modelPointer->initModel(linestr); + par = parameters.first; + parCT = parameters.second; + if (args.TerminalOutput) modelPointer->write(); - modelPointer->setUseIndexCol(linestr); + if (args.TerminalOutput) + { + std::cout << "Calculating EWPT in default settings with:\n mu = " + << modelPointer->get_scale() << std::endl; + } + auto EWPTdefault = Minimizer::PTFinder_gen_all( + modelPointer, 0, 300, args.WhichMinimizer); + std::vector vevsymmetricSolution, checksym, startpoint; + for (std::size_t i = 0; i < modelPointer->get_nVEV(); i++) + startpoint.push_back(0.5 * EWPTdefault.EWMinimum.at(i)); + auto VEVsym = Minimizer::Minimize_gen_all( + modelPointer, EWPTdefault.Tc + 1, checksym, startpoint); + if (args.TerminalOutput) + std::cout << "Start of mu variation" << std::endl; + for (int step = 0; step < args.NumberOfSteps; step++) + { + double mu_factor = + 1 / 2. + (step / static_cast(args.NumberOfSteps)); + auto VEVnames = modelPointer->addLegendTemp(); + auto CT_mu = modelPointer->resetScale(C_vev0 * mu_factor); + auto EWPT_mu = Minimizer::PTFinder_gen_all( + modelPointer, 0, 300, args.WhichMinimizer); + std::vector checkmu; + auto VEV_NLO_mu = Minimizer::Minimize_gen_all( + modelPointer, 0, checkmu, startpoint, args.WhichMinimizer); + if (args.TerminalOutput) + { + std::cout << "\tStatusFlag = " << static_cast(EWPT_mu.StatusFlag) + << " @ mu = " << modelPointer->get_scale() << " = " + << mu_factor << "*C_vev0" << std::endl; + for (std::size_t i = 0; i < EWPT_mu.EWMinimum.size(); i++) + { + std::cout << sep << sep << VEVnames.at(i + 3) << sep + << EWPT_mu.EWMinimum.at(i) << " = " + << EWPT_mu.EWMinimum.at(i) / EWPTdefault.EWMinimum.at(i) + << "/" << VEVnames.at(i + 3) << std::endl; } - if(args.Line==linecounter) + } + if (PrintErrorLines) { - auto parameters = modelPointer->initModel(linestr); - par=parameters.first; - parCT = parameters.second; - if(args.TerminalOutput) modelPointer->write(); - - if(args.TerminalOutput){ - std::cout<<"Calculating EWPT in default settings with:\n mu = " - <get_scale()< vevsymmetricSolution,checksym, startpoint; - for(std::size_t i=0;iget_nVEV();i++) startpoint.push_back(0.5*EWPTdefault.EWMinimum.at(i)); - auto VEVsym = Minimizer::Minimize_gen_all(modelPointer,EWPTdefault.Tc+1,checksym,startpoint); - if(args.TerminalOutput)std::cout<<"Start of mu variation"<(args.NumberOfSteps)); - auto VEVnames = modelPointer->addLegendTemp(); - auto CT_mu=modelPointer->resetScale(C_vev0*mu_factor); - auto EWPT_mu = Minimizer::PTFinder_gen_all(modelPointer,0,300,args.WhichMinimizer); - std::vectorcheckmu; - auto VEV_NLO_mu = Minimizer::Minimize_gen_all(modelPointer,0,checkmu,startpoint,args.WhichMinimizer); - if(args.TerminalOutput){ - std::cout<<"\tStatusFlag = "<(EWPT_mu.StatusFlag) - <<" @ mu = "<get_scale()<<" = "<(EWPT_mu.StatusFlag); - outfile << std::endl; - } - else if(EWPTdefault.StatusFlag == Minimizer::MinimizerStatus::SUCCESS) - { - if(C_PT* EWPTdefault.Tc < EWPTdefault.vc) - { - outfile << linestr; - outfile << sep << mu_factor <(EWPT_mu.StatusFlag); - outfile << std::endl; - } - } - - }//END: Mu Factor - }//END:LineCounter - linecounter++; - if(infile.eof()) break; - } - if(args.TerminalOutput) std::cout << std::endl; - outfile.close(); + outfile << linestr; + outfile << sep << mu_factor << sep << mu_factor * C_vev0; + outfile << sep << EWPT_mu.Tc << sep << EWPT_mu.vc << sep + << EWPT_mu.vc / EWPT_mu.Tc << sep << EWPT_mu.EWMinimum; + outfile << sep << VEV_NLO_mu; + outfile << sep << CT_mu; + outfile << sep << static_cast(EWPT_mu.StatusFlag); + outfile << std::endl; + } + else if (EWPTdefault.StatusFlag == Minimizer::MinimizerStatus::SUCCESS) + { + if (C_PT * EWPTdefault.Tc < EWPTdefault.vc) + { + outfile << linestr; + outfile << sep << mu_factor << sep << mu_factor * C_vev0; + outfile << sep << EWPT_mu.Tc << sep << EWPT_mu.vc << sep + << EWPT_mu.vc / EWPT_mu.Tc << sep << EWPT_mu.EWMinimum; + outfile << sep << VEV_NLO_mu; + outfile << sep << CT_mu; + outfile << sep << static_cast(EWPT_mu.StatusFlag); + outfile << std::endl; + } + } - return EXIT_SUCCESS; + } // END: Mu Factor + } // END:LineCounter + linecounter++; + if (infile.eof()) break; + } + if (args.TerminalOutput) std::cout << std::endl; + outfile.close(); + return EXIT_SUCCESS; } -catch(int) +catch (int) { - return EXIT_SUCCESS; + return EXIT_SUCCESS; } -catch(exception& e){ - std::cerr << e.what() << std::endl; - return EXIT_FAILURE; +catch (exception &e) +{ + std::cerr << e.what() << std::endl; + return EXIT_FAILURE; } - CLIOptions::CLIOptions(int argc, char *argv[]) { + std::vector args; + for (int i{1}; i < argc; ++i) + args.push_back(argv[i]); - std::vector args; - for(int i{1};i 0 and args.at(0) == "--help") + { + throw int{0}; + } + else if (argc < 6) + { + throw std::runtime_error("Too few arguments."); + } - if(args.size() > 0 and args.at(0)=="--help") + const std::string prefix{"--"}; + bool UsePrefix = StringStartsWith(args.at(0), prefix); + if (UsePrefix) + { + for (const auto &arg : args) { - throw int{0}; + auto el = arg; + std::transform(el.begin(), el.end(), el.begin(), ::tolower); + if (StringStartsWith(el, "--model=")) + { + Model = + BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); + } + else if (StringStartsWith(el, "--input=")) + { + InputFile = arg.substr(std::string("--input=").size()); + } + else if (StringStartsWith(el, "--output=")) + { + OutputFile = arg.substr(std::string("--output=").size()); + } + else if (StringStartsWith(el, "--line=")) + { + Line = std::stoi(el.substr(std::string("--line=").size())); + } + else if (StringStartsWith(el, "--numberofsteps=")) + { + NumberOfSteps = + std::stoi(el.substr(std::string("--numberofsteps=").size())); + } + else if (StringStartsWith(el, "--terminaloutput=")) + { + TerminalOutput = + el.substr(std::string("--terminaloutput=").size()) == "y"; + } + else if (StringStartsWith(el, "--usegsl=")) + { + UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; + } + else if (StringStartsWith(el, "--usecmaes=")) + { + UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; + } + else if (StringStartsWith(el, "--usenlopt=")) + { + UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; + } } - else if(argc < 6) + WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL, UseCMAES, UseNLopt); + } + else + { + Model = ModelID::getModel(args.at(0)); + InputFile = args.at(1); + OutputFile = args.at(2); + Line = std::stoi(args.at(3)); + NumberOfSteps = std::stoi(args.at(4)); + if (argc == 7) { - throw std::runtime_error("Too few arguments."); - } - - const std::string prefix{"--"}; - bool UsePrefix = StringStartsWith(args.at(0),prefix); - if(UsePrefix) - { - for(const auto& arg: args) - { - auto el = arg; - std::transform(el.begin(), el.end(), el.begin(), ::tolower); - if(StringStartsWith(el,"--model=")) - { - Model = BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); - } - else if(StringStartsWith(el,"--input=")) - { - InputFile = arg.substr(std::string("--input=").size()); - } - else if(StringStartsWith(el,"--output=")) - { - OutputFile = arg.substr(std::string("--output=").size()); - } - else if(StringStartsWith(el,"--line=")) - { - Line = std::stoi(el.substr(std::string("--line=").size())); - } - else if(StringStartsWith(el,"--numberofsteps=")) - { - NumberOfSteps = std::stoi(el.substr(std::string("--numberofsteps=").size())); - } - else if(StringStartsWith(el,"--terminaloutput=")) - { - TerminalOutput = el.substr(std::string("--terminaloutput=").size()) == "y"; - } - else if(StringStartsWith(el,"--usegsl=")) - { - UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; - } - else if(StringStartsWith(el,"--usecmaes=")) - { - UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; - } - else if(StringStartsWith(el,"--usenlopt=")) - { - UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; - } - } - WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL,UseCMAES,UseNLopt); - } - else{ - Model = ModelID::getModel(args.at(0)); - InputFile = args.at(1); - OutputFile = args.at(2); - Line = std::stoi(args.at(3)); - NumberOfSteps = std::stoi(args.at(4)); - if(argc == 7) { - TerminalOutput = ("y" == std::string(args[5])); - } + TerminalOutput = ("y" == std::string(args[5])); } + } } bool CLIOptions::good() const { - if(NumberOfSteps == 0) - { - throw std::runtime_error("You have set the number of steps to zero."); - } - if(UseGSL and not Minimizer::UseGSLDefault) - { - throw std::runtime_error("You set --UseGSL=true but GSL was not found during compilation."); - } - if(UseCMAES and not Minimizer::UseLibCMAESDefault) - { - throw std::runtime_error("You set --UseCMAES=true but CMAES was not found during compilation."); - } - if(UseNLopt and not Minimizer::UseNLoptDefault) - { - throw std::runtime_error("You set --UseNLopt=true but NLopt was not found during compilation."); - } - if(WhichMinimizer == 0) - { - throw std::runtime_error("You disabled all minimizers. You need at least one."); - } - if(Model==ModelID::ModelIDs::NotSet) { - std::cerr << "Your Model parameter does not match with the implemented Models." << std::endl; - ShowInputError(); - return false; - } - if(Line < 1) - { - std::cerr << "Start line counting with 1" << std::endl; - return false; - } - return true; + if (NumberOfSteps == 0) + { + throw std::runtime_error("You have set the number of steps to zero."); + } + if (UseGSL and not Minimizer::UseGSLDefault) + { + throw std::runtime_error( + "You set --UseGSL=true but GSL was not found during compilation."); + } + if (UseCMAES and not Minimizer::UseLibCMAESDefault) + { + throw std::runtime_error( + "You set --UseCMAES=true but CMAES was not found during compilation."); + } + if (UseNLopt and not Minimizer::UseNLoptDefault) + { + throw std::runtime_error( + "You set --UseNLopt=true but NLopt was not found during compilation."); + } + if (WhichMinimizer == 0) + { + throw std::runtime_error( + "You disabled all minimizers. You need at least one."); + } + if (Model == ModelID::ModelIDs::NotSet) + { + std::cerr + << "Your Model parameter does not match with the implemented Models." + << std::endl; + ShowInputError(); + return false; + } + if (Line < 1) + { + std::cerr << "Start line counting with 1" << std::endl; + return false; + } + return true; } diff --git a/src/prog/Test.cpp b/src/prog/Test.cpp index 3097ae2d..4d1ac3df 100644 --- a/src/prog/Test.cpp +++ b/src/prog/Test.cpp @@ -2,229 +2,251 @@ * Test.cpp * * - * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller + * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas + Müller - This program 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. + This program 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. - This program 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. + This program 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 this program. If not, see . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ /** * @file - * Calculates the electroweak phase transition for a given Inputfile for a given subset of lines in the file - * and adds it at the end of the line in the format + * Calculates the electroweak phase transition for a given Inputfile for a given + * subset of lines in the file and adds it at the end of the line in the format * T_c v_c all single vevs. One parameter point per line. * */ +#include +#include // for Class_Potential_Origin #include -#include -#include -#include // for EXIT_FAILURE, atoi -#include // for copy -#include // for unique_ptr -#include // for getline, string -#include // for pair -#include // for vector -#include // for Class_Potential_Origin #include -#include +#include // for copy #include +#include +#include +#include // for unique_ptr +#include // for EXIT_FAILURE, atoi +#include // for getline, string +#include // for pair +#include // for vector using namespace std; using namespace BSMPT; -struct CLIOptions{ - BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; - int Line{}; - std::string InputFile; - bool UseGSL { Minimizer::UseGSLDefault}; - bool UseCMAES {Minimizer::UseLibCMAESDefault}; - bool UseNLopt{Minimizer::UseNLoptDefault}; - int WhichMinimizer{Minimizer::WhichMinimizerDefault}; - - CLIOptions(int argc, char *argv[]); - bool good() const; +struct CLIOptions +{ + BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; + int Line{}; + std::string InputFile; + bool UseGSL{Minimizer::UseGSLDefault}; + bool UseCMAES{Minimizer::UseLibCMAESDefault}; + bool UseNLopt{Minimizer::UseNLoptDefault}; + int WhichMinimizer{Minimizer::WhichMinimizerDefault}; + + CLIOptions(int argc, char *argv[]); + bool good() const; }; -int main(int argc, char *argv[]) try{ +int main(int argc, char *argv[]) +try +{ - const CLIOptions args(argc,argv); - if(not args.good()) - { - return EXIT_FAILURE; - } + const CLIOptions args(argc, argv); + if (not args.good()) + { + return EXIT_FAILURE; + } - int linecounter = 1; - std::ifstream infile(args.InputFile); - if(!infile.good()) { - std::cout << "Input file not found " << std::endl; - return EXIT_FAILURE; - } - - std::cout << "Found file" << std::endl; - - std::string linestr; - std::unique_ptr modelPointer = ModelID::FChoose(args.Model); - - std::cout << "Created modelpointer " << std::endl; - - while(getline(infile,linestr)) - { - if(linecounter > args.Line) break; - - if(linecounter == 1) - { - - modelPointer->setUseIndexCol(linestr); - - } - if(linecounter == args.Line and linecounter != 1) - { - std::cout << "Found line" << std::endl; - modelPointer->initModel(linestr); - modelPointer->write(); - std::vector dummy; - modelPointer->Debugging(dummy,dummy); - modelPointer->CheckImplementation(args.WhichMinimizer); - } - linecounter++; - if(infile.eof()) break; - } - return EXIT_SUCCESS; -} -catch(int) -{ - return EXIT_SUCCESS; -} -catch(exception& e){ - std::cerr << e.what() << std::endl; - return EXIT_FAILURE; -} + int linecounter = 1; + std::ifstream infile(args.InputFile); + if (!infile.good()) + { + std::cout << "Input file not found " << std::endl; + return EXIT_FAILURE; + } -CLIOptions::CLIOptions(int argc, char *argv[]) -{ + std::cout << "Found file" << std::endl; + std::string linestr; + std::unique_ptr modelPointer = + ModelID::FChoose(args.Model); - std::vector args; - for(int i{1};i args.Line) break; - if(args.size() > 0 and args.at(0)=="--help") + if (linecounter == 1) { - throw int{0}; + + modelPointer->setUseIndexCol(linestr); } - else if(argc < 4) + if (linecounter == args.Line and linecounter != 1) { - throw std::runtime_error("Too few arguments."); + std::cout << "Found line" << std::endl; + modelPointer->initModel(linestr); + modelPointer->write(); + std::vector dummy; + modelPointer->Debugging(dummy, dummy); + modelPointer->CheckImplementation(args.WhichMinimizer); } + linecounter++; + if (infile.eof()) break; + } + return EXIT_SUCCESS; +} +catch (int) +{ + return EXIT_SUCCESS; +} +catch (exception &e) +{ + std::cerr << e.what() << std::endl; + return EXIT_FAILURE; +} + +CLIOptions::CLIOptions(int argc, char *argv[]) +{ - const std::string prefix{"--"}; - bool UsePrefix = StringStartsWith(args.at(0),prefix); - if(UsePrefix) + std::vector args; + for (int i{1}; i < argc; ++i) + args.push_back(argv[i]); + + if (argc < 4 or args.at(0) == "--help") + { + int SizeOfFirstColumn = std::string("--TerminalOutput= ").size(); + std::cout << "Test performs a serious of tests on the given model. " + "Intended for testing new models." + << std::endl + << "It is called either by " << std::endl + << "./Test model input Line" << std::endl + << "or with the following arguments" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--help" + << "Shows this menu" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--model=" + << "The model you want to test" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--input=" + << "The input file in tsv format" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--Line=" + << "The line in the input file with the parameter point used to " + "check the model." + << std::endl; + std::string GSLhelp{"--UseGSL="}; + GSLhelp += Minimizer::UseGSLDefault ? "true" : "false"; + std::cout << std::setw(SizeOfFirstColumn) << std::left << GSLhelp + << "Use the GSL library to minimize the effective potential" + << std::endl; + std::string CMAEShelp{"--UseCMAES="}; + CMAEShelp += Minimizer::UseLibCMAESDefault ? "true" : "false"; + std::cout << std::setw(SizeOfFirstColumn) << std::left << CMAEShelp + << "Use the CMAES library to minimize the effective potential" + << std::endl; + std::string NLoptHelp{"--UseNLopt="}; + NLoptHelp += Minimizer::UseNLoptDefault ? "true" : "false"; + std::cout << std::setw(SizeOfFirstColumn) << std::left << NLoptHelp + << "Use the NLopt library to minimize the effective potential" + << std::endl; + ShowInputError(); + } + + if (args.size() > 0 and args.at(0) == "--help") + { + throw int{0}; + } + else if (argc < 4) + { + throw std::runtime_error("Too few arguments."); + } + + const std::string prefix{"--"}; + bool UsePrefix = StringStartsWith(args.at(0), prefix); + if (UsePrefix) + { + for (const auto &arg : args) { - for(const auto& arg: args) - { - auto el = arg; - std::transform(el.begin(), el.end(), el.begin(), ::tolower); - if(StringStartsWith(el,"--model=")) - { - Model = BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); - } - else if(StringStartsWith(el,"--input=")) - { - InputFile = arg.substr(std::string("--input=").size()); - std::cout << "Inputfile = " << InputFile << std::endl; - } - else if(StringStartsWith(el,"--line=")) - { - Line = std::stoi(el.substr(std::string("--line=").size())); - } - else if(StringStartsWith(el,"--usegsl=")) - { - UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; - } - else if(StringStartsWith(el,"--usecmaes=")) - { - UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; - } - else if(StringStartsWith(el,"--usenlopt=")) - { - UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; - } - } - WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL,UseCMAES,UseNLopt); - } - else{ - Model = ModelID::getModel(args.at(0)); - InputFile = args.at(1); - Line = std::stoi(args.at(2)); + auto el = arg; + std::transform(el.begin(), el.end(), el.begin(), ::tolower); + if (StringStartsWith(el, "--model=")) + { + Model = + BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); + } + else if (StringStartsWith(el, "--input=")) + { + InputFile = arg.substr(std::string("--input=").size()); + std::cout << "Inputfile = " << InputFile << std::endl; + } + else if (StringStartsWith(el, "--line=")) + { + Line = std::stoi(el.substr(std::string("--line=").size())); + } + else if (StringStartsWith(el, "--usegsl=")) + { + UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; + } + else if (StringStartsWith(el, "--usecmaes=")) + { + UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; + } + else if (StringStartsWith(el, "--usenlopt=")) + { + UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; + } } + WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL, UseCMAES, UseNLopt); + } + else + { + Model = ModelID::getModel(args.at(0)); + InputFile = args.at(1); + Line = std::stoi(args.at(2)); + } } bool CLIOptions::good() const { - if(UseGSL and not Minimizer::UseGSLDefault) - { - throw std::runtime_error("You set --UseGSL=true but GSL was not found during compilation."); - } - if(UseCMAES and not Minimizer::UseLibCMAESDefault) - { - throw std::runtime_error("You set --UseCMAES=true but CMAES was not found during compilation."); - } - if(UseNLopt and not Minimizer::UseNLoptDefault) - { - throw std::runtime_error("You set --UseNLopt=true but NLopt was not found during compilation."); - } - if(WhichMinimizer == 0) - { - throw std::runtime_error("You disabled all minimizers. You need at least one."); - } - if(Model==ModelID::ModelIDs::NotSet) { - std::cerr << "Your Model parameter does not match with the implemented Models." << std::endl; - ShowInputError(); - return false; - } - if(Line < 1) - { - std::cerr << "Start line counting with 1" << std::endl; - return false; - } - return true; + if (UseGSL and not Minimizer::UseGSLDefault) + { + throw std::runtime_error( + "You set --UseGSL=true but GSL was not found during compilation."); + } + if (UseCMAES and not Minimizer::UseLibCMAESDefault) + { + throw std::runtime_error( + "You set --UseCMAES=true but CMAES was not found during compilation."); + } + if (UseNLopt and not Minimizer::UseNLoptDefault) + { + throw std::runtime_error( + "You set --UseNLopt=true but NLopt was not found during compilation."); + } + if (WhichMinimizer == 0) + { + throw std::runtime_error( + "You disabled all minimizers. You need at least one."); + } + if (Model == ModelID::ModelIDs::NotSet) + { + std::cerr + << "Your Model parameter does not match with the implemented Models." + << std::endl; + ShowInputError(); + return false; + } + if (Line < 1) + { + std::cerr << "Start line counting with 1" << std::endl; + return false; + } + return true; } diff --git a/src/prog/TestNewKheader.cpp b/src/prog/TestNewKheader.cpp index 75adcb48..a9909913 100644 --- a/src/prog/TestNewKheader.cpp +++ b/src/prog/TestNewKheader.cpp @@ -1,10 +1,13 @@ #include -namespace BSMPT { -namespace Kfactors { -namespace Data { +namespace BSMPT +{ +namespace Kfactors +{ +namespace Data +{ -const std::array msg{}; +const std::array msg{}; } // namespace Data @@ -14,5 +17,5 @@ const std::array msg{}; int main() { - return 0; + return 0; } diff --git a/src/prog/TripleHiggsNLO.cpp b/src/prog/TripleHiggsNLO.cpp index 9f7d503e..86a89e43 100644 --- a/src/prog/TripleHiggsNLO.cpp +++ b/src/prog/TripleHiggsNLO.cpp @@ -2,252 +2,280 @@ * TripleHiggsNLO.cpp * * - * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller + * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas + Müller - This program 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. + This program 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. - This program 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. + This program 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 this program. If not, see . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ /** * @file - * Calculates the Triple Higgs couplings for mulitple points and adds them at the end of the line. + * Calculates the Triple Higgs couplings for mulitple points and adds them at + * the end of the line. */ -#include // for atoi, EXIT_FAILURE -#include // for unique_ptr -#include // for operator<<, string -#include // for pair -#include // for vector -#include // for Class_Potential_Origin +#include // for Class_Potential_Origin #include #include #include #include #include +#include // for unique_ptr +#include // for atoi, EXIT_FAILURE +#include // for operator<<, string +#include // for pair +#include // for vector using namespace std; using namespace BSMPT; -struct CLIOptions{ - BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; - int FirstLine{}, LastLine{}; - std::string InputFile, OutputFile; - bool TerminalOutput{false}; +struct CLIOptions +{ + BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; + int FirstLine{}, LastLine{}; + std::string InputFile, OutputFile; + bool TerminalOutput{false}; - CLIOptions(int argc, char *argv[]); - bool good() const; + CLIOptions(int argc, char *argv[]); + bool good() const; }; -int main(int argc, char *argv[]) try{ +int main(int argc, char *argv[]) +try +{ - const CLIOptions args(argc,argv); - if(not args.good()) + const CLIOptions args(argc, argv); + if (not args.good()) + { + return EXIT_FAILURE; + } + + int linecounter = 1; + std::ifstream infile(args.InputFile); + if (!infile.good()) + { + std::cout << "Input file not found " << std::endl; + return EXIT_FAILURE; + } + std::ofstream outfile(args.OutputFile); + if (!outfile.good()) + { + std::cout << "Can not create file " << args.OutputFile << std::endl; + return EXIT_FAILURE; + } + std::string linestr; + + std::unique_ptr modelPointer = + ModelID::FChoose(args.Model); + std::size_t nPar, nParCT; + nPar = modelPointer->get_nPar(); + nParCT = modelPointer->get_nParCT(); + std::vector par(nPar); + std::vector parCT(nParCT); + std::size_t NHiggs = modelPointer->get_NHiggs(); + + while (getline(infile, linestr)) + { + + if (linecounter > args.LastLine) break; + if (args.TerminalOutput) { - return EXIT_FAILURE; + std::cout << "\rCurrently at line " << linecounter << std::flush; + } + if (linecounter == 1) + { + modelPointer->setUseIndexCol(linestr); + outfile << linestr; + for (auto x : modelPointer->addLegendCT()) + outfile << sep << x; + for (auto x : modelPointer->addLegendTripleCouplings()) + outfile << sep << x; + outfile << std::endl; } - int linecounter = 1; - std::ifstream infile(args.InputFile); - if(!infile.good()) { - std::cout << "Input file not found " << std::endl; - return EXIT_FAILURE; - } - std::ofstream outfile(args.OutputFile); - if(!outfile.good()) - { - std::cout << "Can not create file " << args.OutputFile << std::endl; - return EXIT_FAILURE; - } - std::string linestr; - - std::unique_ptr modelPointer = ModelID::FChoose(args.Model); - std::size_t nPar,nParCT; - nPar = modelPointer->get_nPar(); - nParCT = modelPointer->get_nParCT(); - std::vector par(nPar); - std::vector parCT(nParCT); - std::size_t NHiggs=modelPointer->get_NHiggs(); - - - - - - while(getline(infile,linestr)) - { - - - if(linecounter > args.LastLine) break; - if(args.TerminalOutput) - { - std::cout << "\rCurrently at line " << linecounter << std::flush; - } - if(linecounter == 1) - { - modelPointer->setUseIndexCol(linestr); - outfile << linestr; - for(auto x: modelPointer->addLegendCT()) outfile << sep << x; - for(auto x: modelPointer->addLegendTripleCouplings()) outfile << sep << x; - outfile << std::endl; - } - - if(linecounter >= args.FirstLine and linecounter <= args.LastLine and linecounter != 1) - { - - std::pair,std::vector> parameters = modelPointer->initModel(linestr); - par=parameters.first; - parCT = parameters.second; - - modelPointer->set_InputLineNumber(linecounter); - modelPointer->Prepare_Triple(); - modelPointer->TripleHiggsCouplings(); - - if(args.FirstLine == args.LastLine and args.TerminalOutput) modelPointer->write(); - outfile << linestr; - for(std::size_t i=0;iget_TripleHiggsCorrectionsTreePhysical(i,j,k); - outfile << sep << -modelPointer->get_TripleHiggsCorrectionsCTPhysical(i,j,k); - outfile << sep << -modelPointer->get_TripleHiggsCorrectionsCWPhysical(i,j,k); - } - } - } - outfile << std::endl; - + if (linecounter >= args.FirstLine and linecounter <= args.LastLine and + linecounter != 1) + { + std::pair, std::vector> parameters = + modelPointer->initModel(linestr); + par = parameters.first; + parCT = parameters.second; + + modelPointer->set_InputLineNumber(linecounter); + modelPointer->Prepare_Triple(); + modelPointer->TripleHiggsCouplings(); + + if (args.FirstLine == args.LastLine and args.TerminalOutput) + modelPointer->write(); + outfile << linestr; + for (std::size_t i = 0; i < nParCT; i++) + outfile << sep << parCT[i]; + for (std::size_t i = 0; i < NHiggs; i++) + { + for (std::size_t j = i; j < NHiggs; j++) + { + for (std::size_t k = j; k < NHiggs; k++) + { + outfile << sep + << -modelPointer->get_TripleHiggsCorrectionsTreePhysical( + i, j, k); + outfile << sep + << -modelPointer->get_TripleHiggsCorrectionsCTPhysical( + i, j, k); + outfile << sep + << -modelPointer->get_TripleHiggsCorrectionsCWPhysical( + i, j, k); + } } - linecounter++; - if(infile.eof()) break; - } - if(args.TerminalOutput) std::cout << std::endl; + } + outfile << std::endl; + } + linecounter++; + if (infile.eof()) break; + } + if (args.TerminalOutput) std::cout << std::endl; - outfile.close(); + outfile.close(); - return EXIT_SUCCESS; + return EXIT_SUCCESS; } -catch(int) +catch (int) { - return EXIT_SUCCESS; + return EXIT_SUCCESS; } -catch(exception& e){ - std::cerr << e.what() << std::endl; - return EXIT_FAILURE; +catch (exception &e) +{ + std::cerr << e.what() << std::endl; + return EXIT_FAILURE; } CLIOptions::CLIOptions(int argc, char *argv[]) { - std::vector args; - for(int i{1};i 0 and args.at(0)=="--help") + std::vector args; + for (int i{1}; i < argc; ++i) + args.push_back(argv[i]); + + if (argc < 6 or args.at(0) == "--help") + { + int SizeOfFirstColumn = std::string("--TerminalOutput= ").size(); + std::cout + << "TripleHiggsNLO calculates the coupling between three Higgs bosons" + << std::endl + << "It is called either by " << std::endl + << "./TripleHiggsNLO Model Inputfile Outputfile LineStart LineEnd" + << std::endl + << "or with the following arguments" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--help" + << "Shows this menu" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--model=" + << "The model you want to investigate" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--input=" + << "The input file in tsv format" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--output=" + << "The output file in tsv format" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--FirstLine=" + << "The first line in the input file to calculate the EWPT. Expects " + "line 1 to be a legend." + << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--LastLine=" + << "The last line in the input file to calculate the EWPT." << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--TerminalOutput=" + << "y/n Turns on additional information in the terminal during the " + "calculation." + << std::endl; + ShowInputError(); + } + + if (args.size() > 0 and args.at(0) == "--help") + { + throw int{0}; + } + else if (argc < 6) + { + throw std::runtime_error("Too few arguments."); + } + + const std::string prefix{"--"}; + bool UsePrefix = StringStartsWith(args.at(0), prefix); + if (UsePrefix) + { + for (const auto &arg : args) { - throw int{0}; + auto el = arg; + std::transform(el.begin(), el.end(), el.begin(), ::tolower); + if (StringStartsWith(el, "--model=")) + { + Model = + BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); + } + else if (StringStartsWith(el, "--input=")) + { + InputFile = arg.substr(std::string("--input=").size()); + } + else if (StringStartsWith(el, "--output=")) + { + OutputFile = arg.substr(std::string("--output=").size()); + } + else if (StringStartsWith(el, "--firstline=")) + { + FirstLine = std::stoi(el.substr(std::string("--firstline=").size())); + } + else if (StringStartsWith(el, "--lastline=")) + { + LastLine = std::stoi(el.substr(std::string("--lastline=").size())); + } + else if (StringStartsWith(el, "--terminaloutput=")) + { + TerminalOutput = + el.substr(std::string("--terminaloutput=").size()) == "y"; + } } - else if(argc < 6) + } + else + { + Model = ModelID::getModel(args.at(0)); + InputFile = args.at(1); + OutputFile = args.at(2); + FirstLine = std::stoi(args.at(3)); + LastLine = std::stoi(args.at(4)); + if (argc == 7) { - throw std::runtime_error("Too few arguments."); - } - - const std::string prefix{"--"}; - bool UsePrefix = StringStartsWith(args.at(0),prefix); - if(UsePrefix) - { - for(const auto& arg: args) - { - auto el = arg; - std::transform(el.begin(), el.end(), el.begin(), ::tolower); - if(StringStartsWith(el,"--model=")) - { - Model = BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); - } - else if(StringStartsWith(el,"--input=")) - { - InputFile = arg.substr(std::string("--input=").size()); - } - else if(StringStartsWith(el,"--output=")) - { - OutputFile = arg.substr(std::string("--output=").size()); - } - else if(StringStartsWith(el,"--firstline=")) - { - FirstLine = std::stoi(el.substr(std::string("--firstline=").size())); - } - else if(StringStartsWith(el,"--lastline=")) - { - LastLine = std::stoi(el.substr(std::string("--lastline=").size())); - } - else if(StringStartsWith(el,"--terminaloutput=")) - { - TerminalOutput = el.substr(std::string("--terminaloutput=").size()) == "y"; - } - } - } - else{ - Model = ModelID::getModel(args.at(0)); - InputFile = args.at(1); - OutputFile = args.at(2); - FirstLine = std::stoi(args.at(3)); - LastLine = std::stoi(args.at(4)); - if(argc == 7) { - TerminalOutput = ("y" == std::string(argv[6])); - } + TerminalOutput = ("y" == std::string(argv[6])); } + } } bool CLIOptions::good() const { - if(Model==ModelID::ModelIDs::NotSet) { - - std::cerr << "Your Model parameter does not match with the implemented Models." << std::endl; - ShowInputError(); - return false; - } - if(FirstLine < 1) - { - std::cout << "Start line counting with 1" << std::endl; - return false; - } - if(FirstLine > LastLine) - { - std::cout << "Firstline is smaller then LastLine " << std::endl; - return false; - } - return true; + if (Model == ModelID::ModelIDs::NotSet) + { + + std::cerr + << "Your Model parameter does not match with the implemented Models." + << std::endl; + ShowInputError(); + return false; + } + if (FirstLine < 1) + { + std::cout << "Start line counting with 1" << std::endl; + return false; + } + if (FirstLine > LastLine) + { + std::cout << "Firstline is smaller then LastLine " << std::endl; + return false; + } + return true; } diff --git a/src/prog/TwoStepScan.cpp b/src/prog/TwoStepScan.cpp index b3fff7d3..fea69798 100644 --- a/src/prog/TwoStepScan.cpp +++ b/src/prog/TwoStepScan.cpp @@ -1,129 +1,140 @@ /* -*Two Step Scan for the N2HDM -*Created on: 3.4.2918 -* Author: Jonas -*/ - - + *Two Step Scan for the N2HDM + *Created on: 3.4.2918 + * Author: Jonas + */ /** * @file * This program scans for possible candidates for a two step PT */ -#include #include +#include #include using namespace std; -int main(int argc, char *argv[]) try{ - bool Debug = false; - double steps = 10 ; - if(!(argc == 5)) - { - std::cout << "./twsep input_file output_file linestart lineend \n"; - return -1; - } - char* in_file; char* out_file; - in_file=argv[1]; - out_file=argv[2]; - double Model=2; - double LineNumb,LineStart,LineEnd; - LineStart=atoi(argv[3]); - LineEnd=atoi(argv[4]); - - if(LineStart < 1) - { - std::cout << "Start line counting with 1" << std::endl; - return EXIT_FAILURE; - } +int main(int argc, char *argv[]) +try +{ + bool Debug = false; + double steps = 10; + if (!(argc == 5)) + { + std::cout << "./twsep input_file output_file linestart lineend \n"; + return -1; + } + char *in_file; + char *out_file; + in_file = argv[1]; + out_file = argv[2]; + double Model = 2; + double LineNumb, LineStart, LineEnd; + LineStart = atoi(argv[3]); + LineEnd = atoi(argv[4]); + if (LineStart < 1) + { + std::cout << "Start line counting with 1" << std::endl; + return EXIT_FAILURE; + } - std::vector sol,start,solPot,Check; - std::vector Weinberg,parCTVec; - std::unique_ptr modelPointer = FChoose(Model); - if(Debug)std::cout<<"Setting model parameter"< sol, start, solPot, Check; + std::vector Weinberg, parCTVec; + std::unique_ptr modelPointer = FChoose(Model); + if (Debug) std::cout << "Setting model parameter" << std::endl; + std::ifstream infile(in_file); + if (!infile.good()) + { + std::cout << "Input file not found " << std::endl; + return EXIT_FAILURE; + } + std::ofstream outfile(out_file); + if (!outfile.good()) + { + std::cout << "Can not create file " << out_file << std::endl; + return EXIT_FAILURE; + } + std::string linestr; + int linecounter = 1; - int nPar,nParCT; - nPar = modelPointer->nPar; - nParCT = modelPointer->nParCT; + int nPar, nParCT; + nPar = modelPointer->nPar; + nParCT = modelPointer->nParCT; - int dim = modelPointer->nVEV; - std::vector par(nPar); - std::vector parCT(nParCT); - bool found=false; + int dim = modelPointer->nVEV; + std::vector par(nPar); + std::vector parCT(nParCT); + bool found = false; - while(true) - { - if(linecounter>LineEnd)break; - std::getline(infile,linestr); - if(linecounter == 1) - { - outfile << linestr << sep; - for(int i=0;i LineEnd) break; + std::getline(infile, linestr); + if (linecounter == 1) + { + outfile << linestr << sep; + for (int i = 0; i < steps; i++) + { - outfile<<"vCB_T"<<100*i< > result; - if(linecounter>=LineStart and linecounter<=LineEnd and linecounter!=1) - { - modelPointer->resetbools(); - modelPointer->ReadAndSet(linestr,par); - modelPointer->calc_CT(parCT); - modelPointer->set_All(par,parCT); + outfile << "vCB_T" << 100 * i << sep << "vCP_T" << 100 * i << sep + << "v1_T" << 100 * i << sep << "v2_T" << 100 * i << sep + << "vS_T" << 100 * i << sep; + } + outfile << std::endl; + } + std::cout << std::scientific; + std::cout << std::setprecision(16); + outfile << std::setprecision(16); + std::vector> result; + if (linecounter >= LineStart and linecounter <= LineEnd and + linecounter != 1) + { + modelPointer->resetbools(); + modelPointer->ReadAndSet(linestr, par); + modelPointer->calc_CT(parCT); + modelPointer->set_All(par, parCT); - if(Debug and LineStart==LineEnd) modelPointer->write(); - //Calculating stuff begins :) - std::vector vTree; - for(int k=0;kvevTreeMin.at(k)); - double temp; - double vev; - if(Debug)std::cout<<"Loop over temperature steps starts"<write(); + // Calculating stuff begins :) + std::vector vTree; + for (int k = 0; k < dim; k++) + vTree.push_back(modelPointer->vevTreeMin.at(k)); + double temp; + double vev; + if (Debug) std::cout << "Loop over temperature steps starts" << std::endl; + for (int n = 0; n < steps; n++) + { + temp = 100 * n; + start.clear(); + for (int i = 0; i < dim; i++) + start.push_back(vTree.at(i)); + Check.clear(); + solPot.clear(); + sol.clear(); + Minimize_gen_all(Model, par, parCT, temp, sol, Check, start); + result.push_back(sol); + } + if (Debug) std::cout << "Loop over temperature steps ends" << std::endl; -//Outfile Action - outfile << linestr; - for(int j=0;j. + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ - - - /** * @file * This program calculates the development of the VeVs with the Temperature. */ - -#include // for sqrt, abs -#include // for atof, EXIT_FAILURE, atoi -#include // for copy, max -#include // for operator<<, setprecision -#include // for shared_ptr, __shared_... -#include // for getline, operator<< -#include // for pair -#include // for vector -#include // for Class_Potential_Origin -#include #include +#include // for Class_Potential_Origin +#include #include -#include +#include // for copy, max #include +#include // for operator<<, setprecision +#include +#include // for sqrt, abs +#include // for shared_ptr, __shared_... +#include // for atof, EXIT_FAILURE, atoi +#include // for getline, operator<< +#include // for pair +#include // for vector using namespace std; using namespace BSMPT; -struct CLIOptions{ - BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; - int Line{}; - std::string InputFile, OutputFile; - double TemperatureStart{}, TemperatureStep{}, TemperatureEnd{}; - bool UseGSL { Minimizer::UseGSLDefault}; - bool UseCMAES {Minimizer::UseLibCMAESDefault}; - bool UseNLopt{Minimizer::UseNLoptDefault}; - int WhichMinimizer{Minimizer::WhichMinimizerDefault}; +struct CLIOptions +{ + BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; + int Line{}; + std::string InputFile, OutputFile; + double TemperatureStart{}, TemperatureStep{}, TemperatureEnd{}; + bool UseGSL{Minimizer::UseGSLDefault}; + bool UseCMAES{Minimizer::UseLibCMAESDefault}; + bool UseNLopt{Minimizer::UseNLoptDefault}; + int WhichMinimizer{Minimizer::WhichMinimizerDefault}; - CLIOptions(int argc, char *argv[]); - bool good() const; + CLIOptions(int argc, char *argv[]); + bool good() const; }; -int main(int argc, char *argv[]) try{ - const CLIOptions args(argc,argv); - if(not args.good()) - { - return EXIT_FAILURE; - } - - std::vector sol,start,solPot; - +int main(int argc, char *argv[]) +try +{ + const CLIOptions args(argc, argv); + if (not args.good()) + { + return EXIT_FAILURE; + } - std::shared_ptr modelPointer = ModelID::FChoose(args.Model); - std::ifstream infile(args.InputFile); - if(!infile.good()) { - std::cout << "Input file not found " << std::endl; - return EXIT_FAILURE; - } - std::ofstream outfile(args.OutputFile); - if(!outfile.good()) - { - std::cout << "Can not create file " << args.OutputFile << std::endl; - return EXIT_FAILURE; - } - std::string linestr; - int linecounter = 1; + std::vector sol, start, solPot; - bool found=false; - while(true) - { - if(infile.eof()) break; - std::getline(infile,linestr); - if(linecounter == 1){ - modelPointer->setUseIndexCol(linestr); - } - else if(linecounter == args.Line) - { - std::pair,std::vector> parameters = modelPointer->initModel(linestr); - found=true; - } - else if(linecounter > args.Line) break; - linecounter++; - if(infile.eof()) break; - } - infile.close(); - if(!found) {std::cout << "Line not found !\n"; return -1;} + std::shared_ptr modelPointer = + ModelID::FChoose(args.Model); + std::ifstream infile(args.InputFile); + if (!infile.good()) + { + std::cout << "Input file not found " << std::endl; + return EXIT_FAILURE; + } + std::ofstream outfile(args.OutputFile); + if (!outfile.good()) + { + std::cout << "Can not create file " << args.OutputFile << std::endl; + return EXIT_FAILURE; + } + std::string linestr; + int linecounter = 1; - std::vector Check; - double vev{0.0}; + bool found = false; + while (true) + { + if (infile.eof()) break; + std::getline(infile, linestr); + if (linecounter == 1) + { + modelPointer->setUseIndexCol(linestr); + } + else if (linecounter == args.Line) + { + std::pair, std::vector> parameters = + modelPointer->initModel(linestr); + found = true; + } + else if (linecounter > args.Line) + break; + linecounter++; + if (infile.eof()) break; + } + infile.close(); + if (!found) + { + std::cout << "Line not found !\n"; + return -1; + } - std::cout << std::scientific; - std::cout << std::setprecision(16); - outfile << std::setprecision(16); + std::vector Check; + double vev{0.0}; + std::cout << std::scientific; + std::cout << std::setprecision(16); + outfile << std::setprecision(16); - outfile << "T" << sep << "v"; - for(auto x: modelPointer->addLegendVEV()) outfile << sep << x; - outfile << sep << "Veff(v,T)" - << std::endl; + outfile << "T" << sep << "v"; + for (auto x : modelPointer->addLegendVEV()) + outfile << sep << x; + outfile << sep << "Veff(v,T)" << std::endl; - for(double Temp = args.TemperatureStart; Temp<=args.TemperatureEnd; Temp+=args.TemperatureStep) - { - start.clear(); - if(Temp==args.TemperatureStart) - { - start = modelPointer->get_vevTreeMin(); - } - else{ - start = sol; - } - sol.clear(); - Check.clear(); - solPot.clear(); - sol = Minimizer::Minimize_gen_all(modelPointer,Temp,Check,start,args.WhichMinimizer); - solPot=modelPointer->MinimizeOrderVEV(sol); - vev = modelPointer->EWSBVEV(solPot); + for (double Temp = args.TemperatureStart; Temp <= args.TemperatureEnd; + Temp += args.TemperatureStep) + { + start.clear(); + if (Temp == args.TemperatureStart) + { + start = modelPointer->get_vevTreeMin(); + } + else + { + start = sol; + } + sol.clear(); + Check.clear(); + solPot.clear(); + sol = Minimizer::Minimize_gen_all( + modelPointer, Temp, Check, start, args.WhichMinimizer); + solPot = modelPointer->MinimizeOrderVEV(sol); + vev = modelPointer->EWSBVEV(solPot); - outfile << Temp << sep; - outfile << vev << sep; - outfile << sol; - outfile << sep << modelPointer->VEff(solPot,Temp,0); - outfile << std::endl; - } - outfile.close(); + outfile << Temp << sep; + outfile << vev << sep; + outfile << sol; + outfile << sep << modelPointer->VEff(solPot, Temp, 0); + outfile << std::endl; + } + outfile.close(); - return EXIT_SUCCESS; + return EXIT_SUCCESS; } -catch(int) +catch (int) { - return EXIT_SUCCESS; + return EXIT_SUCCESS; } -catch(exception& e){ - std::cerr << e.what() << std::endl; - return EXIT_FAILURE; +catch (exception &e) +{ + std::cerr << e.what() << std::endl; + return EXIT_FAILURE; } CLIOptions::CLIOptions(int argc, char *argv[]) { - std::vector args; - for(int i{1};i args; + for (int i{1}; i < argc; ++i) + args.push_back(argv[i]); - if(argc < 8 or args.at(0) == "--help") - { - int SizeOfFirstColumn = std::string("--TemperatureStart= ").size(); - std::cout << "VEVEVO calculates the evolution of the global minimum with rising temperature for a given parameter point" << std::endl - << "It is called either by " << std::endl - << "./VEVEVO Model Inputfile Outputfile Line TemperatureStart TemperatureStep TemperatureEnd" << std::endl - << "or with the following arguments" << std::endl - << std::setw(SizeOfFirstColumn) << std::left<< "--help" - << "Shows this menu" << std::endl - << std::setw(SizeOfFirstColumn) << std::left << "--model=" - << "The model you want to investigate"< 0 and args.at(0)=="--help") - { - throw int{0}; - } - else if(argc < 8) - { - throw std::runtime_error("Too few arguments."); - } + if (args.size() > 0 and args.at(0) == "--help") + { + throw int{0}; + } + else if (argc < 8) + { + throw std::runtime_error("Too few arguments."); + } - const std::string prefix{"--"}; - bool UsePrefix = StringStartsWith(args.at(0),prefix); - if(UsePrefix) + const std::string prefix{"--"}; + bool UsePrefix = StringStartsWith(args.at(0), prefix); + if (UsePrefix) + { + for (const auto &arg : args) { - for(const auto& arg: args) - { - auto el = arg; - std::transform(el.begin(), el.end(), el.begin(), ::tolower); - if(StringStartsWith(el,"--model=")) - { - Model = BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); - } - else if(StringStartsWith(el,"--input=")) - { - InputFile = arg.substr(std::string("--input=").size()); - } - else if(StringStartsWith(el,"--output=")) - { - OutputFile = arg.substr(std::string("--output=").size()); - } - else if(StringStartsWith(el,"--line=")) - { - Line = std::stoi(el.substr(std::string("--line=").size())); - } - else if(StringStartsWith(el,"--temperaturestart=")) - { - TemperatureStart = std::stod(el.substr(std::string("--temperaturestart=").size())); - } - else if(StringStartsWith(el,"--temperaturestep=")) - { - TemperatureStep = std::stod(el.substr(std::string("--temperaturestep=").size())); - } - else if(StringStartsWith(el,"--temperatureend=")) - { - TemperatureEnd = std::stod(el.substr(std::string("--temperatureend=").size())); - } - else if(StringStartsWith(el,"--usegsl=")) - { - UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; - } - else if(StringStartsWith(el,"--usecmaes=")) - { - UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; - } - else if(StringStartsWith(el,"--usenlopt=")) - { - UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; - } - } - WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL,UseCMAES,UseNLopt); - } - else{ - Model = ModelID::getModel(args.at(0)); - InputFile = args.at(1); - OutputFile = args.at(2); - Line = std::stoi(args.at(3)); - TemperatureStart = std::stod(args.at(4)); - TemperatureStep = std::stod(args.at(5)); - TemperatureEnd = std::stod(args.at(6)); + auto el = arg; + std::transform(el.begin(), el.end(), el.begin(), ::tolower); + if (StringStartsWith(el, "--model=")) + { + Model = + BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); + } + else if (StringStartsWith(el, "--input=")) + { + InputFile = arg.substr(std::string("--input=").size()); + } + else if (StringStartsWith(el, "--output=")) + { + OutputFile = arg.substr(std::string("--output=").size()); + } + else if (StringStartsWith(el, "--line=")) + { + Line = std::stoi(el.substr(std::string("--line=").size())); + } + else if (StringStartsWith(el, "--temperaturestart=")) + { + TemperatureStart = + std::stod(el.substr(std::string("--temperaturestart=").size())); + } + else if (StringStartsWith(el, "--temperaturestep=")) + { + TemperatureStep = + std::stod(el.substr(std::string("--temperaturestep=").size())); + } + else if (StringStartsWith(el, "--temperatureend=")) + { + TemperatureEnd = + std::stod(el.substr(std::string("--temperatureend=").size())); + } + else if (StringStartsWith(el, "--usegsl=")) + { + UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; + } + else if (StringStartsWith(el, "--usecmaes=")) + { + UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; + } + else if (StringStartsWith(el, "--usenlopt=")) + { + UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; + } } + WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL, UseCMAES, UseNLopt); + } + else + { + Model = ModelID::getModel(args.at(0)); + InputFile = args.at(1); + OutputFile = args.at(2); + Line = std::stoi(args.at(3)); + TemperatureStart = std::stod(args.at(4)); + TemperatureStep = std::stod(args.at(5)); + TemperatureEnd = std::stod(args.at(6)); + } } bool CLIOptions::good() const { - if(UseGSL and not Minimizer::UseGSLDefault) - { - throw std::runtime_error("You set --UseGSL=true but GSL was not found during compilation."); - } - if(UseCMAES and not Minimizer::UseLibCMAESDefault) - { - throw std::runtime_error("You set --UseCMAES=true but CMAES was not found during compilation."); - } - if(UseNLopt and not Minimizer::UseNLoptDefault) - { - throw std::runtime_error("You set --UseNLopt=true but NLopt was not found during compilation."); - } - if(WhichMinimizer == 0) - { - throw std::runtime_error("You disabled all minimizers. You need at least one."); - } - if(TemperatureStep <= 0){ - throw std::runtime_error("The stepsize has to be larger than 0."); - } - if(TemperatureStart < 0) - { - throw std::runtime_error("The starting value of the temperature can not be negative."); - } - if(TemperatureEnd < TemperatureStart) - { - throw std::runtime_error("The minimal value for the temperature is lower then the maximal value."); - } - if(Model==ModelID::ModelIDs::NotSet) { + if (UseGSL and not Minimizer::UseGSLDefault) + { + throw std::runtime_error( + "You set --UseGSL=true but GSL was not found during compilation."); + } + if (UseCMAES and not Minimizer::UseLibCMAESDefault) + { + throw std::runtime_error( + "You set --UseCMAES=true but CMAES was not found during compilation."); + } + if (UseNLopt and not Minimizer::UseNLoptDefault) + { + throw std::runtime_error( + "You set --UseNLopt=true but NLopt was not found during compilation."); + } + if (WhichMinimizer == 0) + { + throw std::runtime_error( + "You disabled all minimizers. You need at least one."); + } + if (TemperatureStep <= 0) + { + throw std::runtime_error("The stepsize has to be larger than 0."); + } + if (TemperatureStart < 0) + { + throw std::runtime_error( + "The starting value of the temperature can not be negative."); + } + if (TemperatureEnd < TemperatureStart) + { + throw std::runtime_error("The minimal value for the temperature is lower " + "then the maximal value."); + } + if (Model == ModelID::ModelIDs::NotSet) + { - std::cerr << "Your Model parameter does not match with the implemented Models." << std::endl; - ShowInputError(); - return false; - } - return true; + std::cerr + << "Your Model parameter does not match with the implemented Models." + << std::endl; + ShowInputError(); + return false; + } + return true; } diff --git a/src/prog/WallThickness.cpp b/src/prog/WallThickness.cpp index fd725c6d..89861969 100644 --- a/src/prog/WallThickness.cpp +++ b/src/prog/WallThickness.cpp @@ -2,345 +2,387 @@ * WallThickness.cpp * * - * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller + * Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas + Müller - This program 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. + This program 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. - This program 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. + This program 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 this program. If not, see . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ /** * @file - * Calculates the electroweak phase transition for a given Inputfile for a given subset of lines in the file - * and adds it at the end of the line in the format + * Calculates the electroweak phase transition for a given Inputfile for a given + * subset of lines in the file and adds it at the end of the line in the format * T_c v_c all single vevs. One parameter point per line. * */ -#include // for atoi, EXIT_FAILURE -#include // for copy, max -#include // for shared_ptr, __shar... -#include // for string, operator<< -#include // for pair -#include // for vector -#include // for Class_Potential_Or... -#include -#include -#include #include +#include +#include +#include // for Class_Potential_Or... +#include #include -#include -#include +#include // for copy, max #include +#include +#include +#include // for shared_ptr, __shar... +#include // for atoi, EXIT_FAILURE +#include // for string, operator<< +#include // for pair +#include // for vector using namespace std; using namespace BSMPT; -struct CLIOptions{ - BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; - int FirstLine{}, LastLine{}; - std::string InputFile, OutputFile; - bool TerminalOutput{false}; - bool UseGSL { Minimizer::UseGSLDefault}; - bool UseCMAES {Minimizer::UseLibCMAESDefault}; - bool UseNLopt{Minimizer::UseNLoptDefault}; - int WhichMinimizer{Minimizer::WhichMinimizerDefault}; - - CLIOptions(int argc, char *argv[]); - bool good() const; +struct CLIOptions +{ + BSMPT::ModelID::ModelIDs Model{ModelID::ModelIDs::NotSet}; + int FirstLine{}, LastLine{}; + std::string InputFile, OutputFile; + bool TerminalOutput{false}; + bool UseGSL{Minimizer::UseGSLDefault}; + bool UseCMAES{Minimizer::UseLibCMAESDefault}; + bool UseNLopt{Minimizer::UseNLoptDefault}; + int WhichMinimizer{Minimizer::WhichMinimizerDefault}; + + CLIOptions(int argc, char *argv[]); + bool good() const; }; -int main(int argc, char *argv[]) try{ +int main(int argc, char *argv[]) +try +{ - const CLIOptions args(argc,argv); - if(not args.good()) + const CLIOptions args(argc, argv); + if (not args.good()) + { + return EXIT_FAILURE; + } + + int linecounter = 1; + std::ifstream infile(args.InputFile); + if (!infile.good()) + { + std::cout << "Input file not found " << std::endl; + return EXIT_FAILURE; + } + + std::ofstream outfile(args.OutputFile); + if (!outfile.good()) + { + std::cout << "Can not create file " << args.OutputFile << std::endl; + return EXIT_FAILURE; + } + std::string linestr; + + std::shared_ptr modelPointer = + ModelID::FChoose(args.Model); + std::vector Weinberg; + + while (getline(infile, linestr)) + { + if (linecounter > args.LastLine) break; + + if (linecounter == 1) { - return EXIT_FAILURE; + modelPointer->setUseIndexCol(linestr); + outfile << linestr; + for (auto x : modelPointer->addLegendCT()) + outfile << sep << x; + for (auto x : modelPointer->addLegendTemp()) + outfile << sep << x; + outfile << sep << "L_W (1D)"; + outfile << sep << "L_W (Plane)"; + outfile << std::endl; } + if (linecounter >= args.FirstLine and linecounter <= args.LastLine and + linecounter != 1) + { + if (args.TerminalOutput) + { + std::cout << "Currently at line " << linecounter << std::endl; + } + std::pair, std::vector> parameters = + modelPointer->initModel(linestr); + if (args.FirstLine == args.LastLine) modelPointer->write(); - int linecounter = 1; - std::ifstream infile(args.InputFile); - if(!infile.good()) { - std::cout << "Input file not found " << std::endl; - return EXIT_FAILURE; - } - - std::ofstream outfile(args.OutputFile); - if(!outfile.good()) - { - std::cout << "Can not create file " << args.OutputFile << std::endl; - return EXIT_FAILURE; - } - std::string linestr; + auto EWPT = Minimizer::PTFinder_gen_all( + modelPointer, 0, 300, args.WhichMinimizer); + auto EWPTFlag = EWPT.StatusFlag; + double Vb1D = 0, LW1D = 0; + double LWplane = 0; - std::shared_ptr modelPointer = ModelID::FChoose(args.Model); - std::vector Weinberg; - - while(getline(infile,linestr)) - { - if(linecounter > args.LastLine) break; - - if(linecounter == 1) - { - modelPointer->setUseIndexCol(linestr); - outfile << linestr; - for(auto x: modelPointer->addLegendCT()) outfile << sep << x; - for(auto x: modelPointer->addLegendTemp()) outfile << sep << x; - outfile << sep << "L_W (1D)"; - outfile << sep << "L_W (Plane)"; - outfile << std::endl; - } - if(linecounter >= args.FirstLine and linecounter <= args.LastLine and linecounter != 1) - { - if(args.TerminalOutput) - { - std::cout << "Currently at line " << linecounter << std::endl; - } - std::pair,std::vector> parameters = modelPointer->initModel(linestr); - - if(args.FirstLine == args.LastLine ) modelPointer->write(); - - auto EWPT = Minimizer::PTFinder_gen_all(modelPointer,0,300,args.WhichMinimizer); - auto EWPTFlag = EWPT.StatusFlag; - - double Vb1D=0, LW1D=0; - double LWplane=0; - - - - if(EWPTFlag == Minimizer::MinimizerStatus::SUCCESS) - { - if(C_PT*EWPT.Tc < EWPT.vc) - { - std::vector vcritical,vbarrier; - vcritical = EWPT.EWMinimum; - - std::vector VEVSymmetric(modelPointer->get_nVEV()); - - - std::vector basepoint; - for(std::size_t i=0;iget_nVEV();i++) basepoint.push_back(VEVSymmetric.at(i) - + 0.5*(vcritical.at(i) - VEVSymmetric.at(i))); - - auto SolMinPlane = Minimizer::MinimizePlane(basepoint,VEVSymmetric,vcritical,modelPointer,EWPT.Tc,args.WhichMinimizer); - auto MaximumPlane = SolMinPlane.Minimum; - - - LW1D = Wall::calculate_wall_thickness_1D(modelPointer,EWPT.Tc,vcritical,VEVSymmetric); - - - - LWplane = Wall::calculate_wall_thickness_plane(modelPointer,EWPT.Tc,vcritical,VEVSymmetric,args.WhichMinimizer); - - - - outfile << linestr; - outfile << sep << parameters.second; - outfile << sep << EWPT.Tc << sep << EWPT.vc; - outfile << sep << EWPT.vc / EWPT.Tc; - outfile << sep << EWPT.EWMinimum; - outfile << sep << LW1D; - outfile << sep << LWplane; - outfile << std::endl; - } - } - - if(args.FirstLine == args.LastLine) { - auto dimensionnames = modelPointer->addLegendTemp(); - std::cout << "Succeded ? " << static_cast(EWPT.StatusFlag) - << sep <<" (1 = Success , -1 = v/T reached a value below " << C_PT << " during the calculation) \n"; - if(EWPT.StatusFlag==Minimizer::MinimizerStatus::SUCCESS) - { - std::cout << std::scientific; - std::cout << dimensionnames.at(1) << " = " << EWPT.vc << " GeV\n"; - std::cout << dimensionnames.at(0) << " = " << EWPT.Tc << " GeV\n"; - std::cout << "xi_c = " << dimensionnames.at(2) << " = " << EWPT.vc/EWPT.Tc << std::endl; - for(std::size_t i=0;iget_nVEV(); i++){ - std::cout << dimensionnames.at(i+3) << " = " << EWPT.EWMinimum.at(i) << " GeV\n"; - } - std::cout << "The potential barrier in the 1D approximation is given by Vb = " << Vb1D << " GeV^4" << std::endl; - std::cout << "The wall thickness is then given as L_W = " << LW1D << " GeV^-1 " << std::endl; - std::cout << "The thick wall parameter is given by T_c L_W = " << EWPT.Tc * LW1D << std::endl; - - - std::cout << "Results of all dimensions : \n"; - std::cout << "The wall thickness is then given as L_W = " << LWplane << " GeV^-1 " - << sep <<" = " << LWplane * 1.239842e-15 << " m " - << std::endl; - std::cout << "The thick wall parameter is given by T_c L_W = " << EWPT.Tc * LWplane << std::endl; - - } - } - } - linecounter++; - if(infile.eof()) break; - } - if(args.TerminalOutput) std::cout << std::endl; - outfile.close(); - return EXIT_SUCCESS; + if (EWPTFlag == Minimizer::MinimizerStatus::SUCCESS) + { + if (C_PT * EWPT.Tc < EWPT.vc) + { + std::vector vcritical, vbarrier; + vcritical = EWPT.EWMinimum; + + std::vector VEVSymmetric(modelPointer->get_nVEV()); + + std::vector basepoint; + for (std::size_t i = 0; i < modelPointer->get_nVEV(); i++) + basepoint.push_back(VEVSymmetric.at(i) + + 0.5 * (vcritical.at(i) - VEVSymmetric.at(i))); + + auto SolMinPlane = Minimizer::MinimizePlane(basepoint, + VEVSymmetric, + vcritical, + modelPointer, + EWPT.Tc, + args.WhichMinimizer); + auto MaximumPlane = SolMinPlane.Minimum; + + LW1D = Wall::calculate_wall_thickness_1D( + modelPointer, EWPT.Tc, vcritical, VEVSymmetric); + + LWplane = Wall::calculate_wall_thickness_plane(modelPointer, + EWPT.Tc, + vcritical, + VEVSymmetric, + args.WhichMinimizer); + + outfile << linestr; + outfile << sep << parameters.second; + outfile << sep << EWPT.Tc << sep << EWPT.vc; + outfile << sep << EWPT.vc / EWPT.Tc; + outfile << sep << EWPT.EWMinimum; + outfile << sep << LW1D; + outfile << sep << LWplane; + outfile << std::endl; + } + } + + if (args.FirstLine == args.LastLine) + { + auto dimensionnames = modelPointer->addLegendTemp(); + std::cout << "Succeded ? " << static_cast(EWPT.StatusFlag) << sep + << " (1 = Success , -1 = v/T reached a value below " << C_PT + << " during the calculation) \n"; + if (EWPT.StatusFlag == Minimizer::MinimizerStatus::SUCCESS) + { + std::cout << std::scientific; + std::cout << dimensionnames.at(1) << " = " << EWPT.vc << " GeV\n"; + std::cout << dimensionnames.at(0) << " = " << EWPT.Tc << " GeV\n"; + std::cout << "xi_c = " << dimensionnames.at(2) << " = " + << EWPT.vc / EWPT.Tc << std::endl; + for (std::size_t i = 0; i < modelPointer->get_nVEV(); i++) + { + std::cout << dimensionnames.at(i + 3) << " = " + << EWPT.EWMinimum.at(i) << " GeV\n"; + } + std::cout << "The potential barrier in the 1D approximation is given " + "by Vb = " + << Vb1D << " GeV^4" << std::endl; + std::cout << "The wall thickness is then given as L_W = " << LW1D + << " GeV^-1 " << std::endl; + std::cout << "The thick wall parameter is given by T_c L_W = " + << EWPT.Tc * LW1D << std::endl; + + std::cout << "Results of all dimensions : \n"; + std::cout << "The wall thickness is then given as L_W = " << LWplane + << " GeV^-1 " << sep << " = " << LWplane * 1.239842e-15 + << " m " << std::endl; + std::cout << "The thick wall parameter is given by T_c L_W = " + << EWPT.Tc * LWplane << std::endl; + } + } + } + linecounter++; + if (infile.eof()) break; + } + if (args.TerminalOutput) std::cout << std::endl; + outfile.close(); + return EXIT_SUCCESS; } -catch(int) +catch (int) { - return EXIT_SUCCESS; + return EXIT_SUCCESS; } -catch(exception& e){ - std::cerr << e.what() << std::endl; - return EXIT_FAILURE; +catch (exception &e) +{ + std::cerr << e.what() << std::endl; + return EXIT_FAILURE; } CLIOptions::CLIOptions(int argc, char *argv[]) { - std::vector args; - for(int i{1};i 0 and args.at(0)=="--help") - { - throw int{0}; - } - else if(argc < 6) + std::vector args; + for (int i{1}; i < argc; ++i) + args.push_back(argv[i]); + + if (argc < 6 or args.at(0) == "--help") + { + int SizeOfFirstColumn = std::string("--TerminalOutput= ").size(); + std::cout << "WallThickness calculates the wall thickness" << std::endl + << "It is called either by " << std::endl + << "./WallThickness Model Inputfile Outputfile LineStart LineEnd" + << std::endl + << "or with the following arguments" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--help" + << "Shows this menu" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--model=" + << "The model you want to investigate" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--input=" + << "The input file in tsv format" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--output=" + << "The output file in tsv format" << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--FirstLine=" + << "The first line in the input file to calculate the EWPT. " + "Expects line 1 to be a legend." + << std::endl + << std::setw(SizeOfFirstColumn) << std::left << "--LastLine=" + << "The last line in the input file to calculate the EWPT." + << std::endl + << std::setw(SizeOfFirstColumn) << std::left + << "--TerminalOutput=" + << "y/n Turns on additional information in the terminal during " + "the calculation." + << std::endl; + std::string GSLhelp{"--UseGSL="}; + GSLhelp += Minimizer::UseGSLDefault ? "true" : "false"; + std::cout << std::setw(SizeOfFirstColumn) << std::left << GSLhelp + << "Use the GSL library to minimize the effective potential" + << std::endl; + std::string CMAEShelp{"--UseCMAES="}; + CMAEShelp += Minimizer::UseLibCMAESDefault ? "true" : "false"; + std::cout << std::setw(SizeOfFirstColumn) << std::left << CMAEShelp + << "Use the CMAES library to minimize the effective potential" + << std::endl; + std::string NLoptHelp{"--UseNLopt="}; + NLoptHelp += Minimizer::UseNLoptDefault ? "true" : "false"; + std::cout << std::setw(SizeOfFirstColumn) << std::left << NLoptHelp + << "Use the NLopt library to minimize the effective potential" + << std::endl; + ShowInputError(); + } + + if (args.size() > 0 and args.at(0) == "--help") + { + throw int{0}; + } + else if (argc < 6) + { + throw std::runtime_error("Too few arguments."); + } + + const std::string prefix{"--"}; + bool UsePrefix = StringStartsWith(args.at(0), prefix); + if (UsePrefix) + { + for (const auto &arg : args) { - throw std::runtime_error("Too few arguments."); + auto el = arg; + std::transform(el.begin(), el.end(), el.begin(), ::tolower); + if (StringStartsWith(el, "--model=")) + { + Model = + BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); + } + else if (StringStartsWith(el, "--input=")) + { + InputFile = arg.substr(std::string("--input=").size()); + } + else if (StringStartsWith(el, "--output=")) + { + OutputFile = arg.substr(std::string("--output=").size()); + } + else if (StringStartsWith(el, "--firstline=")) + { + FirstLine = std::stoi(el.substr(std::string("--firstline=").size())); + } + else if (StringStartsWith(el, "--lastline=")) + { + LastLine = std::stoi(el.substr(std::string("--lastline=").size())); + } + else if (StringStartsWith(el, "--terminaloutput=")) + { + TerminalOutput = el.substr(std::string("--lastline=").size()) == "y"; + } + else if (StringStartsWith(el, "--usegsl=")) + { + UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; + } + else if (StringStartsWith(el, "--usecmaes=")) + { + UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; + } + else if (StringStartsWith(el, "--usenlopt=")) + { + UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; + } } - - const std::string prefix{"--"}; - bool UsePrefix = StringStartsWith(args.at(0),prefix); - if(UsePrefix) + WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL, UseCMAES, UseNLopt); + } + else + { + Model = ModelID::getModel(args.at(0)); + InputFile = args.at(1); + OutputFile = args.at(2); + FirstLine = std::stoi(args.at(3)); + LastLine = std::stoi(args.at(4)); + if (argc == 7) { - for(const auto& arg: args) - { - auto el = arg; - std::transform(el.begin(), el.end(), el.begin(), ::tolower); - if(StringStartsWith(el,"--model=")) - { - Model = BSMPT::ModelID::getModel(el.substr(std::string("--model=").size())); - } - else if(StringStartsWith(el,"--input=")) - { - InputFile = arg.substr(std::string("--input=").size()); - } - else if(StringStartsWith(el,"--output=")) - { - OutputFile = arg.substr(std::string("--output=").size()); - } - else if(StringStartsWith(el,"--firstline=")) - { - FirstLine = std::stoi(el.substr(std::string("--firstline=").size())); - } - else if(StringStartsWith(el,"--lastline=")) - { - LastLine = std::stoi(el.substr(std::string("--lastline=").size())); - } - else if(StringStartsWith(el,"--terminaloutput=")) - { - TerminalOutput = el.substr(std::string("--lastline=").size()) == "y"; - } - else if(StringStartsWith(el,"--usegsl=")) - { - UseGSL = el.substr(std::string("--usegsl=").size()) == "true"; - } - else if(StringStartsWith(el,"--usecmaes=")) - { - UseCMAES = el.substr(std::string("--usecmaes=").size()) == "true"; - } - else if(StringStartsWith(el,"--usenlopt=")) - { - UseNLopt = el.substr(std::string("--usenlopt=").size()) == "true"; - } - } - WhichMinimizer = Minimizer::CalcWhichMinimizer(UseGSL,UseCMAES,UseNLopt); - } - else{ - Model = ModelID::getModel(args.at(0)); - InputFile = args.at(1); - OutputFile = args.at(2); - FirstLine = std::stoi(args.at(3)); - LastLine = std::stoi(args.at(4)); - if(argc == 7) { - TerminalOutput = ("y" == std::string(args.at(5))); - } + TerminalOutput = ("y" == std::string(args.at(5))); } + } } bool CLIOptions::good() const { - if(UseGSL and not Minimizer::UseGSLDefault) - { - throw std::runtime_error("You set --UseGSL=true but GSL was not found during compilation."); - } - if(UseCMAES and not Minimizer::UseLibCMAESDefault) - { - throw std::runtime_error("You set --UseCMAES=true but CMAES was not found during compilation."); - } - if(UseNLopt and not Minimizer::UseNLoptDefault) - { - throw std::runtime_error("You set --UseNLopt=true but NLopt was not found during compilation."); - } - if(WhichMinimizer == 0) - { - throw std::runtime_error("You disabled all minimizers. You need at least one."); - } - - if(Model==ModelID::ModelIDs::NotSet) { - - std::cerr << "Your Model parameter does not match with the implemented Models." << std::endl; - ShowInputError(); - return false; - } - if(FirstLine < 1) - { - std::cout << "Start line counting with 1" << std::endl; - return false; - } - if(FirstLine > LastLine) - { - std::cout << "Firstline is smaller then LastLine " << std::endl; - return false; - } - return true; + if (UseGSL and not Minimizer::UseGSLDefault) + { + throw std::runtime_error( + "You set --UseGSL=true but GSL was not found during compilation."); + } + if (UseCMAES and not Minimizer::UseLibCMAESDefault) + { + throw std::runtime_error( + "You set --UseCMAES=true but CMAES was not found during compilation."); + } + if (UseNLopt and not Minimizer::UseNLoptDefault) + { + throw std::runtime_error( + "You set --UseNLopt=true but NLopt was not found during compilation."); + } + if (WhichMinimizer == 0) + { + throw std::runtime_error( + "You disabled all minimizers. You need at least one."); + } + + if (Model == ModelID::ModelIDs::NotSet) + { + + std::cerr + << "Your Model parameter does not match with the implemented Models." + << std::endl; + ShowInputError(); + return false; + } + if (FirstLine < 1) + { + std::cout << "Start line counting with 1" << std::endl; + return false; + } + if (FirstLine > LastLine) + { + std::cout << "Firstline is smaller then LastLine " << std::endl; + return false; + } + return true; } diff --git a/src/utility.cpp b/src/utility.cpp index 76e7d530..6c90a940 100644 --- a/src/utility.cpp +++ b/src/utility.cpp @@ -14,30 +14,25 @@ along with this program. If not, see . */ - +#include #include #include -#include - - - /** * @file */ -namespace BSMPT { +namespace BSMPT +{ -std::ostream& operator<<(std::ostream& os, const ModelID::ModelIDs& Model) +std::ostream &operator<<(std::ostream &os, const ModelID::ModelIDs &Model) { - static auto IMN = BSMPT::ModelID::InvertModelNames(); - os << IMN.at(Model); - return os; + static auto IMN = BSMPT::ModelID::InvertModelNames(); + os << IMN.at(Model); + return os; } -bool StringStartsWith(const std::string& str, const std::string& prefix) +bool StringStartsWith(const std::string &str, const std::string &prefix) { - return str.size() >= prefix.size() and str.find(prefix) == 0; + return str.size() >= prefix.size() and str.find(prefix) == 0; } - - -} +} // namespace BSMPT