Skip to content

Commit

Permalink
Fixed a mistake in eq (2.30) in the manual and the corresponding func…
Browse files Browse the repository at this point in the history
…tion in the Code. Additionally increased the numbers of minimization in the GSL minimizer if only the GSL minimizer is used.
  • Loading branch information
phbasler committed Jun 26, 2018
1 parent f86a5cf commit 8292adf
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 17 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
2018/06/25 : Fixed a mistake in eq (2.30) in the manual and the corresponding formula in the code. Thanks to Peter Athron for noticing this. Additionally the numbers of minimizations was increased if only the GSL minimizer is used. Before it searched for 20 local minima, now it searches for 50.
2018/04/23 : Fixed a wrong sign in the yukawa couplings to the CP-odd higgs fields
2018/03/30 : Corrected a small bug in the minimizer which caused a seg fault if vevsolTmp > 0.5 and ModifiedVEVVectorDim has dimension 0
2018/03/07 : v1.0 : Relase
Binary file modified manual/manual.pdf
Binary file not shown.
61 changes: 49 additions & 12 deletions src/minimizer/MinimizeGSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,32 @@ int GSL_Minimize_From_S_gen_all(void* p, std::vector<double>& sol,std::vector<do
* deepest potential value as the candidate for the global minimum
* @return True if a candidate for the global minimum is found and false otherwise
*/
bool GSL_Minimize_gen_all(int Model, const std::vector<double>& par, const std::vector<double>& parCT, double Temp, std::vector<double>& solV, int seed)
bool GSL_Minimize_gen_all(int Model, const std::vector<double>& par, const std::vector<double>& parCT,
double Temp, std::vector<double>& solV, int seed,int MaxSol){
std::vector<std::vector<double>> saveAllMinima;
bool result = GSL_Minimize_gen_all(Model,par, parCT,Temp,solV, seed ,saveAllMinima, MaxSol);

// std::cout << "rows = " << saveAllMinima.size() << std::endl;
return result;
}


bool GSL_Minimize_gen_all(int Model, const std::vector<double>& par, const std::vector<double>& parCT,
double Temp, std::vector<double>& solV, int seed){
std::vector<std::vector<double>> saveAllMinima;
int MaxSol = 20;
bool result = GSL_Minimize_gen_all(Model,par, parCT,Temp,solV, seed ,saveAllMinima, MaxSol);

// std::cout << "rows = " << saveAllMinima.size() << std::endl;
return result;
}

bool GSL_Minimize_gen_all(int Model, const std::vector<double>& par, const std::vector<double>& parCT, double Temp,
std::vector<double>& solV, int seed , std::vector<std::vector<double>>& saveAllMinima, int MaxSol)
{
bool Debug = false;
if(Debug) std::cout << "Start Debuging " << __func__ << std::endl;
if(Debug) std::cout << "Searching for " << MaxSol << " solutions " << std::endl;
// Class_Potential_Origin * modelPointer;
// Fchoose(modelPointer,Model);
// int nPar = modelPointer->nPar;
Expand Down Expand Up @@ -188,9 +210,10 @@ bool GSL_Minimize_gen_all(int Model, const std::vector<double>& par, const std::
int MaxTries = 600;
int tries = 0;
int numOfSol = 0;
int MaxSol = 20;
// int MaxSol = 20;
int nCol = dim+2;
double SolAr[MaxSol][nCol];
// double SolAr[MaxSol][nCol];
// std::vector<std:vector<double>> SolAr;
std::vector<double> start,sol,vPot;
if(Debug) std::cout << "Start Loop" << std::endl;
double timeStart = time(NULL);
Expand All @@ -200,12 +223,26 @@ bool GSL_Minimize_gen_all(int Model, const std::vector<double>& par, const std::


GSL_Minimize_From_S_gen_all(&params,sol,start);
if(Debug) std::cout << "Finished from S" << std::endl;
for(int i=0;i<dim;i++) SolAr[numOfSol][i] = sol.at(i);

vPot.resize(modelPointer->NHiggs);
modelPointer->MinimizeOrderVEV(sol,vPot);
SolAr[numOfSol][dim] = modelPointer->EWSBVEV(vPot);
SolAr[numOfSol][dim+1] = modelPointer->VEff(vPot,Temp,0);



if(Debug) std::cout << "Finished from S" << std::endl;
// for(int i=0;i<dim;i++) SolAr[numOfSol][i] = sol.at(i);
// SolAr[numOfSol][dim] = modelPointer->EWSBVEV(vPot);
// SolAr[numOfSol][dim+1] = modelPointer->VEff(vPot,Temp,0);


std::vector<double> row(nCol);
for(int i=0;i<dim;i++) row.at(i) = sol.at(i);
row.at(dim) = modelPointer->EWSBVEV(vPot);
row.at(dim+1) = modelPointer->VEff(vPot,Temp,0);

saveAllMinima.push_back(row);


numOfSol ++;
if(numOfSol == MaxSol) break;

Expand All @@ -227,22 +264,22 @@ bool GSL_Minimize_gen_all(int Model, const std::vector<double>& par, const std::
}

int minIndex = 0;
double VMin = SolAr[0][dim+1];
double VMin = saveAllMinima[0][dim+1];
for(int k=1;k<numOfSol;k++)
{
if(SolAr[k][dim+1] <= VMin)
if(saveAllMinima[k][dim+1] <= VMin)
{
VMin = SolAr[k][dim+1];
VMin = saveAllMinima[k][dim+1];
minIndex = k;
}
}


for(int k=0;k<dim+2;k++) solV.push_back(SolAr[minIndex][k]);
for(int k=0;k<dim+2;k++) solV.push_back(saveAllMinima[minIndex][k]);

if(Debug){
std::cout << "Solution found by GSL is \n";
for(int k=0;k<dim+2;k++) std::cout << SolAr[minIndex][k] << "\t";
for(int k=0;k<dim+2;k++) std::cout << saveAllMinima[minIndex][k] << "\t";
std::cout << std::endl;
}

Expand Down
4 changes: 4 additions & 0 deletions src/minimizer/Minimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ double GSL_VEFF_gen_all(const gsl_vector *v, void *p);
int GSL_Minimize_From_S_gen_all(const std::vector<double>& p, std::vector<double>& sol,const std::vector<double>& start);
bool GSL_Minimize_gen_all(int Model, const std::vector<double>& par, const std::vector<double>& parCT,
double Temp, std::vector<double>& solV, int seed);
bool GSL_Minimize_gen_all(int Model, const std::vector<double>& par, const std::vector<double>& parCT,
double Temp, std::vector<double>& solV, int seed,int MaxSol);
bool GSL_Minimize_gen_all(int Model, const std::vector<double>& par, const std::vector<double>& parCT,
double Temp, std::vector<double>& solV, int seed, std::vector<std::vector<double>>& saveAllMinima, int MaxSol);


// Minfunc_gen.cpp
Expand Down
45 changes: 40 additions & 5 deletions src/models/ClassPotentialOrigin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1855,7 +1855,9 @@ void Class_Potential_Origin::HiggsMassesSquared(std::vector<double>& res, const
}
}

if(diff == 0)
// std::cout << MassMatrix << std::endl;

if(diff == 0 and res.size() == 0)
{
SelfAdjointEigenSolver<MatrixXd> es(MassMatrix,EigenvaluesOnly);
for(int i =0;i<NHiggs;i++)
Expand All @@ -1865,6 +1867,20 @@ void Class_Potential_Origin::HiggsMassesSquared(std::vector<double>& res, const
else res.push_back(tmp);
}
}
else if(diff == 0 and res.size() == NHiggs){
SelfAdjointEigenSolver<MatrixXd> es(MassMatrix,EigenvaluesOnly);
for(int i =0;i<NHiggs;i++)
{
double tmp = es.eigenvalues()[i];
if(std::abs(tmp) < ZeroMass ) tmp = 0;
res[i] = tmp;
}
}
else if(diff == 0 and res.size()!= 0 and res.size() != NHiggs){
std::cout << "Something went wrong in " << __func__ << std::endl;
std::cout << __func__ << "Is calculating the mass for " << NHiggs << "fields but the resolution vector has a size of "
<< res.size() << ". This should be zero or " << NHiggs << std::endl;
}
else if(diff <= nVEV)
{
MatrixXd Diff(NHiggs,NHiggs);
Expand Down Expand Up @@ -2257,7 +2273,7 @@ void Class_Potential_Origin::CalculateDebye()
for(int b=0;b<NQuarks;b++)
{
double tmp = 0.5*(std::conj(Curvature_Quark_F2H1[a][b][j])*Curvature_Quark_F2H1[a][b][i] + std::conj(Curvature_Quark_F2H1[a][b][i])*Curvature_Quark_F2H1[a][b][j]).real();
DebyeHiggs[i][j] += 12/24.0*tmp;
DebyeHiggs[i][j] += 6.0/24.0*tmp;
}
}

Expand All @@ -2266,17 +2282,26 @@ void Class_Potential_Origin::CalculateDebye()
for(int b=0;b<NLepton;b++)
{
double tmp = 0.5*(std::conj(Curvature_Lepton_F2H1[a][b][j])*Curvature_Lepton_F2H1[a][b][i] + std::conj(Curvature_Lepton_F2H1[a][b][i])*Curvature_Lepton_F2H1[a][b][j]).real();
DebyeHiggs[i][j] += 4/24.0*tmp;
DebyeHiggs[i][j] += 2.0/24.0*tmp;
}
}

if(i==j) DebyeHiggs[i][j] *= 0.5;
// if(i==j) DebyeHiggs[i][j] *= 0.5;
}
}

for(int i=0;i<NHiggs;i++){
for(int j=i;j<NHiggs;j++) {
if(std::abs(DebyeHiggs[i][j])<=1e-5) DebyeHiggs[i][j] = 0;
}
}


for(int i=0;i<NHiggs;i++)
{
for(int j=0;j<i;j++) DebyeHiggs[i][j] = DebyeHiggs[j][i];
for(int j=0;j<i;j++) {
DebyeHiggs[i][j] = DebyeHiggs[j][i];
}
}
}

Expand Down Expand Up @@ -2335,6 +2360,13 @@ void Class_Potential_Origin::CalculateDebyeGauge(){
DebyeGauge[i][i] = 2.0/3.0*(nGaugeHiggs/8.0 + 5)*GaugeFac;
}

for(int i=0;i<NGauge;i++){
for(int j=0;j<NGauge;j++)
{
if(std::abs(DebyeGauge[i][j]) <=1e-5) DebyeGauge[i][j] = 0;
}
}

if(Debug)
{
for(int i=0;i<NGauge;i++)
Expand Down Expand Up @@ -2554,3 +2586,6 @@ double Class_Potential_Origin::EWSBVEV(std::vector<double> v)
}
return res;
}



0 comments on commit 8292adf

Please sign in to comment.