1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-26 12:08:52 -05:00

Merge pull request #52 from hrosiak/dev

Dev
This commit is contained in:
Andrej Prochazka 2019-05-12 01:47:25 +09:00 committed by GitHub
commit 275a5cd78e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 766 additions and 490 deletions

View File

@ -9,6 +9,7 @@
#include "catima/generated_LS_coeff.h"
#include "catima/nucdata.h"
#include "catima/storage.h"
#include "catima/srim.h"
#ifdef GLOBAL
extern "C"
{
@ -87,7 +88,7 @@ double bethek_dedx_e(Projectile &p, const Target &t, const Config &c, double I){
double f2 = log(2.0*electron_mass*1000000*beta2/Ipot);
double eta = beta*gamma;
if(!(c.dedx&corrections::no_shell_correction) && eta>=0.13){ //shell corrections
if(!(c.corrections&corrections::no_shell_correction) && eta>=0.13){ //shell corrections
double cor = (+0.422377*pow(eta,-2)
+0.0304043*pow(eta,-4)
-0.00038106*pow(eta,-6))*1e-6*pow(Ipot,2)
@ -99,21 +100,21 @@ double bethek_dedx_e(Projectile &p, const Target &t, const Config &c, double I){
f2+=2*log(gamma) -beta2;
double barkas=1.0;
if(!(c.dedx&corrections::no_barkas)){
if(!(c.corrections&corrections::no_barkas)){
barkas = bethek_barkas(zp_eff,eta,t.Z);
}
double delta = bethek_density_effect(beta, t.Z);
double LS = 0.0;
if(!(c.dedx&corrections::no_lindhard)){
if(!(c.corrections&corrections::no_lindhard)){
//double LS = bethek_lindhard(p);
LS = precalculated_lindhard(p);
}
double result = (f2)*barkas + LS - delta/2.;
result *=f1;
if( (p.T>50000.0) && !(c.dedx&corrections::no_highenergy)){
if( (p.T>50000.0) && !(c.corrections&corrections::no_highenergy)){
result += pair_production(p,t);
result += bremsstrahlung(p,t);
}
@ -443,144 +444,16 @@ double bremsstrahlung(const Projectile &p, const Target &t){
return 16.0*C*gamma*p.Z*p.Z*p.Z*p.Z*t.Z*t.Z*Lbs/(t.A*p.A*3.0*4.0*M_PI);
};
double sezi_p_se(double energy,const Target &t){
double sp = -1;
double e = 1000*energy; //e in keV/u
int i = t.Z - 1;
if(t.Z>92){
i = 91;
}
if(e<=25)e=25;
//double sl = (proton_stopping_coef[i][0]*pow(e,proton_stopping_coef[i][1])) + (proton_stopping_coef[i][2]*pow(e,proton_stopping_coef[i][3]));
//double sh = proton_stopping_coef[i][4]/pow(e,proton_stopping_coef[i][5]) * log( (proton_stopping_coef[i][6]/e) + (proton_stopping_coef[i][7]*e));
double sl = (proton_stopping_coef[i][0]*catima::power(e,proton_stopping_coef[i][1])) + (proton_stopping_coef[i][2]*catima::power(e,proton_stopping_coef[i][3]));
double sh = proton_stopping_coef[i][4]/catima::power(e,proton_stopping_coef[i][5]) * log( (proton_stopping_coef[i][6]/e) + (proton_stopping_coef[i][7]*e));
sp = sl*sh/(sl+sh);
e=1000*energy;
if(e<=25){
//sp *=(t.Z>6)?pow(e/25,0.45):pow(e/25,0.25);
sp *=(t.Z>6)?catima::power(e/25,0.45):catima::power(e/25,0.25);
}
return 100*sp*Avogadro/t.A;
}
double sezi_dedx_e(const Projectile &p, const Target &t){
double e=p.T*1000; // e in keV/u
double se = 0;
if(p.Z==1){
return sezi_p_se(p.T,t);
}
else if(p.Z == 2){
double a=0;
double b=0;
//double zeta = 0;
if(e<=1)e=1;
// He Zeff
b = log(e);
a = 0.2865 + b*(0.1266+ b*(-0.001429+ b*(0.02402 + b*(-0.01135 + b*0.001475))));
double heh = 1.0 - exp(-std::min(30.,a));
b = 7.6 - std::max(0., b);
a = (1.0 + (0.007 + 0.00005*t.Z)*exp(- b*b ));
heh *= a*a;
//zeta = sqrt(heh);
se = sezi_p_se(p.T,t)*heh*4.0; //scale proton stopping
if(e==1)se*= sqrt(p.T*1000.0); //vel proportional
return se;
}
else{ // heavy ion
double h1,h4;
double a,q,b;
double l1,l0,l;
double YRmin = 0.130; // YRmin = VR / ZP**0.67 <= 0.13 OR VR <= 1.0
double VRmin = 1.0;
double v=0;
double vfermi;
double yr=0;
double zeta = 0;
double se;
int i;
i = t.Z - 1;
if(t.Z>92){
i = 91;
}
vfermi = atima_vfermi[i];
v = sqrt(e/25.0)/vfermi;
double v2=v*v;
double vr = (v >= 1)? v*vfermi*(1.+ 1./(5.*v2)) : 3.0*vfermi/4.0*(1.0+v2*(2.0/3.0-v2/15.0));
h1= 1./catima::power(p.Z,0.6667);
yr = std::max(YRmin,vr*h1);
yr = std::max(yr, VRmin*h1);
//-- CALCULATE ZEFF
a = -0.803*catima::power(yr,0.3) + 1.3167*catima::power(yr,0.6) + 0.38157*yr + 0.008983*yr*yr;
q = std::min(1.0, std::max(0.0 , (1.0 - exp(-std::min(a, 50.0))))); //-- Q = IONIZATION LEVEL OF THE ION AT RELATIVE VELOCITY YR
//-- IONIZATION LEVEL TO EFFECTIVE CHARGE
h1 = 1./ catima::power(p.Z,0.3333);
b = (std::min(0.43, std::max(0.32,0.12 + 0.025*p.Z)))*h1;
l0 = (.8 - q * std::min(1.2,0.6 +p.Z/30.0))*h1;
if(q < 0.2){
l1 = 0;
}
else{
if (q < std::max(0.0,0.9-0.025*p.Z)){
l1 = b*(q-0.2)/fabs(std::max(0.0,0.9-0.025*p.Z)-0.2000001);
}
else{
if(q < std::max(0.0,1.0 - 0.025*std::min(16.,p.Z))) l1 = b;
else l1 = b*(1.0 - q)/(0.025*std::min(16.,p.Z));
}
}
// calculate screening
l = std::max(l1,l0*atima_lambda_screening[(int)p.Z-1]);
h1 =4.0*l*vfermi/1.919;
zeta = q + (1./(2.*(vfermi*vfermi)))*(1. - q)* log(1. + h1*h1);
// ZP**3 EFFECT AS IN REF. 779?
a = 7.6 - std::max(0.0, log(e));
zeta = zeta*(1. + (1./(p.Z*p.Z))*(0.18 + .0015*t.Z)*exp(-a*a));
h1= 1./catima::power(p.Z,0.6667);
if (yr <= ( std::max(YRmin, VRmin*h1))){
VRmin=std::max(VRmin, YRmin/h1);
//--C ..CALCULATE VELOCITY STOPPING FOR YR < YRmin
double vmin =.5*(VRmin + sqrt(std::max(0.0,VRmin*VRmin - .8*vfermi*vfermi)));
double eee = 25.0*vmin*vmin;
double eval = 1;
if((t.Z == 6) || (((t.Z == 14) || (t.Z == 32)) && (p.Z <= 19))) eval = 0.35;
else eval = 0.5;
h1 = zeta *p.Z;
h4 = catima::power(e / eee,eval);
se = sezi_p_se(eee*0.001,t) * h1*h1*h4;
return se;
}
else {
se = sezi_p_se(p.T,t)*catima::power(zeta*p.Z,2.0);
return se;
}
return 0;
}
};
double sezi_dedx_e(const Projectile &p, const Material &mat){
double sezi_dedx_e(const Projectile &p, const Material &mat, const Config &c){
double w;
double sum=0.0;
bool use95 = config_lowenergy(c) == low_energy_types::srim_95;
for(int i=0;i<mat.ncomponents();i++){
auto t = mat.get_element(i);
w = mat.weight_fraction(i);
sum += w*sezi_dedx_e(p,t);
sum += w*srim_dedx_e(p.Z,t.Z,p.T, use95)/t.A;
}
return sum;
return 100*sum*Avogadro; // returning MeV/g/cm2
}
@ -703,7 +576,7 @@ double dedx_variance(Projectile &p, Target &t, const Config &c){
double zp_eff = z_effective(p,t,c);
double f = domega2dx_constant*pow(zp_eff,2)*t.Z/t.A;
if(c.dedx_straggling == omega::atima){
if(config_omega(c) == omega_types::atima){
cor = 24.89 * pow(t.Z,1.2324)/(electron_mass*1e6 * beta2)*
log( 2.0*electron_mass*1e6*beta2/(33.05*pow(t.Z,1.6364)));
cor = std::max(cor, 0.0 );

View File

@ -91,17 +91,7 @@ namespace catima{
/**
* electronic energy loss for low energy, should be like SRIM
*/
double sezi_dedx_e(const Projectile &p, const Target &t);
/**
* electronic energy loss for low energy, should be like SRIM
*/
double sezi_dedx_e(const Projectile &p, const Material &mat);
/**
* electronic energy loss of protons for low energy, should be like SRIM
*/
double sezi_p_se(double energy,const Target &t);
double sezi_dedx_e(const Projectile &p, const Material &mat, const Config &c=default_config);
double angular_scattering_variance(Projectile &p, Target &t);

View File

@ -305,47 +305,53 @@ cdef class Config:
#self.cbase = catimac.Config()
self.cbase.z_effective = z_eff_type.pierce_blann
self.cbase.skip = 0
self.cbase.dedx = 0
self.cbase.dedx_straggling = omega_type.atima
self.cbase.calculation = 1
self.cbase.corrections = 0
def z_effective(self, val=None):
if(val is None):
return self.cbase.z_effective
else:
self.cbase.z_effective = val
def skip_calculation(self, val=None):
if(val is None):
return self.cbase.skip
else:
self.cbase.skip = val
def dedx(self, val=None):
def corrections(self, val=None):
if(val is None):
return self.cbase.dedx
return self.cbase.corrections
else:
self.cbase.dedx = val
def dedx_straggling(self, val=None):
self.cbase.corrections = val
def calculation(self, val=None):
if(val is None):
return self.cbase.dedx_straggling
return self.cbase.calculation
else:
self.cbase.dedx_straggling = val
self.cbase.calculation = val
def set(self,other):
if("z_effective" in other):
self.cbase.z_effective = other["z_effective"]
if("dedx" in other):
self.cbase.dedx = other["dedx"]
if("dedx_straggling" in other):
self.cbase.dedx_straggling = other["dedx_straggling"]
if("calculation" in other):
self.cbase.calculation = other["calculation"]
if("corrections" in other):
self.cbase.corrections = other["corrections"]
def get(self):
res = {}
res["z_effective"] = self.cbase.z_effective
res["dedx"] = self.cbase.dedx
res["dedx_straggling"] = self.cbase.dedx_straggling
res["corrections"] = self.cbase.corrections
res["calculation"] = self.cbase.calculation
res["skip"] = self.cbase.skip
return res
def print_info(self):
print("z_effective = %s"%z_eff_type(self.cbase.z_effective))
print("dedx_straggling = %s"%omega_type(self.cbase.dedx_straggling))
print("calculation = %s"%omega_type(self.cbase.dedx_straggling))
default_config = Config()
@ -464,9 +470,6 @@ def w_magnification(Projectile projectile, Material material, energy = None, Con
energy = projectile.T()
return catimac.w_magnification(projectile.cbase,energy, material.cbase, config.cbase)
def sezi_dedx_e(Projectile projectile, Target t):
return catimac.sezi_dedx_e(projectile.cbase, t.cbase)
def bethek_dedx_e(Projectile projectile, Target t, Config c = default_config, Ipot=0.0):
return catimac.bethek_dedx_e(projectile.cbase, t.cbase,c.cbase,Ipot)

View File

@ -68,8 +68,8 @@ cdef extern from "catima/config.h" namespace "catima":
cdef struct Config:
char z_effective;
char skip;
char dedx;
char dedx_straggling
char corrections;
char calculation;
cdef extern from "catima/catima.h" namespace "catima":
cdef double dedx(Projectile &p, double T, const Material &t,const Config &c)
@ -96,7 +96,6 @@ cdef extern from "catima/calculations.h" namespace "catima":
cdef double bethek_lindhard(const Projectile &p);
cdef double bethek_lindhard_X(const Projectile &p);
cdef double bethek_dedx_e(Projectile &p,const Target &t, const Config &c, double I);
cdef double sezi_dedx_e(const Projectile &p, const Target &t);
cdef double z_effective(const Projectile &p, const Target &t, const Config &c);
cdef double z_eff_Pierce_Blann(double z, double beta);
cdef double z_eff_Anthony_Landford(double pz, double beta, double tz);

View File

@ -8,7 +8,7 @@ namespace catima{
* \enum z_eff_type
* enum to select formulat to calculate effective charge of the Projectile
*/
enum z_eff_type:char {
enum z_eff_type:unsigned char {
none = 0,
pierce_blann = 1,
anthony_landorf = 2,
@ -43,11 +43,19 @@ namespace catima{
/**
* enum to select which dEdx straggling options
*/
enum omega:unsigned char{
enum omega_types:unsigned char{
atima = 0,
bohr = 1,
};
/**
* enum to select which how low energy part is calculated
*/
enum low_energy_types:unsigned char{
srim_85 = 0,
srim_95 = 1,
};
/**
* structure to store calculation configuration
* each group of options are grouped and enum are suppose to use
@ -57,17 +65,39 @@ namespace catima{
*
*/
struct Config{
#ifndef GLOBAL
unsigned char z_effective=z_eff_type::pierce_blann;
//char z_effective=z_eff_type::atima14;
unsigned char dedx = 0;
unsigned char dedx_straggling = omega::bohr;
#else
unsigned char z_effective=z_eff_type::atima14;
#endif
#ifdef REACTIONS
unsigned char skip=skip_none;
#else
unsigned char skip=skip_calculation::skip_reactions;
#endif
unsigned char corrections = 0;
unsigned char calculation = 1;
};
inline void set_config_lowenergy(Config c, low_energy_types lt){
c.corrections = c.corrections & (lt<<2);
}
inline unsigned char config_lowenergy(const Config c){
return (c.corrections>>2) & 0x7;
}
inline void set_config_omega(Config c, omega_types ot){
c.corrections = c.corrections & ot;
}
inline unsigned char config_omega(const Config c){
return c.corrections & 0x3;
}
extern Config default_config;
}

View File

@ -4,7 +4,7 @@
// this is taken from atima
namespace catima{
/*
constexpr double proton_stopping_coef[92][8] = { // proton in material stopping coefficient
{ .0091827, .0053496, .69741, .48493, 316.07,1.0143, 9329.3, .0539890}, //H
{ .11393, .0051984, 1.0822, .39252, 1081.0, 1.0645, 4068.5, .0176990}, //He
@ -289,8 +289,9 @@ const double atima_lambda_screening[92]= {
1.16,
1.16,
1.16};
}
*/
}
namespace density_effect{
const double x0[97]= {
1.8639, 2.2017, 0.1304, 0.0592, 0.0305, -.0178, 1.7378, 1.7541, 1.8433, 2.0735,

View File

@ -1,288 +0,0 @@
#ifndef SRIM_DATA
#define SRIM_DATA
// this is take from atima
constexpr double proton_stopping_coef[92][8] = { // proton in material stopping coefficient
{ .0091827, .0053496, .69741, .48493, 316.07,1.0143, 9329.3, .0539890}, //H
{ .11393, .0051984, 1.0822, .39252, 1081.0, 1.0645, 4068.5, .0176990}, //He
{ .85837, .0050147, 1.6044, .38844, 1337.3, 1.0470, 2659.2, .01898},
{ .8781, .0051049, 5.4232, .2032, 1200.6, 1.0211, 1401.8, .0385290},
{ 1.4608, .0048836, 2.338, .44249, 1801.3, 1.0352, 1784.1, .02024},
{ 3.2579, .0049148, 2.7156, .36473, 2092.2, 1.0291, 2643.6, .0182370}, //C
{ .59674, .0050837, 4.2073, .30612, 2394.2, 1.0255, 4892.1, .0160060},
{ .75253, .0050314, 4.0824, .30067, 2455.8, 1.0181, 5069.7, .0174260}, //O
{ 1.226, .0051385, 3.2246, .32703, 2525.0, 1.0142, 7563.6, .0194690},
{ 1.0332, .0051645, 3.004, .33889, 2338.6, .99997, 6991.2, .0217990}, //Ne
{ 6.0972, .0044292, 3.1929, .45763, 1363.3, .95182, 2380.6, .0818350},
{14.013, .0043646, 2.2641, .36326, 2187.4, .99098, 6264.8, .0462},
{ .039001, .0045415, 5.5463, .39562, 1589.2, .95316, 816.16, .0474840},
{ 2.072, .0044516, 3.5585, .53933, 1515.2, .93161, 1790.3, .0351980},
{17.575, .0038346, .078694, 1.2388,2806.0, .97284, 1037.6, .0128790},
{16.126, .0038315, .054164, 1.3104,2813.3, .96587, 1251.4, .0118470},
{ 3.217, .0044579, 3.6696, .5091, 2734.6, .96253, 2187.5, .0169070},
{ 2.0379, .0044775, 3.0743, .54773, 3505.0, .97575, 1714.00, .0117010},
{ .74171, .0043051, 1.1515, .95083, 917.21, .8782, 389.93, .18926},
{ 9.1316, .0043809, 5.4611, .31327, 3891.8, .97933, 6267.9, .0151960}, //Ca
{ 7.2247, .0043718, 6.1017, .37511, 2829.2, .95218, 6376.1, .0203980},
{ .147, .0048456, 6.3485, .41057, 2164.1, .94028, 5292.6, .0502630},
{ 5.0611, .0039867, 2.6174, .57957, 2218.9, .92361, 6323.00, .0256690},
{ .53267, .0042968, .39005, 1.2725, 1872.7, .90776, 64.166, .0301070},
{ .47697, .0043038, .31452, 1.3289, 1920.5, .90649, 45.576, .0274690},
{ .027426, .0035443, .031563, 2.1755, 1919.5, .90099, 23.902, .0253630},
{ .16383, .0043042, .073454, 1.8592, 1918.4, .89678, 27.61, .0231840},
{ 4.2562, .0043737, 1.5606, .72067, 1546.8, .87958, 302.02, .0409440}, //Ni
{ 2.3508, .0043237, 2.882, .50113, 1837.7, .89992, 2377.00, .04965},
{ 3.1095, .0038455, .11477, 1.5037, 2184.7, .89309, 67.306, .0165880},
{15.322, .0040306, .65391, .67668, 3001.7, .92484, 3344.2, .0163660},
{ 3.6932, .0044813, 8.608, .27638, 2982.7, .9276, 3166.6, .0308740},
{ 7.1373, .0043134, 9.4247, .27937, 2725.8, .91597, 3166.1, .0250080},
{ 4.8979, .0042937, 3.7793, .50004, 2824.5, .91028, 1282.4, .0170610},
{ 1.3683, .0043024, 2.5679, .60822, 6907.8, .9817, 628.01, .0068055},
{ 1.8301, .0042983, 2.9057, .6038, 4744.6, .94722, 936.64, .0092242},
{ .42056, .0041169, .01695, 2.3616, 2252.7, .89192, 39.752, .0277570},
{30.78, .0037736, .55813, .76816, 7113.2, .97697, 1604.4, .0065268},
{11.576, .0042119, 7.0244, .37764, 4713.5, .94264, 2493.2, .01127},
{ 6.2406, .0041916, 5.2701, .49453, 4234.6, .93232, 2063.9, .0118440},
{ .33073, .0041243, 1.7246, 1.1062, 1930.2, .86907, 27.416, .0382080},
{ .017747, .0041715, .14586, 1.7305,1803.6, .86315, 29.669, .0321230},
{ 3.7229, .0041768, 4.6286, .56769, 1678.0, .86202, 3094.00, .06244},
{ .13998, .0041329, .25573, 1.4241, 1919.3, .86326, 72.797, .0322350},
{ .2859, .0041386, .31301, 1.3424, 1954.8, .86175, 115.18, .0293420},
{ .76, .0042179, 3.386, .76285, 1867.4, .85805, 69.994, .0364480},
{ 6.3957, .0041935, 5.4689, .41378, 1712.6, .85397,18493.00, .0564710},
{ 3.4717, .0041344, 3.2337, .63788, 1116.4, .81959, 4766.0, .1179},
{ 2.5265, .0042282, 4.532, .53562, 1030.8, .81652,16252.0, .19722},
{ 7.3683, .0041007, 4.6791, .51428, 1160.0, .82454,17965.0, .13316},
{ 7.7197, .004388, 3.242, .68434, 1428.1, .83398, 1786.7, .0665120},
{16.78, .0041918, 9.3198, .29568, 3370.9, .90289, 7431.7, .02616},
{ 4.2132, .0042098, 4.6753, .57945, 3503.9, .89261, 1468.9, .0143590},
{ 4.0818, .004214, 4.4425, .58393, 3945.3, .90281, 1340.5, .0134140}, //Xe
{.18517, .0036215, .00058788,3.5315, 2931.3, .88936, 26.18, .0263930},
{ 4.8248, .0041458, 6.0934, .57026, 2300.1, .86359, 2980.7, .0386790},
{ .49857, .0041054, 1.9775, .95877, 786.55, .78509, 806.6, .40882},
{ 3.2754, .0042177, 5.768, .54054, 6631.3, .94282, 744.07, .0083026},
{ 2.9978, .0040901, 4.5299, .62025, 2161.2, .85669, 1268.6, .0430310},
{ 2.8701, .004096, 4.2568, .6138, 2130.4, .85235, 1704.1, .0393850},
{10.853, .0041149, 5.8907, .46834, 2857.2, .8755, 3654.2, .0299550},
{ 3.6407, .0041782, 4.8742, .57861, 1267.7, .82211, 3508.2, .24174},
{17.645, .0040992, 6.5855, .32734, 3931.3, .90754, 5156.7, .0362780},
{ 7.5309, .0040814, 4.9389, .50679, 2519.7, .85819, 3314.6, .0305140},
{ 5.4742, .0040829, 4.897, .51113, 2340.1, .85296, 2342.7, .0356620},
{ 4.2661, .0040667, 4.5032, .55257, 2076.4, .84151, 1666.6, .0408010},
{ 6.8313, .0040486, 4.3987, .51675, 2003.0, .83437, 1410.4, .03478},
{ 1.2707, .0040553, 4.6295, .57428, 1626.3, .81858, 995.68, .0553190},
{ 5.7561, .0040491, 4.357, .52496, 2207.3, .83796, 1579.5, .0271650},
{14.127, .0040596, 5.8304, .37755, 3645.9, .87823, 3411.8, .0163920},
{ 6.6948, .0040603, 4.9361, .47961, 2719.0, .85249, 1885.8, .0197130},
{ 3.0619, .0040511, 3.5803, .59082, 2346.1, .83713, 1222.0, .0200720},
{10.811, .0033008, 1.3767, .76512, 2003.7, .82269, 1110.6, .0249580},
{ 2.7101, .0040961, 1.2289, .98598, 1232.4, .79066, 155.42, .0472940},
{ .52345, .0040244, 1.4038, .8551, 1461.4, .79677, 503.34, .0367890},
{ .4616, .0040203, 1.3014, .87043, 1473.5, .79687, 443.09, .0363010},
{ .97814, .0040374, 2.0127, .7225, 1890.8, .81747, 930.7, .02769},
{ 3.2086, .004051, 3.6658, .53618, 3091.2, .85602, 1508.1, .0154010},
{ 2.0035, .0040431, 7.4882, .3561, 4464.3, .88836, 3966.5, .0128390},
{15.43, .0039432, 1.1237, .70703, 4595.7, .88437, 1576.5, .0088534},
{ 3.1512, .0040524, 4.0996, .5425, 3246.3, .85772, 1691.8, .0150580},
{ 7.1896, .0040588, 8.6927, .35842, 4760.6, .88833, 2888.3, .0110290}, //Pb
{ 9.3209, .004054, 11.543, .32027, 4866.2, .89124, 3213.4, .0119350},
{29.242, .0036195, .16864, 1.1226, 5688.0, .89812, 1033.3, .0071303},
{ 1.8522, .0039973, 3.1556, .65096, 3755.0, .86383, 1602.0, .0120420},
{ 3.222, .0040041, 5.9024, .52678, 4040.2, .86804, 1658.4, .0117470},
{ 9.3412, .0039661, 7.921, .42977, 5180.9, .88773, 2173.2, .0092007},
{36.183, .0036003, .58341, .86747, 6990.2, .91082, 1417.1, .0062187},
{ 5.9284, .0039695, 6.4082, .52122, 4619.5, .88083, 2323.5, .0116270},
{ 5.2454, .0039744, 6.7969, .48542, 4586.3, .87794, 2481.5, .0112820},
{33.702, .0036901, .47257, .89235, 5295.7, .8893, 2053.3, .0091908},
{2.7589, .0039806, 3.2092, .66122, 2505.4, .82863, 2065.1, .0228160} //U
};
const double srim_vfermi[92] = {
1.0309,
0.15976,
0.59782,
1.0781,
1.0486,
1.00,
1.058,
0.93942,
0.74562,
0.3424,
0.45259,
0.71074,
0.90519,
0.97411,
0.97184,
0.89852,
0.70827,
0.39816,
0.36552,
0.62712,
0.81707,
0.9943,
1.1423,
1.2381,
1.1222,
0.92705,
1.0047,
1.2,
1.0661,
0.97411,
0.84912,
0.95,
1.0903,
1.0429,
0.49715,
0.37755,
0.35211,
0.57801,
0.77773,
1.0207,
1.029,
1.2542,
1.122,
1.1241,
1.0882,
1.2709,
1.2542,
0.90094,
0.74093,
0.86054,
0.93155,
1.0047,
0.55379,
0.43289,
0.32636,
0.5131,
0.6950,
0.72591,
0.71202,
0.67413,
0.71418,
0.71453,
0.5911,
0.70263,
0.68049,
0.68203,
0.68121,
0.68532,
0.68715,
0.61884,
0.71801,
0.83048,
1.1222,
1.2381,
1.045,
1.0733,
1.0953,
1.2381,
1.2879,
0.78654,
0.66401,
0.84912,
0.88433,
0.80746,
0.43357,
0.41923,
0.43638,
0.51464,
0.73087,
0.81065,
1.9578,
1.0257};
double srim_lambda_screening[92]= {
1.00,
1.00,
1.10,
1.06,
1.01,
1.03,
1.04,
0.99,
0.95,
0.90,
0.82,
0.81,
0.83,
0.88,
1.00,
0.95,
0.97,
0.99,
0.98,
0.97,
0.98,
0.97,
0.96,
0.93,
0.91,
0.9,
0.88,
0.9,
0.9,
0.9,
0.9,
0.85,
0.9,
0.9,
0.91,
0.92,
0.9,
0.9,
0.9,
0.9,
0.9,
0.88,
0.9,
0.88,
0.88,
0.9,
0.9,
0.88,
0.9,
0.9,
0.9,
0.9,
0.96,
1.2,
0.9,
0.88,
0.88,
0.85,
0.90,
0.90,
0.92,
0.95,
0.99,
1.03,
1.05,
1.07,
1.08,
1.10,
1.08,
1.08,
1.08,
1.08,
1.09,
1.09,
1.10,
1.11,
1.12,
1.13,
1.14,
1.15,
1.17,
1.20,
1.18,
1.17,
1.17,
1.16,
1.16,
1.16,
1.16,
1.16,
1.16,
1.16};
#endif

652
srim.cpp Normal file
View File

@ -0,0 +1,652 @@
#include "srim.h"
#include <cmath>
#include <algorithm>
namespace catima{
/**
* return SRIM proton stopping power
* @param Z - proton number of material
* @param energy - energy per nuclein in MeV/u
*/
double p_se(int Z, double energy){
double sp = -1;
double e = 1000*energy; //e in keV/u
int i = Z - 1;
if(Z>92){ // dealing with trans-U where no Srim data
i = 91;
}
if(e<=25)e=25;
double sl = (pse_95[i][0]*std::pow(e,pse_95[i][1])) + (pse_95[i][2]*std::pow(e,pse_95[i][3]));
double sh = pse_95[i][4]/std::pow(e,pse_95[i][5]) * std::log( (pse_95[i][6]/e) + (pse_95[i][7]*e));
sp = sl*sh/(sl+sh);
e=1000*energy;
if(e<=25){
sp *=(Z>6)?std::pow(e/25.0,0.45):std::pow(e/25.0,0.25);
}
return sp;
};
/**
* return SRIM proton stopping power
* @param Z - proton number of material
* @param energy - energy per nuclein in MeV/u
*/
double p_se85(int Z, double energy){
double sp = -1;
double e = 1000*energy; //e in keV/u
int i = Z - 1;
if(Z>92){ // dealing with trans-U where no Srim data
i = 91;
}
if(e<=25)e=25;
double sl = (proton_stopping_coef[i][0]*std::pow(e,proton_stopping_coef[i][1])) + (proton_stopping_coef[i][2]*std::pow(e,proton_stopping_coef[i][3]));
double sh = proton_stopping_coef[i][4]/std::pow(e,proton_stopping_coef[i][5]) * std::log( (proton_stopping_coef[i][6]/e) + (proton_stopping_coef[i][7]*e));
sp = sl*sh/(sl+sh);
e=1000*energy;
if(e<=25){
sp *=(Z>6)?std::pow(e/25.0,0.45):std::pow(e/25.0,0.25);
}
return sp;
};
/**
* return srim stopping power
* @param pZ - projectile Z
* @param pZ - material Z
* @param energy - projectile energy in MeV/u unit
*/
double srim_dedx_e(int pZ, int tZ, double energy, bool use_new){
double e=energy*1000; // e in keV/u
double se = 0;
double (*const fp_se)(int, double) = (use_new)?p_se:p_se85;
// double (*const fp_se)(int, double) = p_se85;
if(pZ==1){
return (*fp_se)(tZ, energy);
}
else if(pZ == 2){
double a=0;
double b=0;
if(e<=1)e=1;
// He Zeff
b = log(e);
a = 0.2865 + b*(0.1266+ b*(-0.001429+ b*(0.02402 + b*(-0.01135 + b*0.001475))));
double heh = 1.0 - exp(-std::min(30.,a));
b = 7.6 - std::max(0., b);
a = (1.0 + (0.007 + 0.00005*tZ)*exp(- b*b ));
heh *= a*a;
//zeta = sqrt(heh);
se = (*fp_se)(tZ, energy)*heh*4.0; //scale proton stopping
if(e==1)se*= sqrt(e); //vel proportional
return se;
}
else{ // heavy ion
double h1,h4;
double a,q,b;
double l1,l0,l;
double YRmin = 0.130; // YRmin = VR / ZP**0.67 <= 0.13 OR VR <= 1.0
double VRmin = 1.0;
double v=0;
double vfermi;
double yr=0;
double zeta = 0;
double se;
int i;
i = tZ - 1;
if(tZ>92){
i = 91;
}
vfermi = atima_vfermi[i];
v = sqrt(e/25.0)/vfermi;
double v2=v*v;
double vr = (v >= 1)? v*vfermi*(1.+ 1./(5.*v2)) : 3.0*vfermi/4.0*(1.0+v2*(2.0/3.0-v2/15.0));
h1= 1./std::pow(pZ,0.6667);
yr = std::max(YRmin,vr*h1);
yr = std::max(yr, VRmin*h1);
//-- CALCULATE ZEFF
a = -0.803*std::pow(yr,0.3) + 1.3167*std::pow(yr,0.6) + 0.38157*yr + 0.008983*yr*yr;
q = std::min(1.0, std::max(0.0 , (1.0 - exp(-std::min(a, 50.0))))); //-- Q = IONIZATION LEVEL OF THE ION AT RELATIVE VELOCITY YR
//-- IONIZATION LEVEL TO EFFECTIVE CHARGE
h1 = 1./ std::pow(pZ,0.3333);
b = (std::min(0.43, std::max(0.32,0.12 + 0.025*pZ)))*h1;
l0 = (.8 - q * std::min(1.2,0.6 +pZ/30.0))*h1;
if(q < 0.2){
l1 = 0;
}
else{
if (q < std::max(0.0,0.9-0.025*pZ)){
l1 = b*(q-0.2)/fabs(std::max(0.0,0.9-0.025*pZ)-0.2000001);
}
else{
if(q < std::max(0.0,1.0 - 0.025*std::min(16.,(double)pZ))) l1 = b;
else l1 = b*(1.0 - q)/(0.025*std::min(16.,(double)pZ));
}
}
// calculate screening
i = (pZ>92)?91:pZ-1;
l = std::max(l1,l0*atima_lambda_screening[i]);
h1 =4.0*l*vfermi/1.919;
zeta = q + (1./(2.*(vfermi*vfermi)))*(1. - q)* log(1. + h1*h1);
// ZP**3 EFFECT AS IN REF. 779?
a = 7.6 - std::max(0.0, log(e));
zeta = zeta*(1. + (1./(pZ*pZ))*(0.18 + .0015*tZ)*exp(-a*a));
h1= 1./std::pow(pZ,0.6667);
if (yr <= ( std::max(YRmin, VRmin*h1))){
VRmin=std::max(VRmin, YRmin/h1);
//--C ..CALCULATE VELOCITY STOPPING FOR YR < YRmin
double vmin =.5*(VRmin + sqrt(std::max(0.0,VRmin*VRmin - .8*vfermi*vfermi)));
double eee = 25.0*vmin*vmin;
double eval = 1;
// if((tZ == 6) || (((tZ == 14) || (tZ == 32)) && (pZ <= 19))) eval = 0.375;
if((tZ == 6) || (((tZ == 14) || (tZ == 32)) && (pZ <= 19))) eval = 0.35;
else eval = 0.5;
h1 = zeta *pZ;
h4 = std::pow(e / eee,eval);
se = (*fp_se)(tZ, eee*0.001) * h1*h1*h4;
return se;
}
else {
return (*fp_se)(tZ,energy)*std::pow(zeta*pZ,2.0);
}
return 0;
}
};
const double pse_95[92][8] = {
//H
{0.0128116,0.00533047,0.651042,0.531902,1959.01,1.1887,598.263,0.00954514},
//He
{0.311787,0.00499529,0.118546,0.920917,984.843,1.08223,554.388,0.0505072},
//Li
{0.644503,0.00500368,0.866544,0.567488,962.9,1.01566,1620.34,0.0237767},
//Be
{0.953561,0.00507406,1.3045,0.5903,1945.12,1.05703,326.951,0.0130441},
//B
{1.53151,0.0048852,2.5676,0.423246,1738.88,1.03208,1829.42,0.0200331},
//C
{2.40289,0.00491497,2.49101,0.414939,1858.36,1.01581,2504.17,0.0181984},
//N
{3.31007,0.00495744,0.540621,0.77994,1104.15,0.967848,2235.35,0.0531612},
//O
{0.972706,0.0050039,1.35102,0.5498,1254.28,0.968356,5093.2,0.0536453},
//F
{0.690408,0.00462723,0.326749,1.1052,1301.9,0.943525,47.0373,0.0280245},
//Ne
{0.281235,0.00459698,0.52563,0.878183,1158.3,0.938564,10.1606,0.0414147},
//Na
{2.15352,0.00440847,2.30923,0.606001,1332.24,0.943478,735.116,0.0577231},
//Mg
{3.42983,0.00436897,2.39377,0.554737,1140.29,0.929844,2107.48,0.0789342},
//Al
{0.0389096,0.00454168,4.27975,0.478838,1316.42,0.934106,565.574,0.052722},
//Si
{1.33101,0.00443533,1.52262,0.775843,1227.02,0.914146,1091.17,0.0444972},
//P
{5.78119,0.00398281,0.324072,1.22769,673.459,0.865731,123.619,0.182036},
//S
{0.611741,0.00446376,3.38101,0.542907,1160.67,0.912049,14031.2,0.087705},
//Cl
{1.15307,0.00447333,4.20464,0.538231,1301.13,0.902702,4923.01,0.0525717},
//Ar
{1.70408,0.00447609,2.75072,0.583835,2713.93,0.953183,2035.79,0.0146897},
//K
{2.60265,0.00432185,1.56811,0.864656,556.393,0.84475,120.01,0.962648},
//Ca
{0.536555,0.00440846,3.22706,0.602927,500.851,0.83345,1766.39,2.02699},
//Sc
{1.7187,0.00436934,4.60285,0.516212,1601.6,0.914664,6341.68,0.0629243},
//Ti
{0.146403,0.00484558,5.54014,0.455903,1763.46,0.919014,3951.93,0.0550341},
//V
{4.21238,0.0040013,3.79858,0.482892,2416.97,0.936204,7735.96,0.0289635},
//Cr
{0.697881,0.00430794,2.2863,0.784069,967.872,0.857874,17.8526,0.111149},
//Mn
{0.592743,0.00431334,1.40625,0.968261,1426.42,0.881488,14.4002,0.0424183},
//Fe
{0.0283155,0.00354506,0.564961,1.24111,1527.81,0.881848,25.9497,0.0354067},
//Co
{0.269545,0.00432088,2.24249,0.764706,1243.91,0.867051,23.4911,0.0604457},
//Ni
{3.68234,0.00437139,1.52146,0.736656,1470.86,0.874909,251.685,0.0428115},
//Cu
{2.15403,0.00432278,2.6939,0.523003,1717.27,0.893617,2099.38,0.0525222},
//Zn
{0.531847,0.00382833,0.675606,1.06647,1008.48,0.826099,35.8939,0.0419818},
//Ga
{6.91973,0.00401198,0.522284,0.974708,899.033,0.821636,371.581,0.0738361},
//Ge
{1.80976,0.00448896,5.6612,0.418493,1558.21,0.870542,1756.05,0.0605859},
//As
{1.64641,0.00430255,5.12108,0.516356,1020.24,0.832723,2202.77,0.0846531},
//Se
{4.0715,0.00429051,3.33803,0.543517,2606.26,0.903072,1089.74,0.0181133},
//Br
{1.99798,0.00429503,3.23907,0.593111,4645.72,0.947444,640.841,0.0096946},
//Kr
{5.08884,0.0042563,1.43,0.722156,7087.78,0.979865,762.818,0.00604351},
//Rb
{0.62637,0.00413189,0.0666229,2.65318,1074.6,0.814706,8.69523,0.0504427},
//Sr
{5.04987,0.00393427,4.95613,0.527062,1886.17,0.868672,4817.65,0.0349423},
//Y
{1.17376,0.00421587,5.93823,0.49052,1556.91,0.849851,7821.93,0.0434207},
//Zr
{7.26083,0.00419413,5.93121,0.447579,4687.69,0.939722,2446.36,0.0101526},
//Nb
{0.351621,0.00412551,1.33637,1.28649,1495.35,0.850544,12.7864,0.0471084},
//Mo
{0.0179112,0.00417066,1.16601,1.18837,1260.27,0.825733,12.9721,0.0482827},
//Tc
{3.72287,0.00417681,4.6286,0.567689,1678.02,0.86202,3093.95,0.0624402},
//Ru
{0.0179112,0.00417066,1.16601,1.18837,1260.27,0.825733,12.9721,0.0482827},
//Rh
{0.307959,0.00414183,0.545099,1.36766,1499.06,0.836456,26.5156,0.0382323},
//Pd
{0.813324,0.00421976,5.48878,0.621228,1491.47,0.843298,17.0197,0.0633415},
//Ag
{2.89508,0.00420494,5.30021,0.458632,1380.77,0.835929,13156.5,0.07682},
//Cd
{3.47169,0.0041344,3.23372,0.637885,1116.36,0.819589,4766.03,0.117895},
//In
{2.28576,0.00422582,3.48478,0.625713,804.033,0.79599,8953.57,0.302479},
//Sn
{4.70915,0.00409414,3.88322,0.582491,1031.4,0.815544,13300.4,0.167355},
//Sb
{7.35883,0.00438746,3.2273,0.693616,1364.65,0.832171,1512.36,0.0787703},
//Te
{1.20379,0.00421476,4.65732,0.615557,857.568,0.794208,5814.37,0.255765},
//I
{4.21323,0.00420978,4.67533,0.579451,3503.93,0.892614,1468.87,0.014359},
//Xe
{10.0615,0.00391035,0.364002,1.20347,1539.97,0.821892,1424.28,0.0402424},
//Cs
{0.373157,0.00364035,2.26519,1.151,1675.29,0.837764,13.0656,0.0516993},
//Ba
{4.82483,0.00414578,6.09343,0.570256,2300.11,0.863588,2980.72,0.0386788},
//La
{0.574872,0.00410857,2.76314,0.878406,654.727,0.777081,460.584,0.963426},
//Ce
{3.27544,0.00421774,5.76803,0.54054,6631.29,0.942817,744.066,0.00830259},
//Pr
{2.99783,0.00409014,4.52986,0.620247,2161.15,0.856688,1268.59,0.0430305},
//Nd
{3.02248,0.00410313,3.16182,0.750444,687.321,0.765038,363.38,0.389438},
//Pm
{3.5655,0.00411367,6.01196,0.521709,1830.02,0.838996,3661.99,0.0575667},
//Sm
{3.64072,0.0041782,4.87424,0.578614,1267.7,0.822111,3508.17,0.241737},
//Eu
{0.542525,0.00412806,4.33656,0.639323,1107.85,0.788122,352.321,0.0946601},
//Gd
{7.54702,0.00408134,4.92913,0.507107,2565.83,0.861877,3299.96,0.031273},
//Tb
{4.43006,0.00419028,5.3921,0.508608,3605.27,0.885038,1687.86,0.0164866},
//Dy
{4.31706,0.00406269,3.55237,0.572971,2138.74,0.839174,3204.35,0.029471},
//Ho
{2.73097,0.00402842,3.1059,0.645438,1802.36,0.820889,691.941,0.0306839},
//Er
{1.27982,0.00405535,4.63018,0.573846,1595.12,0.816419,1067.28,0.0552321},
//Tm
{5.75613,0.00404905,4.357,0.524956,2207.32,0.837956,1579.51,0.027165},
//Yb
{9.2061,0.00403636,3.37689,0.572174,3660.35,0.868034,1191.14,0.00953995},
//Lu
{8.23962,0.00404348,3.83028,0.534511,4357.71,0.882431,1524.26,0.00786437},
//Hf
{3.06189,0.00405111,3.5803,0.59082,2346.1,0.837132,1221.99,0.0200717},
//Ta
{7.99485,0.00329576,1.26335,0.777934,1804.13,0.8124,1266.3,0.0263526},
//W
{6.48326,0.00414609,0.776185,1.08393,250.557,0.643106,177.277,0.898821},
//Re
{0.620494,0.00403017,2.53792,0.677642,727.918,0.74834,117.069,0.201369},
//Os
{0.551045,0.00402571,2.70928,0.68387,1089.46,0.777755,1088.3,0.0810305},
//Ir
{1.26011,0.00404797,3.57127,0.525416,2613.09,0.853001,2155.71,0.0282139},
//Pt
{3.20857,0.00405101,3.66577,0.536178,3091.16,0.856024,1508.12,0.0154014},
//Au
{1.04066,0.00405071,5.61035,0.439133,3646.13,0.869259,2878.4,0.0139437},
//Hg
{1.04586,0.00405038,5.38433,0.445067,3717.15,0.87031,2907.28,0.0132933},
//Tl
{3.15124,0.00405235,4.09956,0.542499,3246.31,0.857723,1691.77,0.0150581},
//Pb
{3.06995,0.00405334,6.62045,0.452822,3380.58,0.860267,2638.56,0.0153938},
//Bi
{3.84541,0.00406028,8.7792,0.442301,2721.99,0.843866,2513.15,0.0228962},
//Po
{4.36117,0.00405648,8.18512,0.43626,3113.58,0.852235,3001.79,0.0172051},
//At
{4.36117,0.00405648,8.18512,0.43626,3113.58,0.852235,3001.79,0.0172051},
//Rn
{3.222,0.00400409,5.90236,0.526779,4040.15,0.868037,1658.35,0.0117469},
//Fr
{9.34124,0.00396606,7.92099,0.429769,5180.9,0.887726,2173.16,0.0092007},
//Ra
{6.28686,0.00396735,5.81778,0.535859,4866.43,0.884427,2257.34,0.0105815},
//Ac
{5.92839,0.00396948,6.40824,0.521225,4619.51,0.880827,2323.52,0.0116274},
//Th
{5.24536,0.0039744,6.79689,0.485424,4586.31,0.877944,2481.5,0.0112824},
//Pa
{2.77047,0.00398192,3.55107,0.638231,2516.88,0.829309,2155.59,0.0231207},
//U
{2.78483,0.00398116,3.32988,0.647983,2662.77,0.83678,2337.43,0.024074}
};
//constexpr double hps[92][4] = {
//skipHPS_COEFFICIENTS//
//}
//constexpr double v_fermi[92] = {
//skipV_FERMI//
//}
//constexpr double v_fermi_correction[92][15] = {
//skipV_FERMI_CORRECTIONS//
//}
//constexpr double lambda_screening[92][19] = {
//skipLAMBDA_SCREENING//
//}
const double atima_lambda_screening[92]= {
1.00,
1.00,
1.10,
1.06,
1.01,
1.03,
1.04,
0.99,
0.95,
0.90,
0.82,
0.81,
0.83,
0.88,
1.00,
0.95,
0.97,
0.99,
0.98,
0.97,
0.98,
0.97,
0.96,
0.93,
0.91,
0.9,
0.88,
0.9,
0.9,
0.9,
0.9,
0.85,
0.9,
0.9,
0.91,
0.92,
0.9,
0.9,
0.9,
0.9,
0.9,
0.88,
0.9,
0.88,
0.88,
0.9,
0.9,
0.88,
0.9,
0.9,
0.9,
0.9,
0.96,
1.2,
0.9,
0.88,
0.88,
0.85,
0.90,
0.90,
0.92,
0.95,
0.99,
1.03,
1.05,
1.07,
1.08,
1.10,
1.08,
1.08,
1.08,
1.08,
1.09,
1.09,
1.10,
1.11,
1.12,
1.13,
1.14,
1.15,
1.17,
1.20,
1.18,
1.17,
1.17,
1.16,
1.16,
1.16,
1.16,
1.16,
1.16,
1.16};
// this is take from atima
const double proton_stopping_coef[92][8] = { // proton in material stopping coefficient
{ .0091827, .0053496, .69741, .48493, 316.07,1.0143, 9329.3, .0539890}, //H
{ .11393, .0051984, 1.0822, .39252, 1081.0, 1.0645, 4068.5, .0176990}, //He
{ .85837, .0050147, 1.6044, .38844, 1337.3, 1.0470, 2659.2, .01898},
{ .8781, .0051049, 5.4232, .2032, 1200.6, 1.0211, 1401.8, .0385290},
{ 1.4608, .0048836, 2.338, .44249, 1801.3, 1.0352, 1784.1, .02024},
{ 3.2579, .0049148, 2.7156, .36473, 2092.2, 1.0291, 2643.6, .0182370}, //C
{ .59674, .0050837, 4.2073, .30612, 2394.2, 1.0255, 4892.1, .0160060},
{ .75253, .0050314, 4.0824, .30067, 2455.8, 1.0181, 5069.7, .0174260}, //O
{ 1.226, .0051385, 3.2246, .32703, 2525.0, 1.0142, 7563.6, .0194690},
{ 1.0332, .0051645, 3.004, .33889, 2338.6, .99997, 6991.2, .0217990}, //Ne
{ 6.0972, .0044292, 3.1929, .45763, 1363.3, .95182, 2380.6, .0818350},
{14.013, .0043646, 2.2641, .36326, 2187.4, .99098, 6264.8, .0462},
{ .039001, .0045415, 5.5463, .39562, 1589.2, .95316, 816.16, .0474840},
{ 2.072, .0044516, 3.5585, .53933, 1515.2, .93161, 1790.3, .0351980},
{17.575, .0038346, .078694, 1.2388,2806.0, .97284, 1037.6, .0128790},
{16.126, .0038315, .054164, 1.3104,2813.3, .96587, 1251.4, .0118470},
{ 3.217, .0044579, 3.6696, .5091, 2734.6, .96253, 2187.5, .0169070},
{ 2.0379, .0044775, 3.0743, .54773, 3505.0, .97575, 1714.00, .0117010},
{ .74171, .0043051, 1.1515, .95083, 917.21, .8782, 389.93, .18926},
{ 9.1316, .0043809, 5.4611, .31327, 3891.8, .97933, 6267.9, .0151960}, //Ca
{ 7.2247, .0043718, 6.1017, .37511, 2829.2, .95218, 6376.1, .0203980},
{ .147, .0048456, 6.3485, .41057, 2164.1, .94028, 5292.6, .0502630},
{ 5.0611, .0039867, 2.6174, .57957, 2218.9, .92361, 6323.00, .0256690},
{ .53267, .0042968, .39005, 1.2725, 1872.7, .90776, 64.166, .0301070},
{ .47697, .0043038, .31452, 1.3289, 1920.5, .90649, 45.576, .0274690},
{ .027426, .0035443, .031563, 2.1755, 1919.5, .90099, 23.902, .0253630},
{ .16383, .0043042, .073454, 1.8592, 1918.4, .89678, 27.61, .0231840},
{ 4.2562, .0043737, 1.5606, .72067, 1546.8, .87958, 302.02, .0409440}, //Ni
{ 2.3508, .0043237, 2.882, .50113, 1837.7, .89992, 2377.00, .04965},
{ 3.1095, .0038455, .11477, 1.5037, 2184.7, .89309, 67.306, .0165880},
{15.322, .0040306, .65391, .67668, 3001.7, .92484, 3344.2, .0163660},
{ 3.6932, .0044813, 8.608, .27638, 2982.7, .9276, 3166.6, .0308740},
{ 7.1373, .0043134, 9.4247, .27937, 2725.8, .91597, 3166.1, .0250080},
{ 4.8979, .0042937, 3.7793, .50004, 2824.5, .91028, 1282.4, .0170610},
{ 1.3683, .0043024, 2.5679, .60822, 6907.8, .9817, 628.01, .0068055},
{ 1.8301, .0042983, 2.9057, .6038, 4744.6, .94722, 936.64, .0092242},
{ .42056, .0041169, .01695, 2.3616, 2252.7, .89192, 39.752, .0277570},
{30.78, .0037736, .55813, .76816, 7113.2, .97697, 1604.4, .0065268},
{11.576, .0042119, 7.0244, .37764, 4713.5, .94264, 2493.2, .01127},
{ 6.2406, .0041916, 5.2701, .49453, 4234.6, .93232, 2063.9, .0118440},
{ .33073, .0041243, 1.7246, 1.1062, 1930.2, .86907, 27.416, .0382080},
{ .017747, .0041715, .14586, 1.7305,1803.6, .86315, 29.669, .0321230},
{ 3.7229, .0041768, 4.6286, .56769, 1678.0, .86202, 3094.00, .06244},
{ .13998, .0041329, .25573, 1.4241, 1919.3, .86326, 72.797, .0322350},
{ .2859, .0041386, .31301, 1.3424, 1954.8, .86175, 115.18, .0293420},
{ .76, .0042179, 3.386, .76285, 1867.4, .85805, 69.994, .0364480},
{ 6.3957, .0041935, 5.4689, .41378, 1712.6, .85397,18493.00, .0564710},
{ 3.4717, .0041344, 3.2337, .63788, 1116.4, .81959, 4766.0, .1179},
{ 2.5265, .0042282, 4.532, .53562, 1030.8, .81652,16252.0, .19722},
{ 7.3683, .0041007, 4.6791, .51428, 1160.0, .82454,17965.0, .13316},
{ 7.7197, .004388, 3.242, .68434, 1428.1, .83398, 1786.7, .0665120},
{16.78, .0041918, 9.3198, .29568, 3370.9, .90289, 7431.7, .02616},
{ 4.2132, .0042098, 4.6753, .57945, 3503.9, .89261, 1468.9, .0143590},
{ 4.0818, .004214, 4.4425, .58393, 3945.3, .90281, 1340.5, .0134140}, //Xe
{.18517, .0036215, .00058788,3.5315, 2931.3, .88936, 26.18, .0263930},
{ 4.8248, .0041458, 6.0934, .57026, 2300.1, .86359, 2980.7, .0386790},
{ .49857, .0041054, 1.9775, .95877, 786.55, .78509, 806.6, .40882},
{ 3.2754, .0042177, 5.768, .54054, 6631.3, .94282, 744.07, .0083026},
{ 2.9978, .0040901, 4.5299, .62025, 2161.2, .85669, 1268.6, .0430310},
{ 2.8701, .004096, 4.2568, .6138, 2130.4, .85235, 1704.1, .0393850},
{10.853, .0041149, 5.8907, .46834, 2857.2, .8755, 3654.2, .0299550},
{ 3.6407, .0041782, 4.8742, .57861, 1267.7, .82211, 3508.2, .24174},
{17.645, .0040992, 6.5855, .32734, 3931.3, .90754, 5156.7, .0362780},
{ 7.5309, .0040814, 4.9389, .50679, 2519.7, .85819, 3314.6, .0305140},
{ 5.4742, .0040829, 4.897, .51113, 2340.1, .85296, 2342.7, .0356620},
{ 4.2661, .0040667, 4.5032, .55257, 2076.4, .84151, 1666.6, .0408010},
{ 6.8313, .0040486, 4.3987, .51675, 2003.0, .83437, 1410.4, .03478},
{ 1.2707, .0040553, 4.6295, .57428, 1626.3, .81858, 995.68, .0553190},
{ 5.7561, .0040491, 4.357, .52496, 2207.3, .83796, 1579.5, .0271650},
{14.127, .0040596, 5.8304, .37755, 3645.9, .87823, 3411.8, .0163920},
{ 6.6948, .0040603, 4.9361, .47961, 2719.0, .85249, 1885.8, .0197130},
{ 3.0619, .0040511, 3.5803, .59082, 2346.1, .83713, 1222.0, .0200720},
{10.811, .0033008, 1.3767, .76512, 2003.7, .82269, 1110.6, .0249580},
{ 2.7101, .0040961, 1.2289, .98598, 1232.4, .79066, 155.42, .0472940},
{ .52345, .0040244, 1.4038, .8551, 1461.4, .79677, 503.34, .0367890},
{ .4616, .0040203, 1.3014, .87043, 1473.5, .79687, 443.09, .0363010},
{ .97814, .0040374, 2.0127, .7225, 1890.8, .81747, 930.7, .02769},
{ 3.2086, .004051, 3.6658, .53618, 3091.2, .85602, 1508.1, .0154010},
{ 2.0035, .0040431, 7.4882, .3561, 4464.3, .88836, 3966.5, .0128390},
{15.43, .0039432, 1.1237, .70703, 4595.7, .88437, 1576.5, .0088534},
{ 3.1512, .0040524, 4.0996, .5425, 3246.3, .85772, 1691.8, .0150580},
{ 7.1896, .0040588, 8.6927, .35842, 4760.6, .88833, 2888.3, .0110290}, //Pb
{ 9.3209, .004054, 11.543, .32027, 4866.2, .89124, 3213.4, .0119350},
{29.242, .0036195, .16864, 1.1226, 5688.0, .89812, 1033.3, .0071303},
{ 1.8522, .0039973, 3.1556, .65096, 3755.0, .86383, 1602.0, .0120420},
{ 3.222, .0040041, 5.9024, .52678, 4040.2, .86804, 1658.4, .0117470},
{ 9.3412, .0039661, 7.921, .42977, 5180.9, .88773, 2173.2, .0092007},
{36.183, .0036003, .58341, .86747, 6990.2, .91082, 1417.1, .0062187},
{ 5.9284, .0039695, 6.4082, .52122, 4619.5, .88083, 2323.5, .0116270},
{ 5.2454, .0039744, 6.7969, .48542, 4586.3, .87794, 2481.5, .0112820},
{33.702, .0036901, .47257, .89235, 5295.7, .8893, 2053.3, .0091908},
{2.7589, .0039806, 3.2092, .66122, 2505.4, .82863, 2065.1, .0228160} //U
};
const double atima_vfermi[92] = {
1.0309,
0.15976,
0.59782,
1.0781,
1.0486,
1.00,
1.058,
0.93942,
0.74562,
0.3424,
0.45259,
0.71074,
0.90519,
0.97411,
0.97184,
0.89852,
0.70827,
0.39816,
0.36552,
0.62712,
0.81707,
0.9943,
1.1423,
1.2381,
1.1222,
0.92705,
1.0047,
1.2,
1.0661,
0.97411,
0.84912,
0.95,
1.0903,
1.0429,
0.49715,
0.37755,
0.35211,
0.57801,
0.77773,
1.0207,
1.029,
1.2542,
1.122,
1.1241,
1.0882,
1.2709,
1.2542,
0.90094,
0.74093,
0.86054,
0.93155,
1.0047,
0.55379,
0.43289,
0.32636,
0.5131,
0.6950,
0.72591,
0.71202,
0.67413,
0.71418,
0.71453,
0.5911,
0.70263,
0.68049,
0.68203,
0.68121,
0.68532,
0.68715,
0.61884,
0.71801,
0.83048,
1.1222,
1.2381,
1.045,
1.0733,
1.0953,
1.2381,
1.2879,
0.78654,
0.66401,
0.84912,
0.88433,
0.80746,
0.43357,
0.41923,
0.43638,
0.51464,
0.73087,
0.81065,
1.9578,
1.0257};
} // namespace catima

25
srim.h Normal file
View File

@ -0,0 +1,25 @@
namespace catima{
/**
* return srim stopping power
* @param pZ - projectile Z
* @param pZ - material Z
* @param energy - projectile energy in MeV/u unit
* @param use_v95 - use srim proton coefficient from version 95, otherwise version 85 will be used
*/
double srim_dedx_e(int pZ, int tZ, double energy, bool use_v95=1);
/**
* return SRIM proton stopping power
* @param Z - proton number of material
* @param energy - energy per nuclein in MeV/u
*/
double p_se(int Z, double energy);
double p_se95(int Z, double energy);
extern const double pse_95[92][8];
extern const double atima_lambda_screening[92];
extern const double atima_vfermi[92];
extern const double proton_stopping_coef[92][8];
}

View File

@ -34,36 +34,27 @@ const lest::test specification[] =
CASE("proton stopping power from srim"){
catima::Projectile p{1,1,1,1};
catima::Target he{4.002600,2};
catima::Target carbon{12.0107,6};
auto he = catima::get_material(2);
auto carbon = catima::get_material(6);
EXPECT( catima::sezi_p_se(1,he) == approx(283,1));
p.T = 1;
EXPECT( catima::sezi_p_se(p.T,he) == approx(catima::sezi_dedx_e(p,he)).R(1e-6));
EXPECT(catima::sezi_p_se(10,he)==approx(45.6,1));
EXPECT( catima::sezi_dedx_e(p,he) == approx(283,1));
p.T = 10;
EXPECT( catima::sezi_p_se(p.T,he) == approx(catima::sezi_dedx_e(p,he)).R(1e-6));
EXPECT( catima::sezi_dedx_e(p,he) == approx(45.6,1));
EXPECT(catima::sezi_p_se(30,he) == approx(18.38,1));
p.T = 30;
EXPECT( catima::sezi_p_se(p.T,he) == approx(catima::sezi_dedx_e(p,he)).R(1e-6));
EXPECT( catima::sezi_dedx_e(p,he) == approx(18.38,1));
EXPECT( catima::sezi_p_se(1,carbon) == approx(229.5,1));
p.T = 1;
EXPECT( catima::sezi_p_se(p.T,carbon) == approx(catima::sezi_dedx_e(p,carbon)).R(1e-6));
EXPECT( catima::sezi_p_se(10,carbon) == approx(40.8,1));
EXPECT(catima::sezi_p_se(30,carbon) == approx(16.8,1));
EXPECT( catima::sezi_dedx_e(p,carbon) == approx(229.5,1));
p.T = 10;
EXPECT( catima::sezi_dedx_e(p,carbon) == approx(40.8,1));
p.T = 30;
EXPECT( catima::sezi_p_se(p.T,carbon) == approx(catima::sezi_dedx_e(p,carbon)).R(1e-6));
EXPECT( catima::sezi_dedx_e(p,carbon) == approx(16.8,1));
},
CASE("dedx, low energy, from sezi"){
catima::Projectile p{4,2,2,1};
catima::Target carbon{12.0107,6};
auto carbon = catima::get_material(6);
// He projectile case
p.T = 1;