30 long nHi,
long lHi,
long sHi,
long jHi,
31 long nLo,
long lLo,
long sLo,
long jLo );
33 STATIC double CS_l_mixing_S62(
double deltaE_eV,
double IP_Ryd_ground,
long gLo,
double Aul,
long nelem,
long Collider,
double temp );
56 class StarkCollTransProb_VF01;
57 class StarkCollTransProb_VOS12QM;
71 double tauLo_1,
double IP_Ryd_Hi_1,
double IP_Ryd_Lo_1,
long Collider_1,
double temp_1) :
82 if( ! ( s > 0 &&
n > 0 ) )
84 fprintf(
ioQQQ,
"invalid parameter for my_Integrand_VF01_E\n" );
110 double reduced_b_maxa, reduced_b_maxb;
136 double quantum_defect1 = (double)n- (
double)
nelem/sqrt(
IP_Ryd_Lo);
137 double quantum_defect2 = (double)n- (
double)
nelem/sqrt(
IP_Ryd_Hi);
140 ASSERT( fabs(quantum_defect1) < 1.0 );
141 ASSERT( fabs(quantum_defect1) > 0.0 );
142 ASSERT( fabs(quantum_defect2) < 1.0 );
143 ASSERT( fabs(quantum_defect2) > 0.0 );
146 double omega_qd1 = fabs( 5.* quantum_defect1 * (1.-0.6*
POW2((
double)
l/(
double)n)) /
POW3( (
double)n ) / (
double)
l );
148 double omega_qd2 = fabs( 5.* quantum_defect2 * (1.-0.6*
POW2((
double)
lp/(
double)n)) /
POW3( (
double)n ) / (
double)
lp );
150 omega_qd = 0.5*( omega_qd1 + omega_qd2 );
170 double PS_crit = deltaE_eV*
tauLo/HBAReV;
172 reduced_b_maxb = 1.12*HBAReV*vred/deltaE_eV/
aveRadius;
183 meanb =
MIN2(meanb,reduced_b_maxa);
186 meanb = reduced_b_maxa;
187 double beta_brock= meanb*abs(deltaE_eV)/(HBAReV*4.*PI*vred);
188 if (beta_brock >= 0.4)
189 reduced_b_maxb = 1.12*HBAReV*vred/deltaE_eV/
aveRadius;
211 double col_str = collision_strength_VF01<P>(
ipISO, EOverKT *
temp / TE1RYD,
213 return exp( -1.*EOverKT ) * col_str;
227 double tauLo_1,
double IP_Ryd_Hi_1,
double IP_Ryd_Lo_1,
long Collider_1,
double temp_1) :
228 data(ipISO_1, nelem_1, n_1, l_1, lp_1, s, gLo_1,
229 tauLo_1, IP_Ryd_Hi_1, IP_Ryd_Lo_1, Collider_1, temp_1) {}
233 double EOverKT = -log(y);
235 double col_str = collision_strength_VF01<P>(
data.ipISO, EOverKT *
data.temp / TE1RYD,
243 long i, i1, j, nelem, ipHi, ipLo;
267 fprintf(
ioQQQ,
" HeCollidSetup could not read first line of he1_cs.dat.\n");
271 i1 = (long)
FFmtRead(chLine,&i,
sizeof(chLine),&lgEOL);
279 " HeCollidSetup: the version of he1_cs.dat is not the current version.\n" );
281 " HeCollidSetup: I expected to find the number %i and got %li instead.\n" ,
283 fprintf(
ioQQQ,
"Here is the line image:\n==%s==\n", chLine );
289 while(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioDATA ) != NULL )
292 if( chLine[0] ==
'#')
297 char *chTemp = strtok(chLine,
" \t\n");
298 while( chTemp != NULL )
300 CSTemp.push_back( atof(chTemp) );
301 chTemp = strtok(NULL,
" \t\n");
307 fprintf(
ioQQQ,
" HeCollidSetup could not find line in CS temperatures in he1_cs.dat.\n");
317 for(
long ipHi=1; ipHi < numLevs; ++ipHi )
320 for(
long ipLo=0; ipLo<ipHi; ++ipLo )
324 for(
long ipHi=1; ipHi < numLevs; ++ipHi )
326 for(
long ipLo=0; ipLo<ipHi; ++ipLo )
328 for(
unsigned i=0; i<
CSTemp.size(); ++i )
330 HeCS[ipHi][ipLo][i] = -1.f;
338 while(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioDATA ) != NULL )
342 if( (chLine[0] ==
' ') || (chLine[0]==
'\n') )
344 if( chLine[0] !=
'#')
348 ipLo = (long)
FFmtRead(chLine,&j,
sizeof(chLine),&lgEOL);
349 ipHi = (long)
FFmtRead(chLine,&j,
sizeof(chLine),&lgEOL);
357 for(
long i=0; i<3; ++i )
359 if( (chTemp =
strchr_s( chTemp,
'\t' )) == NULL )
367 for(
unsigned i=0; i<
CSTemp.size(); ++i )
370 if( (chTemp =
strchr_s( chTemp,
'\t' )) == NULL )
372 fprintf(
ioQQQ,
" HeCollidSetup could not scan cs, current indices: %li %li\n", ipHi, ipLo );
376 sscanf( chTemp ,
"%le" , &a );
377 HeCS[ipHi][ipLo][i] = (
realnum)a;
423 const char *where=
" ";
425 nHi, lHi, sHi, jHi, gHi, IP_Ryd_Hi,
426 nLo, lLo, sLo, jLo, gLo, IP_Ryd_Lo,
427 Aul, tauLo, EnerWN, EnerErg, &where );
435 long nHi,
long lHi,
long sHi,
long jHi,
long gHi,
double IP_Ryd_Hi,
436 long nLo,
long lLo,
long sLo,
long jLo,
long gLo,
double IP_Ryd_Lo,
437 double Aul,
double tauLo,
double EnerWN,
double EnerErg,
const char **where )
452 double deltaE_eV = EnerErg/EN1EV;
455 if( nLo==2 && lLo==1 && sLo==3 )
457 factor1 *= (2.f*jLo+1.f) / 9.f;
461 if( nHi==2 && lHi==1 && sHi==3 )
463 factor1 *= (2.f*jHi+1.f) / 9.f;
471 if( (cs =
HeCSTableInterp( nelem, Collider, nHi, lHi, sHi, jHi, nLo, lLo, sLo, jLo )) >= 0.f )
474 if( nLo==2 && lLo==1 && sLo==3 && nHi==2 && lHi==1 && sHi==3 )
494 if( lHi==0 && sHi==3 )
495 cs = 0.25f/
POW2(nelem+1.f);
496 else if( lHi==0 && sHi==1 )
497 cs = 0.4f/
POW2(nelem+1.f);
498 else if( lHi==1 && sHi==3 && jHi==0 )
499 cs = 0.15f/
POW2(nelem+1.f);
500 else if( lHi==1 && sHi==3 && jHi==1 )
501 cs = 0.45f/
POW2(nelem+1.f);
502 else if( lHi==1 && sHi==3 && jHi==2 )
503 cs = 0.75f/
POW2(nelem+1.f);
504 else if( lHi==1 && sHi==1 )
505 cs = 1.3f/
POW2(nelem+1.f);
510 else if( nLo==2 && lLo==0 && sLo==3 )
512 if( lHi==0 && sHi==1 )
513 cs = 2.75f/
POW2(nelem+1.f);
514 else if( lHi==1 && sHi==3 && jHi==0 )
515 cs = 60.f/
POW2(nelem+1.f);
516 else if( lHi==1 && sHi==3 && jHi==1 )
517 cs = 180.f/
POW2(nelem+1.f);
518 else if( lHi==1 && sHi==3 && jHi==2 )
519 cs = 300.f/
POW2(nelem+1.f);
520 else if( lHi==1 && sHi==1 )
521 cs = 5.8f/
POW2(nelem+1.f);
526 else if( nLo==2 && lLo==0 && sLo==1 )
528 if( lHi==1 && sHi==3 && jHi==0 )
529 cs = 0.56f/
POW2(nelem+1.f);
530 else if( lHi==1 && sHi==3 && jHi==1 )
531 cs = 1.74f/
POW2(nelem+1.f);
532 else if( lHi==1 && sHi==3 && jHi==2 )
533 cs = 2.81f/
POW2(nelem+1.f);
534 else if( lHi==1 && sHi==1 )
535 cs = 190.f/
POW2(nelem+1.f);
540 else if( nLo==2 && lLo==1 && sLo==3 && jLo==0 )
542 if( lHi==1 && sHi==3 && jHi==1 )
543 cs = 8.1f/
POW2(nelem+1.f);
544 else if( lHi==1 && sHi==3 && jHi==2 )
545 cs = 8.2f/
POW2(nelem+1.f);
546 else if( lHi==1 && sHi==1 )
547 cs = 3.9f/
POW2(nelem+1.f);
552 else if( nLo==2 && lLo==1 && sLo==3 && jLo==1 )
554 if( lHi==1 && sHi==3 && jHi==2 )
555 cs = 30.f/
POW2(nelem+1.f);
556 else if( lHi==1 && sHi==1 )
557 cs = 11.7f/
POW2(nelem+1.f);
562 else if( nLo==2 && lLo==1 && sLo==3 && jLo==2 )
564 ASSERT( lHi==1 && sHi==1 );
575 else if( (nHi==nLo) && (sHi==sLo) )
593 if( (lLo>=3 && lHi>=3))
696 long nLo1 = nLo, nHi1 = nHi;
736 fprintf(
ioQQQ,
"Check VF01 %ld %ld %ld %ld %ld %ld %g: %g (%g) VOS12 %g (%g) VOS12QM %g PS64 %g\n",
737 Collider,nLo1,lLo1,lHi1,sLo,nelem,
phycon.
te,
742 CS_l_mixing_PS64(nelem,tauLo,nelem+1.-ipISO1,nLo1,lLo1,gHi,lHi1,deltaE_eV,Collider));
743 double rate_t1, rate_t2, rate_t;
744 double oHi=1./(double)gHi;
745 double ogLo=1./(double)gLo;
748 double ratef =
powpq(ELECTRON_MASS/reduced_mass_collider_system,3,2) * COLL_CONST/
phycon.
sqrte;
750 rate_t1 = cs1*ratef*oHi;
751 rate_t2 = cs2*ratef*ogLo;
752 rate_t = rate_t1+rate_t2;
753 fprintf(
ioQQQ,
"Rates for H %ld %ld %ld %ld %ld %ld %ld %ld %g: %g %g \n",
754 nLo1,lLo1,lHi1,sLo,sHi,jLo,jHi,nelem,
phycon.
te,rate_t,
dense.
eden);
807 else if( nHi != nLo )
818 fixit(
"This should not be set here!" );
837 double x = log10(
MAX2(34.7,EnerWN));
865 if( EnerWN < 25119.f )
881 fixit(
"Use Percival and Richards here." );
906 enum {DEBUG_LOC=
false};
909 if( DEBUG_LOC && (cs > 0.f) )
911 fprintf(
ioQQQ,
"DEBUGGG HeCSInterp %li\t%li\t%li\t%li\t-\t%li\t%li\t%li\t%e\t%s\n",
924 long nHi,
long lHi,
long sHi,
long jHi,
925 long nLo,
long lLo,
long sLo,
long jLo )
937 fixit(
"HeCS allocation must be changed in order to remove this and do collapsed levels here." );
941 else if( lLo < 0 || lHi < 0 )
949 if( nLo==2 && lLo==1 && sLo==3 )
951 ASSERT( jLo>=0 && jLo<=2 );
954 if( nHi==2 && lHi==1 && sHi==3 )
956 ASSERT( jHi>=0 && jHi<=2 );
963 if( HeCS[ipHi][ipLo][0] < 0.f )
973 cs = HeCS[ipHi][ipLo][0];
977 cs = HeCS[ipHi][ipLo][
CSTemp.size()-1];
988 ASSERT( (flow >= 0.) && (flow <= 1.) );
990 cs = HeCS[ipHi][ipLo][ipArray] * (1.-flow) +
991 HeCS[ipHi][ipLo][ipArray+1] * flow;
1003 deltaE(deltaE), osc_strength(osc_strength), temp(temp), I_energy_eV(I_energy_eV)
1005 void operator() (
const double proj_energy_overKT[],
double res[],
long n)
const;
1010 STATIC double CS_l_mixing_S62(
double deltaE_eV,
double IP_Ryd_ground,
long gLo,
double Aul,
long nelem,
long Collider,
double temp )
1020 ASSERT( TRANS_PROB_CONST*
POW2(deltaE_eV/WAVNRYD/EVRYD) > 0. );
1022 double osc_strength = Aul / (TRANS_PROB_CONST*
POW2(deltaE_eV/WAVNRYD/EVRYD));
1023 double I_energy_eV = EVRYD * IP_Ryd_ground;
1039 double elow = 0., emid = 1.*energy_factor, ehigh = 10.*energy_factor;
1042 double coll_str = S62.
sum( elow, emid );
1043 coll_str += S62.
sum( emid, ehigh );
1045 coll_str /= energy_factor;
1049 coll_str =
ConvCrossSect2CollStr(coll_str*PI*BOHR_RADIUS_CM*BOHR_RADIUS_CM, (
double)gLo, 1.0, reduced_mass);
1058 if( zOverB2 > 100. )
1060 betaone = sqrt( 1./zOverB2 );
1062 else if( zOverB2 < 0.54 )
1065 double logz = log(zOverB2/PI);
1066 betaone = (1./3.)*(1.28-logz);
1067 if( betaone > 2.38 )
1070 betaone += -0.5*logz;
1076 long ip_zOverB2 = 0;
1077 static const double zetaOVERbeta2[101] = {
1078 1.030E+02,9.840E+01,9.402E+01,8.983E+01,8.583E+01,8.200E+01,7.835E+01,7.485E+01,
1079 7.151E+01,6.832E+01,6.527E+01,6.236E+01,5.957E+01,5.691E+01,5.436E+01,5.193E+01,
1080 4.961E+01,4.738E+01,4.526E+01,4.323E+01,4.129E+01,3.943E+01,3.766E+01,3.596E+01,
1081 3.434E+01,3.279E+01,3.131E+01,2.989E+01,2.854E+01,2.724E+01,2.601E+01,2.482E+01,
1082 2.369E+01,2.261E+01,2.158E+01,2.059E+01,1.964E+01,1.874E+01,1.787E+01,1.705E+01,
1083 1.626E+01,1.550E+01,1.478E+01,1.409E+01,1.343E+01,1.280E+01,1.219E+01,1.162E+01,
1084 1.107E+01,1.054E+01,1.004E+01,9.554E+00,9.094E+00,8.655E+00,8.234E+00,7.833E+00,
1085 7.449E+00,7.082E+00,6.732E+00,6.397E+00,6.078E+00,5.772E+00,5.481E+00,5.202E+00,
1086 4.937E+00,4.683E+00,4.441E+00,4.210E+00,3.989E+00,3.779E+00,3.578E+00,3.387E+00,
1087 3.204E+00,3.031E+00,2.865E+00,2.707E+00,2.557E+00,2.414E+00,2.277E+00,2.148E+00,
1088 2.024E+00,1.907E+00,1.795E+00,1.689E+00,1.589E+00,1.493E+00,1.402E+00,1.316E+00,
1089 1.235E+00,1.157E+00,1.084E+00,1.015E+00,9.491E-01,8.870E-01,8.283E-01,7.729E-01,
1090 7.206E-01,6.712E-01,6.247E-01,5.808E-01,5.396E-01};
1092 ASSERT( zOverB2 >= zetaOVERbeta2[100] );
1095 long ilo=0, ihi = 100;
1098 long imid = (ilo+ihi)/2.;
1099 if ( zetaOVERbeta2[imid] > zOverB2 )
1106 ASSERT( ( zOverB2 < zetaOVERbeta2[ilo] ) && ( zOverB2 >= zetaOVERbeta2[ilo+1] ) );
1110 ASSERT( (ip_zOverB2 >=0) && (ip_zOverB2 < 100) );
1112 const double fp = 1.023292992280754131;
1113 betaone =
exp10( (
double)ip_zOverB2/100. - 1.)*
1114 ( (zOverB2 - zetaOVERbeta2[ip_zOverB2]) * fp
1115 -zOverB2 + zetaOVERbeta2[ip_zOverB2+1] )/
1116 (zetaOVERbeta2[ip_zOverB2+1] - zetaOVERbeta2[ip_zOverB2]);
1130 for(
long i=0; i < n; ++i )
1131 x[i] = -proj_energy[i]*EVDEGK/
temp;
1134 for(
long i=0; i < n; ++i )
1140 double Dubya = proj_energy[i] + 0.5*
deltaE;
1158 double zeta_of_betaone = zOverB2 *
POW2(betaone);
1162 double k0val, k1val;
1164 double cs2 = 0.5*zeta_of_betaone + betaone * k0val * k1val;
1174 res[i] = val[i] * (proj_energy[i]+
deltaE)/EVRYD * cross_section;
1186 double target_charge,
1195 double RD,R12,Sij,Plowb,RC,RC1,EC,ED,
1196 reduced_mass, reduced_mass_2_emass,bracket,contr, rate;
1198 double eEm,eED,eEC,eEmt1Em;
1204 const double tau_zero = 2.41889e-17;
1205 long lmax =
MAX2(l,lp);
1206 double n2 = (double)n*(
double)n;
1207 double lmax2 = (double)lmax*(
double)lmax;
1209 reduced_mass_2_emass = reduced_mass / ELECTRON_MASS;
1214 double dens_au =
dense.
eden*pow(BOHR_RADIUS_CM,3);
1216 double vred = sqrt(tempryd/reduced_mass_2_emass);
1218 double tau_ua = tau/tau_zero;
1224 Sij = 9.*n2*lmax*(n2-lmax2)/(2.*target_charge*target_charge);
1228 R12 = 2. *
pow2(ChargIncoming)/(3.*Plowb*vred*vred*(2.*l+1));
1234 RD = sqrt(tempryd/(8.*PI*dens_au));
1237 RC1 = 0.72*tau_ua*vred;
1243 double PS_crit = deltaE_eV*tau/HBAReV;
1247 / (PI2*ELEM_CHARGE_ESU);
1252 meanb =
MIN2(meanb,bmax);
1256 double v = sqrt(2.*BOLTZMANN*
phycon.
te/reduced_mass);
1257 double beta_brock= meanb*abs(deltaE_eV)/(HBAReV*4.*PI*v);
1263 RC1 = 1.12*HBAReV*vred/deltaE_eV/tau_zero;
1267 RC1 = 1.12*HBAReV*vred/deltaE_eV/tau_zero;
1284 double Emin = R12/(RC*RC);
1297 double Dnl = 2. *
pow2(ChargIncoming)*Sij/(3.*(2.*l+1.));
1302 EC = RD*RD/(RC1*RC1);
1304 eEm = exp(-1.*Emin);
1307 eEmt1Em = eEm*(1.+Emin);
1312 if ( fb1 == 1 && fb2 == 1)
1313 bracket = eEm +
e1(Emin);
1317 bracket = fb1*eEm+ fb2*
e1(Emin);
1321 bracket = fb1*eEm + 2.*
e1(Emin) -
e1(EC);
1323 bracket = fb1*eED +
e1(ED);
1332 contr = (1.-eEmt1Em)/Emin;
1337 contr = 2.*( 1. -eEmt1Em)/
pow2(Emin);
1342 contr = ( 2. -eEC*(2.+EC))/
pow2(Emin);
1343 contr -= eEm*(1.+1./ED);
1360 double units = 2.*pow(BOHR_RADIUS_CM,3)*sqrt(PI)/vred/tau_zero;
1362 rate = units * Dnl* bracket;
1367 cs = rate / ( COLL_CONST *
powpq(reduced_mass_2_emass, -3, 2) ) *
phycon.
sqrte * g;
1379 double target_charge,
1390 TwoLogDebye, TwoLogRc1,
1392 bestfactor, factorpart,
1393 reduced_mass, reduced_mass_2_emass,
1407 reduced_mass_2_emass = reduced_mass / ELECTRON_MASS;
1420 TwoLogRc1 = 10.95 + log10(
phycon.
te * tau * tau / reduced_mass_2_emass );
1426 double PS_crit = deltaE_eV*tau/HBAReV;
1430 / (2*ELEM_CHARGE_ESU);
1431 double vred = sqrt(2.*BOLTZMANN*
phycon.
te/reduced_mass);
1437 meanb =
MIN2(meanb,bmax);
1442 double beta_brock= meanb*abs(deltaE_eV)/(HBAReV*4.*PI*vred);
1443 double deltaE_cm = deltaE_eV*EN1EV/ERG1CM;
1453 TwoLogRc1 = log10(
phycon.
te*ELECTRON_MASS/
pow2(deltaE_cm)/reduced_mass)-11.22;
1460 TwoLogRc1 = log10(
phycon.
te*ELECTRON_MASS/
pow2(deltaE_cm)/reduced_mass)-11.22;
1467 double Dnl =
POW2( ChargIncoming / target_charge) * 6. *
POW2( (
double)n) *
1468 (
POW2((
double)n) -
POW2((
double)l) - l - 1);
1485 long lmax =
MAX2(l,lp);
1489 double Dnlup =
POW2( ChargIncoming / target_charge) * 6. *
POW2( (
double)n) * lmax * (n*n-lmax*lmax) /
double( 2*l+1 );
1500 factorpart = (11.54 + log10(
phycon.
te / Dnl / reduced_mass_2_emass ) );
1502 if( (factor1 = factorpart + TwoLogDebye) <= 0.)
1505 if( (factor2 = factorpart + TwoLogRc1) <= 0.)
1509 bestfactor =
MIN2(factor1,factor2);
1511 ASSERT( bestfactor > 0. );
1514 if( bestfactor > 100. )
1520 rate = 9.93e-6 * sqrt( reduced_mass_2_emass ) * Dnlup /
phycon.
sqrte * bestfactor;
1525 cs = rate / ( COLL_CONST *
powpq(reduced_mass_2_emass, -3, 2) ) *
1558 integType func(ipISO,nelem,n,l,lp,s,gLo,tauLo,IP_Ryd_Hi,IP_Ryd_Lo,Collider,temp);
1572 coll_str = func(1.0)*exp(1.0);
1581 coll_str = VF01_E.
sum( 0.0, 1.0 );
1582 coll_str += VF01_E.
sum( 1.0, 10.0 );
1586 double xn=0., xl = 10.;
1589 while (xl < 100. && func(xl/2.) == 0.)
1597 VF01_ER(integrate::Midpoint<integType>(func,xn,xl));
1599 coll_str = VF01_ER.
sum();
1606 integLogType funcl(ipISO,nelem,n,l,lp,s,gLo,tauLo,IP_Ryd_Hi,IP_Ryd_Lo,Collider,temp);
1607 double x1n = 0.0, x1x = 1.0;
1609 double x1m = 0.5*(x1n+x1x);
1610 if (funcl(x1m) > 0.)
1614 }
while ((x1x-x1n) > 0.001);
1616 VF01_ESL(integrate::Midpoint<integLogType>(funcl,0.0,x1x));
1619 Integrator<integType, Gaussian32> VF01_E(func);
1620 double coll_strg = VF01_E.
sum( 0.0, 1.0 );
1621 coll_strg += VF01_E.
sum( 1.0, 10.0 );
1624 VF01_ERL(integrate::Midpoint<integLogType>(funcl,0.0,x1x));
1626 fprintf(ioQQQ,"Int %ld %ld->%ld ER %g(%g) %ld ESL %g(%g) %ld ERL %g(%g) %ld G %g
S %g\n",
1639 coll_str,VF01_ER.error(),VF01_ER.evals()
1664 return CS_l_mixing<StarkCollTransProb_VF01>(ipISO,nelem,n,l,lp,s,gLo,tauLo,
1665 IP_Ryd_Hi,IP_Ryd_Lo,temp,Collider);
1682 return CS_l_mixing<StarkCollTransProb_VOS12QM>(ipISO,nelem,n,l,lp,s,gLo,
1683 tauLo,IP_Ryd_Hi,IP_Ryd_Lo,temp,Collider);
1690 double m_alpha, m_alphamin, m_sinfac;
1692 Chi_VF01(
double alpha,
double alphamin) : m_alpha(alpha), m_alphamin(alphamin)
1702 double deltaPhi = -PI;
1703 m_sinfac =
pow2(sin(0.5*deltaPhi*sqrt(1+m_alpha*m_alpha)));
1705 double sinChiOver2sq()
const
1708 if( m_alpha <= m_alphamin)
1712 double denom = (1.+m_alpha*m_alpha), ratio = m_alpha/denom;
1713 return 4.*ratio*ratio*m_sinfac*(denom-m_alpha*m_alpha*m_sinfac);
1715 double cosChi()
const
1717 double alphasq =
pow2(m_alpha);
1718 return 1.-2.*alphasq*m_sinfac/(1.+alphasq);
1722 class StarkCollTransProb_VF01
1725 double cosU1, cosU2, sinU1sinU2;
1727 StarkCollTransProb_VF01(
long int n1,
long int l1,
long int lp1) : n(n1), l(l1), lp(lp1)
1730 cosU1 = 2.*
POW2((
double)l/(
double)n) - 1.;
1731 cosU2 = 2.*
POW2((
double)lp/(
double)n) - 1.;
1732 sinU1sinU2 = sqrt( ( 1. - cosU1*cosU1 )*( 1. - cosU2*cosU2 ) );
1734 double operator()(
double alpha,
double alphamin)
const;
1735 double bfun(
double alpha,
double alphamin)
const
1737 double sinChiOver2sq = Chi_VF01(alpha, alphamin).sinChiOver2sq();
1738 double cosChi = 1. - 2*sinChiOver2sq;
1739 return (cosU1*cosU2 + sinU1sinU2 - cosChi);
1743 double StarkCollTransProb_VF01::operator() (
double alpha,
double alphamin)
const
1745 DEBUG_ENTRY(
"StarkCollTransProb_VF01::operator()()" );
1747 ASSERT( alpha >= 1e-30 );
1749 double sinChiOver2sq = Chi_VF01(alpha, alphamin).sinChiOver2sq();
1756 if( l == 0 || lp == 0 )
1758 long lf =
max(l,lp);
1759 if( n*n*sinChiOver2sq <= lf*lf )
1771 probability = (lf+0.5) / sqrt( n*n*sinChiOver2sq * (n*n*sinChiOver2sq - lf*lf) );
1776 probability /= (2.*l+1);
1783 if( OneMinusCosChi == 0. )
1785 double hold = sin( deltaPhi / 2. );
1787 OneMinusCosChi = 8. * alpha * alpha *
POW2( hold );
1791 if( sinChiOver2sq == 0. )
1797 double cosChi = 1. - 2*sinChiOver2sq;
1799 double A = (cosU1*cosU2 - sinU1sinU2 - cosChi);
1800 double B = (cosU1*cosU2 + sinU1sinU2 - cosChi);
1809 ASSERT( sinChiOver2sq > 0. );
1811 probability = 2.*lp/(PI* n*n* sinChiOver2sq );
1821 probability *=
ellpk( -A/(B-A) ) * sqrt( 2*sinChiOver2sq / (B - A) );
1825 probability *=
ellpk( A/B ) * sqrt( 2*sinChiOver2sq / B );
1835 class my_Integrand_VF01_alpha :
public D_fp
1840 my_Integrand_VF01_alpha(
long int n,
long int l,
long int lp,
double alphamin) :
1841 s( n, l, lp), alphamin(alphamin) {}
1845 ASSERT( alpha >= 1.e-30 );
1847 return s( alpha, alphamin )/(alpha*alpha*alpha);
1849 double bfun (
double alpha)
const
1851 return s.bfun(alpha,alphamin);
1856 class my_Integrand_VF01_beta :
public D_fp
1863 my_Integrand_VF01_beta(
long int n,
long int l,
long int lp,
double alphamin) :
1864 s( n, l, lp), alphamin(alphamin) {}
1868 double alpha = exp(beta);
1869 ASSERT( alpha >= 1.e-30 );
1871 return s( alpha, alphamin )/(alpha*alpha);
1873 double bfun (
double alpha)
const
1875 return s.bfun(alpha,alphamin);
1879 class StarkCollTransProb_VOS12QM
1882 double cosU1, cosU2, sinU1sinU2;
1883 vector<double> common;
1885 StarkCollTransProb_VOS12QM(
long int n1,
long int l1,
long int lp1) : n(n1), l(l1), lp(lp1), common(n)
1888 cosU1 = 2.*
POW2((
double)l/(
double)n) - 1.;
1889 cosU2 = 2.*
POW2((
double)lp/(
double)n) - 1.;
1891 sinU1sinU2 = sqrt( ( 1. - cosU1*cosU1 )*( 1. - cosU2*cosU2 ) );
1892 long Lmax =
MIN2(n-1,lp+l), Lmin = abs(lp-l);
1893 double ffac = 1./sqrt(
double(n));
1895 for (
long L=1; L < Lmin; ++L)
1897 ffac *= L/sqrt(
double(nsq-L*L));
1901 fprintf(
ioQQQ,
" PROBLEM: Catastrophic underflow in VOS12 QM transition probability\n"
1902 " Try reducing resolved levels\n");
1906 const int sjtyp = 1;
1909 double l1min,l1max,lmatch;
1911 rec6j(
get_ptr(common)+Lmin,lp,l,0.5*(n-1),0.5*(n-1),0.5*(n-1),
1912 &l1min,&l1max,&lmatch,n-Lmin,&ier);
1913 ASSERT(Lmin ==
int(l1min) && ier >= 0);
1915 for (
long L=Lmin; L <= Lmax; ++L)
1918 ffac *= L/sqrt(
double(nsq-L*L));
1928 sixj1 =
sjs(2*lp,2*l,2*L,n-1,n-1,n-1);
1929 else if (sjtyp == 2)
1930 sixj1 =
SixJFull(2*lp,2*l,2*L,n-1,n-1,n-1);
1933 common[L] = sixj1*ffac*sqrt(2.*
double(L)+1.);
1936 double operator()(
double alpha,
double alphamin)
const;
1937 double bfun (
double,
double )
const
1943 double StarkCollTransProb_VOS12QM::operator() (
double alpha,
double alphamin)
const
1945 DEBUG_ENTRY(
"StarkCollTransProb_VOS12QM::operator()()" );
1946 ASSERT( alpha >= 1e-30 );
1948 Chi_VF01 chi(alpha, alphamin);
1949 double sinChiOver2sq = chi.sinChiOver2sq();
1957 double cosChiVOS12QM = chi.cosChi();
1958 ASSERT( cosChiVOS12QM <= 1);
1960 long Lmax =
MIN2(n-1,lp+l);
1962 for (
long L=n-1; L > Lmax; --L)
1966 double frac = 4*sinChiOver2sq;
1968 for (
long L=Lmax; L >= abs(lp-l); --L)
1970 double gegen = u.val();
1976 double gegen1 =
gegenbauer(n-L-1,L+1,cosChiVOS12QM);
1978 1000*DBL_EPSILON+1e-10*fabs(gegen1)))
1979 fprintf(
ioQQQ,
"DEBUG %ld %ld %g: %g %g %g\n",n,L,cosChiVOS12QM,
1980 gegen1,gegen,gegen/gegen1-1.);
1983 double fac = common[L]*gegen;
1986 pqm *=
powi(frac,abs(lp-l))*(2*lp+1);
1992 void compare_VOS12()
1998 long n=30, l = 4, lp = 3, npt = 1000;
2000 StarkCollTransProb_VOS12QM qm( n, l, lp);
2001 StarkCollTransProb_VF01 cl( n, l, lp);
2003 for (
long i=0; i<npt; ++i)
2005 double ban = 900*(i+0.5)/double(npt);
2006 double alpha = 1.5/(ban*v);
2008 cl(alpha,alphamin),qm(alpha,alphamin));
2014 long n=28, l = 5, lp = 13, npt = 1000;
2016 StarkCollTransProb_VOS12QM qm( n, l, lp);
2017 StarkCollTransProb_VF01 cl( n, l, lp);
2018 for (
long i=0; i<npt; ++i)
2020 double alpha = (i+0.5)/double(npt);
2022 cl(alpha,alphamin),qm(alpha,alphamin));
2028 long n=8, l = 5, lp = 6, npt = 1000;
2030 vector<StarkCollTransProb_VOS12QM> qm;
2031 for (
long i=0; i<4; ++i)
2034 qm.push_back(StarkCollTransProb_VOS12QM(
2035 scale*n, scale*l, scale*lp));
2037 StarkCollTransProb_VF01 cl( n, l, lp);
2038 for (
long i=0; i<npt; ++i)
2040 double alpha = (i+0.5)/double(npt);
2043 for (vector<StarkCollTransProb_VOS12QM>::iterator it=qm.begin();
2044 it != qm.end(); ++it)
2055 long n=30, l = 29, npt = 10000;
2057 vector<StarkCollTransProb_VOS12QM> qm;
2058 for (
long lp=0; lp<n; ++lp)
2059 qm.push_back(StarkCollTransProb_VOS12QM( n, l, lp));
2061 for (
long i=0; i<npt; ++i)
2063 double ban = 400*(i+0.5)/double(npt);
2064 double alpha = 1.5/(ban*v);
2066 for (
long lp=0; lp<n; ++lp)
2068 qm[lp](alpha,alphamin));
2079 long nelem,
double gLo,
long Ztarget,
long Collider,
double sqrte)
2082 long lmin = (lp < l) ? lp : l, dl = abs(l-lp);
2083 double nlfac = double(n*n*(n*n*(l+lp)-lmin*lmin*(l+lp+2*dl)))/
2086 double massratio =
reduced_amu(nelem,Collider)/ELECTRON_MASS;
2087 double rate = 1.294e-5*sqrt(massratio)*Z*Z/(Ztarget*Ztarget*sqrte) * nlfac;
2088 double cs = rate / ( COLL_CONST *
powpq(massratio, -3, 2) ) * sqrte * gLo;
2094 double alphamin_int,
double alphamax_int)
2096 if (alphamin_int >= alphamax_int)
2098 double CSIntegral = 0.;
2100 double step = (alphamax_int - alphamin_int)/5.;
2101 double alpha1 = alphamin_int;
2102 CSIntegral += VF01_alpha.
sum( alpha1, alpha1+step );
2103 CSIntegral += VF01_alpha.
sum( alpha1+step, alpha1+4.*step );
2109 double alphamin_int,
double alphamax_int,
double eps)
2111 if (alphamin_int >= alphamax_int)
2116 double alphalo = alphamin_int;
2119 double alphahi = alphamax_int;
2120 while (alphahi-alphalo > 0.5*eps*(alphahi+alphalo))
2122 double alphamid = 0.5*(alphahi+alphalo);
2123 if (func.bfun(alphamid) <= 0.)
2132 VF01_alphaR(integrate::Midpoint<my_Integrand_VF01_beta<P> >(func,log(alphalo),log(alphamax_int)));
2134 return VF01_alphaR.
sum();
2139 double alphamin_int, double alphamax_int, double eps)
2141 if (alphamin_int >= alphamax_int)
2145 double alphalo = alphamin_int;
2148 double alphahi = alphamax_int;
2149 while (alphahi-alphalo > 0.5*eps*(alphahi+alphalo))
2151 double alphamid = 0.5*(alphahi+alphalo);
2152 if (func.bfun(alphamid) <= 0.)
2161 VF01_alphaR(integrate::Midpoint<my_Integrand_VF01_alpha<P> >(func,alphalo,alphamax_int));
2163 return VF01_alphaR.
sum();
2168 const my_Integrand_VF01_E<P>& vf)
2173 double reduced_b_max1;
2176 double reduced_vel = sqrt( 2.*E_Proj_Ryd*EN1RYD/vf.reduced_mass )/vf.RMSv;
2179 ASSERT( reduced_vel > 1.e-10 );
2180 ASSERT( reduced_vel < 1.e10 );
2188 double alphamax = 15000./
pow2(vf.n);
2203 double reduced_b_min = 1.5 * vf.ColliderCharge /reduced_vel/alphamax;
2204 ASSERT( reduced_b_min > 1.e-10 );
2205 ASSERT( reduced_b_min < 1.e10 );
2209 double reduced_debye = sqrt( BOLTZMANN*vf.temp/vf.ColliderCharge/
dense.
eden/PI )
2210 / (2.*ELEM_CHARGE_ESU)/vf.aveRadius;
2212 reduced_b_max1 = vf.reduced_b_max*sqrt(E_Proj_Ryd*EN1RYD/BOLTZMANN/vf.temp);
2214 reduced_b_max1 = vf.reduced_b_max;
2218 if (reduced_b_max1 <= reduced_b_min)
2221 reduced_b_max1 =
MAX2( reduced_b_max1, reduced_b_min );
2222 ASSERT( reduced_b_max1 > 0. );
2224 double alphamin = 1.5*vf.ColliderCharge/(reduced_vel * reduced_b_max1);
2230 double alphamin_int =
MAX2( alphamin, 1.e-30 );
2231 double alphamax_int =
MAX2( alphamax, 1.e-20 );
2233 double CSIntegral = 0.;
2237 my_Integrand_VF01_alpha<P> func(vf.n, vf.l, vf.lp, alphamin);
2242 my_Integrand_VF01_beta<P> funcb(vf.n, vf.l, vf.lp, alphamin);
2249 double epsabs=0., epsrel=1e-5, abserr, qqq;
2250 const long limit=25, lenw=4*limit;
2251 long neval, ier,last, iwork[limit];
2253 double lalphamin_int = log(alphamin_int),
2254 lalphamax_int = log(alphamax_int);
2255 dqags_(funcb,&lalphamin_int,&lalphamax_int,&epsabs,&epsrel,&qqq,
2256 &abserr,&neval,&ier,&limit,&lenw,&last,iwork,work);
2263 my_Integrand_VF01_alpha<P> func(vf.n, vf.l, vf.lp, alphamin);
2278 double epsabs=0., epsrel=1e-5, abserr;
2279 const long limit=25, lenw=4*limit;
2280 long neval, ier,last, iwork[limit];
2282 double lalphamin_int = log(alphamin_int),
2283 lalphamax_int = log(alphamax_int);
2284 dqags_(funcb,&lalphamin_int,&lalphamax_int,&epsabs,&epsrel,&qqq,
2285 &abserr,&neval,&ier,&limit,&lenw,&last,iwork,work);
2286 fprintf(
ioQQQ,
"Check VF QAGS1 err=%g neval=%ld ier=%ld\n",abserr,neval,ier);
2288 if (CSIntegral > 0. || qqq > 0.)
2290 fprintf(
ioQQQ,
"Check VF[%ld %ld->%ld %g %g]: %s %g var %g err=%g\n",
2291 vf.n,vf.l,vf.lp,E_Proj_Ryd,alphamin,
2292 ccc,qqq,CSIntegral,(qqq-CSIntegral)/
SDIV(CSIntegral));
2299 double ConstantFactors = 4.5*PI*
POW2(vf.ColliderCharge*vf.aveRadius/reduced_vel);
double operator()(double EOverKT) const
virtual double operator()(double) const =0
FILE * open_data(const char *fname, const char *mode, access_scheme scheme)
realnum EnergyErg() const
bool lgCS_PSClassic[NISO]
NORETURN void TotalInsanity(void)
my_Integrand_S62(double deltaE, double osc_strength, double temp, double I_energy_eV)
STATIC double CS_l_mixing_S62(double deltaE_eV, double IP_Ryd_ground, long gLo, double Aul, long nelem, long Collider, double temp)
bool lgCS_therm_ave[NISO]
double CS_l_mixing_VF01(long ipISO, long nelem, long n, long l, long lp, long s, long gLo, double tauLo, double IP_Ryd_Hi, double IP_Ryd_Lo, double temp, long Collider)
double SixJFull(long j1, long j2, long j3, long j4, long j5, long j6)
STATIC double CSIntegral_Romberg(long ipISO, const my_Integrand_VF01_beta< P > &func, double alphamin_int, double alphamax_int, double eps)
realnum GetHelikeCollisionStrength(long nelem, long Collider, long nHi, long lHi, long sHi, long jHi, long gHi, double IP_Ryd_Hi, long nLo, long lLo, long sLo, long jLo, long gLo, double IP_Ryd_Lo, double Aul, double tauLo, double EnerWN, double EnerErg, const char **where)
bool fp_equal_tol(sys_float x, sys_float y, sys_float tol)
double CS_l_mixing_PS64(long nelem, double tau, double target_charge, long n, long l, double gLo, long lp, double deltaE_eV, long Collider)
bool lgColl_l_mixing[NISO]
double sjs(long j1, long j2, long j3, long l1, long l2, long l3)
multi_arr< realnum, 3 > HeCS
bool lgCS_Vrinceanu[NISO]
realnum HeCSInterp(long nelem, long ipHi, long ipLo, long Collider)
void bessel_k0_k1(double x, double *k0val, double *k1val)
t_iso_sp iso_sp[NISO][LIMELM]
void vexp(const double x[], double y[], long nlo, long nhi)
double reduced_amu(long nelem, long Collider)
double xIonDense[LIMELM][LIMELM+1]
double operator()(double y) const
ColliderList colliders(dense)
double CS_l_mixing_VOS12(long n, long l, long lp, long nelem, double gLo, long Ztarget, long Collider, double sqrte)
double CS_VS80(long nHi, long gHi, double IP_Ryd_Hi, long nLo, long gLo, double IP_Ryd_Lo, double Aul, long nelem, long Collider, double temp)
my_Integrand_VF01_E_log(long ipISO_1, long nelem_1, long n_1, long l_1, long lp_1, long s, long gLo_1, double tauLo_1, double IP_Ryd_Hi_1, double IP_Ryd_Lo_1, long Collider_1, double temp_1)
realnum & EnergyWN() const
double sum(double min, double max) const
STATIC double collision_strength_VF01(long ipISO, double velOrEner, const my_Integrand_VF01_E< P > &vf)
EmissionList::reference Emis() const
void dqags_(const D_fp &f, const double *a, const double *b, const double *epsabs, const double *epsrel, double *result, double *abserr, long *neval, long *ier, const long *limit, const long *lenw, long *last, long *iwork, double *work)
my_Integrand_VF01_E< P > data
double powi(double, long int)
const char * strchr_s(const char *s, int c)
STATIC double S62BesselInvert(double zOverB2)
double sum(double min, double max) const
multi_arr< long, 3 > QuantumNumbers2Index
TransitionProxy trans(const long ipHi, const long ipLo)
realnum AtomicWeight[LIMELM]
double CS_l_mixing_VOS12QM(long ipISO, long nelem, long n, long l, long lp, long s, long gLo, double tauLo, double IP_Ryd_Hi, double IP_Ryd_Lo, double temp, long Collider)
double HydroEinstA(long int n1, long int n2)
void reserve(size_type i1)
vector< t_collider > list
void operator()(const double proj_energy_overKT[], double res[], long n) const
#define DEBUG_ENTRY(funcname)
double powpq(double x, int p, int q)
static const double ColliderCharge[4]
STATIC double cross_section(double EgammaRyd, double EthRyd, long nelem, long n, long l, long s)
double ConvCrossSect2CollStr(double CrsSectCM2, double gLo, double E_ProjectileRyd, double reduced_mass_grams)
void rec6j(double *sixcof, double l2, double l3, double l4, double l5, double l6, double *l1min, double *l1max, double *lmatch, long ndim, long *ier)
int fprintf(const Output &stream, const char *format,...)
my_Integrand_VF01_E(long ipISO_1, long nelem_1, long n_1, long l_1, long lp_1, long s, long gLo_1, double tauLo_1, double IP_Ryd_Hi_1, double IP_Ryd_Lo_1, long Collider_1, double temp_1)
sys_float SDIV(sys_float x)
char * read_whole_line(char *chLine, int nChar, FILE *ioIN)
STATIC double CSIntegral_Romberg_alpha(long ipISO, const my_Integrand_VF01_alpha< P > &func, double alphamin_int, double alphamax_int, double eps)
STATIC realnum HeCSTableInterp(long nelem, long Collider, long nHi, long lHi, long sHi, long jHi, long nLo, long lLo, long sLo, long jLo)
double gegenbauer(long n, double al, double x)
double CS_l_mixing_PS64_expI(long nelem, double tau, double target_charge, long n, long l, double g, long lp, double deltaE_eV, long Collider)
STATIC double CSIntegral_QG32(const my_Integrand_VF01_alpha< P > &func, double alphamin_int, double alphamax_int)
double CS_l_mixing(long ipISO, long nelem, long n, long l, long lp, long s, long gLo, double tauLo, double IP_Ryd_Hi, double IP_Ryd_Lo, double temp, long Collider)
double FFmtRead(const char *chCard, long int *ipnt, long int last, bool *lgEOL)