HEXC5
Fit Function | \[\begin{align*} \sigma (pe) &= \text{pcf}(2) \cdot \text{pcf}(3) \cdot (c_1 + c_2) \\ \text{where} \quad c_1 &= \begin{cases} \frac{\exp\left(-\frac{\text{pcf}(4)}{pe}\right) \cdot \ln\left(1 + \text{pcf}(5) \cdot pe\right)}{pe} & \text{if } \left|\frac{\text{pcf}(4)}{pe}\right| < 700 \\ 0 & \text{otherwise} \end{cases} \\ c_2 &= \begin{cases} \frac{\text{pcf}(6) \cdot \exp(-\text{pcf}(7) \cdot pe)}{pe^{\text{pcf}(8)}} & \text{if } \left|\text{pcf}(7) \cdot pe\right| < 700 \\ 0 & \text{otherwise} \end{cases} \end{align*}\] |
Comments | Python code requires NumPy imported as `np`. |
Arguments |
|
||||||||||||||||||||||||
Return values |
|
||||||||||||||||||||||||
Code | c c c################################################################### c subroutine hexc5(pe, pcf, kncf, pxs, kermsg) c c this is a subroutine to calculate cross sections (cm[2]) c versus proton energy (ev). c c pe = collision energy in kev/amu c c pcf(1) = lower limit of the validity of the analytic fit. c pcf(2-8) = parameters for the analytic function. c c kermsg = blank if no errors c c pxs = cross section in 10e-16 cm[2] c c------------------------------------------------------------------------ c double precision pe, pcf, pxs double precision a1, a2, a3, a4, a5, a6, b1, n, m double precision arg1, arg2, zero, c1, c2, dexpr, e, one c dimension pcf(9) character*(*) kermsg data dexpr/7.00d+02/ data zero/0.00d+00/ data one/1.00d+00/ c e = pe b1= pcf(2) a1= pcf(3) a2= pcf(4) a3= pcf(5) a4= pcf(6) a5= pcf(7) a6= pcf(8) c arg1=-a2/e c1=zero if (dabs(arg1) .lt. dexpr) c1=dexp(arg1) * dlog(one+(a3*e))/e arg2=-a5*e c2=zero if (dabs(arg2) .lt. dexpr) c2=a4*dexp(arg2)/(e**a6) pxs = a1 * b1 * ( c1 + c2) c return end |
Arguments |
|
||||||||||||
Return values |
|
||||||||||||
Code | def hexc5(pe, pcf): """ This function calculates the cross-section for proton collisions. pe: collision energy in keV/amu pcf: parameter data array pcf[0]: lower limit of the validity of the analytic fit pcf[1:8]: parameters for the analytic function """ dexpr = 700.0 arg1 = -pcf[3]/pe c1 = np.where(np.abs(arg1) < dexpr, np.exp(arg1) * np.log(1 + pcf[4] * pe)/pe, 0.0) arg2 = -pcf[6] * pe c2 = np.where(np.abs(arg2) < dexpr, pcf[5] * np.exp(arg2)/(pe**pcf[7]), 0.0) pxs = pcf[1] * pcf[2] * (c1 + c2) return pxs |