Python |
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 |
Fortran |
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 |