Python |
def hexc3(pe, pcf):
"""
This function calculates the cross-section for heavy particle collisions.
pe: collision energy in eV
pcf: parameters for fit to the cross section
pcf[0:7]: 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)/pe, 0.0)
arg2 = -pcf[4] * pe
c2 = np.where(np.abs(arg2) < dexpr, pcf[3] * np.exp(arg2)/(pe**pcf[5] + (pcf[6] * (pe**pcf[7]))), 0.0)
pxs = pcf[0] * (c1 + c2)
return pxs |
Fortran |
c
c###################################################################
c
subroutine hexc3(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 ev
c
c pcf(1-8) = parameters for fit to the cross section
c
c kermsg = blank if no errors
c
c pxs = cross section in cm[2]
c------------------------------------------------------------------------
c
double precision pe, pcf, pxs
double precision e, a1, a2, a3, a4, a5, a6, arg1, arg2
double precision a7, a8, c1, c2, 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)
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)/
1 (e**a6 + (a7 * (e**a8)))
c
pxs=a1*(c1 + c2)
return
end |