JEEXC5| Fit Function | \[\begin{align*} \sigma (pe) &= c1 \; \sqrt{\frac{u}{u+1}} \frac{1}{u + \text{pcf}(4)} \begin{cases} \ln(u + 16) & \text{if } \text{pcf}(1)= 1 \\ 1 & \text{if } \text{pcf}(1)= 2 \\ \end{cases} \\ \end{align*}\] |
| Comments | Python code requires NumPy imported as `np` as well as `warnings`. The values of `c1`, and `u` are specific to the code and should be referred to the source code for actual values and details. |
| Arguments |
|
||||||||||||||||||||||||
| Return values |
|
||||||||||||||||||||||||
| Code | c
c###################################################################
c
subroutine jeexc5(pe, pcf, kncf, pfit, kermsg)
c
c this is a subroutine to calculate a cross section
c in cm[2] as function of electron energy in ev.
c for details see doc=h-he-plasma , used for reactions
c 2.3.14, 2.3.15, 2.3.16, 2.3.17a, 2.3.17b
c (see doc=h-he-plasma.)
c
c pcf is the coefficient data array, where
c
c pcf(1) = ttype , type of expression
c if ttype = 1 expression contains ln (u + 16)
c if ttype = 2 expression contains 1 instead of ln term
c
c pcf(2) = normalisation coefficient a
c
c pcf(3) = coefficient c
c
c pcf(4) = coefficient phi
c
c pcf(5) = principal quantum number of the initial state
c
c pcf(6) = principal quantum number of the final state
c
c - warning- .
c
c the coefficient array pcf is updated by this routine to
c include energy independent constants. these coefficients can be
c used in subsequent calls for the same entry. the coefficeients
c added are, see doc=h-he-plasma for meaning,
c
c pcf(7) = threshold energy for the transition
c
c pe = electron energy (ev)
c
c kermsg = blank if no errors
c
c pfit = cross section in cm[2]
c
c written by j. j. smith , iaea atomic and molecular data unit
c
c------------------------------------------------------------------------
c
double precision pe, pcf, pfit
integer n, m, ttype
dimension pcf(7)
character*(*) kermsg
data ry/13.58/
ttype=pcf(1)
a=pcf(2)
c=pcf(3)
phi=pcf(4)
n=pcf(5)
m=pcf(6)
an = n
am = m
c
c first call to jeexc5 determine energy independent
c parameters and place in pcf for further use
c
if (kncf .eq. 6) then
eth = 4.0 *ry * ( 1.0/(an*an) - 1.0/(am*am))
pcf(7) = eth
kncf = 7
else if (kncf .eq. 7) then
eth = pcf(7)
else
kermsg = ' incorrect number of coefficients passed to eexchd'
return
endif
c
if (pe .lt. eth) then
pfit = 0.0
return
endif
c
u = (pe - eth) / eth
c1= a * (c/(am**3)) * ((ry/eth)**2)
pfit = c1 * sqrt(u/(u+1.0))
if (ttype .eq. 1) then
pfit = pfit * log ( (u + 16.0))/ (u + phi)
else if (ttype .eq. 2) then
pfit = pfit / (u + phi)
else
pfit=0.0
kermsg = 'invalid first coefficient must be 1 or 2 '
endif
c
return
c
end |
| Arguments |
|
||||||||||||||||
| Return values |
|
||||||||||||||||
| Code | def jeexc5(pe, pcf, kncf):
"""
This function calculates the cross section in cm2 as function of electron energy.
pe: electron energy in eV
pcf: parameter data array
pcf[0]: type of the analytic fit
pcf[1:4]: fit coeffcient
pcf[4]: principle quantum number of the initial state
pcf[5]: principle quantum number of the final state
pcf[6]: threshold energy
"""
ry = 13.58
# First call to determine energy independent parameters
if kncf == 6:
eth = 4.0 * ry * (1.0 / (pcf[4]**2) - 1.0 / (pcf[5]**2))
pcf[6] = eth
kncf = 7
elif kncf == 7:
eth = pcf[6]
else:
raise ValueError("Incorrect number of coefficients passed to eexchd")
if pe < eth:
warnings.warn('Energy below threshold. Cross section set to 0.')
pfit = 0.0
return pfit
u = (pe - eth)/eth
c1 = pcf[1] * (pcf[2] / (pcf[5]**3)) * ((ry / eth)**2)
pfit = c1 * np.sqrt(u / (u + 1.0))
if pcf[0] == 1:
pfit *= np.log(u + 16.0) / (u + pcf[[3])
elif pcf[0] == 2:
pfit /= u + pcf[3]
else:
raise ValueError("Invalid first coefficient; must be 1 or 2")
return pfit |