mirror of
https://github.com/gwm17/catima.git
synced 2024-11-29 21:48:51 -05:00
50 lines
4.9 KiB
C++
50 lines
4.9 KiB
C++
|
#include <cstdint>
|
||
|
#include "catima/abundance_database.h"
|
||
|
#include <utility>
|
||
|
|
||
|
namespace abundance{
|
||
|
|
||
|
//int abundance_z_max
|
||
|
constexpr int abundance_z_max = 109;
|
||
|
// abundance_z_index[]
|
||
|
constexpr uint16_t abundance_z_index[] = {0,2,4,6,7,9,11,13,16,17,20,21,24,25,28,29,33,35,38,41,47,48,53,55,59,60,64,65,70,72,77,79,84,85,91,93,99,101,105,106,111,112,119,120,127,128,134,136,144,146,156,158,166,167,176,177,184,186,190,191,198,199,206,208,215,216,223,224,230,231,238,240,246,248,253,255,262,264,270,271,278,280,284,285,286,287,288,289,290,291,292,293,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312};
|
||
|
// isotopes_num_data
|
||
|
constexpr uint16_t isotopes_num_data = 313;
|
||
|
// isotopes_a
|
||
|
constexpr uint16_t isotopes_a[] = {1,2,4,3,7,6,9,11,10,12,13,14,15,16,18,17,19,20,22,21,23,24,26,25,27,28,29,30,31,32,34,33,36,35,37,40,36,38,39,41,40,40,44,42,48,43,46,45,48,46,47,49,50,51,50,52,53,50,54,55,56,54,57,58,59,58,60,62,61,64,63,65,64,66,68,67,70,69,71,74,72,70,73,76,75,80,78,76,82,77,74,79,81,84,86,82,83,80,78,85,87,88,86,87,84,89,90,94,92,91,96,93,98,96,95,92,100,97,94,98,102,104,101,99,100,96,98,103,106,108,105,110,104,102,107,109,114,112,111,110,113,116,106,108,115,113,120,118,116,119,117,124,122,112,114,115,121,123,130,128,126,125,124,122,123,120,127,132,129,131,134,136,130,128,124,126,133,138,137,136,135,134,130,132,139,138,140,142,138,136,141,142,144,146,143,145,148,150,145,152,154,147,149,148,150,144,153,151,158,160,156,157,155,154,152,159,164,162,163,161,160,158,156,165,166,168,167,170,164,162,169,174,172,173,171,176,170,168,175,176,180,178,177,179,176,174,181,180,184,186,182,183,180,187,185,192,190,189,188,187,186,184,193,191,195,194,196,198,192,190,197,202,200,199,201,198,204,196,205,203,208,206,207,204,209,209,210,222,223,226,227,232,231,238,235,234,237,244,243,247,247,251,252,257,258,259,262,261,262,266,264,269,268};
|
||
|
// isotopes_abundance
|
||
|
constexpr float isotopes_abundance[] = {0.999885,0.000115,0.99999863,1.37e-06,0.9241,0.0759,1.0,0.801,0.199,0.9893,0.0107,0.99632,0.00368,0.99757,0.00205,0.00038,1.0,0.9048,0.0925,0.0027,1.0,0.7899,0.1101,0.1,1.0,0.922297,0.046832,0.030871,1.0,0.9493,0.0429,0.0076,0.0002,0.7578,0.2422,0.996003,0.003365,0.000632,0.932581,0.067302,0.000117,0.96941,0.02086,0.00647,0.00187,0.00135,4e-05,1.0,0.7372,0.0825,0.0744,0.0541,0.0518,0.9975,0.0025,0.83789,0.09501,0.04345,0.02365,1.0,0.91754,0.05845,0.02119,0.00282,1.0,0.680769,0.262231,0.036345,0.011399,0.009256,0.6917,0.3083,0.4863,0.279,0.1875,0.041,0.0062,0.60108,0.39892,0.3628,0.2754,0.2084,0.0773,0.0761,1.0,0.4961,0.2377,0.0937,0.0873,0.0763,0.0089,0.5069,0.4931,0.57,0.173,0.1158,0.1149,0.0228,0.0035,0.7217,0.2783,0.8258,0.0986,0.07,0.0056,1.0,0.5145,0.1738,0.1715,0.1122,0.028,1.0,0.2413,0.1668,0.1592,0.1484,0.0963,0.0955,0.0925,1.0,0.3155,0.1862,0.1706,0.1276,0.126,0.0554,0.0187,1.0,0.2733,0.2646,0.2233,0.1172,0.1114,0.0102,0.51839,0.48161,0.2873,0.2413,0.128,0.1249,0.1222,0.0749,0.0125,0.0089,0.9571,0.0429,0.3258,0.2422,0.1454,0.0859,0.0768,0.0579,0.0463,0.0097,0.0066,0.0034,0.5721,0.4279,0.3408,0.3174,0.1884,0.0707,0.0474,0.0255,0.0089,0.0009,1.0,0.2689,0.2644,0.2118,0.1044,0.0887,0.0408,0.0192,0.0009,0.0009,1.0,0.71698,0.11232,0.07854,0.06592,0.02417,0.00106,0.00101,0.9991,0.0009,0.8845,0.11114,0.00251,0.00185,1.0,0.272,0.238,0.172,0.122,0.083,0.057,0.056,1.0,0.2675,0.2275,0.1499,0.1382,0.1124,0.0738,0.0307,0.5219,0.4781,0.2484,0.2186,0.2047,0.1565,0.148,0.0218,0.002,1.0,0.2818,0.2551,0.249,0.1891,0.0234,0.001,0.0006,1.0,0.3361,0.2678,0.2293,0.1493,0.0161,0.0014,1.0,0.3183,0.2183,0.1613,0.1428,0.1276,0.0304,0.0013,0.9741,0.0259,0.3508,0.2728,0.186,0.1362,0.0526,0.0016,0.99988,0.00012,0.3064,0.2843,0.265,0.1431,0.0012,0.626,0.374,0.4078,0.2626,0.1615,0.1324,0.0196,0.0159,0.0002,0.627,0.373,0.33832,0.32967,0.25242,0.07163,0.00782,0.00014,1.0,0.2986,0.231,0.1687,0.1318,0.0997,0.0687,0.0015,0.70476,0.29524,0.524,0.241,0.221,0.014,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.992745,0.0072,5.5e-05,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0};
|
||
|
|
||
|
int get_isotopes_num(int z){
|
||
|
if(z<1 || z>abundance_z_max)return 0;
|
||
|
int idx = abundance_z_index[z-1];
|
||
|
int hi=isotopes_num_data;
|
||
|
if(z < abundance_z_max)hi = abundance_z_index[z];
|
||
|
return hi-idx;
|
||
|
}
|
||
|
|
||
|
int get_isotope_a(int z, int i){
|
||
|
int num = get_isotopes_num(z);
|
||
|
if(num==0|| (i+1) > num)return 0;
|
||
|
return isotopes_a[abundance_z_index[z-1]+i];
|
||
|
}
|
||
|
|
||
|
float get_abundance(int z, int i){
|
||
|
int num = get_isotopes_num(z);
|
||
|
if(num==0|| (i+1) > num)return 0;
|
||
|
return isotopes_abundance[abundance_z_index[z-1]+i];
|
||
|
}
|
||
|
|
||
|
std::pair<int,float> get_isotope(int z, int i){
|
||
|
std::pair<int,float> res{0,0.0};
|
||
|
int num = get_isotopes_num(z);
|
||
|
if(num==0|| (i+1) > num)return res;
|
||
|
|
||
|
res.first = isotopes_a[abundance_z_index[z-1]+i];
|
||
|
res.second = isotopes_abundance[abundance_z_index[z-1]+i];
|
||
|
|
||
|
return res;
|
||
|
}
|
||
|
|
||
|
}
|