Initial release of Maemo 5 port of gnuplot
[gnuplot] / demo / reflect.fnc
1 #
2 #   Model function for Reflectivity evaluation
3 #
4
5 mu = 1.130469005513490E-001                     # (cm-1) @ 17.479 keV
6 t0 = 0.18                                       # cm
7 tb = 11.417823202820120 * 0.01745329251994      # thetaB (radians)
8 A = mu * t0 / cos(tb)
9 P = (1 + (cos(2.*tb))**2) / 2
10 Fhkl = sqrt(3.536346308456155**2 + (4.58815426260982e-4)**2) * 0.968
11 r0 = 2.81794092e-13                             # classical electron radius
12 lambda = 7.09338062818239e-9                    # Mo K in cm
13 V = 1.62253546981499e-23
14 P = (1. + (cos(2.*tb))**2) / 2.
15 #
16 # combine constants to avoid exponential overflow on systems with
17 # D floating point format where exponential limits are ca. 10**(+/-38)
18 # r0liV = r0 * lambda / V
19 r0liV = 2.81794092*7.09338062818239/1.62253546981499e-1
20 #
21
22 W(x) = 1./(sqrt(2.*pi)*eta) * exp( -1. * x**2 / (2.*eta**2) )
23 Y(tc) = tc/sin(tb) * Fhkl * r0liV
24 f(tc)= (tanh(Y(tc)) + abs(cos(2.*tb)) * tanh(abs(Y(tc)*cos(2.*tb)))) / (Y(tc)*(1.+(cos(2.*tb))**2))
25 Q(tc) = (r0*Fhkl/V)**2 * (lambda**3/sin(2.*tb)) * P * f(tc)
26 a(x) = W(x) * Q(tc) / mu
27
28 #
29
30 R(x) = sinh(A*a(x)) * exp(-1.*A*(1.+a(x)))