static float Jump_from_L2(int Z,float E) { float Factor=1.0,JumpL1,JumpL2,JumpK; float TaoL1=0.0,TaoL2=0.0; if( E > EdgeEnergy(Z,K_SHELL) ) { JumpK = JumpFactor(Z,K_SHELL) ; if( JumpK <= 0. ) return 0. ; Factor /= JumpK ; } JumpL1 = JumpFactor(Z,L1_SHELL) ; JumpL2 = JumpFactor(Z,L2_SHELL) ; if(E>EdgeEnergy (Z,L1_SHELL)) { if( JumpL1 <= 0.|| JumpL2 <= 0. ) return 0. ; TaoL1 = (JumpL1-1) / JumpL1 ; TaoL2 = (JumpL2-1) / (JumpL2*JumpL1) ; } else if( E > EdgeEnergy(Z,L2_SHELL) ) { if( JumpL2 <= 0. ) return 0. ; TaoL1 = 0. ; TaoL2 = (JumpL2-1)/(JumpL2) ; } else Factor = 0; Factor *= (TaoL2 + TaoL1*CosKronTransProb(Z,F12_TRANS)) * FluorYield(Z,L2_SHELL) ; return Factor; }
static double Jump_from_L2(int Z, double E, xrl_error **error) { double Factor = 1.0, JumpL1, JumpL2, JumpK; double TaoL1 = 0.0, TaoL2 = 0.0; double edgeK = EdgeEnergy(Z, K_SHELL, NULL); double edgeL1 = EdgeEnergy(Z, L1_SHELL, NULL); double edgeL2 = EdgeEnergy(Z, L2_SHELL, NULL); double ck_L12, yield; if (E > edgeK && edgeK > 0.0) { JumpK = JumpFactor(Z, K_SHELL, NULL); if (JumpK == 0.0) { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, UNAVAILABLE_JUMP_FACTOR); return 0.0; } Factor /= JumpK ; } JumpL1 = JumpFactor(Z, L1_SHELL, NULL); JumpL2 = JumpFactor(Z, L2_SHELL, NULL); if (E > edgeL1 && edgeL1 > 0.0) { if (JumpL1 == 0.0 || JumpL2 == 0.0) { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, UNAVAILABLE_JUMP_FACTOR); return 0.0; } TaoL1 = (JumpL1 - 1) / JumpL1 ; TaoL2 = (JumpL2 - 1) / (JumpL2 * JumpL1) ; } else if (E > edgeL2 && edgeL2 > 0.0) { if (JumpL2 == 0.0) { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, UNAVAILABLE_JUMP_FACTOR); return 0.0; } TaoL1 = 0.0; TaoL2 = (JumpL2 - 1) / JumpL2; } else { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, TOO_LOW_EXCITATION_ENERGY); return 0.0; } ck_L12 = CosKronTransProb(Z, F12_TRANS, NULL); if (TaoL1 > 0 && ck_L12 == 0.0) { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, UNAVAILABLE_CK); return 0.0; } yield = FluorYield(Z, L2_SHELL, NULL); if (yield == 0.0) { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, UNAVAILABLE_FLUOR_YIELD); return 0.0; } Factor *= (TaoL2 + TaoL1 * ck_L12) * yield; return Factor; }
static float Jump_from_L3(int Z,float E ) { float Factor=1.0,JumpL1,JumpL2,JumpL3,JumpK; float TaoL1=0.0,TaoL2=0.0,TaoL3=0.0; if( E > EdgeEnergy(Z,K_SHELL) ) { JumpK = JumpFactor(Z,K_SHELL) ; if( JumpK <= 0. ) return 0.; Factor /= JumpK ; } JumpL1 = JumpFactor(Z,L1_SHELL) ; JumpL2 = JumpFactor(Z,L2_SHELL) ; JumpL3 = JumpFactor(Z,L3_SHELL) ; if( E > EdgeEnergy(Z,L1_SHELL) ) { if( JumpL1 <= 0.|| JumpL2 <= 0. || JumpL3 <= 0. ) return 0. ; TaoL1 = (JumpL1-1) / JumpL1 ; TaoL2 = (JumpL2-1) / (JumpL2*JumpL1) ; TaoL3 = (JumpL3-1) / (JumpL3*JumpL2*JumpL1) ; } else if( E > EdgeEnergy(Z,L2_SHELL) ) { if( JumpL2 <= 0. || JumpL3 <= 0. ) return 0. ; TaoL1 = 0. ; TaoL2 = (JumpL2-1) / (JumpL2) ; TaoL3 = (JumpL3-1) / (JumpL3*JumpL2) ; } else if( E > EdgeEnergy(Z,L3_SHELL) ) { TaoL1 = 0. ; TaoL2 = 0. ; if( JumpL3 <= 0. ) return 0. ; TaoL3 = (JumpL3-1) / JumpL3 ; } else Factor = 0; Factor *= (TaoL3 + TaoL2 * CosKronTransProb(Z,F23_TRANS) + TaoL1 * (CosKronTransProb(Z,F13_TRANS) + CosKronTransProb(Z,FP13_TRANS) + CosKronTransProb(Z,F12_TRANS) * CosKronTransProb(Z,F23_TRANS))) ; Factor *= (FluorYield(Z,L3_SHELL) ) ; return Factor; }
static float Jump_from_L1(int Z,float E) { float Factor=1.0,JumpL1,JumpK; if( E > EdgeEnergy(Z,K_SHELL) ) { JumpK = JumpFactor(Z,K_SHELL) ; if( JumpK <= 0. ) return 0. ; Factor /= JumpK ; } if (E > EdgeEnergy(Z, L1_SHELL)) { JumpL1 = JumpFactor(Z, L1_SHELL); if (JumpL1 <= 0.0) return 0.0; Factor *= ((JumpL1-1)/JumpL1) * FluorYield(Z, L1_SHELL); } else return 0.; return Factor; }
static double Jump_from_L1(int Z, double E, xrl_error **error) { double Factor = 1.0, JumpL1, JumpK; double edgeK = EdgeEnergy(Z, K_SHELL, NULL); double edgeL1 = EdgeEnergy(Z, L1_SHELL, NULL); double yield; if (E > edgeK && edgeK > 0.0) { JumpK = JumpFactor(Z, K_SHELL, NULL); if (JumpK == 0.0) { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, UNAVAILABLE_JUMP_FACTOR); return 0.0; } Factor /= JumpK ; } if (E > edgeL1 && edgeL1 > 0.0) { JumpL1 = JumpFactor(Z, L1_SHELL, NULL); if (JumpL1 == 0.0) { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, UNAVAILABLE_JUMP_FACTOR); return 0.0; } yield = FluorYield(Z, L1_SHELL, NULL); if (yield == 0.0) { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, UNAVAILABLE_FLUOR_YIELD); return 0.0; } Factor *= ((JumpL1 - 1) / JumpL1) * yield; } else { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, TOO_LOW_EXCITATION_ENERGY); return 0.0; } return Factor; }
double CS_FluorLine(int Z, int line, double E, xrl_error **error) { double JumpK; double cs_line, Factor = 1.0; if (Z < 1 || Z > ZMAX) { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, Z_OUT_OF_RANGE); return 0.0; } if (E <= 0.0) { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, NEGATIVE_ENERGY); return 0.0; } if (line >= KN5_LINE && line <= KB_LINE) { double edgeK = EdgeEnergy(Z, K_SHELL, error); double cs, rr; if (E > edgeK && edgeK > 0.0) { double yield; JumpK = JumpFactor(Z, K_SHELL, error); if (JumpK == 0.0) { return 0.0; } yield = FluorYield(Z, K_SHELL, error); if (yield == 0.0) { return 0.0; } Factor = ((JumpK - 1)/JumpK) * yield; } else if (edgeK == 0.0) { return 0.0; } else { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, TOO_LOW_EXCITATION_ENERGY); return 0.0; } cs = CS_Photo(Z, E, error); if (cs == 0.0) { return 0.0; } rr = RadRate(Z, line, error); if (rr == 0.0) { return 0.0; } cs_line = cs * Factor * rr; } else if ((line <= L1L2_LINE && line >= L3Q1_LINE) || line == LA_LINE) { double cs, rr; cs = CS_Photo(Z, E, error); if (cs == 0.0) { return 0.0; } rr = RadRate(Z, line, error); if (rr == 0.0) { return 0.0; } if (line >= L1P5_LINE && line <= L1L2_LINE) { Factor = Jump_from_L1(Z, E, error); } else if (line >= L2Q1_LINE && line <= L2L3_LINE) { Factor = Jump_from_L2(Z, E, error); } /* * it's safe to use LA_LINE since it's only composed of 2 L3-lines */ else if ((line >= L3Q1_LINE && line <= L3M1_LINE) || line == LA_LINE) { Factor = Jump_from_L3(Z, E, error); } if (Factor == 0.0) { return 0.0; } cs_line = cs * Factor * rr; } else if (line == LB_LINE) { /* * b1->b17 */ double cs; cs_line = Jump_from_L2(Z, E, NULL) * (RadRate(Z, L2M4_LINE, NULL) + RadRate(Z, L2M3_LINE, NULL)) + Jump_from_L3(Z, E, NULL) * (RadRate(Z, L3N5_LINE, NULL) + RadRate(Z, L3O4_LINE, NULL) + RadRate(Z, L3O5_LINE, NULL) + RadRate(Z, L3O45_LINE, NULL) + RadRate(Z, L3N1_LINE, NULL) + RadRate(Z, L3O1_LINE, NULL) + RadRate(Z, L3N6_LINE, NULL) + RadRate(Z, L3N7_LINE, NULL) + RadRate(Z, L3N4_LINE, NULL)) + Jump_from_L1(Z, E, NULL) * (RadRate(Z, L1M3_LINE, NULL) + RadRate(Z, L1M2_LINE, NULL) + RadRate(Z, L1M5_LINE, NULL) + RadRate(Z, L1M4_LINE, NULL)); if (cs_line == 0.0) { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, TOO_LOW_EXCITATION_ENERGY); return 0.0; } cs = CS_Photo(Z, E, error); if (cs == 0.0) { return 0.0; } cs_line *= cs; } else { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, INVALID_LINE); return 0.0; } return cs_line; }
static double Jump_from_L3(int Z, double E, xrl_error **error) { double Factor=1.0, JumpL1, JumpL2, JumpL3, JumpK; double TaoL1=0.0, TaoL2=0.0, TaoL3=0.0; double edgeK = EdgeEnergy(Z, K_SHELL, NULL); double edgeL1 = EdgeEnergy(Z, L1_SHELL, NULL); double edgeL2 = EdgeEnergy(Z, L2_SHELL, NULL); double edgeL3 = EdgeEnergy(Z, L3_SHELL, NULL); double ck_L23, ck_L13, ck_LP13, ck_L12; double yield; if (E > edgeK && edgeK > 0.0) { JumpK = JumpFactor(Z, K_SHELL, NULL); if (JumpK == 0.0) { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, UNAVAILABLE_JUMP_FACTOR); return 0.0; } Factor /= JumpK ; } JumpL1 = JumpFactor(Z, L1_SHELL, NULL); JumpL2 = JumpFactor(Z, L2_SHELL, NULL); JumpL3 = JumpFactor(Z, L3_SHELL, NULL); if (E > edgeL1 && edgeL1 > 0.0) { if (JumpL1 == 0.0 || JumpL2 == 0.0 || JumpL3 == 0.0) { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, UNAVAILABLE_JUMP_FACTOR); return 0.0; } TaoL1 = (JumpL1 - 1) / JumpL1 ; TaoL2 = (JumpL2 - 1) / (JumpL2 * JumpL1) ; TaoL3 = (JumpL3 - 1) / (JumpL3 * JumpL2 * JumpL1) ; } else if (E > edgeL2 && edgeL2 > 0.0) { if (JumpL2 == 0.0 || JumpL3 == 0.0) { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, UNAVAILABLE_JUMP_FACTOR); return 0.0; } TaoL1 = 0.0; TaoL2 = (JumpL2 - 1) / (JumpL2) ; TaoL3 = (JumpL3 - 1) / (JumpL3 * JumpL2) ; } else if (E > edgeL3 && edgeL3 > 0.0) { TaoL1 = 0.0; TaoL2 = 0.0; if (JumpL3 == 0.0) { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, UNAVAILABLE_JUMP_FACTOR); return 0.0; } TaoL3 = (JumpL3 - 1) / JumpL3 ; } else { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, TOO_LOW_EXCITATION_ENERGY); return 0.0; } ck_L23 = CosKronTransProb(Z, F23_TRANS, NULL); ck_L13 = CosKronTransProb(Z, F13_TRANS, NULL); ck_LP13 = CosKronTransProb(Z, FP13_TRANS, NULL); ck_L12 = CosKronTransProb(Z, F12_TRANS, NULL); if (TaoL2 > 0.0 && ck_L23 == 0.0) { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, UNAVAILABLE_CK); return 0.0; } if (TaoL1 > 0.0 && (ck_L13 + ck_LP13 == 0.0 || ck_L12 == 0.0 || ck_L23 == 0.0)) { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, UNAVAILABLE_CK); return 0.0; } Factor *= TaoL3 + TaoL2 * ck_L23 + TaoL1 * (ck_L13 + ck_LP13 + ck_L12 * ck_L23); yield = FluorYield(Z, L3_SHELL, NULL); if (yield == 0.0) { xrl_set_error_literal(error, XRL_ERROR_INVALID_ARGUMENT, UNAVAILABLE_FLUOR_YIELD); return 0.0; } Factor *= yield; return Factor; }
float CS_FluorLine(int Z, int line, float E) { float JumpK; float cs_line, Factor = 1.; if (Z<1 || Z>ZMAX) { ErrorExit("Z out of range in function CS_FluorLine"); return 0; } if (E <= 0.) { ErrorExit("Energy <=0 in function CS_FluorLine"); return 0; } if (line>=KN5_LINE && line<=KB_LINE) { if (E > EdgeEnergy(Z, K_SHELL)) { JumpK = JumpFactor(Z, K_SHELL); if (JumpK <= 0.) return 0.; Factor = ((JumpK-1)/JumpK) * FluorYield(Z, K_SHELL); } else return 0.; cs_line = CS_Photo(Z, E) * Factor * RadRate(Z, line) ; } else if (line>=L1P5_LINE && line<=L1L2_LINE) { Factor=Jump_from_L1(Z,E); cs_line = CS_Photo(Z, E) * Factor * RadRate(Z, line) ; } else if (line>=L2Q1_LINE && line<=L2L3_LINE) { Factor=Jump_from_L2(Z,E); cs_line = CS_Photo(Z, E) * Factor * RadRate(Z, line) ; } /* * it's safe to use LA_LINE since it's only composed of 2 L3-lines */ else if ((line>=L3Q1_LINE && line<=L3M1_LINE) || line==LA_LINE) { Factor=Jump_from_L3(Z,E); cs_line = CS_Photo(Z, E) * Factor * RadRate(Z, line) ; } else if (line==LB_LINE) { /* * b1->b17 */ cs_line=Jump_from_L2(Z,E)*(RadRate(Z,L2M4_LINE)+RadRate(Z,L2M3_LINE))+ Jump_from_L3(Z,E)*(RadRate(Z,L3N5_LINE)+RadRate(Z,L3O4_LINE)+RadRate(Z,L3O5_LINE)+RadRate(Z,L3O45_LINE)+RadRate(Z,L3N1_LINE)+RadRate(Z,L3O1_LINE)+RadRate(Z,L3N6_LINE)+RadRate(Z,L3N7_LINE)+RadRate(Z,L3N4_LINE)) + Jump_from_L1(Z,E)*(RadRate(Z,L1M3_LINE)+RadRate(Z,L1M2_LINE)+RadRate(Z,L1M5_LINE)+RadRate(Z,L1M4_LINE)); cs_line*=CS_Photo(Z, E); } else { ErrorExit("Line not allowed in function CS_FluorLine"); return 0; } return (cs_line); }
int getAtomicXRayCS_Kissel (int shellID) { int i, Z; float energy_keV; Z = SymbolToAtomicNumber ( targetFormula ); edgeEnergy = 0.0; fluorYield = 1.0; jumpFactor = 1.0; levelWidth = 0.0; electronConfig = Z; if (verbose > 3) { fprintf(stdout, "getAtomicXRayCS: Z = %d\n", Z); fprintf(stdout, "getAtomicXRayCS_Kissel: shellID = %d\n", shellID); if (verbose>2) { fprintf(stdout, "Index PhotonEnergy TotalCS PhotoCS coherentCS incohrentCS \n"); } } if (shellID <= 30 && shellID >= 0) { edgeEnergy = 1000.0 * EdgeEnergy(Z, shellID); fluorYield = FluorYield(Z, shellID); jumpFactor = JumpFactor(Z, shellID); electronConfig = ElectronConfig(Z, shellID); levelWidth = AtomicLevelWidth(Z, shellID); for ( i = 0; i < npts; i++ ) { energy_keV = 0.001 * energy[i]; if ( energy[i] > edgeEnergy ) { photo[i] = CS_Photo_Partial (Z, shellID, energy_keV); } else { photo[i] = 0.0; } total[i] = 0.0; rayleigh[i] = 0.0; compton[i] = 0.0; if (verbose>2) { fprintf(stdout, "%4d %12.1f %12.4g %12.4g %12.4g %12.4g \n", i, energy[i], total[i], photo[i], rayleigh[i], compton[i]); } } } else if (shellID > 99) { for ( i = 0; i < npts; i++ ) { energy_keV = 0.001 * energy[i]; total[i] = CS_Total_Kissel ( Z, energy_keV ); photo[i] = CS_Photo_Total ( Z, energy_keV ); rayleigh[i] = CS_Rayl ( Z, energy_keV ); compton[i] = CS_Compt ( Z, energy_keV ); if (verbose>2) { fprintf(stdout, "%4d %12.1f %12.4g %12.4g %12.4g %12.4g \n", i, energy[i], total[i], photo[i], rayleigh[i], compton[i]); } } } else { for ( i = 0; i < npts; i++ ) { energy_keV = 0.001 * energy[i]; photo[i] = CS_Photo ( Z, energy_keV ); total[i] = CS_Total ( Z, energy_keV ); rayleigh[i] = CS_Rayl ( Z, energy_keV ); compton[i] = CS_Compt ( Z, energy_keV ); if (verbose>2) { fprintf(stdout, "%4d %12.1f %12.4g %12.4g %12.4g %12.4g \n", i, energy[i], total[i], photo[i], rayleigh[i], compton[i]); } } } if (verbose > 1) { fprintf(stdout, "edgeEnergy = %f, fluorYield = %f, jumpFactor = %f,", edgeEnergy, fluorYield, jumpFactor); fprintf(stdout, " electronConfig = %f, levelWidth = %f \n", electronConfig, levelWidth); } return 0; }