Python |
def eionlt(pe, pcf, kncf):
"""
This function calulates electon-impact ionization cross sections(cm2)
as a function of energy in eV.
pe:collision energy in eV
pcf: parameter data array
pcf[0]: binding energy of the electron in first subshell
pcf[1]: binding energy of the electron in second subshell
pcf[2:10]: parameters for analytic function
"""
eth1 = pcf[0]
if pe >= eth1:
if kncf == 10:
eth2 = pcf[1]
xs1 = pcf[4] * pcf[2] * np.log(pe/eth1) *
(1.0 - pcf[6] * np.exp(-pcf[8] * (pe / eth1 - 1.0))) / eth1
xs2 = pcf[5] * pcf[3] * np.log(pe/eth2) *
(1.0 - pcf[7] * np.exp(-pcf[9] * (pe / eth2 - 1.0))) / eth2
pxs = 1.0e-14 * (xs1 + xs2) / pe
return pxs
else:
raise ValueError('Incorrect number of coefficients passed to eionlt')
else:
raise ValueError('Energy below threshold for ionization') |
Fortran |
c
c###################################################################
c
subroutine eionlt(pe, pcf, kncf, pxs, kermsg)
c
c this is a subroutine to calculate cross sections (cm[2])
c versus energy (ev) for electron impact ionization.
c
c pe = collision energy in eV
c
c this evaluation function requires the binding energies of the
c target atomic subshells and constants to be passed in the coefficient
c data array, such that
c
c pcf(1) = binding energy of the electron in first subshell
c pcf(2) = binding energy of the electron in second subshell
c pcf(3-4) = q1, q2
c pcf(5-6) = a1, a2
c pcf(7-8) = b1, b2
c pcf(9-10) = c1, c2
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.
c
c kermsg = blank if no errors
c
c pxs = cross section in cm[2]
c
c------------------------------------------------------------------------
c
double precision e, pe, pcf, pxs
double precision eth1, eth2, xs1, xs2
double precision a1, a2, b1, b2, c1, c2, q1, q2
c
dimension pcf(10)
character*(*) kermsg
c
eth1 = pcf(1)
if(pe .ge. eth1) then
kermsg = ' '
else
pxs = 0.0
return
endif
c
c energy remains in eV
e = pe
c
c determine the value of the cross section pxs
c
if(kncf .eq. 10) then
eth2 = pcf(2)
q1 = pcf(3)
q2 = pcf(4)
a1 = pcf(5)
a2 = pcf(6)
b1 = pcf(7)
b2 = pcf(8)
c1 = pcf(9)
c2 = pcf(10)
xs1 = a1 * q1 * dlog(e/eth1) *
1 (1.d0-b1*dexp(-c1*(e/eth1 - 1.d0)))/eth1
xs2 = a2 * q2 * dlog(e/eth2) *
1 (1.d0-b2*dexp(-c2*(e/eth2 - 1.d0)))/eth2
pxs = 1.0e-14 * (xs1 + xs2)/e
else
kermsg = ' incorrect number of coefficients passed to eionlt'
return
endif
c
return
end |