This repository was archived by the owner on Dec 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelmodels.h
More file actions
430 lines (374 loc) · 16.9 KB
/
Copy pathrelmodels.h
File metadata and controls
430 lines (374 loc) · 16.9 KB
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
/*
This file is part of the RELXILL model code.
RELXILL 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
any later version.
RELXILL 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.
For a copy of the GNU General Public License see
<http://www.gnu.org/licenses/>.
Copyright 2020 Thomas Dauser, Remeis Observatory & ECAP
*/
#ifndef MODELS_H_
#define MODELS_H_
#include "relbase.h"
#include "relutility.h"
#include "xilltable.h"
/**** DEFINES **/
#define MOD_TYPE_RELLINE 1
#define NUM_PARAM_RELLINE 10
#define MOD_TYPE_RELLINELP 2
#define NUM_PARAM_RELLINELP 9
#define MOD_TYPE_RELCONV 11
#define NUM_PARAM_RELCONV 8
#define MOD_TYPE_RELCONVLP 12
#define NUM_PARAM_RELCONVLP 7
#define MOD_TYPE_XILLVER 0
#define NUM_PARAM_XILLVER 7
#define MOD_TYPE_XILLVER_NTHCOMP 100
#define NUM_PARAM_XILLVER_NTHCOMP 7
#define MOD_TYPE_RELXILL -1
#define NUM_PARAM_RELXILL 13
#define MOD_TYPE_RELXILLLP -2
#define NUM_PARAM_RELXILLLP 12
/** density models **/
#define MOD_TYPE_RELXILLDENS -10
#define NUM_PARAM_RELXILLDENS 13
#define MOD_TYPE_RELXILLLPDENS -11
#define NUM_PARAM_RELXILLLPDENS 12
#define MOD_TYPE_XILLVERDENS -100
#define NUM_PARAM_XILLVERDENS 7
/** ion grad models **/
#define MOD_TYPE_RELXILLLPION -21
#define NUM_PARAM_RELXILLLPION 15
// TODO: implement RELXILLION model ??
/** CO models **/
#define MOD_TYPE_RELXILLCO -200
#define NUM_PARAM_RELXILLCO 14
#define MOD_TYPE_XILLVERCO -210
#define NUM_PARAM_XILLVERCO 8
/** Neutron Star / BB models **/
#define MOD_TYPE_RELXILLNS -30
#define NUM_PARAM_RELXILLNS 13
#define MOD_TYPE_XILLVERNS -101
#define NUM_PARAM_XILLVERNS 7
#define MOD_TYPE_XILLVERDENS_NTHCOMP 1000
#define NUM_PARAM_XILLVERDENS_NTHCOMP 8
#define MOD_TYPE_RELXILLDENS_NTHCOMP -1001
#define NUM_PARAM_RELXILLDENS_NTHCOMP 14
#define MOD_TYPE_RELXILLLPDENS_NTHCOMP -1002
#define NUM_PARAM_RELXILLLPDENS_NTHCOMP 15
// unpublished models
#define MOD_TYPE_RELXILLBBRET -300
#define MOD_TYPE_RELXILLLPRET -310
/**** TYPE DEFINITIONS ****/
/**** FUNCTION DEFINITIONS ****/
void check_parameter_bounds(relParam *param, int *status);
double *shift_energ_spec_1keV(const double *ener, const int n_ener, double line_energ, double z, int *status);
relParam *init_par_relline(const double *inp_par, const int n_parameter, int *status);
relParam *init_par_relline_lp(const double *inp_par, const int n_parameter, int *status);
relParam *init_par_relconv(const double *inp_par, const int n_parameter, int *status);
xillParam *init_par_xillver(const double *inp_par, const int n_parameter, int *status);
xillParam *init_par_xillver_nthcomp(const double *inp_par, const int n_parameter, int *status);
xillParam *init_par_xillver_ns(const double *inp_par, const int n_parameter, int *status);
xillParam *init_par_xillver_co(const double *inp_par, const int n_parameter, int *status);
xillParam *init_par_xillver_dens(const double *inp_par, const int n_parameter, int *status);
void init_par_relxill(relParam **rel_param,
xillParam **xill_param,
const double *inp_par,
const int n_parameter,
int *status);
void init_par_relxilllp(relParam** rel_param, xillParam** xill_param, const double* inp_par, const int n_parameter, int* status);
/** basic xillver model function **/
void xillver_base(const double *ener0, const int n_ener0, double *photar, xillParam *param_struct, int *status);
/** internal MODEL FUNCTIONS **/
void tdrelline(const double* ener, const int n_ener, double* photar, const double* parameter, const int n_parameter, int* status);
void tdrellinelp(const double* ener, const int n_ener, double* photar, const double* parameter, const int n_parameter, int* status);
void tdrelxill(const double* ener0, const int n_ener0, double* photar, const double* parameter, const int n_parameter, int* status);
void tdrelxilllp(const double* ener0, const int n_ener0, double* photar, const double* parameter, const int n_parameter, int* status);
void tdrelxilllpion(const double *ener0,
const int n_ener0,
double *photar,
const double *parameter,
const int n_parameter,
int *status);
void tdxillver(const double *ener0,
const int n_ener0,
double *photar,
const double *parameter,
const int n_parameter,
int *status);
void tdrelconv(const double *ener,
const int n_ener,
double *photar,
const double *parameter,
const int n_parameter,
int *status);
void tdrelconvlp(const double *ener,
const int n_ener,
double *photar,
const double *parameter,
const int n_parameter,
int *status);
void tdrelxilldens(const double *ener0,
const int n_ener0,
double *photar,
const double *parameter,
const int n_parameter,
int *status);
void tdrelxilllpdens(const double *ener0,
const int n_ener0,
double *photar,
const double *parameter,
const int n_parameter,
int *status);
void tdxillverdens(const double *ener0,
const int n_ener0,
double *photar,
const double *parameter,
const int n_parameter,
int *status);
void tdrelxillns(const double *ener0,
const int n_ener0,
double *photar,
const double *parameter,
const int n_parameter,
int *status);
void tdxillverns(const double *ener0,
const int n_ener0,
double *photar,
const double *parameter,
const int n_parameter,
int *status);
void tdrelxill_nthcomp(const double *ener0,
const int n_ener0,
double *photar,
const double *parameter,
const int n_parameter,
int *status);
void tdrelxilllp_nthcomp(const double *ener0,
const int n_ener0,
double *photar,
const double *parameter,
const int n_parameter,
int *status);
void tdrelxilllpion_nthcomp(const double *ener0,
const int n_ener0,
double *photar,
const double *parameter,
const int n_parameter,
int *status);
void tdxillver_nthcomp(const double *ener0,
const int n_ener0,
double *photar,
const double *parameter,
const int n_parameter,
int *status);
void tdxillverco(const double *ener0, const int n_ener0, double *photar, const double *parameter, const int n_parameter,
int *status);
void tdrelxillco(const double *ener0, const int n_ener0, double *photar, const double *parameter, const int n_parameter,
int *status);
// Dens & Nthcomp Model
xillParam *init_par_xillver_dens_nthcomp(const double *inp_par, const int n_parameter, int *status);
void init_par_relxilldens_nthcomp(relParam **rel_param,
xillParam **xill_param,
const double *inp_par,
const int n_parameter,
int *status);
void init_par_relxilllp_dens_nthcomp(relParam **rel_param,
xillParam **xill_param,
const double *inp_par,
const int n_parameter,
int *status);
void tdrelxilldens_nthcomp(const double *ener0,
const int n_ener0,
double *photar,
const double *parameter,
const int n_parameter,
int *status);
void tdrelxilllpdens_nthcomp(const double *ener0,
const int n_ener0,
double *photar,
const double *parameter,
const int n_parameter,
int *status);
void tdxillverdens_nthcomp(const double *ener0,
const int n_ener0,
double *photar,
const double *parameter,
const int n_parameter,
int *status);
/* get the version number text on the screen (if not already printed before */
void print_version_number(int *status);
/* get a new relbase parameter structure and initialize it */
relParam *new_relParam(int model_type, int emis_type, int *status);
/* free relbase parameter */
void free_relParam(relParam *);
xillParam *new_xillParam(int model_type, int prim_type, int *status);
void free_xillParam(xillParam *);
/* xspec local model wrapper functions **/
void lmodrelxill(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
void lmodrelxilllp(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
void lmodrelxilllpion(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
void lmodxillver(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
void lmodrelline(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
void lmodrellinelp(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
void lmodrelconv(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
void lmodrelconvlp(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
void lmodrelxilldens(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
void lmodrelxilllpdens(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
void lmodxillverdens(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
void lmodrelxillns(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
void lmodxillverns(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
void
lmodxillverco(const double *ener0, const int n_ener0, const double *parameter, int ifl, double *photar, double *photer,
const char *init);
void
lmodrelxillco(const double *ener0, const int n_ener0, const double *parameter, int ifl, double *photar, double *photer,
const char *init);
void lmodrelxillnthcomp(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
void lmodrelxilllpnthcomp(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
void lmodrelxilllpionnthcomp(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
void lmodxillvernthcomp(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
void lmodxillverdensnthcomp(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
void lmodrelxilllpdensnthcomp(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
void lmodrelxilldensnthcomp(const double *ener0,
const int n_ener0,
const double *parameter,
int ifl,
double *photar,
double *photer,
const char *init);
/** INTENSITY VERSION OF BASIC XILLVER MODEL FUNCTION (created by Adam)**/
void i_xillver_base(const double* ener0, const int n_ener0, double* photar, xillParam* param_struct, int* status);
/** created by Adam to adjust the normalization with reltrans**/
void i_tdxillver(const double* ener0, const int n_ener0, double* photar, const double* parameter, const int n_parameter, int* status);
/** created by Adam to adjust the normalization with reltrans**/
void i_tdxillverdens(const double* ener0, const int n_ener0, double* photar, const double* parameter, const int n_parameter, int* status);
/** created by Adam to adjust the normalization with reltrans**/
void i_tdxillver_nthcomp(const double* ener0, const int n_ener0, double* photar, const double* parameter, const int n_parameter, int* status);
/** created by Gullo to adjust the normalization with reltrans**/
void i_tdxillverdens_nthcomp(const double* ener0, const int n_ener0, double* photar, const double* parameter, const int n_parameter, int* status);
/**created by Gullo to call xillverDCp in reltrans fortran code**/
void lmodxillverf_(const double* ener0, const int* n_ener0, const double* parameter, int* ifl, double* photar, double* photer, const char* init);
void lmodxillverdensf_(const double* ener0, const int* n_ener0, const double* parameter, int* ifl, double* photar, double* photer, const char* init);
void lmodxillvernthcompf_(const double* ener0, const int* n_ener0, const double* parameter, int* ifl, double* photar, double* photer, const char* init);
void lmodxillverdensnthcompf_(const double* ener0, const int* n_ener0, const double* parameter, int* ifl, double* photar, double* photer, const char* init);
#endif /* MODELS_H_ */