#### Ref4.txt

Complex Fresnel Calculations
The complex Fresnel calculations employed in the SPR thickness measurements
are given in the form of a macro for the software program IGOR PRO
(Wavemetric's, Inc.). The calculations closely follow those published in
the article by Wilford Hansen, J. Opt. Soc. Am. 1968, 58, 380-390.
Although the equations follow Hansen's N-phase method, this particular
macro is written to perform only a 4-phase calculation, which typically
involves the phases: glass, gold, thin film, and then air or water. The
results of these complex Fresnel calculations are plots of the percent
reflectivity of p-polarized light (pRp) versus the angle of incidence
(angle). For those not familiar with the program IGOR PRO, it calls a list
of data points a "wave," and a variable is clearly just a single value.
Mathematical operations are carried out on these waves just as on a
spreadsheet column, for example. Many of the waves in these calculations
are complex (i.e. comprised of a list of complex numbers). In order to
relate these macros with the Hansen paper, note the following alterations:
c is equivalent to x,
b is equivalent to b,
e is equivalent to e, (the dielectric constant)
d is equivalent to h, (the layer thickness)
m is equivalent to M, (the symbol used to denote a matrix)
pRp is equivalent to R||, (the reflectivity of transverse magnetic or
p-polarized light)
A number from 1-4, following d, n, e, c, b, q, or m, is
equivalent to the subscript j in the Hansen paper which refers to the
particular phase or layer involved.
q, n (the index of refraction), and r (the reflectance) are as defined in
the Hansen paper. The waves z, ct, and ct2 are intermediate waves used
only in this macro and not in the Hansen paper. With these changes
defined, one should be able to understand the complex Fresnel calculations
by referring to the explanations given in the Hansen paper. In addition,
the Hansen paper presents much more complete Fresnel calculations, and so
these macros can be modified to obtain other information. For example,
phase shifts and electric field strengths can be calculated along with the
reflectivity. Furthermore, these macros are easily altered for systems of
5 or more phases and also could be used for calculations relating to
transverse electric (s-polarized) radiation.
The Macros for IGOR PRO
Macro Setitup() | Makes waves and variables--not global and so
| cannot run this macro. Must copy onto command line
Make/N=2000 angle,rad,pRp,prp1, z1,z2
Make/N=2000/C r,c1,c2,c3,c4,q1,q2,q3,q4,b2,b3,ct,ct2
Make/N=2000/C m2n11, m2n12,m2n21,m2n22,m3n11,m3n12,m3n21,m3n22
Make/N=2000/C m11,m12,m21,m22
Variable d2,d3,lambda
Variable /C n1,n2,n3,n4,e1,e2,e3,e4
DefaultFont/U "Helvetica"
EndMacro
Macro Angl() | Sets up range of incident angles for the calculation
angle = 8*x/2000 | 8 gives range of angles; 2000 is number of points
angle = angle + 40 | 40 is the start of the range of angles
rad = angle*pi/180 | Converts angle in degrees to radians
EndMacro
Macro Film() | Assigns layer thicknesses and wavelength in
d2 = 475
d3 = 0
lambda = 6328
EndMacro
Macro Di() | Assign complex indices of refraction, n; calculate
n1 = cmplx(1.515,0) | the dielectric constants, e
e1 = n1*n1
n2 = cmplx(0.154,3.55)
e2 = n2*n2
n3 = cmplx(1.45,0)
e3 = n3*n3
n4 = cmplx(1,0)
e4 = n4*n4
EndMacro
Macro Xi() | Use e to calculate values of xi (called c here)
c1 = n1*cmplx(cos(rad),0)
c2 = e1*cmplx(sin(rad)^2,0)
c2 = e2 - c2
ct = r2polar(c2) | 3 lines to get square root of the
ct2 = cmplx(sqrt(real(ct)), abs(imag(ct)/2)) | complex wave by going to
c2= p2rect(ct2) | polar coordinates
c3 = e1*cmplx(sin(rad)^2,0)
c3 = e3 - c3
ct = r2polar(c3) | ct and ct2 just temporary waves
ct2 = cmplx(sqrt(real(ct)),abs(imag(ct)/2)) | in the square root calc
c3 = p2rect(ct2)
c4 = e1*cmplx(sin(rad)^2,0)
c4 = e4 - c4
ct = r2polar(c4)
ct2 = cmplx(sqrt(real(ct)),abs(imag(ct)/2))
c4 = p2rect(ct2)
EndMacro
Macro Reflec() | reflectivity calc of p-polarized light
b2 = cmplx(2*pi*d2/lambda,0)
b2 = b2*c2 | calc of the beta values (called b here)
b3 = cmplx(2*pi*d3/lambda,0)
b3 = b3*c3
q1 = c1/e1 | calc of q values
q2 = c2/e2
q3 = c3/e3
q4 = c4/e4
z1 = cos(real(b2))*cosh(imag(b2)) | calc real part of the cosine of b2
z2 = -sin(real(b2))*sinh(imag(b2)) | calc imag part of the cosine of b2
m2n11 = cmplx(z1,z2) | the 1,1 element of matrix M2
m2n22 = m2n11 | the 2,2 element is the same
z1 = sin(real(b2))*cosh(imag(b2)) | calc real part of the sine of b2
z2 = cos(real(b2))*sinh(imag(b2)) | calc imag part of the sine of b2
m2n12 = cmplx(0,-1)*cmplx(z1,z2)/q2 | calc 1,2 element of matrix M2
m2n21 = cmplx(0,-1)*cmplx(z1,z2)*q2 | calc 2,1 element of matrix M2
z1 = cos(real(b3))*cosh(imag(b3)) |
z2 = -sin(real(b3))*sinh(imag(b3)) |
m3n11 = cmplx(z1,z2) |
m3n22 = m3n11 | same as above
z1 = sin(real(b3))*cosh(imag(b3)) | but now for matrix M3
z2 = cos(real(b3))*sinh(imag(b3)) |
m3n12 = cmplx(0,-1)*cmplx(z1,z2)/q3 |
m3n21 = cmplx(0,-1)*cmplx(z1,z2)*q3 |
m11 = m2n11*m3n11 + m2n12*m3n21 |
m12 = m2n11*m3n12 + m2n12*m3n22 | M2 * M3 = M
m21 = m2n21*m3n11 + m2n22*m3n21 |
m22 = m2n21*m3n12 + m2n22*m3n22 |
ct = (m11 + m12*q4)*q1 | ct and ct2 are temporary waves
ct2 = m21 + m22*q4 | used to calc reflectance, r
r = (ct - ct2)/(ct + ct2) |
prp = magsqr(r) * 100 | calc % reflectivity of p-polarized light
EndMacro
Macro FindMin() | find the SPR angle (minimum %R)
Variable MinAng
WaveStats pRp1
MinAng = (8*V_minloc/2000) + 40
Print MinAng
Print prp1(V_minloc - 1)
Print prp1(V_minloc)
Print prp1(V_minloc + 1)
EndMacro
Macro fr() | if change a thickness and want to recalculate
film()
reflec()
findmin()
EndMacro
Macro dxr() | if change an n value and want to recalculate
di()
xi()
reflec()
EndMacro
Macro kill() | kill temp waves to cut file size by 90%
killwaves rad, z1,z2, r,c1,c2,c3,c4,q1,q2,q3,q4,b2,b3,ct,ct2, m2n11, m2n12
killwaves m2n21,m2n22,m3n11,m3n12,m3n21,m3n22, m11,m12,m21,m22
Endmacro
Macro Remake() | just remake the waves if wish to do more calcs
Make/N=2000 rad, z1,z2
Make/N=2000/C r,c1,c2,c3,c4,q1,q2,q3,q4,b2,b3,ct,ct2
Make/N=2000/C m2n11, m2n12,m2n21,m2n22,m3n11,m3n12,m3n21,m3n22
Make/N=2000/C m11,m12,m21,m22
EndMacro