-
Notifications
You must be signed in to change notification settings - Fork 0
/
alter_wimps.c
executable file
·181 lines (158 loc) · 8.62 KB
/
alter_wimps.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#include "src/include.h"
/*-------------------------------------------------------- */
/* Calculation of the abundance of the elements from BBN */
/*-------------------------------------------------------- */
int main(int argc,char** argv)
{
struct relicparam paramrelic;
double ratioH[NNUC+1],cov_ratioH[NNUC+1][NNUC+1];
double H2_H,He3_H,Yp,Li7_H,Li6_H,Be7_H;
double sigma_H2_H,sigma_He3_H,sigma_Yp,sigma_Li7_H,sigma_Li6_H,sigma_Be7_H;
double m_chi, gchi;
int type_wimp, SMC_wimp, fermion, selfConjugate, EM_coupled, neut_coupled, neuteq_coupled;
int failsafe;
if(argc<4)
{
printf(" This program needs 3 parameters:\n"
" type_wimp type of WIMP\n"
" 1 - real scalar\n"
" 2 - complex scalar\n"
" 3 - Majorana fermion\n"
" 4 - Dirac fermion\n"
" SMC_wimp SM coupling of light WIMP\n"
" 1 - coupled to SM neutrinos\n"
" 2 - electromagnetically coupled\n"
" 3 - coupled to SM and equivalent neutrinos\n"
" m_chi mass of light WIMP (in MeV)\n"
" Auxiliary parameters are:\n"
" failsafe 0=fast, 1=precise, 6=robust but slow. See stand_cosmo.c for more options.\n");
exit(1);
}
else
{
sscanf(argv[1],"%d",&type_wimp);
sscanf(argv[2],"%d",&SMC_wimp);
sscanf(argv[3],"%lf",&m_chi);
if(argc>4) sscanf(argv[4],"%d",&failsafe); else failsafe=1;
}
if (type_wimp == 1) // Real scalar
{
gchi = 1.;
fermion = 0; // Boson
selfConjugate = 1; // True
}
else if (type_wimp == 2) // Complex scalar
{
gchi = 2.;
fermion = 0;
selfConjugate = 0;
}
else if (type_wimp == 3) // Majorana fermion
{
gchi = 2.;
fermion = 1; // Fermion
selfConjugate = 1;
}
else if (type_wimp == 4) // Dirac fermion
{
gchi = 4.;
fermion = 1;
selfConjugate = 0;
}
else
{
printf("\t [ERROR] Incorrect input value for parameter 'type_wimp'.");
exit(1);
}
if (SMC_wimp == 1) {
EM_coupled = 0;
neut_coupled = 1;
neuteq_coupled = 0;
}
else if (SMC_wimp == 2) {
EM_coupled = 1;
neut_coupled = 0;
neuteq_coupled = 0;
}
else if (SMC_wimp == 3) {
EM_coupled = 0;
neut_coupled = 0;
neuteq_coupled = 1;
}
else
{
printf("\t [ERROR] Incorrect input value for parameter 'SMC_wimp'.");
exit(1);
}
Init_cosmomodel(¶mrelic);
paramrelic.failsafe=failsafe;
Init_wimp(m_chi,EM_coupled,neut_coupled,neuteq_coupled,fermion,selfConjugate,gchi,¶mrelic);
printf("\t Yp\t\t H2/H\t\t He3/H\t\t Li7/H\t\t Li6/H\t\t Be7/H\n");
paramrelic.err=2;
nucl(¶mrelic,ratioH);
H2_H=ratioH[3];Yp=ratioH[6];Li7_H=ratioH[8];Be7_H=ratioH[9];He3_H=ratioH[5];Li6_H=ratioH[7];
printf(" low:\t %.3e\t %.3e\t %.3e\t %.3e\t %.3e\t %.3e\n",Yp,H2_H,He3_H,Li7_H,Li6_H,Be7_H);
paramrelic.err=0;
nucl(¶mrelic,ratioH);
H2_H=ratioH[3];Yp=ratioH[6];Li7_H=ratioH[8];Be7_H=ratioH[9];He3_H=ratioH[5];Li6_H=ratioH[7];
printf(" cent:\t %.3e\t %.3e\t %.3e\t %.3e\t %.3e\t %.3e\n",Yp,H2_H,He3_H,Li7_H,Li6_H,Be7_H);
paramrelic.err=1;
nucl(¶mrelic,ratioH);
H2_H=ratioH[3];Yp=ratioH[6];Li7_H=ratioH[8];Be7_H=ratioH[9];He3_H=ratioH[5];Li6_H=ratioH[7];
printf(" high:\t %.3e\t %.3e\t %.3e\t %.3e\t %.3e\t %.3e\n\n",Yp,H2_H,He3_H,Li7_H,Li6_H,Be7_H);
paramrelic.err=3;
if(nucl_err(¶mrelic,ratioH,cov_ratioH))
{
printf("--------------------\n\n");
printf("With uncertainties:\n");
H2_H=ratioH[3];Yp=ratioH[6];Li7_H=ratioH[8];Be7_H=ratioH[9];He3_H=ratioH[5];Li6_H=ratioH[7];
sigma_H2_H=sqrt(cov_ratioH[3][3]);sigma_Yp=sqrt(cov_ratioH[6][6]);sigma_Li7_H=sqrt(cov_ratioH[8][8]);sigma_Be7_H=sqrt(cov_ratioH[9][9]);sigma_He3_H=sqrt(cov_ratioH[5][5]);sigma_Li6_H=sqrt(cov_ratioH[7][7]);
printf("\t Yp\t\t H2/H\t\t He3/H\t\t Li7/H\t\t Li6/H\t\t Be7/H\n");
printf("value:\t %.3e\t %.3e\t %.3e\t %.3e\t %.3e\t %.3e\n",Yp,H2_H,He3_H,Li7_H,Li6_H,Be7_H);
printf(" +/- :\t %.3e\t %.3e\t %.3e\t %.3e\t %.3e\t %.3e\n\n",sigma_Yp,sigma_H2_H,sigma_He3_H,sigma_Li7_H,sigma_Li6_H,sigma_Be7_H);
double corr_ratioH[NNUC+1][NNUC+1];
for(int ie=1;ie<=NNUC;ie++) for(int je=1;je<=NNUC;je++) corr_ratioH[ie][je]=cov_ratioH[ie][je]/sqrt(cov_ratioH[ie][ie]*cov_ratioH[je][je]);
printf("Correlation matrix:\n");
printf("\t Yp\t\t H2/H\t\t He3/H\t\t Li7/H\t\t Li6/H\t\t Be7/H\n");
printf("Yp\t %f\t %f\t %f\t %f\t %f\t %f\n",corr_ratioH[6][6],corr_ratioH[6][3],corr_ratioH[6][5],corr_ratioH[6][8],corr_ratioH[6][7],corr_ratioH[6][9]);
printf("H2/H\t %f\t %f\t %f\t %f\t %f\t %f\n",corr_ratioH[3][6],corr_ratioH[3][3],corr_ratioH[3][5],corr_ratioH[3][8],corr_ratioH[3][7],corr_ratioH[3][9]);
printf("He3/H\t %f\t %f\t %f\t %f\t %f\t %f\n",corr_ratioH[5][6],corr_ratioH[5][3],corr_ratioH[5][5],corr_ratioH[5][8],corr_ratioH[5][7],corr_ratioH[5][9]);
printf("Li7/H\t %f\t %f\t %f\t %f\t %f\t %f\n",corr_ratioH[8][6],corr_ratioH[8][3],corr_ratioH[8][5],corr_ratioH[8][8],corr_ratioH[8][7],corr_ratioH[8][9]);
printf("Li6/H\t %f\t %f\t %f\t %f\t %f\t %f\n",corr_ratioH[7][6],corr_ratioH[7][3],corr_ratioH[7][5],corr_ratioH[7][8],corr_ratioH[7][7],corr_ratioH[7][9]);
printf("Be7/H\t %f\t %f\t %f\t %f\t %f\t %f\n\n",corr_ratioH[9][6],corr_ratioH[9][3],corr_ratioH[9][5],corr_ratioH[9][8],corr_ratioH[9][7],corr_ratioH[9][9]);
}
else printf("Uncertainty calculation failed\n\n");
/*paramrelic.err=4;
if(nucl_err(¶mrelic,ratioH,cov_ratioH))
{
printf("--------------------\n\n");
printf("With MC uncertainties:\n");
H2_H=ratioH[3];Yp=ratioH[6];Li7_H=ratioH[8];Be7_H=ratioH[9];He3_H=ratioH[5];Li6_H=ratioH[7];
sigma_H2_H=sqrt(cov_ratioH[3][3]);sigma_Yp=sqrt(cov_ratioH[6][6]);sigma_Li7_H=sqrt(cov_ratioH[8][8]);sigma_Be7_H=sqrt(cov_ratioH[9][9]);sigma_He3_H=sqrt(cov_ratioH[5][5]);sigma_Li6_H=sqrt(cov_ratioH[7][7]);
printf("\t Yp\t\t H2/H\t\t He3/H\t\t Li7/H\t\t Li6/H\t\t Be7/H\n");
printf("mean:\t %.3e\t %.3e\t %.3e\t %.3e\t %.3e\t %.3e\n",Yp,H2_H,He3_H,Li7_H,Li6_H,Be7_H);
printf(" +/- :\t %.3e\t %.3e\t %.3e\t %.3e\t %.3e\t %.3e\n\n",sigma_Yp,sigma_H2_H,sigma_He3_H,sigma_Li7_H,sigma_Li6_H,sigma_Be7_H);
double corr_ratioH[NNUC+1][NNUC+1];
for(int ie=1;ie<=NNUC;ie++) for(int je=1;je<=NNUC;je++) corr_ratioH[ie][je]=cov_ratioH[ie][je]/sqrt(cov_ratioH[ie][ie]*cov_ratioH[je][je]);
printf("Correlation matrix:\n");
printf("\t Yp\t\t H2/H\t\t He3/H\t\t Li7/H\t\t Li6/H\t\t Be7/H\n");
printf("Yp\t %f\t %f\t %f\t %f\t %f\t %f\n",corr_ratioH[6][6],corr_ratioH[6][3],corr_ratioH[6][5],corr_ratioH[6][8],corr_ratioH[6][7],corr_ratioH[6][9]);
printf("H2/H\t %f\t %f\t %f\t %f\t %f\t %f\n",corr_ratioH[3][6],corr_ratioH[3][3],corr_ratioH[3][5],corr_ratioH[3][8],corr_ratioH[3][7],corr_ratioH[3][9]);
printf("He3/H\t %f\t %f\t %f\t %f\t %f\t %f\n",corr_ratioH[5][6],corr_ratioH[5][3],corr_ratioH[5][5],corr_ratioH[5][8],corr_ratioH[5][7],corr_ratioH[5][9]);
printf("Li7/H\t %f\t %f\t %f\t %f\t %f\t %f\n",corr_ratioH[8][6],corr_ratioH[8][3],corr_ratioH[8][5],corr_ratioH[8][8],corr_ratioH[8][7],corr_ratioH[8][9]);
printf("Li6/H\t %f\t %f\t %f\t %f\t %f\t %f\n",corr_ratioH[7][6],corr_ratioH[7][3],corr_ratioH[7][5],corr_ratioH[7][8],corr_ratioH[7][7],corr_ratioH[7][9]);
printf("Be7/H\t %f\t %f\t %f\t %f\t %f\t %f\n\n",corr_ratioH[9][6],corr_ratioH[9][3],corr_ratioH[9][5],corr_ratioH[9][8],corr_ratioH[9][7],corr_ratioH[9][9]);
}
else printf("Uncertainty calculation failed\n\n");*/
paramrelic.err=0;
int compat=bbn_excluded(¶mrelic);
if(compat==1) printf("Excluded by BBN constraints (chi2 without correlations)\n");
else if(compat==0) printf("Compatible with BBN constraints (chi2 without correlations)\n");
else printf("Computation failed (chi2 without correlations)\n");
paramrelic.err=3;
compat=bbn_excluded(¶mrelic);
if(compat==1) printf("Excluded by BBN constraints (chi2 including correlations)\n");
else if(compat==0) printf("Compatible with BBN constraints (chi2 including correlations)\n");
else printf("Computation failed (chi2 including correlations)\n");
return 1;
}