Fit Function: HEXC2

Fit Function \[\begin{align*} \sigma (pe) &= \text{pcf(1)} \left( c_1 + c_2 + c_3 \right) \\ \text{where} \quad c_1 &= \begin{cases} \exp\left(-\frac{\text{pcf(2)}}{pe}\right) \cdot \frac{\log\left(1 + \text{pcf(3)} \cdot pe\right)}{pe}, & \text{if } \left|\frac{\text{pcf(2)}}{pe}\right| < 700 \\ 0, & \text{otherwise} \end{cases} \\ c_2 &= \begin{cases} \frac{\text{pcf(4)} \cdot \exp\left(-\text{pcf(5)} \cdot pe\right)}{pe^{\text{pcf(6)}}}, & \text{if } \left|\text{pcf(5)} \cdot pe\right| < 700 \\ 0, & \text{otherwise} \end{cases} \\ c_3 &= \begin{cases} \frac{\text{pcf(7)} \cdot \exp\left(-\frac{\text{pcf(8)}}{pe}\right)}{1 + \text{pcf(9)} \cdot pe^{\text{pcf(10)}}}, & \text{if } \left|\frac{\text{pcf(8)}}{pe}\right| < 700 \\ 0, & \text{otherwise} \end{cases} \end{align*}\]
Comments Python code requires NumPy imported as `np`.

Fortran

Arguments
namedescriptionunitstype(s)
pe requested energy keV u-1 real, dimension(:)
pcf coefficient data array real, dimension(9)
kncf number of coefficients in the data array integer
pxs cross section cm2 real, dimension(:)
kermsg error message character
Return values
namedescriptionunitstype(s)
pxs cross section cm2 real, dimension(:)
Code
c
c###################################################################
c
      subroutine hexc2(pe, pcf, kncf, pxs, kermsg)
c
c     this is a subroutine to calculate cross sections (cm[2])
c     versus projectile energy (ev) for heavy particle collisions.
c
c     pe = collision energy in kev/amu
c
c     pcf(1-10) = parameters for fit to the cross section
c
c     kermsg = blank if no errors
c
c     pxs = cross section in 10e-16 cm[2]
c------------------------------------------------------------------------
c
      double precision pe, pcf, pxs
      double precision e, a1, a2, a3, a4, a5, a6, arg1, arg2, arg3
      double precision a7, a8, a9, a10, c1, c2, c3, dexpr, zero, one
c
      dimension pcf(10)
      character*(*) kermsg
        data dexpr/7.00d+02/
        data zero/0.00d+00/
        data one/1.00d+00/
c
c     generate e, the energy in kev
c
      e = pe
      a1= pcf(1)
      a2= pcf(2)
      a3= pcf(3)
      a4= pcf(4)
      a5= pcf(5)
      a6= pcf(6)
      a7= pcf(7)
      a8= pcf(8)
      a9= pcf(9)
      a10= pcf(10)
      arg1=-a2/e
      c1=zero
      if (dabs(arg1) .lt. dexpr) c1=dexp(arg1) * dlog(one+(a3*e))/e
c
      arg2=-a5*e
      c2=zero
      if (dabs(arg2) .lt. dexpr) c2=a4*dexp(arg2)/(e**a6)
c
      arg3=-a8/e
      c3=zero
      if (dabs(arg3) .lt. dexpr) c3= a7*dexp(arg3)/
     1   (one + a9*(e**a10))
c
      pxs=a1*(c1 + c2 + c3)
      return
      end

Python

Arguments
namedescriptionunitstype(s)
pe requested energy keV u-1 float, np.ndarray
pcf coefficient data array float, np.ndarray
Return values
namedescriptionunitstype(s)
pxs cross section cm2 float, np.ndarray
Code
def hexc2(pe, pcf):
    """
    This function calculates the cross-section for heavy particle collisions.

    pe: collision energy in keV/amu
    pcf: parameter data array
        pcf[0:10]: parameters for fit to the cross section
    """ 
    dexpr = 700.0

    arg1 = -pcf[1]/pe
    c1 = np.where(np.abs(arg1) < dexpr, np.exp(arg1) * np.log(1 + pcf[2] * pe)/e, 0.0)
    
    arg2 = -pcf[4] * pe
    c2 = np.where(np.abs(arg2) < dexpr, pcf[3] * np.exp(arg2)/(pe**pcf[5]), 0.0)
    
    arg3 = -pcf[7]/pe
    c3 = np.where(np.abs(arg3) < dexpr, pcf[6] * np.exp(arg3) 
                  / (1 + pcf[8] * (pe**pcf[9])), 0.0)
    
    pxs = pcf[0] * (c1 + c2 + c3)
    
    return pxs