Fit Function: NEEXH2

Fit Function \[\begin{align*} \sigma(pe) &= \begin{cases} 0 & \text{if} \; pe \text{ < pcf}(1)\\ \frac{5.984 \times 10^{-16} \cdot \text{cstr}}{pe} \cdot \left(1- \frac{1}{x} \right)^{\text{pcf}(7)} & \text{otherwise} \end{cases} \\ \end{align*}\]
Comments Python code requires NumPy imported as `np` as well as `warnings`. Please refer to the source code for the information on `x` and `cstr`.

Fortran

Arguments
namedescriptionunitstype(s)
pe energy eV real, dimension(:)
pcf coefficient data array real, dimension(7)
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 neexh2(pe, pcf, kncf, pxs, kermsg)
c
c     this is a subroutine to calculate cross sections (cm[2])
c     versus energy (ev) for electron impact excitation.
c
c     pe = collision energy in ev
c
c     pcf(1) = threshold energy (ev), eth.
c     pcf(2-7) = parameters for fit to the cross section
c
c     kermsg = blank if no errors
c
c     pxs = cross section in cm[2]
c
c------------------------------------------------------------------------
c
      double precision pe, pcf, pxs
      double precision cstr, ryd, ksq, x, alog, u , ucont, eth
c
      dimension pcf(7)
      character*(*) kermsg
c
      data ryd/13.6d0/
c
      eth = pcf(1)
      if(pe .ge. eth) then
        kermsg = ' '
      else
        pxs = 0.0d0
        return
      endif
c
        ksq= pe/ryd
        etrans = eth/ryd
        x=ksq/etrans
        xsq = x*x
        xsq2 = xsq*xsq
        alog = 0.0d0
c
        if (pcf(6) .ne. zero) alog = pcf(6) * dlog (x)
        cstr = alog + pcf(2) + pcf(3)/x + pcf(4)/xsq + pcf(5)/(x*xsq)
c
        u = (pe - eth) / eth
        ucont = ( u / (u + 1.0d0)) ** pcf(7)
        pxs =   5.984e-16 *  ucont * cstr / pe
c
      return
      end

Python

Arguments
namedescriptionunitstype(s)
pe energy eV float, np.ndarray
pcf coefficient data array float, np.ndarray
Return values
namedescriptionunitstype(s)
pxs cross section cm2 float, np.ndarray
Code
def neexh2(pe, pcf):
    """
    This function calculates cross-sections in cm[2] as a function
    of projectile energy in ev/amu.

    pe: collision energy (ev)
    pcf: fit coefficient array
        pcf[0]: threshold energy (ev), eth
        pcf[1-7]: parameters for fit to the cross section
    """
    eth = pcf[0]

    if pe < eth:
        warnings.warn('Energy below threshold. Cross section set to 0.')
        pxs = 0.0
        return pxs

    if pe >= eth:
        ksq = pe/13.6
        etrans = eth/13.6
        x = ksq/etrans
        xsq = x * x
        xsq2 = xsq * xsq
        alog = 0.0

        if pcf[6] != 0:
            alog = pcf[6] * np.log(x)

        cstr = alog + pcf[2] + pcf[3]/x + pcf[4]/xsq + pcf[5]/ (x * xsq)

        u = (pe - eth)/eth
        ucont = (u / (u + 1.0)) ** pcf[7]

        pxs = 5.984e-16 * ucont * cstr / pe

    return pxs