NIST

PUBLICATIONS

A111D3 DfllSbfl

C

NATL INST OF STANDARDS & TECH R.I.C.

A11 103081 568

> Marchlando, J. F/A software Program lor ji QC100 .U57 NO.400-83 1989 V198 C.1 NIST- o

NIST SPECIAL PUBLICATION 400-83

U.S. DEPARTMENT OF COMMERCE/National Institute of Standards and Technology

100

U57

#400-83

1989

C.2

emico,
rheNational Institute of Standards and Technology^ was established by an act of Congress on March 3, 1901. The Institute's overall goal is to strengthen and advance the Nation's science and technology and

facilitate their effective application for public benefit. To this end, the Institute conducts research to assure international competitiveness and leadership of U.S. industry, science and technology. NIST work involves development

and transfer of measurements, standards and related science and technology, in support of continually improving

U.S. productivity, product quality and reliability, innovation and underlying science and engineering. The Institute's technical work is performed by the National Measurement Laboratory, the National Engineering Laboratory, the National Computer Systems Laboratory, and the Institute for Materials Science and Engineering.

The National Measurement Laboratory

Provides the national system of physical and chemical measurement;

coordinates the system with measurement systems of other nations and furnishes essential services leading to accurate and uniform

physical and chemical measurement throughout the Nation's scientific community, industry, and commerce; provides advisory and research

services to other Government agencies; conducts physical and chemical

research; develops, produces, and distributes Standard Reference

Materials; provides calibration services; and manages the National

Standard Reference Data System. The Laboratory consists of the following centers: The National Engineering Laboratory

Basic Standards^

Radiation Research

Chemical Physics

Analytical Chemistry

Provides technology and technical services to the public and private

sectors to address national needs and to solve national problems;

conducts research in engineering and applied science in support of these

efforts; builds and maintains competence in the necessary disciplines

required to carry out this research and technical service; develops engineering data and measurement capabilities; provides engineering measure- ment traceability services; develops test methods and proposes engineering standards and code changes; develops and proposes new

engineering practices; and develops and improves mechanisms to

transfer results of its research to the ultimate user. The Laboratory

consists of the following centers: The National Computer Systems Laboratory

Computing and Applied

Mathematics

Electronics and Electrical Engineering^

Manufacturing Engineering

Building Technology

Fire Research

Chemical Engineering^

Conducts research and provides scientific and technical services to aid Federal agencies in the selection, acquisition, application, and use of computer technology to improve effectiveness and economy in Government operations in accordance with Public Law 89-306 (40 U.S.C. 759), relevant Executive Orders, and other directives; carries out this mission

by managing the Federal Information Processing Standards Program,

developing Federal ADP standards guidelines, and managing Federal

participation in ADP voluntary standardization activities; provides scientific and technological advisory services and assistance to Federal

agencies; and provides the technical foundation for computer-related

policies of the Federal Government. The Laboratory consists of the following divisions: The Institute for Materials Science and Engineering

Information Systems

Engineering

Systems and Software

Technology

Computer Security

Systems and Network

Architecture

Advanced Systems

Conducts research and provides measurements, data, standards, refer- ence materials, quantitative imderstanding and other technical information fundamental to the processing, structure, properties and perfor- mance of materials; addresses the scientific basis for new advanced

materials technologies; plans research around cross-cutting scientific themes such as nondestructive evaluation and phase diagram development; oversees Institute-wide technical programs in nuclear reactor

radiation research and nondestructive evaluation; and broadly disseminates generic technical information resulting from its programs. The

Institute consists of the following divisions:

Ceramics

Fracture and Deformation-'

Polymers

Metallurgy Reactor Radiation

'Headquarters and Laboratories at Gaithersburg, MD, unless otherwise noted; mailing address Gaithersburg, MD 20899. ^Some divisions within the center are located at Boulder, CO 80303.

^ Located at Boulder, CO, with some elements at Gaithersburg, MD.
Semiconductor Measurement Technology:

A Software Program for

Aiding the Analysis of

EUipsometric Measurements,

Simple Models

J. F. Marchiando

Semiconductor Electronics Division

National Institute of Standards and Technology

Gaithersburg, MD 20899

July 1989

NOTE: As of 23 August 1988, the National Bureau of

Standards (NBS) became the National Institute of

Standards and Technology (NIST) when President

Reagan signed into law the Omnibus Trade and

Competitiveness Act

(2cioo

U.S. DEPARTMENT OF COMMERCE, Robert A. Mosbacher, Secretary

NATIONAL INSTITUTE OF STANDARDS AND TECHNOLOGY, Raymond G. Kammer, Acting Director
Library of Congress Catalog Card Number: 89-600743

National Institute of Standards and Technology Special Publication 400-83

Natl. Inst. Stand. Technol. Spec. Publ. 400-83, 252 pages (July 1989)

CODEN: NSPUE2

U.S. GOVERNMENT PRINTING OFFICE

WASHINGTON: 1989

For sale by the Superintendent of Documents, U.S. Government Printing Office, Washington, DC 20402-9325
Table of Contents

Page

Abstract 1

1. Introduction 2

2. The Forward Problem 5

2.1 Transverse Electric Mode or 5-Polarization 7

2.1.1 Reflection Coefficient 7

2.1.2 Partial Derivatives 11

2.2 Transverse Magnetic Mode or P-Polarization 15

2.2.1 Reflection Coefficient 15

2.2.2 Partial Derivatives 17

2.3 Ellipsometric Angles (A, V') 20

3. The Inverse Problem 23

3.1 Formulation of the Leeist- Squares Problem 23

3.2 Sensitivity Analysis of Model Parameters 26

4. Manual of Operations 32

4.1 Software Development Considerations 32

4.1.1 Input/Output Files 32

4.1.2 Allocations of Array or Work Space 33

4.1.3 Library Software 34

4.2 Input Data Requirements 35

4.2.1 Parameters 35

4.2.1.1 Wavelengths 35

4.2.1.2 Optical Media 37

4.2.1.3 Layer Thickness 40

4.2.2 Sample Characterization or Construction 41

4.2.3 Measurement Data (A,V') 48

4.2.4 Combining 50

4.3 Command Options 51

4.3.1 Forward Problems, Plots, 53

4.3.2 Search (vary) 56

4.3.3 Search Grid (vary) 58

4.3.4 Search Grid (froz,vary) 59

iii
4.3.5 Sensitivity Analysis 60

4.3.6 MAE Plots of Uncertainties 61

5 Worked Examples 63

5.1 Search (vary) 63

5.2 Search Grid (vary) 68

5.3 Search Grid (froz,vary) 71

5.4 Sensitivity Analysis 75

6. Listing of Software Source Files and Routines 79

6.1 Named COMMON and BLOCK DATA Statements 79

6.1.1 lOUNIT 79

6.1.2 DEFNIT 80

6.1.3 FILMMM 81

6.1.4 FILMSS 82

6.1.5 RSTACK 83

6.1.6 WSTACK 84

6.1.7 CGNXXl 85

6.1.8 SCANCC 86

6.1.9 SEAMXl 87

6.1.10 SEAMX2 88

6.1.11 BLKDAT.FOR 89

6.2 Source Programs 90

6.2.1 MAIN.FOR 90

6.2.2 FILEOP.FOR 92

6.2.3 INPDAT.FOR 93

6.2.4 ARRANG.FOR 103

6.2.5 PLTDAT.FOR 105

6.2.6 SCAN2.F0R 115

6.2.7 SCAN2G.F0R 120

6.2.8 SCAN3.F0R 126

6.2.9 ZOOM.FOR 142

6.2.10 Z00M2.F0R 145

6.2.11 Z00M3.F0R 148

6.2.12 ASMBL.FOR 151

iv
6.2.13 ASMBL3.F0R 155

6.2.14 ASMBLX.FOR 159

6.2.15 SCATR.FOR 165

6.2.16 FORWRD.FOR 167

6.2.17 STAT22.FOR 171

6.2.18 CORLAT.FOR 173

6.2.19 SEAMA.FOR 177

6.2.20 SEAMAX.FOR 183

6.2.21 SEAM2.F0R 193

6.2.22 SEAM3.F0R 197

6.2.23 POPLAT.FOR 202

6.2.24 PLTE.FOR 207

6.3 General Utilities 215

6.3.1 DOT.FOR 215

6.3.2 NORM.FOR 216

6.3.3 APROD.FOR 217

6.3.4 SCALII.FOR 218

6.3.5 SCALJJ.FOR 220

6.3.6 CGNL.FOR 222

6.3.7 LSQR.FOR 224

6.3.8 SQRTT.FOR 236

6.3.9 POLAR.FOR 237

6.3.10 IINDEX.FOR 239

6.3.11 ISTIME.FOR 240

6.3.12 TIMES.FOR 241

7. Acknowledgments 243

8. References 244

V

Semiconductor Measurement Technology:

A Software Program for Aiding the

Analysis of Ellipsometric Measurements,

Simple Models

J. F. Marchiando

Semiconductor Electronics Division

National Institute of Standards and Technology

Gaithersburg, Maryland 20899

MAINl is a software program for edding the analysis of ellipsometric measurements.

MAINl consists of a suite of routines written in FORTRAN that are used to invert the

standard reflection ellipsometric equations for simple systems. Here, a system is said to

be simple if the solid material sample may be adequately characterized by models which

assume at least the following: (1) materials are nonmagnetic; (2) samples exhibit

depth-dependent optical properties, such as one with layered or laminar structure atop

a substrate that behaves like a semi-infinite half-space; (3) layers are flat and of uniform thickness; and (4) the dielectric function within each layer /substrate is isotropic,

homogeneous, local, ajid hnear. Each layer is characterized in part by a thickness (z),

while the optical properties for a given material and wavelength are expressed in terms

of a refractive index (n) and extinction coefficient [k). The ellipsometric equations are formvdated as a standard damped nonlinear least-squares problem and then solved by an

iterative method when possible. Estimates of the uncertainties associated with assigning

numerical vedues to the model parameters are calculated as well.

j Key words: ellipsometry; FORTRAN; measurement; modeling; program; sensitivity;

software; uncertainty.

I

1
1. Introduction

In general, when linearly polarized light is incident on a flat surface, it becomes elliptically polarized upon reflection. Ellipsometry involves measuring this induced change

in polarization. The fundamental problem is then to understand those properties which

characterize the material medium and are able to induce this measured change in polarization. MAINl is a program for aiding the analysis of ellipsometric measurements.

MAINl consists of a suite of routines written in FORTRAN* that are used to invert a standard set of reflection ellipsometry equations. The systems under consideration here

involve those containing flat, thin, solid films atop a substrate. The program has been

used in modeling systems as basic as those involving thermally grown oxide films atop

silicon and as complicated as those involving SIMOX (Separation by IMplanted OXygen).

A system is said to be simple if the solid material sample may be adequately characterized by models which assume at least the following: (1) materials are nonmagnetic; (2)

samples exhibit depth-dependent optical properties, such as one with layered or laminar

structure atop a substrate that behaves like a semi-infinite half-space; (3) layers are flat and of uniform thickness; and (4) the dielectric function within each layer/substrate is

isotropic, homogeneous, local, and linear. Such approximations are well known and documented [1-7].

In general, the model assumes three kinds or types of parameters: each layer is characterized in part by a thickness (2), while the optical properties of the media (ambient,

layers, substrate) are expressed in terms of a scalar refractive index (n) and extinction

coefficient [k) at some given wavelength of light. With only three model parameters

to characterize each layer, a sample may be readily assembled layer by layer atop the

* Disclaimer: Certain commerical equipment, instruments, materials, or software products are identified by name in this document in order to adequately specify the experimental

procedure or software development. Such identification does not imply recommendation or endorsement by the National Institute of Standards and Technology, nor does it imply that

the materials, equipment, or software products identified are necessarily the best available

for the intended purpose.

2
substrate. Since the natural parameters of the formulation include the thickness and dielectric function, i.e., the model parameters themselves, it is straightforward to analyze

distinct samples collectively. Thus, the program is said to have a miiltiple-sample capability. Due to the method of indexing the model parameters used in the program, it

is possible for two distinct layers (media, thickness) to have some model parameter in

common, e.g., distinct media but common thickness or vice versa. Also, it is possible for

two distinct samples to have model parameters in common, e.g., common layer (media,

thickness). Such cases may arise when analyzing samples that differ in thickness resulting from some etch-back process. Thus, the program is said to allow coupling between

samples and/or layers.

Since the model parameters contain the optical properties themselves, it is important

to note that they involve no further dependences. No provision is made to incorporate

distinct physical models into the expression of the dielectric function, e.g., the effective

medium approximation.

The phenomenological models and methods of solution are classical. The ellipsometric

equations are formulated as a standard nonlinear, damped least-squares problem which

is solved by an iterative method appropriate for linear systems. Following the conver- gence of the iterations to a good solution, i.e., within the resolution of the measurement

by the instrumentation, simple estimates of the uncertainties associated with ascribing

numerical values to the model parameters are calculated as well.

Regarding the uniqueness of the calculated solution which is found by minimizing a

residual in the least-squares sense, it is important to realize that miiltiple or pseudo solutions may exist, as well as correlation among the modeling parameters. Consequently,

while the program does serve as a useful tool in finding solutions, the responsibility of

assessing the consistency and appropriateness of the results remains entirely dependent

on the user. The collection of modules or subroutines is designed to run in batch mode,

as opposed to interactive mode, and is suitable for calculations involving only the physical models mentioned earlier.

Although no graphic displays are provided while running the program, provision is made

for selecting specific sets of data for output. These data are written to a file in a format ajnenable to the generation of graphics later. Thus, graphics capability is dependent

3
upon the resource library available at the local computing site. Actually, any one of several software graphics packages would be more than adequate. But for convenience, as

well as for completeness, this document does refer to the NCAR software graphics package [27,28]. This is mentioned briefly in section 4.1.3. The section also discusses the use

of the LINPACK library [17], which is public domain software.

This report presents a brief overview of the theory and methods of solution and provides a brief manual of operations or guide for the user to the options and capabilities of the

software program. The model describing the scattering of light is presented in section 2. The methods of inverting the ellipsometric equations and estimating the uncertainties

associated with knowing the modeling parameters are discussed in section 3. Section 4

presents the manual of operations for the software package. This includes an overview

of consideraiions important in using the software package. A brief outline of the internal organization of the subroutines and calling sequences is provided for orientational

purposes. This outline includes a short listing of the parameters which specify upper

bounds for the necessary allocations of space for the work-storage arrays. Presented next

are the free-field formats which are used when entering the required sets of input data.

These include the tabular lists of model parameters, the specification or characterization

of the samples, and the collective sets of measurements of the ellipsometric angles. Finally, information is given regarding the command options that are available to the user

in exercising operational control over the program, i.e., constraints of procedures during

analyses. A selected set of examples involving sample data input and program output is presented in section 5. The listing of the software source files and routines are presented

in section 6.

The source code is written predominantly in standard FORTRAN-77. Minor compiler

extentions are associated with the DO-loop constructions and formats for OPEN/CLOSE

statements; such are appropriate for a VAX computer. The source code contains some

in-line comments for the user's convenience. The more expert user may wajit to modify

routines while taking advantage of the interior data structure of the program, whereas

the less expert user may simply want to operate the package as presented. The program

is available upon request by sending the author a floppy disk or a small nine-track magnetic tape.

4
2. The Forward Problem

Any discussion regarding the description of the scattering of light from a medium must

ultimately incorporate some formulation involving Maxwell's equations [1-7]. Here, a

brief discussion is presented regarding the reflection and refraction of a time-harmonic

monochromatic plane electromagnetic wave obliquely incident on a flat plane surface of a stratified medium exhibiting depth- dependent optical properties. Within those regions

or neighborhoods where the optical properties of the material medium are continuous,

isotropic, linear, local, and absent of free charges and surface currents. Maxwell's equations in centimeter-gram-second (cgs) units are

V X E

V X H

V D

VB

with the constitutive relationships

B = ^H,

and the complex dielectric function e is defined by

.47r(T / .. v2 /_\ e = c-|-i = (n-Htib) , (5)

where E is the electric field vector, H is the magnetic field vector, D is the electric

displacement, B is the magnetic induction, J is the induced conduction current, /x is the noagnetic permeability, <r is the specific or optical conductivity, e is the dielectric

-1b

C

.a;c

(1)

1a 47r, -D + —J

c c

U3 -i-eE,

c (2)

0,

0,

(3)

(4)

D = eE, J = <rE,
permittivity, n is the index of refraction, is the extinction coefficient, a; is the angular frequency of the incident light, c is the vacuum speed of light, and where the dot

denotes differentiation with respect to time, and the time dependence is assumed to be

of the form e"**^*, which is distinct from the engineering or Nebraska convention that

assumes e''"*'*'* and e = (n — ik)'^.

For convenience, the material medium is assumed to occupy the semi-infinite positive

half-space (z > 0), with the flat surface being the plane {z = 0). For the isotropic homogeneous medium with depth-dependent (z) optical properties, there is translational

invariance within the {x,y) plane. Thus, the 2-axis is aligned in a direction normal to

the surface and planes of stratification. A lossless isotropic homogeneous medium like air

or vacuum is assumed to occupy the so-called ambient region [z <0). For this configuration of geometry and restricted class of problems, the optical properties are assumed to

be of the form

c = e(a;,2), cr = a{u;,z), /x = /x(a?, z) = 1, z > 0,

e = Coi^), a = 0, M = 1> z <0,

where allowance is made for dispersive nonmagnetic materials. Then, it is convenient to

express eqs (1) and (2) in Cartesian coordinates, i.e.,

VyE:,-V,Ey = i(^)fiH,, (6)

V,E^ - V^E, = i (^) fiHy, (7)

V^Ey - VyE^ = i (^^ tiH,, (8)

VyH, - V,Hy = -i (^) eE^, (9)

V,^, - V^H, = -i (^) sEy, (10)

V^Hy - VyH, = -i (^) eE,. (11)

A source time-harmonic monochromatic plane wave is assumed to be incident on the

surface of the medium {z = 0), from the ambient region {z < 0), in a direction of angle (p with respect to the surface normal. The plane of incidence is taken to be the (z, x)

6
plane, ajid the direction cosines of propagation both being positive. Any arbitrarily polarized wave may be resolved into two waves. With this geometry, it is natural to choose

the two waves to be the orthogonal set involving linearly polarized waves: one which

maintains its electric vector polarized perpendicular to the plane of incidence, i.e., transverse electric, TE, or a-polarization; and the other which maintains its magnetic vector

perpendicular to the plane of incidence, i.e., transverse magnetic, TM, or p-polarization.

This set uncouples the system of Maxwell's equations, and each polarization {s,p) may

be treated individually.

The next problem under consideration in modeling the medium is to determine or otherwise calculate the resulting reflected and/or refracted fields which may be subjected

to measurement with an ellipsometer. In the following subsections, further discussion

is presented regarding the calculation of the reflected and/or refracted waves for each

polarization. Here, the problem for each polarization involves a second-order ordinary

differential equation (ODE) complete with boundary conditions.

It is convenient to recognize that both ODEs admit plane wave solutions if the dielectric function within each layer is a constant. The profile of the stratified structure of

the dielectric function is approximated by a stepped profile of isotropic, homogeneous,

uniformily thick layers or laminae. Then, the problem of solving Maxwell's equations

is reduced to one of matching analytic solutions at boundaries between adjacent layers.

This involves solving a set of recurrence relations and is the form of the forward problem

that is actually solved here. The Jacobian is determined in a like manner. Finally, re- garding the quantities that are measured by the ellipsometer and characterize the phase

shift induced upon reflection, the ellipsometric angles {A, if)) are defined in terms of the

reflected flelds.

2.1 Transverse Electric Mode or 5—Polarization

2.1.1 Reflection CoefHcient

Due to the uncoupling within the system of Maxwell's equations, there is one solution or

polarization where the incident, refracted, and reflected fields may be characterized by

electric-field vectors which are aligned in a direction perpendicular to the plane of incidence, i.e., along the y-direction: {Eg = = 0) and (Ey ^ 0). This is called the transverse electric mode or 3-polarization. From eq (7), Hy =0; from eq (11), Hx = Hx{z,x)]

7
and from eq (9), Hg = Hz{z,x); so there are no dependences on y. Substituting eqs (6)

and (8) into eq (10) yields

V, (-^VgEy) - V, ( -Av.eJ = -i-eEy

or ^2

V^ + V^-(V,lnM) V. + ^e/x Ey = 0.

Assuming a solution by the method of separable variables, let Ey = Z{z)?l{x) and

ko=u;/c, then

|[V^-(V,ln/.)V. + fc2e/x]2 = -^^l^ = «

where is an arbitrary constant and real because of translation invariance within the

plane. One may write

so that

^ixkaOL X = e"*"** (12)

where in the ambient region,

= \/i7sin0 = constant > 0, (13)

with £0 being the dielectric function of the ambient region, and 0 being the angle of incidence of the light, i.e., 0<<^< y. Here, (^ = 0) involves a direction normal to the surface.

From the differential representation of Majcwell's equations across a surface of discontinuity in piecewise continuous media, the tangential fields, Ey and H^^ are continuous

across boundaries between adjacent layers. Consequently, eq (12) becomes valid within

each spatial region, i.e., ambient, layers, and substrate. Then, letting

ri = \Jz^L — o? ^ where 0 < arg(77) < tt, (14)

the above ODE in z may be written a^

[V^-F(V,ln,x)V. + A;2772]Z = 0.

8
Within any layer of the media, the optical properties are assumed to be homogeneous, so

the middle gradient term vanishes. The ODE finally becomes

(15)

and admits solutions involving the well-known set of damped plane waves,

From eq (6),

one finds

VzEy = —i—fiHx = —ikof^Sx,

X.

It follows from the continuity of the tangential fields that the logarithmic derivative of

the solution or admittance function

V

M L

1 - iZe""''*"*'

1 + ile-^^^fco*?

is a continuous function of z alone, where R is the reflection coefficient local to the layer

or spatial region. It also follows that coefficient E^ ^ vanishes within the substrate re- gion because its basis function diverges for large z. This allows one to evaluate the admittance at the boundary of the substrate.

ys =

Vs \/e,/i, - Ea sin^ (f) (16)

where the subscript s denotes the substrate region. This will be called the innermost

boundary condition for the admittance.

The last part of the problem is the calculation of the reflection coefficient local to the

ambient region, Ra, where the subscript denotes the ambient region. Since the optical

properties are assimied to be known, the method of solution reduces to that of matching the boundary conditions across each layer that separates the substrate from the ambient region. A reflection coefficient local to each region needs to be determined. This

9
is accomplished by considering a single layer alone. For convenience, consider the layer

(L) adjacent to the substrate, which has complex dielectric function and thickness

2^ . Let a local coordinate system be defined on the layer and let it be oriented so that

the positive z-axis extends from left-to- right. Let layer (L) occupy the spatial region

{0 < z < Zi^)i while the substrate is located within the unbounded region (2 > 2^ ). Then,

from eq (14),

Vl = y/^Lt^L - easin^ (f)

and due to continuity, the boundary condition on the right-hand-side (rhs) of the layer

(If) is of the form.

f^L L

-t2zij koTfL

so that

and

J2 — g*2*i&o»;i, (^J/^J - yjrhs)

XVLll^L)+yL{^^^).

y,{\hs) = y,{z = Q) = l-R,

1 + R.

The dependences on the model parameters and (rhs) boundary condition may be ex- pressed more explicitly, by letting

(17)

and substituting to find

:y.(ihs) =

' {Vl It^L ) + X(rhs) - 7^ [{ri^ It^L ) - yr. (rhs)]

{Vl ll^L ) + X(rhs) + \{r\^ //^^ ) - y^ (rhs)]

[ (l-7J(^J/^J + (l+7^)y^(rhs)

(1 + 7j (^i. //XJ + (1 - 7J J^Jrhs)

(18)

This equation is applied recursively, matching the boundary conditions and moving to- ward the left across each and every layer in succession, so that the admittance function

10
may be evaluated at the outer surface which borders the ambient region, i.e., y{z — 0).

The reflection coefficient in the ambient region, Ra, is found from y{0) and is given by

Ra

{Va/f^a)-y{0)

(19)

where again, all of the fx^s can be set equal to unity, if the material is nonmagnetic.

2.1.2 Partial Derivatives

The forward scattering problem assumes that all of the parameters which characterize

the sample are known, as well as the source field which is incident upon the surface of

the sample. The forward problem involves calculating the reflected and refracted fields

resulting from this incident field. But reflection ellipsometry provides measurements involving only two numbers, i.e., the relative ampUtude attenuation and the relative phase

shift of the light that is induced upon reflection for a given angle of incidence <f> and

wavelength A. This is discussed later in section 2.3. It is necessary to invert the ellipsometric equations and to determine best estimates to the model parameters that give

rise to the reflected fields that manifest the measured phase shifts and amplitude attenuations. This is the inverse problem that is discussed later in section 3. During the inversion process that involves finding improvements to the values of the model parameters, it becomes necessary to estimate the effect that each model parameter induces in the calctdated phase shifts or reflected fields. This requires partial derivatives of the fields with

respect to the model parameters [8,9]. Collectively, these derivatives will be called the

Jacobian.

Since the model parameters include refractive indices and extinction coefficients for each

layer and substrate, as well as layer thicknesses, each layer is characterized by (z,n,fc)

and substrate by (n, k). Here, the subscript labeUng of the layer or substrate region and

the incident wavelength of light has been suppressed. For example, for a sample containing layers measured by ellipsometry involving wavelengths, there would generally be -|-2(m^ -f l)m^ model parameters. However, only three types of partial

derivatives need to be considered because the reflection coefficient involves a composite

function of such basic parameters as thicknesses via {i2zko), complex dielectric functions

(e = (n-f-tfc)2), and the angle of incidence via (-easin^ 0). Recalling eq (19) and suppressing references to the /i's, it follows that one may readily express the partial derivatives

11
of the reflection coeflficient associated with these three basic parameters. They are of the

following general operator form:

d{i2zK) [va + ym^

when the prime is used for convenience as an operator to imply a partial derivative with

respect to {i2zko)',

'4^.K=- '"'^'^'K (21)

when the prime is used to imply a partial derivative with respect to e, and

when the prime is used to imply a partial derivative with respect to (—ea sin (j)). These

need to be calculated for each model parameter undergoing variation.

The derivatives of the admittance function evaluated at the surface may be understood

and calculated in a straightforward manner, by considering the effect of a variation in

the model parameters within the substrate region. Prom eq (16),

ys =^1, = y/e,- ea sin^ (f>,

so y

sy- gy- 1 1 (23)

' de. d{-e.An^4,) 2ri. 2y.' ^

'

The effect of this derivative on the admittance must then be matched as a boundary

condition across each layer that lies between the substrate and the ambient region. This

gives rise to four cases to consider during the matching process, depending upon whether

the partial derivative operates on a function whose parameter is exterior or interior to

the local region of interest. These four cases follow directly from considering the boundary conditions satisfied by any given layer, i.e., eq (18) for the layer (X) adjacent to the

substrate,

•^^^ ^~^M(l+7jry,+(l-^jy,(rhs).

12
Case 1 considers any partial derivative taken with respect to {e,z) that operates exterior

to the local region. Here, only the (rhs) boundary condition is affected. Using the chain

rule for partial derivatives on the above equation, it follows that

y;(lh.) = (24)

This equation provides the key relationship for transporting derivatives involving matched

boundary conditions across any given layer. In general, if the layers of a sample are indexed consecutively, where the top layer (1) is adjacent to the ambient region, and where

layer (X) is not the top layer, then

:V^_,(rhs) = 3^^(lhs) impHes :^;_,(rhs) = :y;(lhs). (25)

So, eqs (24) and (25) are applied repeatedly until the outer boundary at (-2 = 0) is reached;

i.e., determining 3^'(0), then eqs (20) or (21) may be evaluated as appropriate.

Case 2 considers variations in the complex dielectric function (e^ ) interior to the layer

{L). This leaves ;y^(rhs) unaffected. Again, using the chain rule for the partial derivatives, and taJdng advantage of the identities,

and

one finds that the variation may be written as

q(2,TE)

[(l+7jr/^+(l-7j>'Jrhs)]

where

and

_ [(1-7J^.. + (1+7^)^1, (rhs)] ^(2,TE) ,26)

[(l+7j^.+(l-7.)A(rhs)f '

C['''^' - (1 - 7J + + iz^Kj^ [3;. (rhs) -

^(2.TE) ^ (1J_7J _^ .^^^^^^ _ y^^^^^^^ ^

13
This boundary condition is then matched across every layer positioned between layer (L)

and the ambient, by applying case 1 and eq (24) accordingly.

Case 3 considers variations in the layer's thickness via (i2z^fco) interior to the local region. Taking the necessary partial derivatives and utilizing the fact that

d{i2z^K)

the variation may be expressed as

y, ^ = _ 27.^; [7y^-y^(rhs)] [t?, + (rhs)]

[(l+7j^.+(l-7.)X(rhs)]^

Again, this boundary condition is transported to the outer surface, by applying case 1 and eq (24) as necessary.

Case 4 considers variations in the angle of incidence via (— eo sin^ <j>) exterior and interior

to the local region under consideration. Recalling that

d{-ea sin^ (f) 2ri and

the variation may be expressed as

<r,(4,TE)

V(lhs)

[(l+7jr;^+(l-7.):y.(rhs)]

where

and

[(l-7J^i. +(l+7x)3^i.(rhs)] ^(4,TE) ^28)

[(l+7j^.+(l-7.)3^.(rhs)]^ '

q ' ' = iz^ko-fL [:yr (rhs) - 77^] + (1 - 7i) + ^ + (l+7j^.3^:(rhs)

C^^'^^) = iz^kol, [77, - J^,(rhs)] + + (1 -7j^.:^:(rhs).

14
This case is distinct from the others by requiring both ^^^(rhs) and ^^(rhs) to be in

the right-hand-side of the equation as may be seen from the coefficients C^^^. Consequently, eq (28) must be used recursively, starting with the boundary conditions for the

substrate region, i.e., eq (23).

Following the evaluations of the necessary partial derivatives in eqs (20) to (22), 3^'(0)

and R'^, it is necessary to express the derivatives in terms of the angle of incidence (f) and the model parameters {z,n,k) for the appropriate layer or substrate, i.e.,

anc

_dRa _ / \ dRa = 2(„ + ti)—, (30)

9Ra _ . / . , V dRa , X __.2z(n + ^fc)^, (31)

= -2ea sm <f> cos <f> — r^-^ . (32)

These expressions determine the Jacobian of the reflected fields. These are then used in

section 2.3, where the measured ellipsometric angles (A,'0) and the associated partial

derivatives are defined in terms of the reflected fields.

2.2 Transverse Magnetic Mode or P—Poleirization

2.2.1 Reflection CoefHcient

Proceeding in like manner of presentation of the TE mode, the uncoupHng of Majcwell's

equations provides a solution or polarization where the incident, refracted, and reflected

fields may be characterized by electric field vectors which are aligned in a direction parallel to the plane of incidence, i.e., the {z,x) plane. Here, [Hg = Hx = 0), and {Hy ^ 0).

This is called the transverse magnetic mode or p-polarization. From eq (10), Ey = 0; from eq (6), Eg=Eg{z^x)\ from eq (8), Ex=Ex{z^x)\ so there are no dependences on

y. Substituting eqs (9) and (11) into eq (7) yields

15
or [V^ + Vl - ( V.ln e) V, + fc^/x] Hy = 0.

Assuming a solution by the method of separable variables, let Hy — Z[z) e*"*"". Then,

restricting the domain to a single layer or substrate region where the optical properties

are homogeneous and uniform, the gradient term vanishes, so that the ODE is of the

form of eq (15), which has solutions involving a set of damped plane waves, i.e.,

Again, the tangential component of the magnetic field vector is continuous across boundaries between adjacent layers involving no interfacial currents. Accordingly, the method

of solution follows from eq (9),

so X.

Since the tangential components of the field vectors are continuous across boundaries,

the logarithmic derivative of the solution or impedance function

1

e

1 _ i^g-"'*""

1 + i2e-*2**o'»

is a continuous function of z alone. The innermost boundary condition for the impedance

function is

(33) ^ _ _ Ve>At< - gg sin^ <^ ya — —

where the subscript s denotes the substrate region. Starting with the substrate region,

the boundary conditions of the impedance function may be matched to the adjacent

layer (L),

3^^(rhs)-X(zJ = 3^,

so that

1 - J?^e-*^^^*°^^

'

1 + i2^e-*2*ii*o»?ji

(^Jgr)-yi>(rhs)

16
and

y^^s) = y^(z = 0) =

or upon substitution with eq (17),

1-R,

l-\-RL J

iVr, /gx ) + (rhs) - 7^ [{y^ /e^ ) - ^(rhs)]

iv^ I^L ) + (rhs) + 7^ [{rj^ /e^ ) - (rhs)]

(l-7j(^JgJ + (l+7jyr(rhs)

(l+7j(»7xAJ + (l-7i.)3^x(rhs)

(l-7J^i.+(l+7jg^y^(rhs)

(1+7Jt;^ +(l-7x)ex:yi.(rHs)

(34)

The reflection coefficient in the ambient region, Rat is found firom the impedance function evaluated at the outer surface (^ = 0) and is given by

R.= (Wga)-y(o)

(35)

2.2.2 Partial Derivatives

The discussion presented here parallels section 2.1.2 of the TE mode. Recalling eq (35),

it follows that the operator equations regarding partial derivatives are of the form:

— Dl K =

2(7y,/ea)y(0)

d{i2zko) [{Va/ea) + ym^

when the prime is used to imply a partial derivative with respect to {2izko),

^=Jl> ^

2(^a/ga)y(0)

[{Va/ea) + y{0)]' de

when the prime is used to imply a partial derivative with respect to e, and

dR.

5 (—Ca sin^ <l>)

2[(vjc,)'y{o)-{vj^.)y{o)]

liij^a) + y(o)f

(36)

(37)

(38)

when the prime is used to imply a partial derivative with respect to (—Co sin^ ^). These

need to be calculated for each model parameter undergoing variation.

17
These derivatives of the impedance function may be understood by considering a variation in the model parameter within the substrate region. From eq (33), one finds that

ays

and

dy.

Sa Sin

- («

1

2V

(39)

(40)

The effect of each derivative may be viewed as a variation on the impedance function

that must be matched as a boundary condition across each layer that lies between the

substrate and ambient region. Again, four cases need to be considered, depending upon

whether the partial derivative operates on a function whose parameter is exterior or interior to the local region of interest. Consider the adjacent layer (L).

Case 1 considers partial derivatives with respect to (e, z) operating exterior to the local

region. Again, only the (rhs) boundary condition is affected. Operating upon eq (34)

yields

47.^13^: (rhs)

V(lhs) =

i2

• (41)

[(l + 7j';,,+(l-7j^x,y,,('lis)]

The above equation is applied repeatedly until the outer boundary at (2 = 0) is reached;

i.e., y'{0), so that eq (36) or (37) may be evaluated where appropriate.

Case 2 considers variations in the complex dielectric function (e^) interior to layer (L).

This leaves y^ (rhs) unaffected. The partial derivative may be expressed rather simply in

unreduced form,

X(lhs) (l-TJ^i. +(l+7jgi.yx(rhs)

(l+7j^^ +(l-7je^3^^(rlis)

^(2,TM)

where

and

(2,TM)

+ 7jr/^ +(l-7Je.;:Vjrhs)]

_ [(1-7J^^ +(l+7jg^y..(rhs)] ^(2,tm)

(^^) +(l+7.):y.(rhs) + r2,fc,7x 3^.(rhs)

(42)

- 1

18
1 -

This boundary condition may then be matched across any layer positioned between layer

(X) and the ambient, by repeated use of case 1 and eq (41) as appropriate.

Case 3 considers veiriations in the layer's thickness via {i2zj^ ko) interior to the local region. The partial derivative is of the form

^ [(l+7j^.+(l-7Jg.>^x(rhs)]^

Again, this boundary condition is transported to the outer surface, by applying case 1 and eq (41) as necessary.

Case 4 considers variations in the angle of incidence via (— ea sin^ (f>) exterior and interior

to the local region under consideration. The partial derivative may be expressed as

y(ihs) =

(l-7j^i. +(l+7jgxyjrhs)

^Il^J Ul+7j^i +(l-7jei;:V^(rlis)

) [(1

(4,TM)

+ 7j^^ +(l-7j£L:V^(rlis)]

[(1 yL (rhs)] ^(4,TM)

^i^/ [(1+7Jt;^ +(l-7Jgr:V^(rlis)]

(44)

where

and

(4,TM)

,(4,TM)

+ (1 + 7i ) X (rhs) + iz^ kol.

+ (l-7i.)«i;>^I(rlis) + »^i;^o7x

ft)

:V^(rhs)-l

7^ P^.Crhs)

Again, case 4 is distinct from the other three by requiring both, ^^(rhs) and J^^(rhs),

as may be seen from the coefficients C^^'^^^. Consequently, eq (44) must be used recursively, stsirting with the boundary condition of the substrate region, i.e., eq (40).

The paxtial derivatives with respect to the model parameters (z,n. A;), for each appropriate layer, substrate, and wavelength are required later, and are of the same form as that

presented in eqs (29) to (32).

19
2.3 Ellipsometric Angles (A,V')

In sections 2.1 and 2.2, a physical model was proposed for a restricted class of media,

and the forward electromagnetic problem was solved where the reflection coefficients

local to the ambient region are complex amplitudes, i.e., from eq (19)

and from eq (35),

Ra,p = \Ra,p\exp{iSp),

(45)

(46)

where subscripts {s,p) refer to polarization, and S refers to the phase. The ellipsometric

angles (A, V*) are defined in terms of the complex variable p which is formed by the ratio

of the reflection coefficients.

P =

a,p Ra,*

R,a,p Ra,»

exp {i {8p — Sg)} = tanV' exp(iA),

where the explicit relationship of the phases involves

(47)

while the modulus involves

R

such that

tan-^ =

a,p

so

Ra,$

tj} = tan"''

= \P\

0 < A < 27r,

TP where 0 < ij} < —

,

(48)

(49)

Further, since the ellipsometric angles refer exclusively to the reflected fields in the ambient region, it is convenient to omit further subscriptive references to the ambient.

It is important to draw attention to two subtleties arising from the choice of convention

used in defining the ellipsometric angles. First, the Rg was defined in terms of the electric field, whereas Rp used the magnetic field. If electric fields are used in the definitions

exclusively, then Rp,E = —Rp,Hj so that only the A is affected, i.e..

Aj) = Ag -f- TT (mod 27r). (50)

20
Second, the time dependence here was chosen from the physics convention, as opposed

to the engineering or Nebraska convention. The complex amplitudes found with one con- vention are related to that with the other convention by simple complex conjugation.

This affects only the phase or sign of A, i.e..

Now that the ellipsometric angles have been defined, it will be necessary to formulate

the Jacobian or paxtial derivatives of the ellipsometric angles in terms of the reflected

fields ajid their partial derivatives. These are important to the general formulation of

the inverse problem, which involves inverting the ellipsometric equations discussed later

in section 3.

For convenience, let all further primes used within this section refer to an implied partial

derivative with respect to some model parameter, e.g., (2^, n^, A;^, n,. A;,, 0), where the

subscripts refer to some layer or substrate region. Since the ellipsometric angles involve

phase and modulus information of the complex variable p, it will be necessary to develop

relationships which express partial derivatives of the modulus and phase of a complex

variable in terms of the partial derivatives of the real and imaginary parts of that same

complex variable.

This may be accomplished in the usual manner by considering the notation involving a single complex variable, denoted by R, which has modulus r, phase 6, and real and

imaginary parts, x and y, respectively, i.e..

A,engineering — 27r — Aphysics (mod 27r). (51)

R = re** = X -\- iy where

Then,

R* " and i28 = ln{R/R*)

so that by forming

R*^

R*

R* R' — RR

2i {xy' - yz')

,

21
one finds that

Proceeding in like manner,

g, ^

xy' - yx'

a;2 + 2/2

2rr' = 2{xx' +yy'),

(52)

one finds that

, xx' + yy'

r =

Here, eqs (52) and (53) applies to each polarization individually; i.e., one finds

Now, consider the definitions of the ellipsometric angles. Prom eq (49) and using the

trigonometric identity involving derivatives of arctangents, it follows that

(53)

|.2 _j_ j,2 8 ' p

-.2 I ^2 ' 'a ' p (54)

where the right-hand-side of this expression is used in conjunction with eq (53) for each

polarization.

Proceeding in like manner with eq (48), it follows that

(55)

where the right-hand-side of this expression is used in conjunction with eq (52) for each

polarization.

Eqs (52) to (55) provide the basic set of equations necessary for evaluating the various

partial derivatives of the ellipsometric angles in terms of the reflection coefficients and

their partial derivatives.

22
3. The Inverse Problem

3.1 Formulation of the Least-Squares Problem

In order to characterize the layered structure of the sample, it is necessary to invert the

standard ellipsometric equations, i.e., eqs (48) and (49). These equations describe how

the material optical properties of the sample induce a phase-shift in the reflected light

that is measured by the ellipsometer. Because of the nonlinearity of the equations, it is

usually not possible to find simple analytic expressions which will invert the equations.

One common approach to performing such inversions is to formulate them as nonlinear least-squares problems [10-15]. Here, one considers a sequence of forward problems,

where each increment of the sequence involves three distinct steps. The steps include:

starting with a good estimate of values of the model parameters, determining the deviations between the experiment and the model, and then updating the model parameters

with better values. This sequence is repeated until the magnitude of the corrections become sufficiently small.

The ellipsometric equations are of the form:

A = A(A,<^,b) (56)

V' = V(A,0,b) (57)

where A is the vacuvmi wavelength of the incident light; ^ is the angle of incidence; b is

£in array where the components specify the model parameters, i.e., layer thicknesses, indices of refraction and extinction coefficients of the layers and substrates, e.g.,

{"^L J » > ^* > ^# )> where the subscripts refer to a layer or substrate region; and where

the superscripts refer to the wavelength dependence of the optical properties. The standard procedure involves minimizing some non-negative scalar error expression containing

the deviations between experiment and model of A and -0 in the least-squares sense, e.g.,

2M = E5.- =8^g = |gf (59)

»=1

23
where superscripts (e,in) refer to experiment and model, respectively, M denotes the

number of measurements of (A, V') from experiment, g is a column array of the deviations, i.e.,

g2i-i={^l-AT)/V2M, (60)

92i = {ri-i^T)/^^ (61)

where 1 < i < M, and the superscript T denotes transposition. Here, the error expression assumes equal weighting factors or uncertainties in the measurements of A and ip.

This is a simplification because it is well known that the measurement uncertainty in A

and "0 may differ by more than a factor of two [26].

The third step of the sequence is concerned with the procedure for obtaining better numerical values for the model parameters, i.e., the Newton step. An estimate of the nec- essary correction may be realized by linearizing the functional representation of the model

and solving the resulting matrix equation, g = Jv, where v is a column array (Newton step) for improving the model parameters that were selected to undergo variation,

i.e., Vj ~ Sbj, and J is the sparse matrix involving the Jacobian which is not necessarily

square, i.e., Jjj ~ (1/%/2M) (dAi/dbj).

Such matrix equations are common to optimization problems and involve only linear

algebra. It is well known that additional numerical stability may result when requesting the norm of v to be minimized as well. This may be accomplished by modifying the

error expression to

G = {g- Jv)^(g - Jv) -f «v^v, (62)

where «; is a positive scalar parameter subjectively chosen between 0.01 and 1.0 for our

calculations. Of course, the final solution v should be independent of /c, but here, « simply moderates the rate of convergence.

It is also known that the columnar scaling of J affects the accuracy of the solution, as

well as the effectiveness of k. A simple choice for the scaling can be found by considering

the diagonal elements from J^J and then defining the diagonal matrix, S, where

Sy,- = ^{rj).. . (63)

24
Then letting

J = JS-\ ' (64)

V = Sv, (65)

r = g - Jv = g - Jv, (66)

a suitable error expression may be defined by

G=: (g-Jv)^(g-Jv)+«v^v (67) = r^r + Kv^v. (68)

The criterion for critical points or relative minima is a vanishing variation, i.e.,

dG/dvj = 0, which yields a set of equations that may be expressed as

1 j r g

-Kl V 0

(69)

and must then be solved for v.

Because of the sparsity of the Jacobian, it is expedient to utilize an iterative method for

solving the above matrix algebra problem. Algorithms [16,17] exist that specifically address this type of problem, one [18,19] of which utilizes a relatively stable Lanczos process (Krylov space decomposition) in formulating the method of steepest-descents. Essentially, the method requires each updating vector be orthogonal to the previous update vectors. Further details may be found elsewhere [18-22]. From this procedure, one

finds V, which leads to v, which is then used to improve the estimate of the values for

the model parameters, e.g., 6^*^ = b^^^ + vj.

Using this improved b, the sequence is repeated again until either: |g| becomes sufficiently small, of the order of a few millidegrees, e.g., the resolution of the measurement,

or until |v| becomes sufficiently small so that |g| suffers no further reduction regardless

of magnitude. It is especially during this last case, that it becomes necessaxy to scan a

grid of model parameters. Multiple pseudo-minima may be encountered, e.g., nonuniqueness. Often, this reveals either: (i) correlation which prevents model parameters from

being resolved independently; i.e., the measurement data were not sufficiently functionally independent which thereby induces a functional dependence among the model parameters; or (ii) the inadequacy of the model in providing a sufficiently good physical

25
description of the process, which is likely whenever |g| greatly exceeds the resolution of

the measurements.

Finally, it is important to realize that in the above outlined steps, the emphasis centers on searching for and ascribing good values to the parameters of a physical model

which has already been specified. Only one specific model is assumed to have been applied to a given set of measurements. But often situations may occur or questions may

arise where it is important to consider alternative models during the effort to further re- duce the G, and these must be investigated as well. Also, it is possible that two or more

distinct models may be found that reduce the deviations in |gj to comparable magnitudes. Then, the problem of characterizing the sample becomes one of comparing models

which ought to lead toward a decision about selecting the better model. One heuristic

approach has been to select that model which provides the smallest deviations, i.e., |g|,

while utilizing the fewest modeling parameters and being consistent with physical reality.

However, comparisons assume some criteria or ordering, and that requires a number. So

the problem becomes one of reducing a model to a number. This reduction is certainly

not simple and fully merits its own discussion, e.g., hypothesis testing and decision theory. But such a discussion is beyond the scope that is intended here, so that it is expedient to direct the reader to consider simple statistics and its use of the i^-statistic in

assessing the so-called goodness-of-£t test [23]. For further discussion on topics such as parameter estimation, hypothesis testing, significance testing, and other formulations involving decision processes, the reader is advised to consider the vast literature available

in statistics.

3.2 Sensitivity Analysis of Model Parameters

In the discussion of the least-squares problem in section 3.1, the main emphasis was on

obtaining accurate numerical values for the model parameters. It foUov/s naturally that

the next step should involve some assessment of the uncertainties associated with those

values. Fortunately, for a restricted class of linearizable problems, one may ascribe es- timates to these uncertainties by utilizing a formulism similar to that used in the leastsquares problem [2, 10-15, 23-25].

26
Consider again the functional representation of the model and its expansion about the

critical or fixed point solution, e.g., using variations out to first order, i.e.,

^» ^» dhj

3=1 ^

eind

j=i 3

where N refers to the number of distinct model parameters, and refers to the uncertainty associated with individual measurements of (A,'0) performed by the instrument.

It may also be the case during the course of the analysis of finding the critical point solution discussed in section 3.1, that some of the model parameters will have had values

and uncertainties assigned to them by some earlier experiment or measurement that is external to and distinct from those being analyzed here, e.g., values found or taken from

the literature; these values are assumed as gi<ren and remained unchanged throughout

the calculations. Consequently, the set of model parameters may be partitioned into two

disjoint sets, those {Shj) that remain unchanged {uj) and those {8hj) that are allowed to

vary {vj). This allows both of the above expansions to be combined and expressed as

9i = Jv,ijVj + Ju,ijUj + J^^i4>i + ej, (72)

or in matrix notation as

g = J„v J„u + + e, (73)

where gi refers to the deviations similar to eqs (60) and (61) but without including the

scaling factor of (l/\/2M), J refers to the Jacobian or the array of partial derivatives

that is appropriate to the partitioning and evaluated at the critical point, involves

the uncertainty in the angle of incidence and the assumption of stochastic independence

between each measurement, and the implied summation affects only the j index. The

sensitivity analysis of the model parameters centers on the procedures of assigning values

of uncertainty in knowing v.

From the representation of the cttot expression G presented in eqs (62) or (67), it fol- lows that the minimum value of G is attributed to residuals that are due to measure- ment uncertainties ej that are assumed to behave as random variables in a statistical

dAi

d<f> (70)

d(f>

6(f> + e (71)

27
sense, i.e., being stochastically independent and identically distributed. So, when G is evaluated at the critical point solution, it is assumed to be of the form

i2 o = \g\ = |e| (74)

so that an expansion of G about the critical point may be shifted to zero and written as

_ 2 G = G — Go — g — Jt;V — JmU — lgl (75)

Before presenting a formal solution for v, it is worthwhile to consider the fact that roundoff error affects the numerical accuracy of a calculation, and this is often dependent on

the scaling of the problem. Again, it is convenient to follow eqs (63) to (65) and scale

the numerical problem by defining the diagonal matrix S, where

with

(76)

V = Sv

and

so that eq (75) may be written as a function of v, i.e.,

G = g - JwV - JuU - J^* -|g|

(77)

(78)

(79)

Recalling the criteria of a critical point, i.e., {dG/dvj) = 0, one finds a system of equations for V, i.e.,

J« (g - - Juu - J^#) = 0. (80)

Defining the square matrix

and the nonsquare matrix

b = s-^a-^j:,

(81)

(82)

28
and substitutes eq (82) into eq (80), a formal solution of v may be written as

v = B(g- Juu- J^#). (83)

Of course, this is contingent upon the rank or invertibility of A. This equation involves a measure of both types of errors, i.e., random error (g,^) and systematic error (u). However, due to the assumption of stochastic independence, each type of error may be considered separately.

Consider first the contributions associated with the random error. Prom eq (83), the

random component assumes = Bji [gi - J,^ii>i) . (84)

The measurement uncertainties (e,), as well as the deviations found from fitting the

model to the data {gi), are assumed to behave as statistical random variables, which are mutually stochastically independent and identically distributed. Of course, this assumes

that A and ^ are uncorrelated. Then, each random variable involves the same probability distribution function (PDF), and the variance may be estimated from g. Recall that

g involves 2M measurements and N model parameters, and # involves M model parameters. The PDF for is assumed to behave as a %^ distribution with 2M — N degrees of

freedom, where the variance is estimated by

sl^3''(gi)= . (85)

* 2M-N ^

^

The PDF for 4>i is assumed to behave as a distribution with 2M — M degrees of freedom, where the variance is estimated by

3

2 _ „2/ 72 3\<f>j) = , (86)

where the 0, were estimated from a set of calibration data, which is external to the set

of measurements of the ellipsometric angles, and not estimated from fitting the model to

the measurement of (A,^). Often, may be of the order of a few millidegrees. Given

the estimated variance of the statistical PDF for the random variables {gi,<t>i), and given

the linear relationship between the model parameters and the random variables, i.e., eq

29
(84), one may then proceed and estimate the variance of the PDF for the model parameters V. The expectation values are of the form

{9x91} = 8ii,

{9iii) = 0,

(87)

(88)

(89)

where the bra-ket notation () refers to an expectation value, and S refers to the Kronecker delta. The variance of the model parameters v is then estimated by considering

the expectation value of the following quadratic form.

VjVk = Bji (^gi - J^^i4>i) Bki {gi - J^,iil)

This yields the form

{vjVk) - BjiBki (si + slJl -) ,

or expressed in matrix notation as

(90)

(91)

(92)

Further, it may be seen that the variance of that involving some linear combination of

the model parameters, e.g., V = ajVj (93)

where a,- are real scalar coefficients, is of the form

(V^) = ajak{vjVk). (94)

Also, it follows from eqs (78), (81), and (82), that

BB^ = S-iA-^jJj„A-iS-i

^S-^A-^S-^

= s

-1

s (J^J.)"'s

30

(95)
which is well known.

Next, consider the contributions associated with systematic error. From eq (83), the systematic component assumes

Vj = BjiJu,ikUk' (96)

By applying absolute value signs and the triangle inequality, a strict upper bound for

\vj\ may be found and is given by

\vi\ < \BiiJ^,ik\\ukV (97)

Assuming the total magnitude of uncertainty that is assigned to a model parameter involves a direct sum of both types of errors, then one may combine eqs (91) and (97) to

yield the form ^ \/^M^[ +^5^+ \BiiJr.,ik\\uk\, (98)

where summation is implied on the [i-^k) indices. And, the uncertainty associated with a

linesir combination of the model parameters from eq (93) is assumed to be given by

|V| < y/ajakBjiBki (^J + ^J^^) + \aj\\BjiJ^,ik\\uk\, (99)

where summation is implied on the {i,j,k) indices.

31
4. Manual of Operations

In order to use MAINl, it is necessary to: (1) specify the model parameters which characterize the layered structure of the sample, (2) collect the necessary measurement data

of ellipsometric angles, (3) assign size allocations of arrays which hold these data, (4) assign formats and filenames which are provided for entering the input data and receiving

the output data from calculations, and (5) understand the limitations and capabilities of

the software package and its utility for implementing strategies to analyze the measure- ment data. The filename convention assumes a filename of up to six characters and an extension of up to three characters; the standard format is given by: filename.ext. This

section presents a brief overview of these considerations.

4.1 Software Development Considerations

The main program, MAIN, performs a small set of functions. First, it calls a subroutine to

open the necessary data files. Second, it requests a routine to read most of the input data

file. Third, it allows the user to select an option from a menu or tabulated list of command options and then calls the appropriate subroutine. Following the return from the

subroutine to the main program, the main program stops; no further command options

are processed.

4.1.1 Input/Output Files

MAINl makes use of four input/output files. One file serves for entering the input data,

while three files serve for collecting output data.

X.DAT is the input data file. It contains: the model parameters which characterize the

sample, the configuration of the layered structure of the sample, the ellipsometric angles of

the measurement data, and the command options that provide control of the program.

X.OUT is an output data file. It contains a collective list of: all the entered input data

and the general proceedings generated during the course of a calculation, as well as any

informative error messages.

X.SOUT is the solution output data file that collects the breakpoint information during

any grid scan of the model parameters. This information is written onto disk at periodic

intervals of 15 cpu-minutes and overwrites the information from previous breakpoints, so

32
that only the last or most recent breakpoint is retained. The procedure for restarting or resuming a previously interrupted calculation involves the simple task of appending the

output of this file X.SOUT onto the end of file X.DAT, i.e., without any intervening blank

lines, and then re-executing the job. When the job is re-executed, the program will at- tempt to read only one set of breakpoint information in file X.DAT before resuming calculations. Consequently, it is important to replace any earlier breakpoint data in X.DAT, as

appropriate.

X.PLOT is the output file whose data are formatted in a manner that is intended to be

amenable for later reading and plotting.

These files are opened initaJly by the subroutine FILEOP. Since breakpointing involves

opening/closing files, other occurrences of the open/close statements may be found in subroutines: SCAN2, SCAN2G, SCANS, SEAMAX. The integer logical units that are associated with these files are assigned by the block data statement located in BLKDAT.FOR.

These logical units are passed throughout the interior of the program by the named common block statement located in lOUNIT.

Further, all output files are deleted at the start of the program, as may be seen from looking at files MAIN.FOR and FILEOP.FOR. Consequently, it is important to append any

breakpoint information contained in X.SOUT to X.DAT, as appropriate, before the next

execution of the program, lest that which was stored in X.SOUT be overwritten and lost.

4.1.2 Allocations of Array or Work Space

In general, the allocation size of the arrays used in the program may be determined or es- timated from a set of eight constants. These constants are assigned their numerical values

prior to compilation by parameter statements located in file DEFNIT. Consequently, if any

changes are made to these assignments, it is usually necessary to re-compile and re-link

most (if not all) of the subroutines in order to incorporate the said changes into the running program. The following list includes the eight basic constants.

nsampl, the total number of samples allowed for analysis, where the sample involves

some finite number of films/layers atop a substrate.

nfilnm, the total number of films/layers allowed atop the substrate of any given sample.

33
nlmnts, the total number of distinct indices of refraction and extinction coefficients that

are allowed during analysis.

nwaves, the total number of distinct wavelengths of light that are allowed to be incident

on the sample.

nbient, the total number of distinct ambients (air, vaccum, etc.) which are external to

the layers/substrate of the sample.

nrpeat, the total number of allowed repeats of measurements (per wavelength) on a sample.

nanglx, the total number of allowed angles of incidence (per wavelength) of incident

light.

nanglm, the total number of allowed angles of incidence (per wavelength) used during

multiple-angle error analysis. This is discussed in section 4.3, but involves setting the command option=6. As may be seen in the main program, MAIN, this

option has been suppressed; i.e., this constant is not currently used.

In some cases, the array allocations seem needlessly overestimated. The algorithm that

estimates the array allocations from the eight constants assumes a worst-case scenario with

the largest size possible being calculated. This occurs especially when sizing the arrays for

the Jacobian. Consequently, it is convenient to assign some upper limit to these arrays.

This is the purpose of the constant named imjaaa. Further, a simple internal check-test is

also provided to ensure that the indices remain within bounds of the dimensions of these

arrays.

4.1.3 Library Software

During the course of analyses, it is often necessary to determine the sensitivity of dependence of the calculation upon the model parameters. As discussed earlier in section 3.2

from eqs (82) and (99), it is necessary to calculate the inverse of a square matrix, i.e., the

matrix formed by the product of the Jacobian and its transpose. This is accomplished or performed by subroutines from the LINPACK library of mathematical software [17]. Reference calls to these subroutines may be found in files: CORLAT.FOR, SEAMA.FOR,

and SEAMAX.FOR.

34
Finally, several of the subroutine calls occurring in subroutine POPLAT refer to the NCAR

graphics library [27,28]. But again, this has been suppressed because it refers to commajid option=6, which is discussed in section 4.3.

4.2 Input Data Requirements

As mentioned in section 4.1.1, the program reads all of its input data from file X.DAT.

From section 2, it follows that the file contains: the model parameters, the characterization of the layered structure of the samples, and the measurement data of ellipsometric

angles. This section discusses a line by line construction of file X.DAT. An example of a

patrtially completed input file is shown in section 4.2.4. The first line in the file is reserved

for entering a command option. This is discussed later in section 4.3.

The main program uses subroutine INPDAT to read the data that are presented in the

following subsections. These data are stored in arrays located in the named common areas

that are in file FILMMM.

Note: The examples presented in this document are for the expressed single purpose of

communicating the utility of the software package and are not to be construed as an en- dorsement of numerical values that are associated with optical properties of media at particular wavelengths.

4.2.1 Parameters

As discussed earlier in section 2, the forward problem involves at least two kinds of parameters, those which characterize the source, i.e., wavelength and angle of incidence, and

those which characterize the material sample, i.e., indices of refraction and extinction coefficient at each wavelength for each distinct type of optical media and distinct layer thicknesses. In the following subsections, the parameters are grouped and presented in the order that they ought to appear in the input file. Each subsection presents one particular

type of parameter and the general format appropriate for that type of input data. Each

format is demonstrated by a worked example.

4.2.1.1 Wavelengths

The first group of parameters mentioned above involves wavelengths. Here, the first line

of data is the number of distinct wavelengths that are associated with the measurements

35
collected on all of the samples. This positive integer is denoted by mx- This line of data

is next followed by m\ lines of data which contain the information about the wavelengths.

Each of these lines contains two numbers, one index label and one wavelength. The wavelengths are expressed in units of nanometers. The labels are indexed consecutively from 1

to mx. The lines are ordered so that the index label is monotonically increasing while the

wavelengths are monotonically decreasing.

An example of this format is shown below for a simple case, where the measurements in- j volve only two distinct wavelengths, such as that resulting from the use of two different

lasers and a collection of multiple- angle of incidence data on one or more samples. The

j format would then involve three lines of data, e.g.,

2

1 632.8

2 441.0

This format may be expressed succinctly by the following form:

/{i, Ai)

where:

mx is the total number of distinct wavelengths;

i is an integer that indexes the wavelengths consecutively in unit increments,

i.e., i = 1,2,3, ... ,771^; and

Ai is the wavelength of the incident light that is measured in free-space and ex- pressed in units of nanometers. It is required that the wavelengths be ordered

monotonically decreasing with increasing index, i.e., (A,- > Aj+i). Wavelengths

associated with lower energy are entered or listed first.

The above notation is a suggestive adaptation of the argument list for a READ statement

in FORTRAN. The forward slash mark '/' delimits the first line of input data. The

parentheses bound items that ought to appear on each subsequent line of data until the

implied DO-loop has been satisfied. Such notation has been convenient in conveying the

complicated formats that are required for the input entries as well as the associated data

mwaves total number

HeNe ' wavelength ' HeCd laser line

of distinct wavelengths

nanometers

36
structures. In general, this notation will be assumed throughout the remainder of the document, as appropriate, i.e., unless stated otherwise from context.

4.2.1.2 Optical Media

4.2.1.2.1 Ambient

The ambient region refers to that spatial region which lies external to the layered structure of the sample, i.e., the (layers/substrate) system. Distinct refractive indices may be

due to dispersion or fluid that is inside some filled cell containing the submersed sample.

Although the corrections for the window of the cell would be important, such considerations are beyond the scope of presentation here, and the reader is well advised to refer to

the outside literature. The format for entering the indices of refraction for the ambient is

of the same form as that discussed for entering wavelengths, i.e.,

TTlo l{h f^i)

where:

vria is the total number of distinct refractive indices in the ambient region;

t is an integer that indexes the refractive indices consecutively in unit increments,

i.e., 1 = 1,2,3,..., TTia'i and

n,- is the index of refraction of the ambient at one particular wavelength.

To demonstrate the use of the above format, consider a case where ellipsometric measure- ment data were collected on a sample that had been placed in at least two distinct ambients, e.g., air and vacuum. Further, let the incident wavelengths be those mentioned in the

previous example. Then, the format could be the following:

3 ! mbient ' numbar of distinct aitibients 11.0 ! ' vacuum

2 1.00027 ! ' air at 032.8 lun, EeNe laser line

3 1.00027 ! ' air at 441.0 lun, EeCd

This involves four lines of input data. Apart from the comments that are appended to the

above lines of data, the format does not associate optical properties with wavelength. This

37
will be accomplished later in section 4.2.2, where the construction of the sample's layered

structure from the constituent model parameters is discussed.

4.2.1.2.2 Layers/Substrate

For each optical medium that contributes toward the construction of the layered structure

of the sample, one requires the numerical value of the index of refraction and extinction

coefficient for each wavelength of incident light. For convenience, the word 'element' or its

mnemonic 'Imnt' is used to associate some form of indexing of the numerical values that

are assigned to the optical properties at distinct wavelengths.

As discussed earlier in section 3, the numerical values assigned to these parameters may

be selected to undergo variation (vary) or remain fixed (frozen) during the course of the

analysis or calculations. An integer switch (froz/vary) is provided for each model parameter, i.e., refractive index or extinction coefficient. If the switch is set equal to 0, the numerical value is frozen. If the switch is set equal to 1 upon input, the numerical value may

undergo variation. The switches remain unchanged during the course of calculation.

An uncertainty value is also required for each model parameter. The magnitude of this

uncertainty may serve either of two purposes. If the numerical value of the parameter undergoes variation, then the uncertainty value sets the maximum stepsize allowed for changing the numerical value of the parameter between consecutive iterations of the calculation.

If the numerical value of the parameter is selected to remain frozen, then the uncertainty

value is used during the sensitivity analysis calculation to estimate the uncertainty values

of other 'vary' model parameters. This is discussed further in section 3.2.

The format for entering the optical properties of the layers/substrate is:

where:

"^wt is the total number of distinct 'elements' involving refractive indices and extinction coefficients for each distinct type of optical media and wavelength;

i is an integer that indexes the line entries of data consecutively in unit increments, i.e., i = 1, 2, 3, ... ,minint;

38
rij is the numerical value that is assigned to either an index of refraction or extinction coefRcient of some pajticular optical medium at some particular wavelength;

Sui is the magnitude of uncertainty that is assigned to the numerical value of the

model parameter Ui] and

Vi is the integer (froz/vary) switch with value of either 0 or 1, respectively.

To demonstrate this format, consider the well-known case involving a silicon substrate that

supports a thermally grown oxide layer. Further, assume that the wavelengths associated

¥rith the measurements were those mentioned earlier from the example in section 4.2.1.1.

The format could then be something like the following:

I rnlmnts ' (n,k 1 VBvelength, elemant)

1 3 882 0 002 0 ! n,nu,ivar7 Silicon ' at 632.8 zun. HalTe 2 0 010 0 002 0 ! k.ku.ivary Silicon

3 1 457 0 002 0 ! zi,nu,ivar7 Si02 amorphous glass

4 0 0 0 0 1 ! k,]ni,ivar7 Si02 ' at Helfe or EeCd

S 4 753 0 002 0 ! n.nu.ivary Silicon ' at 441.6 nm. HeCd

6 0 103 0 002 0 ! k.ku.ivary Silicon

7 1 466 0 002 0 ! n.nu.ivary Si02 amorphous glass

which involves only eight Lines of input data. This example involves four sets of information. It contedns the optical properties of crystalline silicon and amorphous silicon dioxide at two distinct wavelengths. This is a simple tabulation of numerical values; ordering

is not important among the last seven line entries. Note that no reference to wavelength

is indicated here; thus the specifications regarding the optical properties are still incomplete. The manner in which the optical properties are associated with the appropriate

wavelength will be discussed later in section 4.2.2. (Again, that section discusses how the

layered structure of the samples is constructed layer by layer from the constituent model

parameters as a function of wavelength. That section will conclude the characterization of

the sample.)

Lastly, the example shows that one model parameter was selected to have its numerical

value undergo variation, i.e., the extinction coefficient for amorphous silicon dioxide at either wavelength. Note also that the uncertainty value was set to zero. This condition is

check-tested upon input, so the user would be notified. (Setting the uncertainty value to

39
a nonzero value circumvents any notification.) The reason for the check-test is that the

program uses the uncertainty value to limit the stepsize for updating the numerical value

of the associated model parameter. With an allowed maximum stepsize of zero, the program would be unable to reduce the numerical value of the error expression, at least with

respect to this model parameter. Being unable to justify further calculation, it would ter- minate. Such control is useful in other situations as well, e.g., limiting the calculation to a single evaluation of the residual or discerning relative contributions made to the uncertainty value of some 'vary' model parameter. This may be accomplished by assigning a

sufficiently small number to the uncertainty value on input.

4.2.1.3 Layer Thickness

The program also requires the thicknesses of the layers that contribute to the layered structure of the samples. The unit of thickness is nanometers. Again, in similar fashion as that

presented in the previous subsection, the format is of the form:

where:

rriz is the total number of distinct thicknesses that contribute to the layered structure of the sample;

i is an integer that indexes the line entries consecutively in unit increments, i.e.,

i = 1,2,3, . . .,771^;

Zi is the thickness of a layer measured in nanometers;

Szi is the magnitude of uncertainty in knowing the thickness z,; and

Vi is the integer (froz/vary) switch with value 0 or 1, respectively.

To demonstrate this format, let the following example build upon information presented

from previous examples. Consider a sample involving two layers atop a substrate of silicon, where one layer is atop the other layer. Let the layer adjacent to the substrate be a thermally grown oxide, and let the layer adjacent to the ambient region be a layer of silicon. Then, the layered structure is of the ordered form:

(ambient / silicon / oxide / silicon substrate).

40
Suppose further that the top layer of silicon is 50 nm thick, that the oxide layer is 100 nm

thick, ajid that a reasonable initial estimate of the uncertainty is subjectively chosen to be

2 nm. This construct would require three lines of input data. An example of the format

may be as the following:

2 ! mfilinm ' thicknesBss

1 60.0 2.0 0 ! z.ra.ivary ' top laysr, Si

2 100.0 2.0 1 I z,BU,ivar7 ' bottom layer, Si02

This tabulation would include the distinct thickness from all samples; thus ordering among

thicknesses is not important here. Further, note that this format does not associate thickness with a sample or with ordering of layers on a sample. The ordering of the layers is

discussed in the next section. And lastly, one may see from the above example that the

oxide thickness has been judiciously chosen to undergo variation.

4.2.2 Sample Characterization or Construction

Since the basic constituent model parameters have been presented, it is now possible and

necessary to discuss how: (1) the layered structure of each sample is constructed from the

constituent model parameters, (2) the wavelengths are associated with the optical properties, and (3) the ordering of the wavelengths affects the ordering of the input of the measurement data. The last item is discussed in the next section, i.e., section 4,2.3.

First, it is important to discuss the meaning of the word 'sample.' A sample is defined

as being that structure of the (layers/substrate) system that is subjected to ellipsometric measurement. Characterization of the sample refers to the index-labeling procedure

that associates the spatial regions of the (ambient /layers/substrate) system with the appropriate model parameters at given wavelengths, so that the forward scattering problem

is completely defined. Measurements on a sample may involve one or more wavelengths,

as weU as one or more ambients. For any given sample, the optical properties may change

as a function of wavelength, i.e., exhibit dispersion, whereas layer thicknesses remain un- changed. Here, the representation of the optical media involves a distinct model parameter

per distinct wavelength. A sample is constructed in a layer-by-layer fashion by specifying

the optical properties for each spatial region for each incident wavelength. Admittedly,

41
this parameterization of optical media is by design suitable only for analyzing media involving very few wavelengths, very few ambients, but many-angle of incidence measure- ment data.

Recall, the inverse scattering problem is formulated as a least-squares problem. This involves a series of linear algebra problems. Consequently, the matrices associated with individual samples may be combined so that several samples may be analyzed together. Accordingly, the program is said to have a multiple-sample capability. The maximum number

of samples that may be analyzed together is set by the parameter nsampl, as mentioned in

section 4.1.2.

Recall again that the previous section discussed formats for inputting model parameters.

Each model parameter has a distinct index label; each line entry following the first line is indexed. The actual ordering among the line entries within any given set of model parameters is relatively unimportant, i.e., apart from wavelength. Here, the index labels are used

for specifying the configuration of the (ambient, wavelength, sample) system. The sample

is characterized by an ordered set of integers that point into arrays that store the numerical values associated with the model parameters.

For convenience, the integers are ordered in a format compatible with the collection al- gorithm of the laboratory instrumentation. Here, measurements are collected by scan- ning the angles of incidence for each given wavelength. The ellipsometric measurement

data are ordered into a data structure that follows the FORTRAN indexing convention for

multiply-indexed arrays. That data structure is of the following form:

[angles, repeats, ambients, wavelengths, samples)

where:

samples indexes the set of distinct samples that were subjected to ellipsometric measurement;

wavelengths indexes the set of distinct wavelengths used during measurement on a given

sample;

ambients indexes the set of distinct ambients used during measurement involving a

given wavelength and sample;

42
repeats indexes the sets of distinct repeats of multiple- angle measurements performed on a system of given ambient, wavelength, and sample; and

angles indexes the sets of distinct angles of incidence used during measurement on

a system of given repeat index, ambient, wavelength, and sample.

This form suggests that the samples are considered individually. First, the sample is specified; then, the incident wavelengths are specified; this is followed by the specification of

the ambient, i.e., the value of its refractive index at the associated wavelength. Last, the

angle of incidence is specified to completely define the forward problem. The repeats serve

as convenient (or artificisil) partitioning of the multiple-angle of incidence data, e.g., distinguishing data collected on different days.

To implement the above organization and thereby characterize the (ambient, wavelength,

sample) system, the program reads a tabulated set of integers line by line. The first line

of data specifies the number of samples; this is denoted by mgampies- This is followed by a

series of lines that are grouped in a sample-by-sample manner.

For convenience, consider the lines that are associated with the j*^^ sample. The first line

of data for this subset should specify: the index label, the number of layers, and the number of wavelengths. These are denoted, respectively, by: Jsampie? ^A,j- The

next line should specify the wavelength and number of ambients that have been involved

with this sample and wavelength. The two integers are denoted, respectively, by: Ajj

and Tna,ij, where the first entry is the index label for the wavelength, and i is a local index of the ordered wavelengths, i.e., i = 1, 2, 3, . . . ,Tnx,j.

Now that the sample and wavelength have been indicated, consider next the structure of

the layers/substrate. The layers/substrate are considered in succession, i.e., starting with

the top layer or layer 1, which is adjacent to the ambient region. Each layer/substrate

region is associated with a line of integer data. The integers include the index labels for

the layer, refractive index, extinction coefficient, and thickness, in that order. This is indicated, respectively, by: /, rii^ij, h^ij, and zij, where the tilde refers to that implying

index labels. The substrate assumes a layer index label of m^^j + l, but no index label for

thickness is required. This completes the specification of the layers/ substrate system for

the j*^ sample.

43
The next set of ma,ij lines of data is used to specify the ambients and repeats, i.e., one

line for each ambient. Each line should contain two integers; they are the index label of

the ambient at associated wavelength and the number of repeats of the multiple- angle of

incidence data. These are denoted, respectively, by: a^,,j and r*^,tj, where ^ is a local

index of the ambients, i.e., £ = 1,2,3, .. . ,ma,ij. Here, a repeat value of 1 is associated

with one set of measurements, i.e., not two. This completes the specification of the (ambient/layers/substrate) system, as well as the implied organization of the collection of measurement data.

Regarding the organization for these specification data, the general format is given by the

following form:

44
1

l)s&inple • • •

(i+1)ample

1 Wi.ij ki^ij Zij

• • • • • •

• • • •

"^Zyj ^mrsij ^mrfij ^mrj

• m

Hi} ^t,i3

'Tlgamplc

45
where:

'^samples IS the total numbei of distinct samples that are/were subject to ellipsometric

measurement.

isampie IS an integer that indexes the samples consecutively in unit increments, i.e.,

m^j is the total number of layers that lie atop the substrate of sample j. The top

layer is adjacent to the ambient and is indexed locally as being equal to one. The bottom layer is adjacent to the substrate and is indexed locally as being

equal to m^j.

mxj is the total number of distinct wavelengths that are used in the measurements

involving sample j.

Xij is the integer index label of the appropriate wavelength that is associated with

the i*'^ wavelength incident on sample j. Note that i is indexed locally, i.e.,

i = 1, 2, 3, . . . ,m\j. Further, it is requested that the set of measurement data

be ordered upon input so that the wavelengths be decreasing with increasing

index, or equivalently, that the index label A be monotonically increasing with

index, i.e., {Xij < Xi+ij).

nia^ij is the total number of distinct ambients that involve the i'^ wavelength incident on sample j.

I is an integer local index of the layers and substrate of the sample, i.e.,

i = 1, 2, 3, . . . ,mzj, m-zj+l. The layers are indexed consecutively; the layer adjacent to the ambient is labeled 1; the layer adjacent to the substrate is labeled

m^j, and the substrate is labeled m^j + l.

ni^ij is the integer index label of the appropriate index of refraction

that involves the l^^ layer and the z*^ wavelength incident on sample j.

ki^ij is the integer index label of the appropriate extinction coefficient

that involves the layer and the z*^ wavelength incident on sample j.

zi^ij is the integer index label of the appropriate thickness of the /'^ layer of sample

j46
nt,ij is the integer index label of the appropriate index of refraction of the substrate

that involves the t*^ wavelength incident on sample j.

kg^ij is the integer index label of the appropriate extinction coefficient of the substrate that involves the i*^ wavelength incident on sample j.

ai^ij is the integer index label of the index of refraction of the t"^ ambient that is used with the V'^ wavelength incident on sample j. Here, I is indexed locally,

i.e., [l = 1, 2, 3, . . . ,ma,,j). Furthermore, it is requested that the measurement

data be ordered upon input so that (a^.tj < a^+i,ij).

r^ij is the total number of sets of repeated measurements that involve the ambient with the i'^ wavelength incident on sample j. Note that a repeat value of 1

relates to reading one set of data, i.e., not two. Each set involves a collection of

multiple- angle measurements.

Again, the optical properties become associated with the appropriate wavelength via explicit use of index label. This simplifies any inherent coupling between distinct samples.

Distinct samples may have one or more model parameters in common.

To demonstrate this format, consider again the example presented in the previous section

that discussed layer thicknesses, i.e., section 4.2.1.3. There, the sample involved two layers, i.e., a top layer of silicon, a layer of amorphous silicon dioxide, and a substrate of silicon. Suppose that this sample is measured by eUipsometry using wavelengths from the two

aforementioned laser lines. Assume further that sets of multiple-angle measurements were

performed in air, as well as in vacuum. After performing these measurements, suppose

that this sample is subjected to some etchant, which is able to remove the top layer and

leave the oxide layer unaffected. Let this become the 'second' sample. Let this 'second'

sample be subjected to a similiar set of ellipsometric measurements, but only in air. Note

that the model parameters of the oxide layer and substrate are common to both samples.

The format for this example coiJd be as the following.

2 1 4 2 2

msantple ' number of samples

isample, mfilm, mwave

iwave, mbicnt

n.k.r

n.k

imbiezit , mrpeat

- (HeNe)

'Si, 50 nm

' Si02, 100 nm

' Si, substrate

' vacuum

47
2 2 ! inibiozili i inrpsa1> air

2 1 ! iwave , mbiezit HeCd,

1 5 6 1 ! n.k.z Si, EO zun 2 7 4 2 ! n,k,z Si02, 100 xm

3 S 6 ! n,k Si, substrate

3 1 ! imbieiit , mrpeat air

2 1 2 ! isanple, rnfilm, mwave

1 1 ! inave, mbiezit HeNe

1 3 4 2 ! n,k,z Si02, 100 nn

2

41 2

1 _ \_

! Zl,X 51, substrate

2 1 ! imbient, mxpeat air

2 1 ! iwave, mbient HeCd

1 7 4 2 ! n.k.z Si02, 100 zun 2 B 6 ! n,k Si. substrate

3 1 ! imbiezit, mrpeat air

Here, the example includes a repeated set of measurements on the first sample in air using

light from the HeNe laser.

4.2.3 Measurement Data (AjV')

The measurement data are organized in a manner similar to that discussed in the preceding section, i.e., section 4.2.2. There, the data structure assumed a form given by:

(angies, repeats, ambients, wavelengths, samples).

Again, the measurement data are entered into the data file line by line. Each line contains one measurement of (A,^'), as well as the angle of incidence and associated uncertainties.

Here, the format is of the following general form:

where:

'm^,Hij is the total number of multiple-angle measurements of ellipsometric angles (A, V*)

that were collected during the f*^ repeat set, i.e., (1 < f < rt,ij), of data measurements on the system involving the t'^ ambient with the i*** wavelength incident on the jf*** sample.

ai^ij is the integer index label of the index of refraction of the l*^ ambient associated

with the i**' wavelength incident on the j*'^ sample. This is the same label mentioned in the previous section.

Xij is the integer index label appropriate to the i*^ wavelength incident on the j*^

sample. This is the same label mentioned in the previous section.

48
a is an integer that indexes the multiple- angle measurements consecutively in unit

increments, i.e., a = 1,2,3,. . . ^m^^fuj.

(f>ci is the angle of incidence measured in degrees, where a value of zero relates to

that of normal incidence.

6(f>a is the magnitude of uncertainty in the angle of incidence as determined from

calibration of laboratory instrumentation.

Aa is measured in degrees, i.e., (0 < A < 360), assuming the Nebraska convention,

i.e., Rp^H and eq (51).

SAa is the magnitude of uncertainty associated with measuring A^.

V'o is measured in degrees, i.e., {0 <tl) < 90).

Stpa is the magnitude of uncertainty associated with measuring -^aTo demonstrate this format, let the measurements be those found or generated by solving the forward scattering problem for the sample configurations presented in the previous

example. Let the measurements involve only a few angles of incidence data. These measurements would be exact. Let the uncertainty associated with <f>, A, and be given by

0.01, 0.05, and 0.05 degrees, respectively. Although these values naturally depend upon

the instrumentation, their magnitudes are chosen subjectively here for convenience. The

format cotild then be as the following:

2 1 1

' mazigl,iDbieii,i«ave/(phi (delta, psi) (angle, d_angle) ! vacuum

1 65 .0000 0.0100 173.6043 0.0600 37.0679 0.0600 ! HeNe

2 70 .0000 0.0100 172.2664 0.0600 34.3707 0.0600

3 2 1

' mangl, ifflbien,i9ave/ (phi , delta, psi) (angle. d_angle) ! air

1 0B .0000 0.0100 173.6101 0.0600 37.0627 0.0600 ! HeNe

2 70 .0000 0.0100 172.2760 0.0600 34.3633 0.0600

3 75 .0000 0.0100 170.0364 0.0600 30.1673 0.0500

2 2 1

' mangl,imbien,i9ave/(plii, delta,psi) (angle. d_angle) ! repeat

1 67 .5000 0.0100 172.9647 0.0600 35.8406 0.0600

2 72 .5000 0.0100 171.3629 0.0600 32.5214 0.0500

4 3 2

' mangl, imbien,i9ave/(plii, delta, psi) (angle. d_angle) ! air

1 67 .5000 0.0100 286.8467 0.0500 30.2644 0.0500 ! HeCd

2 70 .0000 0.0100 297.5219 0.0600 31.2799 0.0600

3 72 .5000 0.0100 307.5732 0.0600 32.6322 0.0000

4 75 .0000 0.0100 316.8687 0.0600 34.2225 0.0000

2 2 1

' mangl,ifflbien,i9ave/(phi, delta,psi) (angle. d_angle) ! air

1 70 .0000 0.0100 79.8092 0.0600 41.0465 0.0600 ! Eeire

2 73 .0000 0.0100 68.2602 0.0600 41.0304 0.0600

49
2 3 2 ' maiigl,iinbioii,iwave/(ph.i,delta,psi) (angle, d.emgla) ! air

1 70.0000 0.0100 211.2235 0.0500 77.3289 0.0500 ! HeCd

2 73.0000 0.0100 216.1656 0.0500 84.4928 0.0500

Incidentally, these data are retained in arrays that are located in the named common area, exprmt.

4.2.4 Combining

The input data file is composed of at least two kinds of information, those which define

the system model and associated measurements, and those which define the options for

processing these data. Thus far, only the first kind has been presented. The input data

file is constructed, i.e., in part, by simply combining the previous formats in the order as

presented. Such involves the wavelengths, the model parameters, the characterization of

the samples, and the measurement data. No intervening blank lines are allowed.

Combining all the examples as presented thus far, and indexing the lines for convenience,

i.e., the data file X.DAT should not actually contain such indexing, the combined format

would be:

1

2 2

! option *

! mwaves

' reserved for some selected option

total number of distinct wavelength

3 1 632.8 ! HeNa ' wavelength ' nanometers

4 2 441.6 ! HeCd laser line

6 3 ! mbiont ' number of distinct ambients

6 1 1.0 vacuum

7 2 1.00027 air at 632.8 nm, HeNe laser line

8 3 1.00027 air at 441.6 nm, HeCd

e 7 ! mlmnts ' (n,k 1 wavelength, element)

10 1 3.882 0 002 0 ! n,nu. ivary ' Silicon ' at 632.8 nm, HeUe

11 2 0.019 0 002 0 ! k , ku

,

ivary ' Silicon

12 3 1.457 0 002 0 ! n,nu. ivary ' Si02 amorphous glass

13 4 0.0 0 0 0 ! k , ku

,

ivary ' Si02 ' at HeNe or HeCd

14 5 4.753 0 002 0 ! n,nu. ivary ' Silicon ' at 441.6 nm, HeCd

15 6 0.163 0 .002 0 ! k,ku. ivary ' Silicon

16 7 1.466 0 .002 0 ! n,nu. ivary ' Si02 amorphous glass

17 2 ! mfilmm ' thicknesses

18 1 50.0 2.0 0 ! z,zu. ivary ' top layer. Si

19 2 100.0 2.0 1 ! z,zu. ivary ' bottom layer, Si02

20 2 ! ms ample ' number of samples

21 1 2 2 ! isample, mfilm, mnave

22 1 2 ! iwave, mbient ' (EeHe)

23 1 1 2 1 n,k,z ' Si, 50 nm

24 2 3 4 2 n,k,z ' Si02, 100 nm

25 3 1 2 n,k ' Si, substrate

50
20 1 1 ! imbient, mrpeat vacuum

27 2 2 ! imbient , mrpeat air

28 2 1 ! iffave, mbient EeCd

29 1 6 8 1 ! n,k,z Si, 50 nm

30 2 7 4 2 ! zi,lc,z Si02, 100 nm

31 3 B 6 ! n,k Si, substrate

32 3 1 ! imbient, mrpeat air

33 2 1 2 ! isample, mfilm, mwave

34 1 1 ! isave, mbient HelTe

35 1 3 4 2 ! n,k,z Si02, 100 ZUQ 80 2 1 2 ! n,k ' Si, substrate

37 2 1 ! imbient, mrpeat air

38 2 1 ! ivave, mbient EeCd

39 1 7 4 2 ! n,lc,z Si02, 100 nn

40 2 B 8 ! n.k Si, substrate

41 3 1 ! imbient , mrpeat air

42 2 1 1

* mazigl.imbien.ivave/Cphi, delta, psi) (angle, d_angle) ! vacuum

43 1 86 .0000 0.0100 173.B043 0.0500 37.0679 0.0500 HeNe

44 2 70 .0000 0.0100 172.2864 0.0500 34.3707 0.0500

4S 3 2 1

' mangl, ifflbiezi,i9ave/(phi, delta, psi) (angle. d_ angle) j air

46 1 6B .0000 0.0100 173.5101 0.0600 37.0527 0.0600 HeNe

47 2 70 .0000 0.0100 172.2760 0.0600 34.3633 0.0600

48 3 7B .0000 0.0100 170.0364 0.0500 30.1673 0.0600

48 2 2 1

' m angl,imbien,i?ave/(phi,delta,psi) (angle. d_angle) repeat

SO 1 87 .BOOO 0.0100 172.9647 0.0600 36.8405 0.0600

61 2 72 BOOO 0.0100 171.3529 0.0500 32.6214 0.0500

83 4 3 2 ' mangl,imbien,i7ave/(phi, delta, psi) (angle. d_ angle) j air

M 1 87 BOOO 0.0100 286.8467 0.0600 30.2644 0.0500 HeCd

B4 2 70 0000 0.0100 297.5219 0.0500 31.2799 0.0600

SS 3 72 BOOO 0.0100 307.5732 0.0500 32.6322 0.0000

86 4 7B 0000 0.0100 316.8687 0.0500 34.2225 0.0000

87 2 2 1

' mangl,imbien,i9ave/(plu., delta, psi) (angle. d_angle) air

88 1 70 0000 0.0100 79.8092 0.0600 41.0455 0.0500 j HeNe

89 2 73 0000 0.0100 88.2602 0.0500 41.0304 0.0500

60 2 3 2 ' mangl,imbien,i9ave/(phi., delta, psi) (angle. d_angle) air

61 1 70 0000 0.0100 211.2236 0.0600 77.3289 0.0500 HeCd

63 2 73 0000 0.0100 218.1556 0.0600 84.4928 0.0500

68 ! reserved for further/other option information

4.3 Command Options

The laist type of input data that must be included in the file X.DAT is that associated

with directing the use of the software package. To direct the execution of the software

program package, a menu-driven decision-tree of command options is made available to

the user. The first level of the tree involves a menu of five options. Here, one option is selected per execution of the program, and the selection of that option forms the first line

of the input to the data file X.DAT, as mentioned previously in section 4.2. The program

reads this line and the following lines shown in the previous subsection (4.2.4), i.e., model

51
parameters, sample characterization, and measurement data, where appropriate. After

reading this input of data, the program branches to the appropriate subroutines. Upon

completion from these routines (at level one), the main program stops. Again, as was

mentioned earlier, the main program does not loop back to a previous condition where a

request is made of the user to select another option at level one.

Before reading the first line of the input file, the program writes to the output file X.DAT

the following menu of available options:

options: 1, forvard problems, plots,

2, search ( vary)

3, search grid ( vary)

4, search grid (froz,vary)

6, sensitivity analysis

6, MAE plots ' uncertainty

Enter: option '

Where the options (level one):

1, requests the program to perform one of several simple tasks, such as providing a

set of tabulated output that is amenable for plotting, or initiating a series of calculations of the forward scattering problem. No iterative calculations are induced,

i.e., no minimizations or inversions of the ellipsometric equations. This is discussed

further in section 4.3.1.

2, requests the program to invert the ellipsometric equations by performing a series of

unconstrained optimization calculations. The variation of numerical values of selected model parameters is generally unbounded. This is presented in section 4.3.2.

3, requests the program to invert the ellipsometric equations by performing a grid scan over a selected set of model parameters. A series of constrained optimization

calculations is initiated at each point of the grid of model parameters. This is discussed further in section 4.3.3.

4, requests the program to invert the ellipsometric equations by performing a grid scan over a selected set of model parameters, where the grid scans are held local

to the individual sample. Hence, the coupling between samples is suppressed. A

52
series of constrained optimization calculations is initiated at each point in the grid

scan. This is discussed further in section 4.3.4.

5, requests the program to initiate a sensitivity analysis of selected model parameters.

The uncertainty associated with assigning a numerical value to a model parameter

is estimated from the covariance matrix elements and the relative contributions of

uncertainty from the frozen model parameters. This is discussed further in section

4.3.5.

6, requests the program to determine which selection of multiple angles (of incidence)

minimizes the calculated magnitude of uncertainty in the numerical value of some

selected model parameter. This involves a grid scan over groups/sets of incident angles. The magnitude of uncertainty is calculated as a function of these groups/sets.

This is discussed further in section 4.3.6.

These options provide the current range of utility of the program. Regarding the general

nature of the options, it may be expected that option one is more useful towards the beginning of analysis with plots, option five is more useful towards the conclusion of analysis,

while options two and three form the primary tools during analysis. Option four provides

a measure of convenience with uncoupling samples. This not only reduces the sizes of the

matrices, but also this tends to remove redundant calculations from the grid scan. Since

the grid scans are constructed from a simple nesting of DO-loops, a reduction may be ex- pected to occur whenever the grid scans involve model parameters which are not common

to every sample. This reduction and savings can become significant.

These options are discussed further in the following subsections. Here, it is convenient to

simply foUow the decision-tree of options.

4.3.1 Forward Problems, Plots, ...

Upon selection of option one (at level one), the main program calls subroutine PLTDAT.

The routine is partitioned to serve five distinct tasks. Hence, another menu of options is

afforded to the user. Regarding the calling sequence of routines as initiated from the main

program, this involves level two. Accordingly, the menu of options is:

PLTDIT, forward scattering problsms, ploti, ... This menu of options is at level two.

53
options: 1, plot (z,n,]i[)

2, plot deviations of fit, g = experiment-model

3, model > experiment/measurement data, use model to simulate measurement data,

format is suitable to reading as input,

(angles , repeat s , ambient s , waves , szunples)

4, use model at measurement/scan points,

request another menu to format output,

output * (delta, psi, intensity, R,dA, ...)

B, scan grid, plot |g|, ID or 2D

Enter: option '

where the options (level two):

1, requests the program to output the profile of the index of refraction and extinction

coefficient as a function of depth through the layered structure of the sample. The

simple format is intended to be suitable for later plotting. The output is written to

the plot file X.PLOT.

2, requests the program to calculate and tabulate the deviations between the measure- ment data and that calculated by the model. The deviations are ordered similar to

that of the measurement data. The output is written to the plot file X.PLOT.

3, requests the program to use the model to simulate measurement data. The format

is suitable for use in file X.DAT. The output is written to both files, X.OUT and

X.PLOT.

4, requests the program to use the model to calculate some selected field quantity.

The selections include: the ellipsometic angles, reflected field intensities, and matrix elements of the Jacobian. The output is written to file X.PLOT. To assist the

selection process, two menus are provided. These are presented later in this section.

5, requests the program to initiate a grid scan of model parameters and evaluate the

error expression |g| for each point on the grid. Here, the grid is either one or two

dimensional; i.e., only one or two model parameters may undergo variation. Here,

it is necessary to specify the domain of the grid. The format for this input is presented later in this subsection. The output is written to file X.PLOT.

As mentioned above, regarding options four and five, both present menus to assist the se54
lection process in the decision-tree of options. These menus are presented next.

For the case regarding option four (level two), the program responds by presenting the

first of two menus. The first menu presents a list of selected field quantities that are available for formatted output.

PLTDAT, select the format of the output table.

This menu of options is at level three.

options: 1, (i,ai, delta, psi, intensity ) 2, (i.ai, iRsl.lRpI, iRs I **2, iRpI **2)

3, (i,ai, |Rs|,|Rp|, intensity }

4, (i,ai, d/d pariuneter (delta, psi) )

Enter: option '

where:

1, involves the ellipsometric angles and the intensity /, where 7 = + |-Rp|^).

2, involves the magnitude and intensity of the field amplitude for each polarization.

3, involves the magnitude of the field amplitudes and the total intensity.

4, involves the matrix elements of the Jacobian. The partial derivative is specified by

the (froz/vary) switch of the model parameter. Either zero or one model parameters may be selected as undergoing variation. For the case involving zero model

parameters undergoing variation, the partial derivative is taken with respect to the

angle of incidence. Here, the Jacobian matrix elements are expressed in the physics

convention, i.e., not the engineering convention. Only that associated with A is affected, i.e., inducing a minus sign.

i, refers to the local indexing of the multiple angles of incidence, which involves one

given configuration of the system, i.e., (repeat, ambient, wavelength, sample).

ai, refers to the angle of incidence measured in degrees.

Continuing the case regarding option four (level two), the second menu of options (level

three) involves selecting the appropriate grid of incident angles used in the tabulation.

PLTDIT, select the domain of incident angles.

This menu of options is at level three.

55
options: 1, at axperimezit /measurement points

2, grid scan, incident angles * (1,89)

Enter: option

where the options refer to the incident angles associated with

1, the measurement data of ellipsometric angles {A^tp), and

2, a grid, indexed from 1 to 89, with stepsize of one (degree). Such is usually more

than adequate for plotting the field as a function of incident angle.

Finally, consider the case involving option five (level two). Here, the domain of the grid

needs to be specified. Since each dimension of the grid involves one of the distinct model

parameters, it is necessary to specify: the model parameters, their bounds, and their stepsizes. The model parameters are selected via the (froz/vary) switch; only those indicated

as varying contribute to the grid. Since the plots are either one or two dimensional, only one or two model parameters may have numerical values being indicated as varying. The

format for reading this grid information follows the convention of DO-loop specification,

and is given by the form:

ip» Pi) P2, P3,

where ip refers to the index label of the model parameter p, and pj refers to numerical

value of the model parameter associated with the initial value, final value, and stepsize.

Further, it is required that the lines be ordered according to the input data requirements

presented earlier in section 4.2, i.e., optical media first, then thicknesses.

4.3.2 Search (vary)

Upon selection of option two (level one), the main program calls subroutine ZOOM. This

routine initiates and maintains the search for a minimum to the error expression as an un- constrained optimization problem. The (froz/vary) switch specifies the model parameters

which have numerical values that are undergoing variation. At least one numerical value

must undergo variation per measurement of (A,-^), so that their associated rows in the Jacobian are not zero. Note that an iterative method requires an initial solution. Here, the

initial value solution is given by the initial input of model parameters as presented in section 4.2. The problem is now completely defined; no further specifications are necessary;

56
no further menus need to be issued to the user.

Since the optimization algorithm is unconstrained, unphysical fixed-point solutions are

possible and likely during analyses. Such has been discussed earlier in section 3.

The following presents a brief orientation regarding the internal organization of the routine ZOOM. The organization is that for setting up an iterative loop. It calls subroutine

ASMBL to construct the Jacobian matrix. It calls subroutine CGNL to solve for the Newton step. It updates the numerical value of the selected model parameters and tests the

rate of reduction of the error expression. The progress regarding the rate of reduction is

written to the output file, X.OUT. If the rate of reduction is sufficiently small to merit no

further expenditure, it returns; otherwise, it continues iterating. Such calculations usually

involve short durations of time, breakpointing is not necessary, and so it was not incorporated into the routine.

Upon completion of the above tasks, the program reports its best fixed-point solution.

The deviations between the measurement data and that of the model are written to the

plot file, X.PLOT, using subroutine PLTDAT. Statistics regarding the deviations are provided by the routine STAT22. It reports the statistical means, standard deviations, and

the correlation coefficient of the deviations g. Here, the mean involving A is defined by

the variance is defined by

{{9. - {9.))') ^ ^j:{9,,i-{9.))\

where the square root estimates the standard deviation, and the covariance is defined by

M

i=l

and the correlation coefficient is defined by the ratio formed by the covariance divided by

the product of standard deviations of 9^ ^ and 9^ ^. A correlation matrix, as defined by eq (81), is calculated by subroutine CORLAT. Being

a symmetric matrix, the upper triangle is reported to the output file, X.OUT. The output

file also reports the condition number of this matrix [17], as well as the diagonal elements

57
of the renormalization matrix as defined by eq (63). Such helps identify which model parameters may be correlated and aids the decision process regarding the selection of frozen

model parameters during a series of calculations. Upon completing these tasks, the program stops.

4.3.3 Search Grid (vary)

Upon selection of option three (level one), the main program calls subroutine SCAN2 to

invert the ellipsometric equations. It seeks to find a minimum to the error expression, as

a constrained optimization problem, by initiating a scan over a grid of numerical values

associated with a selected set of model parameters. Here, the (froz/vary) switch specifies

the selection; the model parameters contributing to the grid are those whose numerical

values are selected to undergo variation. Since the grid is constructed from a single block

of nested DO-loops, each selected model parameter contributes one dimension to the grid,

i.e., a hyper-cube. Note that efficient use of the grid occurs when the selected model parameters are common to all samples.

Again, each dimension of the grid involves four items: the model parameter, the lower

bound, the upper bound, and the stepsize. To provide this information to the program, it

is convenient to follow the convention of DO-loop specification and request /require that

the input format to be of the form:

Pi, P2, P3,

where ip refers to the index label associated with the model parameter p, and pj refers

to the numerical value of the model parameter associated with the initial value, final value,

and stepsize. Also, it is required that the lines of data be ordered according to the input

data requirements presented earlier in section 4.2, i.e., optical media first, then thicknesses.

For each point on the multidimensional grid, the calculation initiates a series of unconstrained optimization problems, except that the range of numerical values of the selected

model parameters is restricted within the bounds of the grid. At the conclusion of the grid

scan, when the program reports its best fixed-point solution, the program also reports any

components of the solution which lie near the boundary of the selected grid. Solutions

with components at grid boundaries are, of course, grid dependent, and as such, further

calculation is usually necessary, i.e., after the grid is moved or redefined.

58
Since grid specification includes the stepsize, i.e., number of steps, it is possible for calculations to become very time-consuming. For this reason, the routine provides breakpoint

information to the output file X.SOUT at intervals of 15 cpu-minutes. This is discussed in

section 4.1.1. The mechanism for restarting a previously interrupted calculation is rather

straightforward. One need merely append the contents of X.SOUT onto the end of the input data file X.DAT, without any intervening blank lines. Upon starting any grid scan calculation, the program will attempt reading a set of breakpoint information. If restarting is

not intended by the user, the input data file should be absent of excess lines. The program

does initiate some measure of fail-testing regarding the breakpoint information. Anything

deemed irregular in the input file should inhibit the chances of erroneous restarts, but it

is good practice to truncate the input data file with either an end-of-file condition or some

other delimiter, e.g., a connected line of four equal signs.

Again, a^ presented in the previous subsection, i.e., section 4.3.2, the routine reports only

a basic set of statistics regarding deviations of the fit between the measurement data and

that of the model.

4.3.4 Search Grid (froz, vary)

Option four (level one) is one example of a specialty algorithm. It is tailored to a specific

need of the user regarding the analysis of a particular class of problems and, as such, may

find limited applicability with general problems, apart from providing an outline for the

user to modify the program to address one's own particular needs.

Here, the program calls subroutine SCAN3 to invert the ellipsometric equations by constructing two nested blocks of distinct grid scans, where the inner-block grid assumes that

the samples are uncoupled. The first/inner block of grids is similar to that mentioned earlier in section 4.3.3, the so-called vary grid. Each sample is scanned independently of other

samples, so the coupling between samples is suppressed, while coupling within the sample

is fully accounted. At each point of the grid and sample, the routine initiates a calculation

of the constrained optimization problem.

The outer block of grids involves a selected subset of model parameters whose numerical

values are considered frozen. For each point of the so-called froz grid, the program scans

the appropriate vary grid of each sample, and the results of calculation are reported to the

output file, X.OUT. Consequently, this can lead to substantial listings of output. Note,

59
the coupling between samples involving model parameters contributing to the froz grid is

fully accounted.

Breakpointing capability is provided with the routine. Upon completion of the above tasks, a basic set of statistics regarding deviations of the fit between measurement and the model

is provided. If coupling exists between samples regarding the vary grid of model parameters, the simple statistics that are generated at conclusion of calculation will generally be

meaningless, because the samples were treated independently; i.e., distinct samples maintain distinct values associated with the same model parameter.

The capability provided by this option has been found toward generating surfaces of the

error expression for purposes of later graphics. Note, it is a simple matter to dupe the

program and induce an uncoupling among the samples during analysis by selecting one model parameter to compose the froz grid and set its lower/upper bound to the same numerical value.

To specify which model parameters contribute to the froz grid, one need merely set the

(froz/ vary) switch to an integer value of two and include the specification of its grid within

the ordering of the input file as discussed earlier in section 4.3.3.

4.3.5 Sensitivity Analysis

Option five (level one) induces the program to initiate a sensitivity analysis regarding the

model parameters whose numerical values were selected to undergo variation, as discussed

in section 3.2. This calculation is performed by the subroutine SEAMA.

The output includes the following, where:

{gg), refers to the statistical estimate of the variance of the deviations involving

both A and -0 as defined by eq (85). The standard deviation is included

for convenience.

(aa), refers to the statistical estimate of the variance of the uncertainty in the

angle of incidence associated with laboratory instrumentation during

measurement, as defined by eq (86). The standard deviation is included

as well.

60
\BggB\jk, refers to covariance matrix elements involving the deviations as defined by

the first term in eq (91).

\BJaaJB\jk, refers to covariance matrix elements involving the uncertainty in the angles of incidence as defined by the second term in eq (91).

The so-called total uncertainty reported for the vary model parameter is defined by eq

(98), which combines contributions from random and systematic errors. Here, the random

component involves one of the diagonal elements from the covariance matrix. Also listed

are the relative contributions of systematic errors entering into this sum.

4.3.6 MAE Plots of Uncertainties

Option six (level one) is another example of a specialty algorithm. This option serves the

purpose of finding the optimum set of multiple angles of incidence which may induce the

minimum magnitude of uncertainty associated with some selected model parameter. To

accomplish this, the routine scans a grid of incident angles and calculates the magnitude

of uncertainty associated with the appropriate model parameter. The formulation of the

problem regarding uncertainties is that as reported in the literature [24], which is distinct from that presented in section 3.2. The algorithm combines contributions utilizing

absolute values, and so it overestimates the calculated magnitudes. Further, as may be expected, any effects due to correlation here will naturally frustrate the exercise.

This option is delegated to the subroutine SEAMAX. It calls subroutine SEAM2 to construct a table involving the forward problem, i.e., providing predetermined magnitudes to

the deviations g, while properly calculating/storing the elements of the Jacobian, for the

entire grid of incident angles. As the multidimensional grid is scanned across this collection of multiple angles of incidence, subroutine SEAM3 constructs the forward problem for

the appropriate set of incident angles. The associated magnitudes of uncertainty \vj\ are

calculated and written to the output file, X.SOUT. At conclusion of the scan, subroutine

POPLAT is used to plot the data. Here, since the calculated magnitudes were found to

vary by several orders of magnitude, it was convenient to request subroutine POPLAT to

induce a logarithmic transformation onto the magnitudes, where magnitudes are mapped

into the range from -5 to 4. For the case involving more that two multiple angles of incidence, the routine graphs the so-called Density of States profile associated with the magnitudes. The domain of the graph involves the angle of incidence.

61
The necessary input is read by subroutine INPDAT. No repeat data are allowed; i.e., re- peat values are set equal to one. No measurement data are necessary in the input file,

X.DAT. The first line of input, associated with this option, is the integer one. The input

format for the next following lines is of the form:

where h^^ftij refers to the integer increment or step of the DO-loop associated with the

construction of the grid of incident angles, involving the f*** repeat, the i*^^ ambient, and

the i*^ wavelength on the jf*^ sample. The unit step is measured in degrees, where a rea- sonable integer value is something like 2 degrees. The other symbols are the same as that

referred to in section 4.2.3. Note that (1 < m^,ftij < nemglm) as was mentioned earlier in

section 4.1.2.

Again, subroutine SEAM2 sets up a tabulation, and subroutine SEAM3 uses it. This design removes redundant calculations of the forward problem, i.e., to hasten execution time,

but at the expense of array space. The tabulation requires the use of large arrays, and the

algorithms within SCANCC and SEAMX2 tend to overestimate the sizes necessary for

said arrays. For these reasons and that due to limited applications of this option, it has

been suppressed from the main program.

62
5. Worked Examples

The following subsections present worked examples of using the program. Each subsection

presents one example involving one selection from among the set of available top level options. A brief orientation is given regarding the purpose of each calculation. Since the program outputs a journal listing of the input data, only the output file needs to be presented

in the following subsections. Again, the output lines are shown as indexed for convenience.

As mentioned earlier in section 4.1.1, this output file is named X.OUT.

5.1 Search (vary)

This option is discussed in section 4.3.2. The input data file X.DAT is similar to that

presented in section 4.2.4, i.e., apart from some minor modifications as discussed below.

This option is selected by setting the first line of data in the input file X.DAT to be the

integer value '2.' This is shown on line 9 of the output file listing below. Regarding the

output on line 31, the model parameter whose numerical value is selected to undergo variation is that associated with thickness of the layer of oxide atop the substrate. The numerical value of the model parameter is set to 110 nm, i.e., the initial value solution as

entered in X.DAT.

Recall from section 4.2.3 that the measurement data are exact for the model parameters

with numerical values as presented in section 4.2.4. Note that on line 19 of the example

presented in section 4.2.4, the oxide thickness is 100 nm, i.e., the true solution. Hence, the

initial value solution is displaced from the true solution by 10 nm. The purpose here is to

show the rate of convergence of the program. The output below written on line 141 shows

that 54 iterations were used to converge to the correct final solution shown on line 144.

Attention is directed less toward optimality of iterations than with that necessary to follow

convergence.

Again, the output file contains a journal listing of the input data, progress reports regarding convergence, the final numerical values of the vary model parameters, and a selection

of associated statistics, as well as the amount of cpu-time that is used during calculation.

The output file X.OUT is given below.

1 options: 1, forvard problems, plots, ...

3 2, search ( vary)

8 3, search grid ( vaxj)

63
4 4, search grid (froz,vary)

6 5. sensitivity analysis

e

7

fl. MAE plots ' uncertainty

8 Enter: option '

9 option ' 2

10

11 mwaves = 2, number of distinct waveleng

13 1 632.8000

IS 2 441.6000

14

16 mbiezit = 3, number of distinct ambient

10 1 1.000000

17 2 1.000270

18 3 1.000270

19

30 mlnints = 7. number of distinct : n+ik

31 1 3.8820 0.0020 0

33 2 0.0190 0.0020 0

33 3 1.4570 0.0020 0

34 4 0.0000 0.0000 0

36 B 4.7B30 0.0020 0

36 6 0.1630 0.0020 0

37 7 1.4660 0.0020 0

38

39 mfilnun =

30

8133

33 msampl =

34

363637

38

39

40

414343

44

464647

48

49

60

51

6363

64

6666

2, number of distinct film widths

1 60.0000 2.0000 0 2 110.0000 2.0000 1

2, number of distinct samples

szunple, mfilm, mwave

ivave, mbien

i.n.k.z

i.n.k.z

i.n.k

imbien, mrpeat

imbien, mrpeat

iwave, mbien

i,n,k,z

i,n,k,z

i.n.k

imbien. mrpeat

sample, mfilm. mwave

iwave. mbien

i.n.k.z

i.n.k

imbien. mrpeat

iwave, mbien

i.n.k.z

i.n.k

imbien, mrpeat

64
67

58

5900

618388

84

858887

88

89

70

717373

74

75

78

77

78

79

80

818388

84

8588

zoom:

111

05.0000

70.0000

12 1 65.0000

70.0000

75.0000

2 2 1 07.5000

72.5000

13 2 67.5000

70.0000

72.5000

75.0000

12 1 70.0000

73.0000

13 2 70.0000

73.0000

1

' mazigl, repeat, ambient, 9Bve, sample/ (phi, delta,psi)

0.0100

0.0100

0.0100

0.0100

0.0100

0.0100

0.0100

0.0100

0.0100

0.0100

0.0100

173.5043

172.2664

173.5101

172.2750

170.0354

172.9647

171.3529

286.8467

297.5219

307.5732

316.8687

0.0500

0.0500

0.0500

0.0500

0.0500

0.0500

0.0500

0.0500

0.0500

0.0500

0.0500

37.0579

34.3707

37.0527

34.3633

30.1573

35.8405

32.5214

30.2644

31.2799

32.6322

34.2225

0.0500

0.0500

0.0600

0.0500

0.0600

0.0600

0.0500

0.0500

0.0500

0.0000

0.0000

2

' mangl, repeat, ambient, save, sample/ (phi, delta,psi)

0.0100

0.0100

0.0100

0.0100

79.8092

68.2502

211.2235

216.1566

0600

0500

0.0500

0.0500

41.0466

41.0304

77.3289

84.4928

0.0600

0.0500

0.0500

0.0500

loop, ratio of reduction,

(rel) (total)

87 0 1 .487E+01

88 1 9 .034E-01 9 .034E-01 1.344E+01

89 2 8 .729E-01 7 .886E-01 1 .173E+01

90 3 8 138E-01 6 .418E-01 9 .546E+00

91 4 7 .986E-01 5 .126E-01 7 .623E+00

93 E 7 .926E-01 4 .061E-01 6 .041E+00

98 e 7.893E-01 3 .206E-01 4 .768E+00

94 7 7 907E-01 2 635E-01 3 .770E+00

96 8 7 918E-01 2 007E-01 2 986E+00

98 9 7 937E-01 1 593E-01 2 36gE-t-00

97 10 7 953E-01 1 267E-01 1 884E-t-00

98 11 7 961E-01 1 008E-01 1 600E+00

99 12 7 971E-01 8 038E-02 1 196E+00

100 13 7 976E-01 6 411E-02 9 536E-01

101 14 7 982E-01 5 117E-02 7 612E-01

103 15 7 986E-01 4 087E-02 6 079E-01

108 16 7 989E-01 3 265E-02 4 866E-01

104 17 7 991E-01 2 609E-02 3 880E-01

106 18 7 994E-01 2 085E-02 3 102E-01

108 19 7 995E-01 1 667E-02 2 480E-01

107 20 7 995E-01 1 333E-02 1 983E-01

108 21 7 996E-01 1 066E-02 1 585E-01

109 22 7 999E-01 8 525E-03 1 268E-01

(degrees)

65
110 71 OQQI? —

o

HX AH A17 — AH . UX^fi UX

111 Oo • UvlC Ul Co ACAV—AQ po

H H C17— no

112 ZD 7f

/I o

AfiQ17 — AO

113 OH 7 QJ AQQV AQ co

H AAV AO

114 07 7f 70H 17_AQ A H C H V AO xblJ£~Uz

115 OQZo Qo . UOUJS—01 OOOP AO 3

O O H 1? AO

116 Z9 77 1 . 78oB-03 2 D55E-02

117 7f . 9vba—vi. 1 A07T? AO • 427E-03 2 123E-02

118 OX 7f 007V—AH . WW f js y 1

4X 1 A07V AO

119 QO oO

A A01?_AH WH ^ H V—AA 1 358E-02

120 43*3 7 7f '70717—AA 1 085E-02

112191 ^4 7f Q7417-ni cD fli 07—04 8 6E5B-03

1 99 ao 4, fl7'JR—04 6 949E-03

1 9Q wV

fio wOTXA vX o 5 583E-03

124 w f 7 993E-01 4.462E-03

1 9K 7 994E-01 ^0P17—04 3. 567E-03

11209A w V 7 888E-01 X fi09V-04 2. 814E-03

Id f 8 14flE-01 1X R41 17-04 2. 292E-03

120 41 7 874E-01 1X 1. 80BE-03

112V9Q 40 8.000E-01 Q 7A«T7_AC 1. 444E-03

lOU 43 8 191E-01 7f 1. 182E-03

1lol^1 44 7. 951E-01 Au ^9017-OK 9. 401E-04

1lo299 4R 8. 042E-01 cD \IOOa I/O 7. 561E-04

19d 4A 8. 152E-01 4 143E-05 6. 163E-04

lo4 47 8. 072E-01 3 344E-05 4. 975E-04

130 4n 7. 208E-01 2 411E-0B 3. B86E-04

136 49 8. 994E-01 2 168E-05 3. 22EE-04

137 BO 7. 821E-01 1 698E-05 2. B22E-04

138 51 8. 458E-01 1.434E-05 2. 133E-04

130 62 8.463E-01 1 214E-05 1. 805E-04

140 53 8. 298E-01 1 007E-05 1. 498E-04

141 B4 7. 243E-01 7. 294E-06 1. 085E-04

142 14S

144

145 146 147

148

149

150

161

model parameter value along the miziimuin:

1) 100.0000 0.00000 for: 2, (z ), estimated uncertainty

initial

final

Igl =

Igl = .48745E+01

.08499E-04

(degrees)

Statistics of deviations ' experiment-model ' g

162 where : g

153 let: ()

154

155 mean ()

166 variance ()

167 covariance

158 std dev

169 correlat coef

160

181

162 psi:

column array of length ' 2M

(psi or delta) ' (1 or 2)

m() = <g()> = (1/M) sum: g()

< [g( )-m( )]**2 >

< Cg(l)-m(l)]*[g(2)-m(2)] > sqrt (variance)

covariance / [std dev (psi) >x std dev (delta)]

mean,

0.000

std dev

0.000

(degrees)

66
163 delta: 0.000 0.000

104 0.59B ' correlation coefficient ' <p8i|delta>

les

166 J(T)*J: (renomalized for correlation)

167 1) 1.00000

168

169 loraalization coefficients: sqrt [J(T)*J] (i,i)

170 8.3BE-02

171

173 rcond= l.OOOE-t-00, condition number

178 174 elapied cpu-tirae = 38 centi-seconds

175 + 16 seconds

67
5.2 Search Grid (vary)

This option is discussed in section 4.3.3. The option is selected by entering an integer

value of '3' on the first line in the input data file X.DAT. This is indicated on line 9 of

the output file listing below. Again, only the oxide layer thickness is subjected to variation. Line 87 shows the necessary parameters governing the formation of the grid. Note

that the grid values overstep the correct solution. For each grid point, the program initiates a series of iterations similar to that shown in the previous subsection. The solution is presented on line 96; it is the correct solution. The contents of the output file X.OUT is

given below.

1 options: 1, forvard problems, plots, ...

3 2, search ( vary)

s 3, search grid ( vary)

4 4, search grid (froz,vary)

5 B, sensitivity analysis

6 6, MAE plots ' uncertainty

7

8 Enter: option '

B option '3

10

11 mnaves = 2, number of distinct wavelengths

12 1 632.8000

13 2 441.6000

14

15 nbient = 3, number of distinct ambient environments and waves.

18 1 1.000000

17 2 1.000270

18 3 1.000270

IB

20 mlmnts = 7, number of distinct: n+ik

21 1 3.8820 0.0020 0

22 2 0.0190 0.0020 0

23 3 1.4570 0.0020 0

24 4 0.0000 0.0000 0

26 E 4.7530 0.0020 0

26 0 0.1630 0.0020 0

27 7 1.4660 0.0020 0

28

38 mfilmm = 2, number of distinct film widths

30 1 50.0000 2.0000 0

31 2 100.0000 2.0000 1

3233 msampl = 2, number of distinct samples

34 12 2

' sample, mfilm, mwave

35 12 ' iwave, mbien

3fl 112 1' i,n,lc,z

37 2 3 4 2' i,n,k,z

68
38

3940

414243

44

4S4047

48

40SO

5163SS

64

566087

5859

00

61

03

0304

06

0007

08

09

70

717373

74

78

7077

78

79

80

818388

84

858087

88

89

90

3

12

2

12

33

2

1

12

22

12

3

1 1 65.0000

70.0000

12 1 05.0000

70.0000

7B.0000

2 2 1 87.5000

72.5000

13 2 67.5000

70.0000

72.5000

75.0000

12 1 70.0000

73.0000

13 2 70.0000

73.0000

i.n.k

imbien, mrpeat

imbien, mrpeat

ivave, mbien

i.n.k.z

i.n.k.z

i.n.k

imbien. mrpeat

sample, mfilm, msave

i?ave. mbien

i.n.k.*

i.n.k

imbien, mrpeat

ivave. mbien

i,n,k,z

i.n.k

imbien, mrpeat

1

' mangl, repeat, ambient, vave, sample/ (phi, delta,psi)

0.0100

0.0100

0.0100

0.0100

0.0100

0.0100

0.0100

0.0100

0.0100

0.0100

0.0100

173.6043

172.2664

173.5101

172.2750

170.0354

172.9647

171.3529

286.8467

297.5219

307.5732

316.8687

0.0500

0.0500

0.0500

0.0500

0.0500

0.0500

0.0500

0.0500

0.0500

0.0500

0.0500

37.0579

34.3707

37.0527

34.3633

30.1573

35.8405

32.5214

30.2644

31.2799

32.6322

34.2225

0.0500

0.0500

0.0500

0.0600

0.0500

0.0500

0.0500

0.0500

0.0500

0.0000

0.0000

2 ' mangl, repeat, ambient, vave, sample/ (phi, delta, psi)

0.0100

0.0100

0.0100

0.0100

79.8092

68.2502

211.2235

216.1566

0.0600

0.0500

0.0500

0.0600

41.0455

41.0304

77.3289

84.4928

0.0500

0.0600

0.0600

0.0500

Scan a grid of model parameters

.

Grid info: initial, final, increment

1) 96.0000 105.0000 10.0000

lote: HO attempt sas made to restart.

• for: 2, (z )

69
91

9293

94

959697

9899

100

101

103 103

104

105 106

107

108 109

110

111 113

lis

114

115 116 117

118

119

130

121 122 123

124

number of grid points scanned, kt = population along the minimuai, kts = norm of residual, Igl = 5.30715E-05 (degrees)

Model parcuneter value along the minimum:

1) l.OOOOOOE+02 'for; 2, (a )

Statistics of deviations ' experiment -model ' g

where

g

" column array of length ' 2M

let: () • (psi or delta) ' (1 or 2)

mean () = m() = <g()> = (1/M) sum: g()

variance () = < [g( )-m( )]**2 > eovariance = < [g(l)-m(l)]* Cg(2)-m(2)] > std dev = sqrt (variance)

correlat coef = eovariance / [std dev (psi) * std dev (delta)]

psi

delta:

mean, std dev (degrees)

0.000 0.000

0.000 0.000

0.274 " correlation coefficient ' <psi|delta>

J(T)*J: (renormalisad for correlation)

1) 1.00000

Normalization coefficients

8.35E-02

sqrt [J(T)*J](i,i)

rcond= l.OOOE+00, condition number

elapsed cpu-tima = IE centi-seconds

+ 32 seconds

70
5.3 Search Grid (froz,vary)

This option is discussed in section 4.3.4. To select this option, the first item entered on

the first Kne of the input data file X.DAT ought to be the integer value '4.' This is indicated on line 9 in the listing presented below. Again, the thickness of the oxide layer

is subjected to variation, a vary model parameter, i.e., line 31. Regarding line 24, it is

seen that the integer (froz/vary) switch has been set to two, i.e., a grid involving a frozen

model parameter. This model parameter is the extinction coefficient of the oxide layer.

The associated grid parameters are shown on lines 87 and 88. Here, for convenience, the

oxide extinction coefficient is set to consider only a single value, i.e., zero. The correct solution is presented on line 131. The output file is listed below.

options: 1, forward problems, plots, ... 2, sa&rch. ( vary)

3, search grid ( vary)

4, search grid (froz,vary)

5, sensitivity analysis

6, MIE plots ' uncertainty

Enter: option ' option ' 4

mvavas = 2, number of distinct vavelengths

1 032.8000

2 441.0000

fflbient = 3, niunber of distinct ambient environments and «aves.

1 1.000000

2 1.000270

3 1.000270

mlmnts = 7, number of distinct: n+ik

mfilmm =

so

318333 msanpl

84

36

1 3 8820 0 0020 0 2 0 0190 0 0020 0 3 1 4B70 0 0020 0 4 0 0000 0 0000 2

5 4 7530 0 0020 0

6 0 1030 0 0020 0 7 1 4000 0 0020 0

2, number of distinct film widths

1 50.0000 2.0000 0 2 100.0000 2.0000 1

2, number of distinct samples 12 2 ' sample, mfilm, mvave 12 ' ivave, mbien

71
oo 1X 1X 2 1X

* 1 V y

Or 4

oB9fi 'ink

ov XlnDxOZli inXpOB.w 4U xiuuxon J xnx Liociu 41 2 1

' ivave, mbien

^442 1X RD A 4X 43 9^ 7f 2

44 Aw

40 30 1X XuliJ10XL| mx UOB V 40

4 r 2^ 1X SBinuxo 1 mxxxuif Uiw aw

1 1 AO 1X 3<9 4 2 1,11, x,z

KA 2^ 1X

* -i T1 V

51 O 4 ^ X

' iinlDiflii, iDxpsali

52 2 1

' iwave, mbien

53 X r 4 2 • i,n.k,z

54 ^ b 0

55 Q 4 3 1

' imbien, mrpeat

5857 z 1

4 4 X X

4X mazigl

,

repeat , ambient , save , sample/ (phi .delta ,psi;

58 4X A A4 AA o . oxuo 173.5043 0.0500 37.0579 A AC AA

58 2

A A 4 AA 0 .0100 172.2664 0.0500 34.3707 A AC AA 0 . OoOO

00

81 q 4X A X

82 1 AR nnnn A A4 AA u . uxuu 173.6101 0.0500 37.0527 A AC AA

83 7A AAAA A A4 AA 0 . 0x00 172.2750 0.0600 34.3633 A AC AA 0 . ObOO

84 3

TfC AAAA 7o . 0000 A A 4 AA

0 . 0100 170.0354 0.0500 30.1573 A A C A A 0 . OoOO

85

08 •J A X 87 1 A7Dr. DUUU cnnn A A4 AA U . UXUU 172.9647 0.0600 36.8405 A AC A A

88 "5A 70 CAAA A A4 AA 171.3629 0.0600 32.5214 A AC A A

89

70 A 41 3 2

rX 1 07 ROOO 0V . 01V X 00w 286.8467 0.0500 30.2644 0.0600

9^IS 7rt Oftfin A A4 AA u . uxuu 297.5219 0.0600 31.2799 0.0600

78 3

*70 CAAA 72 . OOOO A A4 AA 0 . 0100 307.5732 0.0500 32.6322 0.0000

74 AAAA f O . 0000 A A4 AA 0 . 0100 316.8687 0.0500 34.2226 0.0000

7570 41 ^ X niBngl

,

repeat , ambient, wave, 8 tunple/ (phi, delta,psi)

77 1

•»A AAAA r U . 0000 A A 4 AA 0 . 0100 79.8092 0.0600 41.0466 0.0600

78 2 73 . 0000 A A 4 AA 0 . 0100 68.2602 0.0500 41.0304 0.0600

7980 2 1 3 2

81 1 70.0000 0.0100 211.2235 0.0500 77.3289 0.0600

82 2 73.0000 0.0100 216.1556 0.0500 84.4928 0.0500

8384

85 Scan a grid of model parameters

88 Grid info ; initial, final,

87 1) 0.0000 0.0000

88 2) 96.0000 106.0000

increment

0.0000 'for: 4, (n+ik)

10.0000 • for: 2, (z )

72
89

90

919393

94

9594

97

9899

100

101 103 103

104

106 10«

107

108

109

130

131 133

133

134

136

136 137

138

130

ISO

181

133

133

134

186 134

187 188

139

140

141

Range of do-loops : froz

1) 1 grid points for:

Range of do-loops : vsltj

1) 2 grid points for:

Couplings between samples involve:

2. (« )

4, (n+ik)

2, (z )

1 distinct model parameters

Vote: The existence of coupling between samples

due to the ViRT model parameters —

induces an unusual interpretation unto the residual |g|,

because, while providing coupling, they are ITOT necessarily of similar value on different samples.

Attempt to read breakpoint information

lote: 10 attempt was made to restart.

110 =

111 « 1 grid: f roz

113 118

1) 1 0 OOOOOOE+00 model parameter for: 4, (n+ik)

114 sample grid: vary

116 1 3 947890E-05 Igl

lie 1 OOOOOOE+02 for: 2, (z ) 117 2 1 9g0443E-O4 Igl

118 1 OOOOOOE+02 for: 2, (z ) 119 1 084976E-04 Igl

' summed over samples

number of FROZ grid points scanned, ktu = 1 population along the minimum, ktum = 1 norm of residual, Igl = 1.084994E-04 (degrees)

Model parameter value along the minimum: froz

O.OOOOOOE+00 • for: 4, (n+ik) ' boundary

Model parameter value along the minimum: vary

l.OOOOOOE+02 -for: 2, (z )

lote that the minimum point is near a boundary.

Vote: The existence of coupling between samples

due to the VIRT model parameters —

induces an unusual interpretation unto the residual jgl,

because, while providing coupling, they are VOT

necessarily of similar value on different samples.

73
142 143

144 14S 146 147

148

149

150

161

163

153 164

168 it&

167

168

150 180

161

163 168

164

165 166 167

168

Statistica of deviatioiiB ' experiment -model ' g

vhere: g ' column array ol length ' 2M

let: () • (psi or delta) ' (l or 2)

mean () = m() = <g()> = (1/M) sum: g()

variance () = < [g( )-m{ )]**2 > covariance = < [g(l)-m(l)]* [g(2)-m(2)] > td dev = iqrt (variance)

correlat coef = covariance / [std dev (psi) std dev (delta)]

psi:

delta:

mean, std dev (degrees)

0.000 0.000

0.000 0.000

0.595 " correlation coefficient ' <p8i|delta>

J(T)*J: (renormalized for correlation)

1) 1.00000

Formalization coefficients

8.35E-02

sqrt [J(T)*J](i,i)

rcond= l.OOOE+00, condition number

elapsed cpu-time = 29 centi-seconds

+ 42 seconds

74
5.4 Sensitivity Analysis

This option is discussed in section 4.3.5. To select this option, the first item on the first

line in the input data file X.DAT ought to contain the integer value '5.' Regarding the

output presented below, lines 30 and 31 reveal that both layer thicknesses are the only

vary model parameters. Note that no iterations are performed by the program; it is as- sumed that the critical-point or fixed-point solution has already been found, and is given

by those entered upon input. The total uncertainty associated with knowing the thicknesses of the the silicon and oxide layers is given, respectively, by lines 125 and 142, i.e.,

4.69E-02 and 3.03E-01. The output file is given by the following.

1 options: 1, forward problams , plots, ...

3 2, search ( vary)

s 3, search, grid ( vary)

4 4, search grid (froz,vary)

6 6, sensitivity analysis

a 0, MIE plots * uncertainty

7

8 Enter: option '

9 option ' 5

10

11 mvaves = 2, number of distinct wavelengths

13 1 632.8000

18 2 441.6000

14

16 mbient = 3, number of distinct ambient environments and waves.

18 1 1.000000

17 2 1.000270

18 3 1.000270

19

30 mlmnts = 7, number of distinct: n+ik

31 1 3.8820 0.0020 0

33 2 0.0190 0.0020 0

38 3 1.4670 0.0020 0

34 4 0.0000 0.0000 0

3B B 4.7530 0.0020 0

30 6 0.1630 0.0020 0

37 7 1.4660 0.0020 0

38

39 mfilmm = 2, number of distinct film widths

80 1 50.0000 2.0000 1

81 2 100.0000 2.0000 1

8388 msaiqjl - 2, number of distinct samples

84 12 2 ' sample, mfilm, mwave

85 12 ' iwave, mbien

se 112 1' i,n,k,z

87 2 3 4 2' i,n,k,z

75
38 •> ' ! n v

89

40 2 2 ' imbiozi, nrpea't

41 2 1 ' ivave, mbien

43 1 c X o

aO

41 i,n,k,z

48 2 7 2

• J _ 1_ _ 1 |ZL, JC ,Z

44 o c o o 0 1,11,

45 9 4 ' imbifln, nrpea't

48

47 2 1 2 sainpls , Kizilin, mwave

48 4 4 1 1

' 19&V6 , nbiszi

49 A 2 i,xi,k,z

50 2 1 2 1,11,

2 1

* imbien, mrpeat

S3 ' iwave, mbien

S8 41 1 2 • i,n,k,z

64 2 D 0 ' itH.k

55 3 1

' imbien, mrpeat

58

57 1

4 4 X X4X

- repeat , ambient , wave , 8 ample/ (phi , delt a , ps i

)

58

41 AC /^AAA OD . UUUU A A4 AA 173.5043 0.0500 37.0579 0.0500

59 2 70 . 0000 A A4 AA 0 . 0x00 172.2664 0.0500 34.3707 0.0500

Ml

81 •> 41 2 X 83 1 Do . UUUU A A-l AA 173.5101 0.0500 37.0527 0.0600

88 TXA AAAA f 0 . 0000 A A4 AA 0 . 0x00 172.2750 0.0500 34.3633 0.0500

64 3 AAAA f O . 0000 A A4 AA 0 . 0100 170.0354 0.0500 30.1573 0.0500

8588 2 X S7 4

J. o r • Ovuu A A4 AA U . UXUU 172.9647 0.0500 35.8405 0.0500

68 1 2 • ouuu A A4 AA U • VXUU 171.3529 0.0500 32.5214 0.0600

69

70 41 3 2

91 1X Ufa OVVV V a w X VVI 286.8467 0.0600 30.2644 0.0500

73 •J A AAAA A A4 AA 297.5219 0.0500 31.2799 0.0600

78 3 72.5000 0.0100 307.5732 0.0500 32.6322 0.0000

74 4 75.0000 0.0100 316.8687 0.0500 34.2226 0.0000

7578 2

41 2 1 2 mangl

,

repeat .ambient .wave, sample/ (phi , delta,psi)

77 1 70 . 0000 0 . 0100 79.8092 0.0500 41.0455 0.0600

78

79 2 73.0000 0.0100 68.2502 0.0500 41.0304 0.0600

80 2 1 3 2

81 1 70.0000 0.0100 211.2235 0.0500 77.3289 0.0500

83 2 73.0000 0.0100 216.1556 0.0500 84.4928 0.0500

83

84

86 - 86 Statistics of deviations ' experiment-model ' g

87

88 where: g

' column array of length ' 2H

89 let: () ' (psi or delta) ' (1 or 2)

90

76
91 mean () = mO = <g()> = (1/M) sum: g()

92 variance () = < Cg( )-m( )]**2 >

03 covariance = < [g(l)-m(l)]* Cg(2)-m(2)] >

94 Btd dev = sqrt (variance)

96 corralat coal = covariance / [std dev (psi) * std dev (delta)]

86

97 mean, std dev (degrees)

98 psi: 0.000 0.000

99 delta: 0.000 0.000

100 0.017 ' correlation coefficient ' <psi|delta>

101

103 J(T)*J: (renormalized for correlation)

108 1) 1.00000

104 2) 0.08240 1.00000

105

100 lormalization coefficients: sqrt [J(T)*J] (i,i)

107 7.85E-02 8.3BE-02

108

109 rcond= 8.477E-01, condition number

110 ====================================================================

111 <gg> ' 3.414E-13 B.843E-07 (vMiance, std dev)

113 <aa> ' 3.046E-08 1.746E-04 (variance, std dev)

lis

114 Discern: Uncertainty in model parameters

116 where: |v| = sqrt( BB(T) <gg> + (BJ)(BJ)(T) <aa>)

118 + IBJI lul

,

117

lie B * [J(T)*J]**-1 *J(T), (nonsquare J)

119

130 vary total initial parameter

131 133 1 1 1.80E-12 2.36E-00 (j,i), iBggBl, iBJaaJBl

138 1.36E-06 1.64E-03 |Bg|, iBJal

134 ____________________________

136 1) 4.69E-02 2.00E+00 5 . OOOOOOE+01 , for: 1, (z ) 138 1.64E-03 1.36E-00 1.54E-03 random, |Bg|. iBJal

137 4.54E-02 systematic ' total

138

139 1) 2.29E-03 systematic ' IB Jul ' 1, (n+ik)

ISO 2) 9.22E-04 systematic ' iBJul ' 2, (n+ik)

181 3) 2.54E-03 systematic ' iBJul ' 3, (n+ik)

183 4) O.OOE+00 systematic ' iBJul ' 4, (n+ik)

iss E) 2.16E-02 systematic ' iBJul ' B, (n+ik)

184 e) 8.00E-03 systematic ' iBJul ' 6, (n+ik)

186 7) 9.40E-03 systematic ' IB Jul ' 7, (n+ik)

186 187 2 1 -1.44E-13 -2.fl8E-07 (j.i), iBggBl, iBJaaJBl

138 3.80E-07 B.18E-04 iBgl. iBJal

189 2 2 l.e4E-12 3.03E-08 (j.i), iBggBl, iBJaaJBj

140 1.28E-06 1.74E-03 jBgj. iBJaj

141 ----------------------------

143 2) 3.03E-01 2.00E+00 1 . OOOOOOE+02 , for: 2, (z ) 148 1.74E-03 1.28E-00 1.74E-03 random, iBgj, iBJaj

77
144 3.01E-01 systematic ' total

145 148 1) 1.03E-04 systematic ' |BJu| ' 1, (n+ik)

147 2) 2.51E-05 systematic ' iBJul ' 2, (n+ik)

148 3) 2.4BE-04 systematic ' |BJu| ' 3, (n+ik)

149 4) O.OOE+00 systematic ' IB Jul " 4, (n+ik)

IBO B) 5.04E-03 systematic ' iBJul ' 5, (n+ik)

151 6) 6.31E-03 systematic ' |BJu| ' 6, (n+ik)

162 7) 2.90E-01 systematic ' |BJu| ' 7, (n+ik)

153 ===================================================================

154

166 elapsed epu-time = 62 centi-seconds

78
6. Listing of Software Source Files and Routines

This section presents a listing of the source files for MAINl. For convenience, the files are

partitioned into three classes. The first class involves files associated with storage arrays,

the second class involves source programs that govern the scattering problem and hosts

the user's options, and the third class involves general utilities that provide basic tasks for

the source programs of class two.

6.1 Named COMMON and BLOCK DATA Statements

6.1.1 lOUNIT.

1 c Hcuned common of the logical unit assignments associated with

2 c reading/writing oi input/output files on the hardware disk.

3

4 common /iounit / in, iout, idat, isout, iplt

6

79
6.1.2 DEFNIT.

1 C

2 e

3 c

4 c

5 c

3

7 e

8 s*

9 e*

10 e*

11 c*

12 e*

13 c*

14 e*

IS e*

16

17 e

18

1920

2122

2324

25

27

28

2930

3132

33

34

35 e

3637

39 e

Each, sampla is characterized by the f ilm/substrate

geometry: air / ^(1) / ... / z(nfilms) / substrata

parameters: three data (t,rL,k) for each film, may vary,

two data ( sn,k) for the substrate, may vary. one data ( s,n, ) for the air, may not vary.

Special

paramet

paramet

pareunet

paramet

paramet

paramet

paramet

paramet

cae@ for: analyising Standard Reference Materials

er (nsampl=150)

er (nfilms= 4) er (nlmnts= 16)

®r (nwaves=

er (nbient=

1)

1) er (nrpeat= 20) er (nmglx=

®r (nanglm=

2)

2)

Usual cas@

parameter

parameter

parameter

parameter

parameter

parameter

parameter

parameter

(nsampl= 8)

(nfilms= 8)

(nlmnt8=300)

(nwaves=100)

(nbient= 1)

(nrp®at= 1)

(nanglx= 20)

(nanglm= 2)

sample configurations ' films/substrate

distinct films on a seunple

(n.kl w.lmnt) ' Si, Si02, etc.

wavelengths of incident probe

ambient environment of samples

repeats of any given experiment

angles at one wavelength to fit experiment

multi-angle error analysis at one wavelength.

sample configurations ' films/substrate

distinct films on a sample

(n,k| w.limt) ' Si, Si02, etc.

wavelengths of incident probe

ambient environment of samples

repeats of any given experiment

angles at one wavelength to fit experiment

multi-angle error analysis at one wavelength

parameter (nrows =nfilms>x3+2 ) parameter (nf ilmm=nf ilms^nsampl) ! z parameter (nrowss=iif ilmm+nlmnts) I (z,n,k)

parameter (mrows8=nsampl*nwaves*nbient*nrpeat*nanglx*2)

parameter (nexpts=nsampl>Knwaves>cnbient>Knrpeat>t=nanglx ) parameter (nseam3=neampl*nwaves*nbient* nanglra )

! (z,n,k)/(n,k) ' 1 sample

' n samples

parameter (aajaaa = 1000000)

parameter (nnjaaa = mrowss*nrows)

complex cmplx, conjg, sqrtt

Mote: nanglm < nanglx

! convenience

! aa.ja, aaa,ji

! SEAMAX

80
6.1.3 FILMMM.

1 real ambent(iiwavas>i^biezit)

3 real vavelnCnwaves) , waveqq(iiwaves) , navewvCnwaves)

3 real diefcn(nlinnts) , uzicerl(nlinnts)

4 real widths (nfilnun) , uzicerz(ii:f ilnun)

6 integer Ivaryl (nlnzit s ) , Ivaryz(nfilinm)

a integer imfila(nseurtpl) , iifilm(nseunpl>Knwaves>(<nrows)

7 integer nnwave(nsainpl) , iivaveCnsampl'Cnwaves)

8 integer nnbentCnsampl'i^vaveB) , iibent(nsBinpl>*<nwaves*nbient)

e integer nnpeat(nsainpl*n«ave8*nbient)

10

11 real psiiis(nexpts) , deltas (nexpts) , angle sCnexpts)

13 real psiiiuCnexpts) , deltau(nexpts} , angleuCnexpts)

IS integer mangle(nrpeat*nbient*nwaves<*'nsainpl)

14 integer istepsC nbient*n9aves*nsainpl)

16

10 real aaCzmjaaa), bbCmrowss), ccCmronss), xx(nro«ss)

17 integer ja(imjaaa), ia(mro?BS+l)

18 integer iptu(nrowss) , iptv(nrowss) , iptw(nrowBs)

19 logical llnorm

30

31 common /wvaves / waveln, vaveqq, ?aveww, mwaves

33

38 common /filmmm / ambent, diefcn, widths,

34 k iifilm, xmfilm, iiwave, imwave,

36 k iibent , unbent , zmpeat

,

36 k mbient, mlmnts, mfilmm, msampl

37

38 common /choose / uncerl, iincerz, Ivaryl, Ivaryz

3080 common /exprmt / psiiis, deltas, angles, psiiiu, deltau, angleu,

31 k mangle, isteps, method

83

88 common /arrays / aa, bb, cc, xx, ja, ia, iptu, iptv, ipt«,

34 k meqns , mvary , mfroz , llnorm

81
6.1.4 FILMSS.

1 c Each sample is characterized by the f ilm/substrate:

2 c geometry: air / z(l) / ... / z(nfilms) / substrate

3 c parameters: three data (z,n,lc) for each film, may vary

4 c two data ( ,n,k) for the substrate, may vary

5 c one data ( ,xi, ) for the air, may not vary

6

7 c epsilon = electric permittivity ' dielectric function ' 1

8 c sigma = specific conductivity ' 0

9 c mu = magnetic permeability ' 1

10 c omega = angular frequency

11 c die_r = epsilon * mu

12 c die_i = 4*pi * sigma * mu / omega

IS

14 complex die(nfilms+l)

15 real zzz(nfilms ), air

16 integer mfilm

1718 common /films s / die, zzz, air, mfilm

82
6.1.5 RSTACK.

1 complex Rs , Rp ! reflection coell in eunbient

2 complex dRs(nrows), dRp(nrows) ! Jacobians

3 complex dRsa, dRpa ! d/d(angle}

4

6 common / rstack / Rs.Rp, dRs.dRp, dRsa, dRpa

83
6.1.6 WSTACK.

1 parameter (ziaat=(nrowss>f(zixowss+l})/2) ! upper triangle + diagonal

2 real aat (naat) ! A(T)*A, Inverse

a real aatsCnrowss) ! A(T)*A, scale factors

4 integer ipvt(nronss) ! workspace, LIIfPACK

66 common / wstack / aat, aats, ipvt |

84
6.1.7 CGNXXl.

1 c Storage allocation required by: CGIT

2 c This storage is needed only in: ZOOM, Z00M2

34 real p(inrowss), u(mrowss)

6 real v(nrowss), w(nrowss), xw(nrowss), se(nrowss)

a7 common / cgnxxl / p,u, v,w,xw,se

85
6.1.8 SCANCC.

1 c Used only by: SCA1I2, SCAN3, SCAN2G.

2

3 character bufft^S, buff(1*9 ! convenience, label breakpoint

4

5 c Nested do-loops associated with multi-parameter grid scan

6 parameter (niii=nro7Ss)

7 integer iiii(niii), iii2(niii)

8 real pppp(niii), pppl(niii)8 ppp2(niii), ppp3(niii)

9 real psav(niii)

10 •

86
6.1.9 SEAMXl.

1 c Sensitivity analysis for multiple: angle, Eunbient, wave, ssmiple.

2

3 integer iptx(nxows), ipty(nrows) ! vary

4 integer kptx(nrows), kpty(nrows) ! frozen

s

a real aaa(nnjaaa), bbb(mrowss ), xxx(nrowss) ! frozen

7 integer jaa(nnjaaa), iaa(mrowss+i)

80 common / seamxl / iptx, ipty, kptx, kpty,

10 k aaa, bbb, xxx, jaa, iaa

87
6.1.10 SEAMX2.

1 c Sensitivity analysis for multiple: angle, ambient, wave, sample.

2

3 c Storage of forward scattering problem at various incident angles.

4 c For the error analysis, mrpeat=l, ... in all cases.

5e parameter (ndegr =89) ! grid of angles

.7 parsuneter (ndegs = ndegr*nbient*nwaves*nsampl) ! (ndegr,)

8 pareuneter (ndegw = nrows^nbient'Xnwaves't'nseunpl) ! (nrows,)

9 real psii(ndegs), dell(ndegs)

10 real psia(ndegs), dela(ndegs) ! 6R /d(ph.i)

11 real psid(nrows , ndegs ) , deld(nrows , ndegs) ! dR /d(e) 'Jacobiem.

12

13 c Arrays associated with, the nesting of do-loops within SEAM,

14 c Sensitivity/error analysis of multiple:

15 c angle, ambient, wave, seunple.

1617 integer iiii(nseams) , iiil(nseams) , iii2(nseams)

18

19 common / seamx2 / psii, dell, psia, dela, psid, deld,

20 k iiii, iiil, iii2, mraws, maraws,

21 I; mm, raddeg, ueoig

88
6.1.11 BLKDAT.FOR

1 block data blkdat

2 include ' iounit .

s

4 data in,iout ,idat ,isout,iplt / E,6,7,8,9 /

60 end

89
6.2 Source Programs

6.2.1 MAIN.FOR

1 program main

2 include 'iovmit.'

34 call fileop ! open relevant files

5

a write (iout.lOl)

7 read (idat,*,err=12,end=12) ichoic

8 write (iout,102) ichoic

9 if (ichoic . It . 1 .or. ichoic. gt. 5) then

10 write (iout,122)

11 stop

12 end if

1314 call inpdat (ichoic)

15 call arrang

16 itl = istime (i) ! CPU time (milli-sac)

17 goto (1,2,3,4,5,6), ichoic

1819 1 continue ! forward problem, plots, ...

20 call pltdat (0)

21 goto 11

22 2 continue ! unconstrained optimization

23 call zoom ! seek single minimum

24 call corlat

25 c* call seama

20 goto 11

27 3 continue ! grid scan ( ,vary)

28 call scan2

29 call corlat

30 c* call seauna

31 goto 11

32 4 continue ! grid scan (froz.vary)

33 call scan3

34 call corlat

35 c* call seama

3d goto 11

37 5 continue ! sensitivity analysis

38 call corlat

39 call seeuna

40 goto 11

41 6 continue ! sensitivity analysis scans

42 c* call seamax ! error plots, DOS

43 goto 11

44

45 11 it2 = iftime (i) ! CPU time (milli-sec)

46 it = (it2-itl)/10 ! CPU time (centi-sec) elapsed

47 its = 100 ! clock imits / second

48 itm = its*60 ! / minute

90

1
49 ith = itm*60 ! / hour

50 itd = ith*24 ! / day

51

53 id = it/itd ! davs

53 it = it -id*itd

54 ih = it/ith ! hours

55 it = it -ih*ith

50 im = it/itm ! minutes

57 it = it -im*itm

58 is = it/its ! seconds

50 it = it -is*it8 ! centi-seconds

60

81 if (id.ne.O) then

03 write (iout.lll) it ,i8 ,im,ih,id

es else if (ih.ne.O) then

04 write (iout.lll) it ,is,im,ih

05 else if (im.ne.O) then

00 write (iout,lll) it , is , im

07 else if (is.ne.O) then

08 write (iout.lll) it ,is

08 else

70 write (iout,lll) it

71 end if

73

73 close ( iout)

74 stop

75

70 12 write (iout,121)

77 stop

78

79 101 format (/' options: 1, forward problems , plots, ...

80 /• 2. search ( vary) '

81 /' 3. search grid ( vary) '

83 /• 4. search grid (froz,vary) '

83 /' B. sensitivity analysis '

84 /• fl. MAE plots ' uncertainty '

86 //' Enter: option ' ' ) 80 102 format (

' option ' ' , il ) 87

88

89 111 format (/' elapsed cpu-time = i3, ' centi-seconds

90 k /• + ' , i3, ' seconds '

91 k /' + ' , i3, ' minutes ' k /' + ' , is ,

' hours •

93 k /' + ', is, * days ' 94

96 121 format (/' ... oops, unable to discern: option')

90 122 format (/' ... oops, inconsistent value: option')

97 end

91
6.2.2 FILEOP.FOR

1 subroutine filaop

2 include 'iounit.'

34 open (idat,file='x.dat' ,status='old' .readonly, shared)

s8 11 open (iout,file='x.out' ,8tatus='old' ,disp='delete' ,err=12)

7 close(iout)

8 goto 11

9 12 open (iout,file='x.out' ,status='new')

idU 13 open (isout,file='x.sout' ,status='old' ,disp='delete' ,err=14)

12 close(isout)

13 goto 13

14 14 continue ! open (i8out,file='x.sout' ,status='ne?')

IS

18 16 open (iplt,file='x.plot' ,statu8='old' ,disp='delete' ,err=16)

17 close(iplt)

18 goto IS

19 16 open (iplt ,file=' X. plot ' ,status= 'new'

)

20

21 return

22 end

92
6.2.3 INPDAT.FOR

1 subroutine inpdat (ichoic)

3 include ' iounit .

3 include 'defnit.'

4 include 'filinmm.'

6 logical first

0

7 data pi / 3 . 141B92fl5E+00 /

8 data cccc / 2 . 99792458E+17 / ! speed of light, (nm/sec)

B c data cccc / 2 . 99792458E-M4 / ! speed of light, (micro-m/sec)

10 c data cccc / 2 . 99792458E-(-10 / ! speed of light, (cm/sec)

11

13 c Bote: 1.0 micro-m = 1E3 nano-m = 1E4 Angstrom

13 c lE-3 micro-m = 1 nano-m = 10 A

14 c lE-4 micro-m = lE-1 nano-m = 1 A

151017 raddeg = pi/180.0

18 first - .false.

10 c

30

31 c Distinct wavelengths (free space) incident on siunple.

33 read (idat, *) mwaves

33 write (iout,10l) mwaves

34 if (mwaves. It. 1 .or. mwaves .gt .nwaves) then

36 write (iout,102) nwaves

30 stop

37 end if

38 do i=l, mwaves

39 read (idat, *) j, wavlen

30 write (iout,103) j, wavlen

31 if (j.ne.i .or. wavlen. le. 0.0) then

33 write (iout,104)

33 stop

84 end if

85 if (i.ne.l) then ! impose ordering

30 if (waveln(i-l) .le. wavlen) then ! longer waves first,

37 write (iout,10B) ! waves be distinct.

38 stop

39 end if

40 end if

41 waveln(i) = wavlen ! nano-meters

43 waveqq(i) = 2.0*pi/ wavlen

48 waveww(i) = 2.0*pif (cccc/wavlen)

44 end do

46 c

40

47 c Distinct refractive indices of ambients ' (n| ambient, wave)

48 read (idat, *) mbient

49 write (iout.lll) mbient

so nbnwav = nbient^nwaves ! ambients, waves

93
615263

54

565657

58

59eo

6162 , 88

64

65 C

66

67 C

6868

70

717378

74

757677

78

7980

81

8S838485

86

87

88

89

90

91939394

95

96

er c

98

99 C

100

101

102 103

if (mbient . It . 1 . or . mbient . gt .nbnwav) then

write (iout,112) nbziwav

stop

end if

do i=l, mbient

read (idat, *) j, air ! refractive index

write (iout,113) j, air

if (j.ne.i .or. air. It. 1.0) then

write (iout,114)

stop

else

ainbent(i) = air

end if

end do

Distinct material elements: (n,k| wave,8ampl}

read (idat, *) mlmnts

write (iout,121) mlmnts

if (mlmnts. It. 1 .or. mlmnt s . gt . nlmnt s ) then

write (iout,122) nlmnts

stop

end if

do i=l, mlmnts

read (idat, *) j, dielec, uncert, ivary

write (iout,123) j, dielec, uncert, ivary

if (j.ne.i .or.

ft dielec. It. 0.0 .or. uncert . It . 0 . 0 .or.

ft ivary . It . 0 . or . ivary . gt . 2 } then

write (iout,124)

stop

end if

if (ivary. eq.l .and. uncert. eq. 0.0) then

write (iout,126)

stop

end if

diefcn(i) = dielec ! n,k

uncerl(i) = uncert

Ivaryl(i) = ivary

iptw(i) = -1 ! discern utilization

if (ivary. eq. 2 .and. ichoic.ne.4) then ! convenience

first = .true,

end if

end do

Distinct film thickness-es : z read (idat, *) mfilmm

write (iout,131) mfilmm

if (mfilmm. It. 0 .or. mfilmm. gt .nfilmm) then

write (iout,132) nfilmm

94
104

lOS

loa 107

108

100

110

111

112 113

114

115 116 117

118

110

130

131 133

133

134

136 130 137

138

130

130

131 133

133 134

136 130

137 C

138

130 C

140

141 143 14S

144

146 146 147

148

140

160

161 163 168

164

168 166

Stop

end if

±i (mfilinin.gt .0) then

do i=l,mfilnun

read (idat, *) j, vidth, uncert, ivary

«rite (lout, 133) j, width, uncert, ivary

if (j.ne.i .or. k width. It. 0.0 .or. uncert . It . 0 . 0 .or.

ft ivary . It . 0 . or . ivary . gt . 2 ) then

write (iout,134)

stop

end if

if (ivary. eq.l .and. uncert. eq. 0.0) then

write (iout,135)

stop

end if

widths (i) = width

uncerz(i) = uncert

Ivaryz(i) = ivary

j = mlmnts+i

iptw(j) = -1 ! discern utilization

if (ivary.eq.2 .and. ichoic.ne.4) then ! convenience

first = .true,

end if

end do

end if

if (first) then

write (iout,137)

stop

end if

impose constraint:

ivary=2

be allowed only for

ichoic=4

Distinct sample configurations: (films/substrate)

read (idat, «) msampl

write (iout,141) msampl

if (msampl. It. 1 .or. msampl. gt .nseunpl) then

write (iout,142) nsampl

stop

end if

i = 0

iws = 0

iaws = 0

do i8=l, msampl ! distinct samples

read (idat, *) js, mfilm, mwave

write (iout,143) js, mfilm, mwave

if (js.ne.is .or. k mfilm. It. 0 .or. mfilm. gt .nfilms .or.

I: mwave. It. 1 .or. mwave .gt .mwaves ) then

write (iout,144) nfilms, mwaves

95
1

157 Stop

158 end if

159 mfilms = mfilm+1 ! films/substrate

160 nnfilm(is) = mfilm ! number of films on seunple

161 nnwave(is) = mwave ! number of waves on sample

162 \ 163 do iw=l, mwave ! seem, distinct waves on sample

164 read (idat, *) iwave, mbien

165 write (iout,14B) iwave, mbien

166 if ( iwave. It. 1 .or. iwave .gt .mwave s .or.

| 167. I; mbien. It. 1 .or. mbien. gt .mbient ) then

iiSs- write (iout,146)

169 stop

170 end if

171 if (iw.ne.l) then ! impose ordering

172 if (iiwave(iws) .ge. iwave) then

173 write (iout,147)

174 stop

176 end if

176 end if

177 iws = iws+1

178 iiwave(iws) = iwave ! specify the distinct wave

179 nnbent(iws) = mbien ! number of distinct ambients

180

181 do m=l, mfilms ! films/substrate

182 if (m.eq. mfilms) then ! substrate

183 read (idat, *) j, n,k

184 write (iout,148) j, n,k

185 else

186 read (idat, *) j, n,k,iz ! film I 187 write (iout,149) j, n,k,i2

188 if (iz.lt.l .or. iz .gt .mf ilmm) then

189 write (iout,150)

190 stop

191 end if

192 i = i+1

193 iifilm(i) = iz

194 end if

196 if (j.ne.m .or. n.eq.k .or.

196 k n.lt.l .or. n.gt.mlmnts .or.

197 ft k.lt.l .or. k.gt.mlmnts ) then

198 write (iout,150)

199 stop

200 end if

201 i = i+1 [ 202 iifilm(i) = n | 203 i = i + 1 204 iifilm(i) = k

205 206 j = mlmnts+iz ! indicate utilization

207 iptw(j ) = 0

208 iptw(n) = 0

209 iptw(k) = 0

96

i
210 end do ! film

211

212 if (in.ne.l) then ! test widths ' z

213 ii = i+1 - (infilm*3+2)

214 jj = i+1 - (mf ilin*3+2)*2

215 do i2=l,mfilm

216 if (iif ilmCj j) .ne.iif ilin(ii)) then

217 write (iout.lBl) iz, iifilm(jj), iifilin(ii)

218 stop

219 end if

220 ii = ii+3

221 jj = jj+3

222 end do

223 end if ! test z

224

225 do inbn=l .mbien ! seem, distinct ambients

220 read (idat, *) imbien, mrpeat

227 write (iout,152) imbien, mrpeat

228 if (imbien. It. 1 .or. imbien. gt .mbient .or.

229 t mrpeat. It. 1 .or. mrpeat .gt .nrpeat ) then

230 write (iout,153)

331 stop

232 end if

233 if (mbn.ne.l) then ! impose ordering

334 if (imbien .le. iibent(iaws) ) then

23S write (iout,154)

230 stop

337 end if

338 end if

339 iawB = iaws+l

340 iibent(iaws) = imbien ! specify distinct eunbient

241 nnpeat(iaws) = mrpeat ! repeats of experiment

343 end do ! ambient

343 end do ! wave

344 write (iout,175)

345 end do ! seunple

340 347 C* if (ichoic .eq. 1) then

348 C* call pltdat (1) ! plot: (z.n.k)

349 c* return

360 c* end if

351

353 k = 0 ! discern utilization of

363 ma = mlmnts+mfilmm ! the model parameters

354 do i=l ,aa

366 if (iptw(i) .eq. -1) then ! not utilized

360 k = k+1

367 if (i .le. mlmnts) then

268 write (iout,lB6) ' (n+ik) ' , i

369 else

300 j = i -mlmnts

301 write (iout,156) ' (z )', j 303 end if

97
263 end if

264 end do

265

266 if (k.ne.O) then ! impose constraint that

267 stop ! all model pariuneters

268 end if ! be of use.

269 C ==: ==== = === = = ========== === = === = ===== = ============== = =============:

270

271 if (ichoic .eq. 6) goto 30 ! sensitivity analysis

272 273 c Experimental, measurement, or target data.

274 c (psi, delta I phi, repeat, ambient, wave, sample)

276

276 i = 0 ! index measured data

277 ii = 0 ! overflow indicator

278 iws = 0

279 iaws = 0

280 iraws = 0

281 do is=l,msampl ! sczin samples

282 mwave = zm.wave(is)

283 first = .true.

284 do iw=l, mwave ! scan wavelengths

285 iws = iws+1

286 iwave = iiwave(iws) ! specify wavelength

287 mbien = nnbent(iws)

288 do mbn=l, mbien ! scan ambients

289 iaws = iaws+1

290 imbien = iibent(iaws) ! specify ambient

291 mrpeat = nnpeat(iaws)

292 do irpeat=l , mrpeat ! repeats of experiment

293 read (idat, *) mangl, jmbn,jw

294 if (first) then

295 first = .false.

296 write (iout,172) mangl, irpeat ,jmbn,j w, is

297 else

298 write (iout,172) mangl, irpeat ,jmbn,jw

299 end if

300 if (mangl. It. 1 .or. mangl . gt . nanglx .or.

301 k jmbn.ne .imbien .or. jw.ne. iwave ) then

302 writ e ( iout , 1 73 )nanglx , irpeat , imbien , iwave , i s 303 stop

304 end if

306 iraws = iraws+1

306 mangle (iraws) = mangl

307

308 do iangl=l , mangl ! incident angles

309 read (idat, *) j , angle, au, delta, du, psi,pu

310 write (iout, 174) j .angle, au, delta, du,psi,pu

311 312 if (delta .It. 0.0) then ! [0, 360)

313 delta = delta + 360.0

314 end if

316 c

98
sie e

S17 Q

318 Q

sie c

830 c

821 e

9dm Q

S2S

S34

sai

336 337 e

338 330

SSI sss sss

334

SSI

SS6 SS7

SSS

sss

S40

S41 S43

S4S

S44

S4i S4S S47

S4S

S49 SSO

SSI SSS sss

SS4

SSS SSS

SS7

SSS

SSS

sao

SSI SSS SSS

Sfl4 ses sse SS7

The above incoming measiiremsnt data (delta, psi)

is assumed to be of the Nebraska convention.

engineering assumes: n-ik > (psi, delta) (Nebraska)

physics assumes: n+ik > (psi, delta) (this softweure progrsm)

both assume : TM mode or p-polarization uses the E field.

Consequently, this affects only the Delta.

The transformation is: (physics) < conjg (Nebraska)

if (delta .ne. 0.0) then

delta = 360.0 - delta

end if

T3Si abs (psi )

' Co 90)

DU abs (pu ) delta _ abs (delta) ! Co, 360)

du abs (du ) angle abs (angle) ! [0, 90) au abs (au )

psi amod (psi , 90 0) ! degrees

pu amod (pu , 90 0)

delta amod (delta, 360 0)

du unod (du , 360 0)

angle eunod (angle, 90 0) au amod (au ,90 0)

psi psi fraddeg ! radians

pu pu •raddeg

delta delta •raddeg

du du *raddeg

angle angle *raddeg au au * raddeg

i = i+1

if (i .gt .nexpts) then

i = i-1

ii = ii+1

end if

! sequential index

extention

p8iiis(i) = psi

psiiiu(i) = pu

deltas (i) = delta

deltau(i) = du

angles (i) = angle

angleu(i) = au

do ! angle

write (iout,175)

end do ! repeat

end do ! ambient

end do ! wave end do ! seunple

99
369

370 il (ii.gt.O) then

371 i = i+ii

372 write (iout,176) nexpts, i

373 stop

374 end if

375 376 C retum

377

378 C Sensitivity/error analysis of multiple: angle , ambient , wave , sample

379 c No need for experimental data, here. But rather

380 c we need: manglm, isteps.

381 c Assume: mrpeat =1, ... in all cases.

382 383 30 read (idat, method

384 write (iout,161) method

386 if (method. It. 1 .or. method. gt. 3) then

386 write (iout,162}

887 stop

388 end if

389

390 i = 0 ! index measured data

391 ii = 0 ! overflow indicator

392 iws = 0

393 iaws = 0

394 iraws = 0

395 do is=l,msampl ! scan samples

396 mwave = nnwave(is)

397 first = .true.

398 do iw=l, mwave ! scan wavelengths

399 iws = iws+1

400 iwave = iiwave(iws) ! specify wavelength

401 mbien = nnbent(iws)

402 do mbn=l, mbien ! scan ambients

403 iaws = iaws+1

404 imbien = iibent(iaws) ! specify ambient

405 mrpeat = nnpeat(iaws)

406 if (mrpeat . gt . 1 ) then ! consistencey

407 write (iout,181) mrpeat

408 stop

409 end if

410 c* do irpeat=l .mrpeat ! repeats of experiment

411 read (idat, ») is tep.raangl, jmbn,jw,j8

412 if (first) then

413 first = .false.

414 write (iout,182) istep,mangl, jmbn,jw,js

415 else

416 write (iout,182) is tep.mangl, jmbn.jw

417 end if

418 if (istep.lt.l .or. istep.gt.lO .or.

419 k mangl.lt.l .or. mtmgl.gt .nanglm .or.

420 k jmbn.ne . imbien .or

421 k jw.ne. iwave .or js.ne.is ) then

100
433 write (iout,183) nanglm,iinbien,iwave,is

433 stop

434 end if

435 iraws = iraws+l

436 mangle(irans) = mangl ! multiple angles

437 isteps(ira7s) = istep ! increment of grid

438 C* end do ! repeat

439 end do ! ambient

4S0 end do ! wave

4S1 •nd do ! scunple

4S3 return

4SS

484 101 format (/' mwaves =', i4, ', number of distinct wavelengths')

4Si 102 format (' nvaves =

'

, i4 , ' , < oops ' ) 4M 103 format (' ', 14, fl2.4)

4S7 104 format (

'

oops

,

... card info inconsistent')

4S9 106 format (

'

oops

,

... wavelengths not: ordered, distinct .'

)

439 111 formate/' mbient =', 14, ', number of distinct ambient'.

440 k ' environments and waves.')

441 112 format (' nbnvav = ' , 14, ' , < oops ' ) 443 113 format (' ', 14, lfl2.6)

443 114 format (' oops

,

. . . card info inconsistent . '

)

444 121 format (/' mlnnts =', 14, ', number of distinct: n+ik')

44S 122 format (

'

nlmnts = ' , 14, ' , < oops ' ) 446 123 format C

'

' , i4, 2fl2 .4, i5)

447 124 format (' oops

,

... card info inconsistent')

448 125 format (

'

oops

,

since: Ivary = 1, '

448 » /' then: uncert =/= 0.0 ') 4>0 131 formate/' mf ilmm =', 14, ', number of distinct film widths')

4tl 132 format (

'

nfilmm = ' , 14, ' , < oops ' ) 453 133 format (

'

', 14, 2fl2.4, 15)

453 134 format (' oops

,

... card info inconsistent')

454 136 format (' oops

,

since: ivary = 1, '

455 * /• then: uncert =/= 0.0 ') 458 137 format (

'

oops

,

an imposed constraint has been violated:

457 » /' it is only in the case of: Ichoic = 4'

458 » /• may one be allowed to use: ivary =2' ) 458 141 formate/' msampl = ', 14, ', number of distinct seunples')

460 142 format (

'

nsaunpl = ' , 14, ' , < oops ' ) 461 143 format (

'

', 314, 8x, ' ' sample, mfilm, mwave')

483 144 format (

'

oops

,

nfllms=', 14, ', mwave8=', 14)

483 146 format (

'

', 214, 12x, ' ' iwave, mblen')

484 146 format (' oops

,

... card info inconsistent')

485 147 format (' oops

,

... distinct, ordered ') 488 148 format ( 9x, 3i4, 8x, ' ' i.n.k ') 467 149 format ( 9i, 4i4, 4x, ' ' i.n.k.z')

468 160 format (' oops

,

... card info inconsistent')

488 161 format (' oops

,

compare corresponding widths: '

470 k /' iz, iHilm(jj), iifllm(ii) : ', 315)

471 162 format (' 2i4, 12x, ' ' imblen, mrpeat')

473 163 format (' oops

,

... card info inconsistent')

473 164 format (' oops

,

... impose ordering on the: ambients')

474 160 format (> oops

,

parameter not in sample configuration, '

,

101
475 » a6, • ' i3)

476 161 format (' method i4, ' , (1 ' normal eqns, '

477 k / 16x, '2 ' permute signs in ''forward*' problem,'

478 I; / 16x, '3 ' singular value decomposition ') 479 162 format (' oops, ... card info inconsistent')

480 172 format (Ix, 5i4, ' ' mangl, repeat, ambient, wave, sample'

,

481 k '/ (phi, delta,psi) '

)

482 173 format (' oops, ... card info inconsistent'

483 k /Ix, Bi4, ' ' nanglx, repeat, ambient, wave, sample')

484 174 format (Ix. i4, 6fl2.4)

485 17B format (' ') 486 176 format (' oops, enlarge: nexpts=', i4, ' > ', i4)

487 181 format (' oops, repeats =', i4, ', ——> 1')

488 182 format (Ix, 5i4, ' ' istep, mangl, ambient, wave, sample '

)

489 183 format (' oops, ... card info inconsistent'

490 ft /' istep < 11'

491 ft / ' mangl < ' , i4 ,

' ' nanglm ' 492 ft / 13x, 3i4, 4x, ' ' (eunbient, wave, seunple)')

493 end

102
6.2.4 ARRANG.FOR

This subroutine sets up the necessary pointers for indexing/ordering the matrix elements

in the sparse matrix of the Jacobian.

1 subroutine arrazig

2 include ' defnit .

s

4 include 'filimnn.'

5 The sparse matrix format for the model parameters is of the form

0 c C(n/k).(l), .... (n/k)_(mlmnts)] ' diefcn (w)

7

8

c C z_(mfilms)] widths

9 c Ordering of indices in IPTII: [vary- -> <—froz]

10

11

13 mn = mlnnts+mfilmm ! model parameters

13 i = 0 ! vary ' compress

^4 k = 0

15 do m=l,mlnnts

16 iptvCffl) = 0 ! local uniqueness

17 if (ivaryl(n) .e^ . 1) then ! varv

18 i = i+1 ! compress

10 iptu(i) = m ! full (vary)

20 iptv(m) — i ! vary (full)

31 else ! frozen

33 k = k+1 ! compress

33 JUU UUU ' A A ! backwards

34 iptu(km) = D ! full (froz)

so iptv( m) = km • froz ffull')

20 end if

J ( end do

38

sw if (mf ilmm.ne.O) then

30 do m=l,mfilmm

31 j = mlmnts+m

32 iptw(j) = 0

if (Ivaryz(m) .eq. 1) then ! vary

34 i = i+1 ! compress

35 iptu(i) =

j

! full (vary)

30 iptv(j) = i ! vary (full)

37 else ! frozen

38 k = k+1 ! compress

SB km = mm+1 -k ! backwards

40 iptu(km) = j

! full (froz)

41 iptvC j) = km ! froz (full)

43 end if

43 end do

44 end if

4B46 mvary = i ! compress

103
47 mlroz = k

48

49 ratuzn

50 and

! compress

104
6.2.5 PLTDAT.FOR

1 subroutine pltdat (ichoic)

3 include 'iounit.'

s include 'defnit.'

4 include 'filnmun.'

6 include 'filmss.'

« include 'rstack.'

r include 'seanxl.'

8

9 real a (nro9S*2), b(2), c(2)

10 real uz(nro7s*2), im(nro9B*2) , uJc(nrow8>t'2)

11 character*12 labelo ! convenience label

13 data pi / 3.14159265 /

18

14 c The sparse matrix format for the model parameters is of the form:

15 c C(n/k)_(l), .... (n/k)_(mlmnts)] ' diefcn (w)

16 c [ s_(l)( z_(mfilms)] ' aidths

17

18

10 j = ichoic

30 if (j.lt.l .or. j.gt. 5) then

31 write (iout.lOl)

33 read (idat, •) j 38 vrite (iout,102) j 34 if (j.lt.l .or. j.gt. 5) then

35 stop

36 end if

37 end if

38

30 if (j .eq. 1) goto 1

80 if (j .eq. 2) goto 2

81 if (j .eq. 3) goto 3

83 if (j .eq. 4) goto 4

88 if (j .eq. 6) goto 5

84

86 C ================================================================

36 c Plot distribution: (z,n,k) for those samples

87 c shich have one or more films.

88

80 1 continue

40 i = 0

41 ivs = 0

43 iass = 0

48 do is=l,m8ampl

44 mfilm = nnf ilm(is)

45 mwave = nnvaveCis)

46 if (mfilm .ne. 0) then

47 mfilms = mfilm+1 ! films/substrate

48 do i«=l,m7ave

40 ivs = iws+1

60 ivave = ii9ave(i9s)

105
61 mbian, = xinbeiit(iws)

53 qq = vaveqqCiwave) ! FILMSS

53

54 k = 2 ! index of plot array

55 ukd) = 0.0 ! extinction of ambient

56 iik(2) = 0.0

57 uz(2) = 0.0 ! surface

68

60 do m=l ,mfilm8 ! f ilms/substrate

60 if (m.ne .mf ilms) then ! z

61 i = i+1

9^' iz = iifilm(i)

68 zzz(m) = widths (iz)

64 uz(k+l) = uz(k)

65 iiz(k+2) = uz(k) + zzz(n ) M if (m.eq.l) than

67 thin = zzz(m)

68 else

^9 thin = aminl (thin. zzz(m))

70 end if

71 end if

7* do ink=l,2 ! n+ik

78 i = i+1

74 nk = iifilm(i)

79 c(ink) = diefcn(nk)

76

' end do

77 un(k+l) = c(l) ! LHS

78 im(k+2) = c(l) ! RHS

79 uk(k+i) = c(2) ! LHS

80 iik(k+2) = c(2) ! RES

81 k = k+2

83 end do ! mfilms

88 ii2( 1) = -thin

84 iw(k-l) = iiz(k-2) < substrate/film interf

86 uz(k ) = uz(k-2) + thin ! substrate

oB87 do iRbn=l ,mbien ! ambient

88 iaws = iaws+1

88 imbien = iibent(iaws)

air = anbentC imbien) ! FILMSS

ei un(l) = air ! refractive index

un(2) = air

Oft

04 nu = 2 ! n+ik

06 vrite (iplt.lll) k.nu.mbn.iw.is

06 do j=l,k

07 write (iplt,112) j. (j), un(j), uk(j)

08 end do

00 end do ! ambient

100 end do ! wave

lot else ! advance indices

103 i = i + (mf ilm*3+2)*mwave

103 do iw=l,mwave

106
104 iws = iss+1

105 mbien = imbsntCivs)

106 iavs = iaws+mbiezL

107 end do

108 end if

109 end do ! sample

110 return

111

112 c ============================================================

113 c Plot deviations of the fit: b = experiment -model

114

115 2 continue

116 llnorm = .false.

117 call asmbl ! bb

118

119 rd = 180.0/pi ! radians —> degrees

120 ngl = 0

121 ii = 0

122 ivs = 0

123 iaws = 0

124 iraws = 0

125 do is=l,msampl

126 mwave = nnwave(is)

127 do iv=l, mwave

128 ivs = i7S+l

129 mbien = nnbent(i7s)

130 do mbn=l, mbien

131 iaws = iaws+1

132 mrpeat = nnpeat(iaws)

133 do irpeat=l , mrpeat

134 iravs = iraws+l

135 mangl = mangle (iravs)

136 137 nu = 2 ! (psi, delta)

138 write (iplt,211) mangl,nu,irpeat,mbn,iw, is

139 do iangl=l , mangl

140 ngl = ngl+1

141 angl = angles (ngl) ! radians

142 psixm = bb(ii+l)

143 delxm = bb(ii+2)

144 angl = angl rd ! degrees

146 psixm = psixm*rd

146 delxm = delxm*rd

147 write (iplt,212) iangl, angl, delxm,psixm

148 ii = ii+2

140 end do ! angle

150 end do ! repeat

161 end do ! ambient

152 end do ! wave

153 end do ! sample

164 return

155

166 C ===========================================================:

107
167 C Output model experimental data suitable for use as input data.

158

. 159 3 c ont iziue experiment < model

160 caxx axxaJig

161 162 ItlWS — u

163 . xws — 0

1'64 . xavs — 0

165 ^ B a rt ixaWB \J 166 ngx - u measured data

lit

mlilm — zuif ilinCis )

IP TT C FILHSS

160 niwav6 = ziziwav6 (i s ) 170 inzu.inB — mzi±m+i films/substrate

ifTl nrow = mfilm*3+2

17a 173

i«8 = i9S+l

IT* iwave = iiwave(iws)

iW mbien = imbent(iws)

176 qq = waveqqC iwave) F ILnSS

177

178 do m=l,mfilms films/substrate

170 if (m.ne .mf ilms) then zixzns z

180 mws = mws+l

1'81 iz = iifilmCmws)

182 zzz(m) = vidthsCiz)

183 end if

184 do ink=l,2 n+ix

185 mws = mws+l

186 nk = iifilmCmws

)

187 c(inlc) = diefcn(nk) ! 188 end do

180 die(m) = cmplx (c(l), c(2))**2 ! 17TT WGC r ILnbb

100 end do ! mfilms

101

1 a9 do mbn=l, mbien 1 iXlUD J.OXL w 0 103 iaws = iaws+i

104 imbien = iibent(iaws)

105 mrpeat = nnpeat(iaws)

106 air = eunbentC imbien) 1 FILMSS

107 do irpeat=l , mrpeat

108 iraws = iraws+1

100 mangl = meuigleC iraws)

200 write (iout,311) mangl , imbien , iwave

201 write (iplt,311) mangl , imbien , iwave

202 do iangl=l , mangl j incident angles

203 ngl = ngl+1 j measured data

204 angl = angles (ngl)

206 call scatr (qq,angl, b,a,c)

206 207 psi = b(l) *180.0/pi ! psi

208 delta = b(2) *180. 0/pi ! delta

200 angl = angl *180. 0/pi

108
210

211 212 213

214

215 210 217

218 219

220

221

222 223

224

225 220 227

228

229

230

231

232 233 C

284 C

235 C

230 237

238

239

240

241 242 243

244

245 240 247

248

249 260

251 252 253

254

256 260 267

268

259

200

201

202

au = aiigleu(ngl) *180.0/pi

pu = psiiiu(ngl) *180.0/pi

du = deltau(ngl) *180.0/pi

il (delta. It. 0.0) then ! [0,360)

delta = delta + 360.0

end if

if (delta. ne. 0.0) then f phase shift

delta = 360.0 - delta

end if

nrite

k

write

k

end do

end do

end do

end do

end do

return

(iout,312) iangl, angl.au,

delta, du, psi,pu

(iplt,312) iangl, angl,au,

delta, du, psi,pu

! angle

! repeat

! ambient

! wave

! sample

Output model experimental data, (delta, psi, R, |R| , ... ) Scan incident angles.

4 continue

write (iout,411)

read (idat, *) ichoos

write (iout,412) ichoos

if (ichoos. It. 1 .or. ichoos. gt. 4) then

write (iout,413) 'choose'

stop

end if

write (iout,421)

read (idat, •) iselct

write (iout,422) iselct

if (iselct. It. 1 .or. iselct. gt. 2) then

write (iout,413) 'select'

stop

end if

write (labelo,423) ichoos, iselct ! label output

call arrang

mws = 0 iws = 0 iaws = 0 iraws = 0 ngl = 0

do is=l,msampl

mfilm = nnfilm(is) ! FILMSS mwave = nnwave(is)

109
263 mfilms = mfilm+l ! lilms/substrate

264 nroH = ralilm*3+2

265 do iw=l,mwav8

266 iws = iws+1

267 iwave = iiwave(iws)

268 mbiexi = unbent (iws)

269 qq = waveqqC iwave) 1 FILMSS

270

271 do i=l,nrow ! convenience

272 iptx(i) = 0

273 ipty(i) = 0

274 end do

' 275 iv = 0

276 kv = 0

277 mv = 0

278 270 do m=l , mfilms ! films/substrate

280 if (m.ne .mfilms) then ! films ' z

481 mws = mws+1

282 iz = iifilm(mws)

^283 zzz(m) = widths(iz) ! FILMSS

284 iv = iv+1

285 if (Ivaryz(iz) ,eq. 1) then

286 j = mlmnts+iz

287 i = iptv(j)

288 kv = kv+1

289 iptx(kv) = i

290 ipty(kv) = iv

291 if (iptw(i) .eq.O) then ! unique

292 mv = mv+1

293 iptw(i) = mv

294 end if

295 end if

296 end if

297 do ink=l,2 ! n+ik

298 mws = mws+1

299 nk = iifilm(mws)

300 c(iiik) = diefcn(nk) ! n,k

301 iv = iv+1

302 if (Ivaryl(nk) .eq. 1) then

303 i = iptv(nk)

304 kv = kv+1

306 iptx(kv) = i

306 ipty(kv) = iv

307 if (iptw(i) .eq.O) then

308 mv = mv+1

309 iptw(i) = mv

310 end if

311 end if

312 end do

313 die(m) = cmplx (c(l) ,c(2) )**2 ! FILMSS

314 end do ! mfilms

315

110
3ie if (ichoos.eq.4 .and. mv.gt.l) then

317 srite (iout,431)

318 stop

319 end if

320

321 do mbn=l ,mbien ! ambients

322 iaws = iaws+1

323 imbien = iibentCians)

324 mrpeat = nnpeatCiavs)

326 air = ajnbent (imbien) ! FILMSS

320 do irpeat=l , mrpeat

327 iraws = iraws+1

328 if (iselct . eq. 1) then ! specific angles

329 memgl = meoigle (iraws)

330 else ! scEUi angles

331 mangl = 89

332 end if

333 if (ichoos . eq. 1) ncolmn=3

334 if (ichoos . eq. 2) ncolmn=4

335 if (ichoos . eq. 3) ncolmn=3

33« if (ichoos.eq.4) ncolmn=2

337 338 write (iplt,432) mangl,ncolmn, imbien, ivave, is.

339 labelo

340

341 do iangl=l , mangl ! angles

342 if (iselct .eq. 1) then

343 ngl = ngl+1 ! measured

344 angl = angles (ngl) ! radians

345 phi = angl*(180 . 0/pi) ! degrees

346 else

347 phi = float (iangl) ! degrees

348 angl = phi* (pi/180.0) ! radians

349 end if

350 call forwrd (qq.angl, Rs,Rp, dRs,dRp,

361 dRsa,dRpa)

352 sx = real (Rs)

363 sy = aimag (Rs)

354 px = real (Rp)

355 py = aimag (Rp)

360 call polar (sx,sy,sr,sa,l) ! |Rs|

357 call polar (px.py ,pr,pa,l) ! iRpI

358

359 Br2 = sr*sr ! intensity

300 pr2 = pr*pr

361 8r2pr2 = (sr2+pr2)*0.B ! total

362

363 call scatr (qq,angl, b,a,c)

364 psi = b(l) *180.0/pi ! psi

365 delta = b(2) *180.0/pi ! delta

366 307 if (mv.eq.O) then ! Jacobian

308 dpsi = c(l) *180.0/pi ! psi'

111
369 ddel = c(2) *180.0/pi ! delta'

370 else

371 dpsi =0.0 ! initialize

373 ddel = 0.0

373 do k=l,kv ! coompress, vary

374 iv = ipty(k) ! local, lull

375 iv2 = iv+iv ! delta ' a ' local

376 ivl = iv2-l ! psi ' a ' local

377 dpsi = dpsi + a(ivl)

378 ddel = ddel + a(iv2)

370 end do

380 dpsi = dpsi •<180.0/pi

381 ddel = ddel >«180.0/pi

382 end if

383

384 if (delta. It. 0.0) then ! [0,360)

385 delta = delta + 360.0

386 end if

387

388 if (delta. ne. 0.0) then ! phase shift

389 delta = 360.0 - delta

390 end if

391 382 C

393 if (ichoos.eq.l) then

894 Qrite (iplt,433) iangl.phi,

395 k delta,psi, sr2pr2

'396 else if (ichoos .eq.2) then

.397 write (iplt,433) iangl,phi,

898 k sr,pr, 8r2,pr2

.u399 else if (ichoos .eq. 3) then

400 write (iplt,433) iangl,phi,

401 k sr,pr, sr2pr2

402 else if (ichoos .eq. 4) then

403 write (iplt,433) iangl,phi,

404 k ddel, dpsi

405 else

406 stop

407 end if

408 C

409 410 end do ! angle

411 end do ! repeat

412 end do ! ambient

413

414 do k=l,lcv

.416 i = iptx(k)

416 iptw(i) = 0

417 end do

418

419 end do ! wave

420 end do ! sample

421 write (iout,434)

112
422 return

423

424 c

425 C Output /plot Igl over a grid of model parameters (v) , ID or 2D.

420

^« 1 5 continue

call sc an2g

return

430

431 ^0J 101 format (/' PLTDAT, forward scattering problems, plots, ...

' k /' This menu of options is at level two.'

AAA k //' options

1, plot (z,n,k) '

436 k /> 2, plot deviations of fit,

4o0 'g = experiment-model'

*o i k /> 3i model > experiment/measurement data,'

4oS k /'

439 k /> format is suitabln to raadinir as insut .

k /> (angles , repeats , ambient s , waves , samples)

441 k /' 4, use model at measurement /scan points, '

442 k /' request another menu to format output, '

443 k /> output ' (delta, psi, intensity, R,dR, ...)

AAA k /' 5, scan grid, plot |g| , ID or 2D '

446 k //' Enter: option ' ' ) 440 102 format (

• option ' ' , il /)

447

448

440 111 format (Ix. Bi4, ' ' nz,nu, ambient, wave, sample / (i,z,n,k)')

460 112 format (Ix, i6, Ip3el3.4)

A R 1 211 format (Ix, 8i4, ' ' manglx,nu, repeat, ambient, wave, sample '

,

462 k ' / (i,phi, ddel.dpsi)')

463 212 format (Ix, i5, Ip3el3.4)

A KA 311 format (Ix, 3i4, ' ' mangl,imbien,iwave/ (phi , delta, psi) '

,

40D k ' (angle, d_angle)')

450 312 format (Ix, i4, Ix , flflO.4)

457

468 469 411 format (/' PLTDAT, select the format of the output table.'

400 k /• This menu of options is at level three.'

AA1 k //' options : 1, (i.ai, delta, psi, intensity )'

AA9 k /' 2, (i,ai, iRsLlRpI, iRs 1 **2, iRpI **2) '

403 k /' 3, (i,ai, |R8|,|Rp|, intensity )'

404 k /• 4, (i,ai, d/d pariuneter (delta, psi) )'

A AR k //' Enter: option ' '

)

400 412 format (

' option ' ' , il ) AA7 413 format (

• oops, inconsistent value ascribed unto: a6)

408

4fl0 470 421 format (/' PLTDAT, select the domain of incident angles. '

471 ft /• This menu of options is at level three.'

472 k //• options : 1, at experiment/measurement points '

473 k /• 2, grid scan, incident angles ' (1,89)'

474 k //• Enter: option ' '

)

113
475 422 format (

* option ' ' , il /)

476 423 format ( 'option:(', il , »

,

' , il , ' )» ) ! 12 characters

477

478 479 431 format (

' ... oops, only (0 or 1) parameters may VARY')

480 432 format (Ix, Bi4, ' ' mangl.nu, imbien.iwave.sampl, ' , a)

481 433 format (Ix, i4, Ix, flO.4, Ip4el3.4)

482 434 format (/' output vritten to: x.plot')

483 484 end

114
6.2.6 SCAN2.FOR

1 lubroutine scan2

3 include 'iounit.'

s include ' defnit .

4 include 'filainin.'

5 include 'icancc'

07 logical Ibdry, local

8 character blank, comma

9 data blank /' *l , comma /*

10

11 c Solve the forward scattering problem over a grid of model parameters.

13

13 c Input grid info for scanning the model parameters

14

IS raddeg - 180.0 / 3.14159265 ! degrees < radians

16

17 vrite (iout,101}

18 i = 0

19 do m=l,mlmnts ! (n+ik)

30 if (IvaryKm) .eq. 1) then

31 i = i+l

33 read (idat, *) j, pi, p2, p3

33 vrite (iout,102) i, pit p2, p3, j, '(n+ik)'

34

35 if ( j.ne.m .or. p2.lt.pl .or.

36 k pi. It. 0.0 .or. p2.lt. 0.0 .or. p3.lt. 0.0) then

37 vrite (iout,103)

38 stop

39 end if

30 if (p3.eq.0.0) p3=p2-pl

31 if (p3.eq.0.0) then

33 iii2(i) = 1

33 else

34 iii2(i) = 1 + nint ((p2-pl)/p3)

35 end if

36 pppl(i) = pi

87 ppp2(i) = p2

88 ppp3(i) = (p2-pl) /float (max (1, iii2(i)-l))

39 c psav(i) = diefcn(m) ! n+ik

40 iptu(i) = m

41 end if

43 end do ! mlmnts

43

44 if (mf ilnm.ne.O) then

45 do m=l,mfilnn ! z ' thickness

46 if (lvar7z(m) .eq. 1) then

47 i = i+l

4S read (idat, *) j, pi, p2, p3

49 vrite (iout,102) i, pi. p2, p3, j, '(z )'

BO

115
61 if ( j.ne.m .or. p2.lt.pl .or.

62 ft pi. It. 0.0 .or. p2.lt. 0.0 .or. p3.lt. 0.0) then

63 write (iout.lOS)

64 stop

66 end if

66 il (p3.eq.0.0) p3=p2-pl

67 if (p3.eq.0.0) then

68 iii2(i) = 1

69 else

60 iii2(i) = i + nint ((p2-pl)/p3)

61 end if

62 pppl(i) = pi

63 ppp2(i) = p2

64 ppp3(i) = (p2-pl) /float (max (1, iii2(i)-l))

66 c psav(i) = widths(m)

66 iptu(i) = mlmnts+m

67 end if

68 end do ! mfilmm

69 end if

70 mvary = i ! depth of do-loop nest

71

72 C

73 c Discern breakpoint

74

76 read (idat,*,err=ll,end=ll) mvarii, kt, kts, old

76 write (iout,121)

77 write (iout.lll) mvarii, kt, kts, old

78 if (mvarii .ne .mvary .or. kt.lt.l .or. kts. It. 1 .or.

79 k old. le. 0.0 ) goto 11

80 do i=l, mvary

81 read (idat,>*<,err=ll,end=ll) j, iiii(i), pppp(i), psav(i)

82 write (iout,112) j, iiii(i), pppp(i)< psav(i)

83

84 if (iiii(i) .It. 1 .or. j.ne.i .or.

86 k iiii(i) .gt. iii2(i) .or.

86 k pppp(i) .It. pppl(i)-ppp3(i)*0.001 .or.

87 k PPPP(i) 'g*- ppp2(i)+ppp3(i)*0.001 .or.

88 k psav(i) .It. pppl(i)-ppp3(i)*0.001 .or.

89 k psav(i) .gt. ppp2(i)+ppp3(i)*0.001 ) then

90 write (iout,113)

91 stop ! goto 11

92 end if

93

94 if (iiii(i) .It .iii2(i) .or. iii2(i) . eq. 1) then

96 PPPPi - pppl(i)+ppp3(i)*float(iiii(i) -1) ! [,)

96 else

97 PPPPi = ppp2(i) ! ] 98 end if

99 if (abs(pppp(i)-ppppi) .gt. ppp3(i)*0.01) then

100 write (iout,113)

101 stop ! goto 11

102 end if

103 end do

116
104 vrite (iout,114)

105 iiistp = 1 106 iii = mvary

107 itl = iftime (i) ! start clock

108 goto 2

io« 11 continue

110 vrite (lout, 115)

111 itl = iftime (i) ! start clock

113 lis c ======================================================

114 c Emulate, initialize, activate: the nest of do-loops

116

lie do i=l,mvary

117 iiii(i) = 0 ! initialization: il-i3

lis end do

119 kt = 0

130 iiistp = 1 ! do-loop increment

131 iii = 0 ! index of: nested do-variables

133 1 iii = iii+1 ! index of: iii-th. nested do

133 if (iii .gt. mvary) goto 3

134 2 iiii(iii) = iiii(iii) + iiistp ! update do-loop variable

136 if (iiii(iii) .It. iii2(iii)) then ! test upper limit

130 pppp (iii) = pppl(iii) + ppp3(iii)>*<f loat (iiii(iii) -1)

137 goto 1

135 else if (iiii(iii) .eq. iii2(iii)) then

139 if (iii2(iii) .eq. 1) then

ISO pppp(iii) = pppl(iii)

181 else

183 pppp(iii) = ppp2(iii)

188 end if

184 goto 1

186 end if

188 iiii(iii) = 0 ! reset inner do, il-i3

187 iii = iii-1 ! backup one do-level

188 if (iii .eq. 0) goto 4 ! escape nest of do-loops

189 goto 2

140 3 iii = iii-1 ! level of inner-most nested do.

141 c ! begin processing body

143

148 kt = kt+l ! simple counter

144 do i=l, mvary ! re-set model parameters

146 m = iptu(i)

148 if (m.le .mlmnts) then

147 diefcn(m) = pppp(i) ! n+ik

148 else

149 m = m-mlmnts

160 9idths(ffl) = pppp(i) ! z

161 end if

163 end do ! vary

168

164 call «oom2 (pppl, ppp2, ppp3) ! iterate ' steepest descent

166 168 llnora = .false.

117
157 call asmbl

158 call norm (meqns ,bb, 131101:01,1) ! retain norm of residual

159 bnorm = bnorm*raddeg ! degrees

160

161 if (kt.eq.l) then

162 kts = 1 ! density ol states

163 old = bnorm

164 do i=l,mvary ! retain model parsuneters

166 m = iptu(i)

166 if (m.le.mlmnts) then

ler psav(i) = diefcn(m)

16$ else

169 m = m-mlmnts

170 psav(i) = widths (m)

171 end if

172 end do ! vary

173 else if (bnorm.lt .old) then

174 kts = 1

1.75 old = bnorm

176 do i=l,mvary

177 m = iptu(i)

178 if (m.le.mlmnts) then

179 psav(i) = diefcn(m)

180 else

1-81 m = m-mlmnt s 182 psav(i) = widths(m)

183 end if

184 end do ! vary

185 else if (bnorm. eq. old) then ! retain density of states

186 kts = kts+1 ! along the minimum

187 end if

188

. 189 it2 = iftime (i) ! CPU clock

190 tim = float (it2-itl) /6.0E4 ! CPU minutes elapsed

191 if (tim .gt. 15.0) then ! breakpoint

192 itl = it2

193 open (unit=isout, file='x.sout' , status='unknom')

194 write (isout.lll) mvary, kt, kts, old

195 do i=l,mvary

196 write (isout,112) i, iiii(i), pppp(i), psav(i)

197 end do

198 call time (bufft)

199 call date (buffd)

200 write (isout,116) bufft, buffd f convenience

201 close (unit =is out)

202 end if

203 c ! finish processing body

204 goto 2 ! nested do-loop: iiii

205 4 continue ! last line of do-nest, iiii

206 C ======================================

207 Ibdry = .false.

208 209 write (iout,104) kt , kts, old ! density of states along minimum

118
210 nrite (iout,105)

311 do i=l ,mvary

312 local = (psav(i) .le. pppl(i)+ppp3(i)*0.001) .or.

213 t (psav(i) .ge. ppp2(i)-ppp3(i)*0.001)

214 c* local = local .and. (iii2(i) .ne . 1)

315 il (local) lbdry=.true.

216 in := iptu(i)

217 if (m. le .mlmnts) then ! n+ik ' diefcn

218 diefcn(m) = psav(i)

219 if (local) then

320 write (iout,106) i, psav(i), m, '(n+ik)', blank

221 else

222 write (iout,106) i, psav(i), m, '(n+ik)'

333 end if

334 else ! z ' widths

225 m = m-mlmnts

220 widths(m) = psav(i)

227 if (local) then

228 write (iout,106) i, psav(i), m, ' (z )', blzmk

229 else

230 write (iout.ioe) i, psav(i), m, ' (z )'

231 end if

233 end if

333 end do ! vtury

334 if (Ibdry) write (iout,107)

235

230 return

237

338 101 format (/' Scan a grid of model parameters.'

339 k /' Grid info:', 4x, 'initial,', 6x, 'final,'.

k 5x ,

* increment ' ) 341 102 format ( 3x, i4, ') ', 3fl3.4, ' - for:', i5, ', ', a6)

103 format (/' scan, error: inconsistent data input')

343 104 format (/' number of grid points scanned, kt = ', ilO

344 k /' population along the minimum, kts = ', ilO

k /' norm of residual, Igl = ', lpel3.6.

340 k ' (degrees) ') 347 105 format (/' Model parameter value along the minimum:')

348 106 format (lx,i4, ')', IplelS.e, ' - for:', i5, ', ', a6,

349 k al , ' ' boundary '

)

350

351 107 format (/' Ifote that the minimum point is near a boundary.')

352 111 format (Ix, i4,lx, 2il0, lplel5.6, ' ' mvary, kt , kts, b(min)

253 112 format (li, 2(i4,lx), Ip2el5.6, ' ' i, ip, p, p(min)')

254 113 format (/' The attempted restart was NOT acceptable.')

266 114 format (/' The attempted restart was acceptable.')

250 115 format (/' Note: NO attempt was made to restart.')

257 116 format (

' wall clock: time = ', a8, Ix, ' ' hh:mm:ss '

268 k / • date = ', a9, ' ' dd-mmm-yy' ) 359 300 121 format (• •)

301 end

119
6.2.7 SCAN2G.FOR

1 subroutine scan2g ! Plot Igl

2 include 'iounit.' ! Called by: PLTDAT

3 include 'defnit.'

4 include 'filmmm.'

s include 'seance'

a

7 logical Ibdry, local

8 character blank, comma

9 data blank /' '/, comma /','/

10

11 c Solve the forward scattering problem over a grid ol model parameters.

12

13 c Input grid info for scanning the model parameters

14

16 raddeg = 180.0 / 3.14159265 ! degrees < radiiois

16

17 write (iout.lOl)

18 i = 0

19 do m=l,mlmnts ! (n+ik)

20 if (Ivaryl(m) .eq. 1) then

21 i = i+1

22 read (idat, *) j, pi, p2, p3

23 write (iout,102) i, pi, p2, p3, j, '(n+ik)'

24

25 if ( j.ne.m .or. p2.lt.pl .or.

26 k pi. It. 0.0 .or. p2.lt. 0.0 .or. p3.lt. 0.0) then

27 write (iout,103)

28 stop

29 end if

30 if (p3.eq.0.0) p3=p2-pl

31 if (p3.eq.0.0) then

32 iii2(i) = 1 33 else

34 iii2(i) = 1 + nint ((p2-pl)/p3)

35 end if

36 pppl(i) = pi

37 ppp2(i) = p2

38 ppp3(i) = (p2-pl) /float (max (1, iii2(i)-l))

39 c psav(i) = diefcn(m) ! n+ik

40 iptu(i) = m

41 end if

42 end do ! mlmnts

43

44 if (mf ilmm.ne .0) then

46 do m=l,mfilmm ! z ' thickness

46 if (Ivaryz(m) .eq. 1) then

47 i = i+1

48 read (idat, *) j, pi, p2, p3

49 write (iout,102) i, pi, p2, p3, j, ' (z )'

50

120
61 if ( j.no.m .or. p2.lt.pl .or.

52 k pi. It. 0.0 .or. p2.lt. 0.0 .or. p3.lt. 0.0) thou

53 write (iout,103)

64 stop

56 end if

66 if (pS.eq.O.O) p3=p2-pl

67 if (p3.eq.0.0) then

58 iii2(i) = 1

60 else

60 iii2(i) = 1 + nint ((p2-pl)/p3)

61 end if

62 pppl(i) = pi

63 ppp2(i) = p2

64 ppp3(i) = (p2-pl) /float (max (1, iii2(i)-l))

65 c psav(i) = vidths(m)

66 iptu(i) = mlmnts+ra

67 end if

68 end do ! mfilimn

69 end if

70 mvary = i ! depth of do-loop nest

71

72 c

73 c Test and Ensure that we consider only: ID or 2D plots

74

76 if (mvary. eq.O .or. mvary. gt. 2) then

76 write (iout,211)

77 stop

78 end if

79 c

80 c Discern breakpoint

81

82 read (idat,*,err=ll,end=ll) mvarii, kt, kts, old

83 write (iout,121)

84 write (iout,lll) mvarii, kt, kts, old

86 if (mvarii .ne .mvary .or. kt.lt.l .or. kts. It. 1 .or.

86 k old. le. 0.0 ) goto 11

87 do i=l, mvary

88 read (idat,*,err=ll,end=ll) j, iiii(i), pppp(i), psav(i)

89 write (iout,112) j, iiii(i), pppp(i), psav(i)

90

91 if (iiii(i) .It. 1 .or. j.ne.i .or.

92 k iiii(i) .gt. iii2(i) .or.

98 k pppp(i) .It. pppl(i)-ppp3(i)*0.001 .or.

94 k pppp(i) .gt. ppp2(i)+ppp3(i)*0.001 .or.

96 k psav(i) .It. pppl(i)-ppp3(i)*0.001 .or.

96 Jt psav(i) .gt. ppp2(i)+ppp3(i)*0.001 ) then

97 write (iout,113)

98 stop ! goto 11

99 end if

100

101 if (iiii(i) .It .iii2(i) .or. iii2(i) .eq.l) then

102 PPPPi = pppl(i)+ppp3(i)*float(iiii(i) -1) ! [,)

103 else

121
104 PPPPi = ppp2(i) ! ] 105 end. il

106 it (a'bs(pppp(i)-ppppi) .gt. ppp3(i)*0 .01) then

107 write (iout,113)

108 stop ! goto 11

109 end if

110 end do

111 write (iout,114)

112 iiistp = 1 113 iii = mvary

114 itl = iftime (i) ! start clock

115 goto 2 ! start at interior, resume

116 11 continue ! start at beginning

117 write (iout,115)

118 itl = iftime (i) ! start clock

119

120 C

121 c Forimilate header card for the plot utility

122 c Plot format: nx,ny,nu /(i,x,y,u) =====> index backwards

123

124 m = 1 ! (v,g)

125 kt = mvary+1

126 if (mvary .eq. 1) then

127 write (iplt,212) (iii2(kt-j), j=l, mvary), m ! header card

128 else

129 write (iplt,213) (iii2(kt-j), j=l, mvary), m ! header card

130 end if

131 c ======================================================

132 c Emulate, initialize, activate: the nest of do-loops

133

134 do i=l, mvary

136 iiii(i) = 0 ! initialization: il-iS

136 end do

137 kt = 0

138 iiistp = 1 ! do-loop increment

139 iii = 0 ! index of: nested do-variables

140 1 iii = iii+1 ! index of: iii-th nested do

141 if (iii .gt. mvary) goto 3

142 2 iiii(iii) = iiii(iii) + iiistp ! update do-loop variable

143 if (iiii(iii) .It. iii2(iii)) then ! test upper limit

144 pppp(iii) = pppl(iii) + ppp3(iii)*float (iiii(iii) -1)

145 goto 1

146 else if (iiii(iii) .eq. iii2(iii)) then

147 if (iii2(iii) .eq. 1) then

148 pppp(iii) = pppl(iii)

149 else

150 pppp(iii) = ppp2(iii)

151 end if

152 goto 1 153 end if

154 iiii(iii) = 0 ! reset inner do, il-i3

156 iii = iii-1 ! backup one do-level

156 if (iii .eq. 0) goto 4 ! escape nest of do-loops

122
167 goto 2

158 3 iii = ! level of inner-most nested do.

159 c ! begin processing body

160

161 kt = kt+1 ! simple counter

162 do i^l.mvary ! re-set model parameters

163 m = iptu(i)

164 it (m.le .mlmnts) then

165 diefcn(m) = pppp(i) ! n+ik

166 else

167 m = m-mlmnts

168 widths (m) = pppp(i) ! z

169 end if

170 end do ! vary

171

173 c* call zoom2 (pppl, ppp2, ppp3) ! iterate ' steepest descent

173

174 llnorm = .false.

176 call asmbl

176 call norm (meqns ,bb,bnorm,l) ! retain norm of residual

177 bnorm = bnorm*raddeg ! degrees

178 c

17B

180 m = mvary+1 ! backnards

181 write (iplt, 214) kt , (pppp(m-j), j=l,mvary), bnorm

182

183 c

184 if (kt.eq.l) then

185 kts = 1 ! density of states

186 old = bnorm

187 do i=l,mvea'y ! retain model parameters

188 m = iptu(i)

189 if (m. le .mlmnts) then

190 psavCi) = diefcn(m)

191 else

193 m = m-mlmnts

193 psav(i) = Hidths(m)

104 end if

195 end do ! vary

196 else if (bnorm.lt .old) then

197 kts = 1 198 old = bnorm

199 do i=l,mvEiry

200 m = iptu(i)

201 if (m. le .mlmnts) then

202 psav(i) = diefcn(m)

203 else

204 m = m-mlmnts

205 pBav(i) = widths(m)

206 end if

207 end do ! vary

208 else if (bnorm. eq. old) then ! retain density of states

209 kts = kts+1 ! along the minimum

123
210 end if

211

212 it2 = iftime (i) ! CPU clock

213 tim = float (it2-itl) /6.0E4 ! CPU minutes elapsed

214 if (tim .gt. 15.0) then ! breeikpoint

215 itl = it2

216 open (unit=isout, file='x.80Ut' , status= 'unknown'

)

217 write (isout,lll) mvary, kt, kts, old

218 do i=l,mvEu:y

219 write (isout,112) i, iiii(i), pppp(i), psav(i)

220 end do

221 call time (bufft)

222 call date (buffd)

223 write (isout,116) bufft, buffd ! convenience

224 close (unit=isout)

225 end if

226 c ! finish processing body

227 goto 2 ! nested do-loop: iiii

22S 4 continue ! last line of do-nest, iiii

229 C ======================================

230 Ibdry = .false.

231

232 write (iout,104) kt, kts, old ! density of states along minimum

233 write (iout,105)

234 do i=l, mvary

236 local = (psav(i) .le. pppi(i)+ppp3(i)*0.001) .or.

236 k (psav(i) .ge. ppp2(i)-ppp3(i)*0.001)

237 c* local = local .and. (iii2(i) .ne . 1)

238 if (local) lbdry=.true.

239 m = iptu(i)

240 if (m.le.mlmnts) then ! n+ik ' diefcn

241 diefcn(m) = psav(i)

242 if (local) then

243 write (iout,106) i, psav(i), m, '(n+ik)', blemk

244 else

245 write (iout,106) i, psav(i), m, '(n+ik)'

246 end if

247 else ! z ' widths

248 m = m-mlmnts

249 widths(m) = psav(i)

260 if (local) then

251 write (iout,106) i, psav(i), m, '(z )', blank

262 else

253 write (iout,106) i, psav(i), m, '(z )'

254 end if

265 end if

256 end do ! vary

257 if (Ibdry) write (iout,107)

258 write (iout,108)

259

260 return

261

262 101 format (/' Scan a grid of model parameters. (scan2g)'

124
263 k /' Grid info:', 4x, 'initial,', 6x, 'final,',

384 k Bx, 'increment' ) 205 102 format ( 3x, i4, ') ', 3fl3.4,

288 t ' ' for:', i5, ', ', a6)

287

288 103 format (/' scan2g, error: inconsistent data input')

289 104 format (/' number of grid points scanned, kt = ', ilO

270 k /' population along the minimum, kts = ', ilO

271 k /' norm of residual, |g| = ', lpel3.5,

272 ft ' (degrees) ') 273 105 format (/' Model pareuneter value along the minimum:')

274 106 format (lx,i4, ')', lplel5.6, ' ' for:', i5, ', ', a6,

275 ft al , ' ' boundary '

)

278 107 format (/' Note that the minimum point is near a boundary.')

277 108 format (/' output sritten to: x.plot')

278 278 111 format (li, i4,lx, 2il0, lplelB.6, ' ' mvary, kt, kts, b(min)')

280 112 format (Ix, 2(i4,lx), Ip2el5.6, ' ' i, ip, p, p(min)')

381 113 format (/' The attempted restart sas SOT acceptable.')

282 114 format (/' The attempted restart was acceptable.')

288 115 format (/' Ifote: NO attempt was made to restart.')

384 116 format (

' wall clock: time = ', a8, Ix, ' ' hh:mm:ss '

386 ft / ' date = ', a9, ' ' dd-mmm-yy' ) 388 387 121 format (' ') 388

380 211 format (/' ... oops, we consider only: ID or 2D plots, '

300 ft / ' we allow only : mvary ' 1 or 2 '

)

301 212 format ( Ix, 2i4, ' ' mx,mu / (i, x, u(x)'lgl) ') 303 213 format ( Ix, 3i4, ' ' mx(2),mx(l), mu /(i, x(2),x(l), u'Igl)')

303 214 format ( Ix, i6, Ip3el5.6)

304 end

125
6.2.8 SCAN3.FOR

1 subroutine scanS

2 include ' iounit .

3 include ' defnit .

4 include 'filminin.'

5 include 'filmss.'

6 include 'seance'

78 integer iipt(niii), jjpt(niii)

9 integer jjjj(niii), jjj2(niii)

10 real qqqq(niii), qqql(niii), qqq2(niii), qqq3(niii)

11 real qsav(niii)

12

13 logical Ibdry, local, Icoupl

14 character blimk, comma

15 data bljucik /' '/, comma/','/

le

17 c Solve the forvard scattering problem over a grid of model parameters.

18 c Note: the model pareuneters involve partitions of:

19 c C froz / froz (grid) / vary (grid, continuous) ] 20 c [froz > < vary]

2122

23 raddeg = 180.0 / 3.14169268 ! degrees < radians

24

25 C ===============================:=======:==========================

26 c Input grid info for scanning the model parameters

27

28 write (iout.lll)

29 ki = 0 ! simple cotinter

30 k = 0 ! froz, grid

31 i = 0 I vary, grid

32 do m=l,mlmnts ! (n+ik)

33 if (Ivaryl(m) .ne. 0) then ! grid

34 ki = ki+1

35 read (idat, •<) ji pit p2, p3

36 write (iout,112) ki, pi, p2, p3, j, '(n+ik)'

37

38 if ( j.ne.m .or. p2.lt.pl .or.

39 k pi. It. 0.0 .or. p2.lt. 0.0 .or. p3.lt. 0.0) then

40 write (iout,113)

41 stop

42 end if

43 if (Ivaryl(m) .eq. 1) then ! vary

44 i = i+1

45 j = niii+l-i ! backward

46 else ! froz

47 k = k+1

48 2 - ^

49 end if

so

126
51 if (p3.eq.0.0) p3=p2-pl

52 if (pS.eq.O.O) then

53 iii2(j) = 1

64 else

66 iii2(j) = 1 + nint ((p2-pl)/p3)

60 end if

67 PPPl(j) = pi- es PPp2(j) = p2

69 PPp3(j) = (p2-pl) /float (max (1, iii2(j)-l))

60 c* pBav(j) = diefcn(m) ! n+ik

ex iipt(j) = m

03 jjpt(m) = j 63 end if

64 end do ! mlmnts

65

66 if (mf ilnon.ne .0) then

67 do m=l,mfilmm ! z ' thickness

68 if (Ivaryz(m) .ne. 0) then

69 ki = ki+1

70 read (idat, *) j, pi, p2, p3

71 write (iout,112) ki, pi, p2, p3, j, '(z )'

72

73 if ( j.ne.m .or. p2.lt.pl .or.

74 k pi. It. 0.0 .or. p2.lt. 0.0 .or. p3.lt. 0.0) then

76 write (iout,113)

76 stop

77 end if

78 if (IvaryzCm) .eq. 1) then ! vary

79 i = i+1

80 j = niii-i-l-i ! backwards

81 else ! froz

82 k = k+1

83 j = k

84 end if

66

86 if (p3.eq.0.0) p3=p2-pl

87 if (p3.eq.0.0) then

88 iii2(j) = 1

89 else

90 iii2(j) = 1 + nint ((p2-pl)/p3)

91 end if

93 PPPl(j) = Pl

93 PPP2(j) = p2

94 PPp3(j) = (p2-pl) /float (max (1, iii2(j)-l))

96 c* psav(j) = widths(m)

96 iipt(j) = m+mlmnts

97 jjpt(m+mlmnts) = j 68 end if

99 end do ! mfilmm

100 end if

101

102 mfrozz = k ! depth of do-loop nest/grid: froz

103 mvaryy = i ! depth of do-loop nest/grid: vary

127
104 muv = mfrozz+mvaryy

105

100 C

107 C Outpuli PBiige of d.o~loops ioT ths grxd: froz, vary

108

109

•if (mfrozz .eg^. 0) then

110 writtS (1011^,114) mfrozz

111 stop

112 else

113 write ^loutfl^ly 'iroz'

114 do i=l, mfrozz

lis m = iipt(i)

116 11 v.ni . J.0 .mimzits J txien

117 write (iout |122) i , iii2(i)

,

m, Hn+ikJ

118 else

119 m = m-mlmnts

120 write (iout, 122) i, iii2(i). m, '(z )'

121 end iif

ATI A A r\

1 exid if

124

125 if (mvaryy .eq^. 0) thou

126 write (iout, 115) mvaryy

127 stop

128 else

129 write (iout, 121) 'vary'

130 do i=l , mvaryy

131 J — niii+l—

! backwards

132 m = iipt(j)

133 11 . J.e .mlinxits j then

134 write (iout, 122) i, iii2(j). m, ' Qn+ikJ

136 else

136 m = m-mlmnts

137 write (iout, 122) i, iii2(j). m, '(z )'

138

• - end if

139 end do

140 end if

141

142 c

143 c Discern whether: VARY model pareuneters are coupled between samples

144 c Note here that the couplings:

145 c 1) between samples are suppressed, while those

146 c 2) within the sample are fully accotinted.

147

148 mm = mlmnts+mfilmm

149 do m=l ,mm ! initialize template

160 iptw(m) = 0 ! cumulative

151 iptv(m) = 0 ! individual

152 end do

163

164 iws = 0

166 mws = 0

156 do is=l,msampl

128
157 mwave = imwave(is)

158 mlilm = niif ilm(is)

159 mlilms = mlilm+1

160 do iw=l, mwave

101 ivB = iws+l

162 ivave = iiwaveCins)

163 mbien = iiiibent(iws)

164 do m=l,mfilm8

165 if (m.ne .mf ilms) then

166 m7s = mvs+1

167 iz = iifilm(inws)

168 if (Ivaryz(iz) .eq. 1) then

169 j = mlmnts+iz

170 iptv(j) = 1 ! vary

171 end if

172 end if

173 do ink=l,2

174 mws = mws+1

175 nk = iifilm(mws)

176 if (Ivaryl(nk) .eq. 1) then

177 iptv(nk) = 1 ! vary

178 end if

179 end do ! n+ik

180 end do ! films

181 end do ! waves

182

183 do m=l,mm ! overlap

184 iptw(m) = iptw(m)+iptv(m) ! cumulative

185 iptv(m) = 0 ! individual ' initialize

186 end do

187 end do ! samples

188 189 k = 0 ! count couplings

190 do m=l,mm

191 if (iptw(m) .gt .1) k=k+l

192 end do

193

194 if (k.eq.O) then ! no vary couplings

195 Icoupl = .false. ! between samples

196 else ! couplings/overlap

197 Icoupl = .true.

198 write (iout.lSl) k

199 do m=i,mm

200 if (iptw(m) .gt . 1) then

201 if (m.le. mlmnts) then

202 write (iout,132) m, '(n+ik)'

203 else

204 j = m-mlmnts

205 write (iout,132) j, '(z )'

206 end if

207 end if

208 end do

209 write (iout,133)

129
210 C* stop

211 end if

212 213 C ================================================================

214 c Discern breakpoint, [froz > < vary]

216 2ie write (iout,141)

317 read (idat,*,err=ll,end=ll) kk, ii, ktu, bmin

218 write (iout,142) kk, ii, ktu, bmin

219 if (kk.ne.mfrozz .or. ii .ne .mvaryy .or.

220 t ktu. It. 1 .or. bmin. It. 0.0 ) goto 11

221 222 do i=l,mfrozz

223 j = i

234 read (idat,*,err=ll,end=ll) ii, iiii( j ) ,pppp( j ) ,psav( j ) ,im

226 write (iout,143) ii, iiii( j ) ,pppp( j ) ,psav( j ) ,im

226 m = iipt(j)

227 if (m.gt .mlmnts) m=m-mlmnts

228 229 if ( ii .ne. i .or.

330 fc im .ne. m .or.

331 I; iiii(j) .It. 1 .or.

332 fc iiii(j) .gt. iii2(j) .or.

233 ft PPPP(j) -It- pppl(j)-ppp3(j)*0.001 .or.

234 . ft PPPP(j) -gt- ppp2(j)+ppp3(j)*0.001 .or.

385 ft psavCj) .It. pppl( j )-ppp3( j )*0.001 .or.

236 ft psav(j) .gt. ppp2(j)+ppp3(j)*0.001 ) then

237 write (iout,146)

238 stop ! goto 11

239 end if

240

341 if (iiii(j) .lt.iii2(j) .or. iii2(j) .eq.l) then

242 PPPPi = PPPKj) + ppp3(j)*float (iiii(j) -1) ! [,)

243 else

244 PPPPi = PPp2(j) ! ] 246 end if

246 if (abs(pppp( j )-ppppi) .gt. ppp3(j)*0.00l) then

247 write (iout,146)

248 stop ! goto 11

249 end if

260 end do ! mfrozz

261

262 if (mvarjry.ne.O) then

253 do i=l, mvaryy

264 j = niii+l-i ! backwards

266 read (idat,*,err=ll,end=ll) ii, psav(j), im

256 write (iout,144) ii, psav(j), im

257 m = iipt(j)

258 if (m.gt .mlmnts) m=m-mlmnts

259 260 if ( ii .ne. i+mfrozz .or.

261 ft im .ne. m .or.

262 ft psav(j) .It. pppl(j)-ppp3(j)*0.001 .or.

130
363

204

365 366 367

368

369 370

371 373 37S

374

375

376 377

378

379

380 C

381 C

383 383

384

386 380 387

388

380 300

391 393 30S

394

396 390

397

398

399 300

301 303

303

304

306 30«

307

308 e

300

310

311 313 313

314

316

psav(j) .gt. ppp2(j)+ppp3(j)*0.001

write (iout,146)

stop ! goto 11

end if

) then

end do

end if

write (iout,147)

iiistp = 1 iii = mfrozz

itl = iftime (i)

goto 22

11 continue

write (iout,148)

itl = iftime (i)

start clock

re-start

! start from beginning

! start clock

nest of do-loops (froz)

! index/counter

! initialization: il-i3

! do-loop increment

! index of: nested do-variables

! index of: iii-th. nested do

! update do-loop variable

! test upper limit

Emulate, initialize, activate:

ktu = 0

do i=l,mfrozz

iiii(i) = 0 end do

iiistp = 1 iii = 0 21 iii = iii+1

if (iii .gt. mfrozz) goto 23

22 iiii(iii) = iiii(iii) + iiistp

if (iiii(iii) .It. iii2(iii)) then

pppp(iii) = pppl(iii) + ppp3(iii)*f loat (iiii(iii) -1)

goto 21

else if (iiii(iii) .eq. iii2(iii)) then

if (iii2(iii) .eq. 1) then

pppp(iii) = pppl(iii)

else

pppp(iii) = ppp2(iii)

end if

goto 21

end if

iiii(iii) = 0

iii = iii-1

if (iii .eq. 0) goto 24

goto 22

23 iii = iii-1

reset inner do, il-i3

backup one do-level

escape nest of do-loops

ktu = ktu+1

do i=l, mfrozz m = iipt(i)

if (m.le.mlmnts) then

diefcn(m) = pppp(i)

else

! level of inner-most nested do.

! begin processing body

! simple counter

! re-set model parameters

! n+ik

131
316 m = m-mlmnts

317 QidthsCm) = pppp(i) ! z

318 Olid d.£ 319 end do

320

321 isiun = 0 ! sxun: meqns

322

323

siuni = 0.0 ! stun : 1 g 1 C

324 C Output model pareuneters associated with grid: txoz

325 836 write (iout,151)

327 write (iout,152) ktu

828 do i=l,mfrozz

329 m = iipt(i)

330 if (m.le.mlmnts) then

331 write (iout,153) i, iiii(i), pppp(i), m, '(n+ik)'

332 else

333 m = m-mlmnts

334 write (iout,153) i, iiii(i), pppp(i), m, '(z )'

335 end if

336

337 end doc

338 c Assume that VART model parameters are uncoupled between samples.

339 c Each sample is separately scanned across its own VART parameters

340

341 Ibdry = .false.

342 ngl = 0

343 XT USW B Z~ V

344 mws = 0

345 iaws = 0

346 iraws = 0

347

348

do is=l,msampl

c

340 isx = is ! save

350 nglx = ngl

361 iwsx = iws

352 mwsx = mws

353 iawsx = iaws

354 irawsx = iraws

355 350 do m=l,mm ! localize: vary

357 iptw(m) = 0

358 end do

350 300 mwave = nnwave(is)

361 mfilm = nnfilm(is)

362 mfilms = mfilm+1

363 do iw=l, mwave

364 iws = iws+1

365 iwave = iiwave(iws)

366 mbien = nnbent(iws)

367 do m=l, mfilms

368 if (m.ne .mfilms) then

132
M0 mws = mws+l

S70 iz = iifilm(mws)

in zzz(m) = widths (iz)

87a if (Ivaryz(iz) .oq. 1) then

S7» iptwCmlmnts+iz) = 1 S74 end if

STi end if

876 do ink=l,2

877 mws = mws+1

87S nk = iif ilm(mws)

879 if (IvaryKnk) .eq. 1) then

880 iptw(nk) = 1 881 end if

883 end do

888 end do ! films

884

888 do mbn=l,mbien ! pointers

888 iaws = iaws+l

887 mrpeat = nnpeat(iaws)

888 do irpeat=l .mrpeat

880 iraws = iraws+l

800 mangl = mangle (iraws)

801 ngl = ngl+mangl ! multiple tmgles

803 end do ! repeat

808 end do ! ambient

804 end do ! wave

805 e ! arrang, localized

808 i = 0

807 k = 0

808 do m=l,mm

800 if (iptw(m) .eq. 1) then ! vary, local

400 i = i+1

401 iptu(i) = m

403 iptv(m) = i

408 iptw(m) = 0

404 else ! froz, elsewise

408 k = k+l

408 km = mm+l-k

407 iptu(km) = m

400 iptv( m) = km

400 end if

410 end do

411 fflvary = i

413 mfroz = k

418 C

414 if (mvary.eq.O) then ! everything is frozen

415 c* llnorm = .false.

418 e* call asmbl3 (isx, iwsx, mwsx, iawsx, irawsx, nglx)

417 G* call norm (meqns, bb, old.l) ! retain norm of residual

418 G* old = old*raddeg ! degrees

410 e* goto 34

430

431 write (iout,161) mvary, is

133
423 Stop

423 end if

424 c ! do-nest: local

42B do i=l,mvary

426 m = iptu(i) ! n+ik, iz+mlmiits <

427 j = jjpt(m)

428 j j j2(i) = iii2(j)

429 qqql(i) = pppKj)

430 qqq2(i) = ppp2(j)

431 qqq3(i) = ppp3(j)

432 end do

433

434 C ===============================-============================

435 c Emulate, initialize, activate: nest of do-loops (vary)

436 437 ktv = 0 ! index/counter

438 do i=l,mvEury

439 jjjjCi) = 0

440 end do

441 c iiistp = 1 442 jjj = 0 ! index of: nested do-variables.

443 31 jjj = jjj+1 ! index of: iii-th nested do.

444 if (jjj .gt. mvary) goto 33

445 32 j3jj(jjj) = jjjj(jjj) + iiistp ! update do-loop variable

446 if (jjjj(jjj) .It. jjj2(jjj)) then ! test upper limit

447 qqqq(jjj) = qqqKjjj) + qqq3(jjj)*fioat (jjjj(jjj) -i)

448 goto 31

449 else if (jjjj(jjj) .eq. jjj2(jjj)) then

460 if (jjj2(jjj) .eq. 1) then

451 qqqq(jjj) = qqqKjjj)

452 else

453 qqqq(jjj) = qqq2(jjj)

454 end if

455 goto 31

456 end if

457 ' reset inner do, il-i3

458 ' backup one do-level

469 if (jjj .eq. 0) goto 34 ! escape nest of do-loops

460 goto 32

461 33 jjj = ' level of inner-most nested do.

462 c ! begin processing body

463

464 ktv = ktv+1 ! simple counter

465 do i=l, mvary ! reset model parameters

466 m = iptu(i)

467 if (m.le.mlmnts) then

468 diefcn(m) = qqqq(i)

469 else

470 m = m-mlmnts

471 widths (m) = qqqq(i)

472 end if

473 end do

474

134
476 call zooms (qqql> qqq2, qqqS, ! damped least squares

470 t isx, ivsx, mssx, iavsx, irawsx, nglx)

477 llnorm = .false.

478 call asmblS (isx, iwsx, mwsx, iawsx, irawsx, nglx)

479 call norm (meqns, bb, bnorm, 1) ! retain norm of residual

480 bnorm = bnorm*raddeg ! degrees

481 482 if (ktv.eq.l) then ! initial

483 ktvmin = 1 484 old = bnorm

485 do i=l,mvary

486 m = iptu(i)

487 j = jjpt(m)

488 if (m.la .mlmnts) then

489 qsav(j) = diefcn(m)

490 else

491 m = m-mlmnts

492 q8av(j) = widths (m)

493 end if

494 end do

496 else if (bnorm.lt .old) then

496 ktvmin = 1 497 old = bnorm

498 do i=l,mvar7

499 m = iptu(i)

500 j = jjpt(m)

601 if (m.le .mlmnts) then

603 q8av(j) = diefcn(m)

608 else

604 m = m-mlmnts

606 qsav(j) = widths (m)

606 end if

607 end do

608 else if (bnorm. eq. old) then ! along minimum

509 ktvmin = ktvmin+1 ! population

610 end if

611

61J c ! finish processing body

61S goto 32 ! nested do-loop: jjjj

514 34 continue ! last line of do-nest

515 c ============================================================

516 c Output results: VART model parameters of the sample.

617

618 if (is.eq.l) then

619 write (iout,17l)

520 end if

621 write (iout,172) is, old

522 638 if (mvary.ne.O) then

634 do i=l,mvary

635 m = iptu(i)

626 j = jjpt(m)

627 local = (qsav(j) .le. pppl(j)+ppp3(j)*0.001) .or.

135

\
B28 k (qsavCj) .ge. ppp2(j)-ppp3(j)*0.001)

529 C* local = local .and. (iii2( j ) .ne . 1)

530 if (local) lbdry=.true.

531

632 if (m.le .mlnnts) then

633 if (local) then

534 write (iout,173) q8av(j), m, '(n+ik)', blank

636 else

536 write (iout,173) qsav(j), m, '(n+ik)'

637 end if

538 else

639 m = m-mlmnts

540 if (local) then

541 write (iout,173) qsav(j), m, '(z )', blank

542 else

543 write (iout,173) qsav(j), m, '(z )'

644 end if

645 end if

546 end do

547 end if

548

649 isun = isun + meqns ! meqns

660 sujni = sumi + old*old*float (meqns) ! |g|

551

652 end do ! samples

553 c

654 c Note: summing |b(s)| from each seunple ===>

666 c NO coupling between samples by 7ART parameters.

656

557 sumi = sqrt (sumi/float (isum)) ! |g| without coupling

558 if (Ibdry) then

559 write (iout,174) sumi, comma

560 else

561 write (iout,174) sumi

562 end if

663

664 c

565 c If coupling exists between samples via VART model parameters.

666 c the calculation of the ctimulative residual is meaningless.

667 c because the coupled VAR7 parameter is NOT necessarily held common

668

669 c Discern the cumulative residual along the minimum.

570 c Restore the VARY model parameters associated with the minimum.

571

672 if (mvaryy .ne .0) then

673 do i=l, mvaryy

674 j = niii+l-i ! backwards

575 n = iipt(j)

676 if (m.le .mlmnts) then

677 diefcn(m) = qsav(j)

578 else

579 m = m-mlmnts

680 widths (m) = q8av(j)

136
S81 end if

683 end do

583 end if

584

585 C

686 llnorm = .false.

687 call asmbl

688 call norm (meqns ,bb,bnorra,l) ! retain norm of residual

688 bnorm = bnorm*raddeg ! degrees

580

691 if (Ictu.eq.l) then

593 ktumin = 1 ! density of states

693 bmin = bnorm

694 do i=l,muv ! retain model parameters

596 if (i.le.mfrozz) then

598 j = i

597 else

698 j = niii+1 - (i-mfrozz)

599 end if

600 m = iipt(j)

601 if (ffl.le .mlmnts) then

603 psavCj) = diefcn(m)

605 else

604 m = m-mlmnts

606 psav(j) = widths (m)

606 end if

607 end do

008 else if (bnorm . It . bmin) then

609 ktumin = 1

610 bmin = bnorm

611 do i=l,muv ! retain model parameters

613 if (i.le.mfrozz) then

613 j = i

614 else

616 j = niii+1 - (i-mfrozz)

616 end if

617 m = iipt(j)

618 if (m.le .mlmnts) then

618 psav(j) = diefcn(m)

630 else

631 m = m-mlmnts

633 p8av(j) = widths (m)

633 end if

024 end do

635 else if (bnorm. eq. bmin) then ! retain density of states

636 ktumin = ktumin+l ! along the minimum

637 end if

638

629 C

630 c Breakpoint

631 683 it2 = iftima (i) ! CPU clock

633 tim = float (it2-itl) /6.0E4 ! CPU minutes elapsed

137
034 if (tin .gt. 15.0} then ! brecdipoizit

035 itl = it2

630 037 close (uziit=iout)

638 open (vinit=iout,file='x.out ' , status= ' old' , access= ' append'

)

639

640 open (unit=isout, f ile='x.sout' , Btatus='imlaioBn'

)

641 write (isout,142) mfrozz, mvaryy, ktu, bmin

642 do i=l,mfrozz

643 m = iipt(i)

644 if (m.le .mlmnts) then

645 write (i80ut,143) i, iiii(i), pppp(i), psav(i), in, 646 t ', (n+ik), froz'

647 else

648 m = m-mlmnts

649 write (iBout,143) i, iiii(i), pppp(i), psav(i), m,

050 I; '« (z ), froz'

651 end if

652 end do

653 if (fflvaryy.ne.O) then

654 j do i=l, mvaryy

665 ii = i+mfrozz ! convenience counter

056 j = niii+l-i ! backwards

657 m = iipt(j)

658 if (m.le .mlmnts) then

659 write (isout,144) ii, psav(j), m,

660 ft ', (n+ik), vary'

661 else

662 m = m-mlmnts

663 write (isout,144) ii, psav(j), m,

664 ft ', (z ), vary'

665 end if

666 end do

667 end if

668

669 call time (bufft)

670 call date (buffd)

671 write (isout,200) bufft, buffd ! convenience

672 close (unit=isout)

673 end if

674 c ! finish processing body

675 goto 22 ! nested do-loop: iiii

676 24 continue ! last line of do-nest

677 c ================================================================

678

679 write (iout,lBl)

680 write (iout,181) ktu, ktumin, bmin

681 Ibdry = .false.

682 683 write (iout,182) 'froz'

684 do i=l,mfrozz

685 j = i

686 m = iipt(i)

138
687 local = (psav(j) .le. pppl(j)+ppp3(j)*0.001) .or.

888 k (psav(j) .go. ppp2(j)-ppp3(j)*0.001)

688 c* local = local .and. (iii2( j ) .na . 1)

690 il (local) lbdry=.true.

691 if (m. la .mlnzits) then

692 dieicn(m) = psav(j)

693 if (local) then

694 write (iout,183) psav(j), m, ' (n+ik) ' , blank

695 else

696 write (iout,183) psav(j), m, ' (n+ik)

697 end if

698 else

699 m = m-mlmnts

700 widths (m) = psav(j)

701 if (local) then

702 write (iout,183) psav(j), m, '(z )', blank

703 else

704 write (iout,183) psav(j), m, '(z )'

706 end if

706 end if

707 end do

708 709 if (mvaryy .ne. 0) then

710 write (iout,182) 'vary'

711 do i=l,mv«u:yy

712 j = niii+l-i

713 m = iipt(j)

714 local = (psav(j) .le. pppl( j )+ppp3(j )*0 .001) .or.

716 k (psav(j) .ge. ppp2( j )-ppp3( j )*0 .001)

716 c* local = local .and. (iii2( j ) .ne . 1)

717 if (local) lbdry=.true.

718 if (m . le .mlmnts) then

719 diefcn(m) = psav(j)

730 if (local) then

721 write (iout,183) p8av(j), m, '(n+ik)', blank

723 else

733 write (iout,183) psav(j), m, '(n+ik)'

724 end if

736 else

726 m = m-mlnints

727 widths (ra) = psav(j)

728 if (local) then

729 write (iout,183) psav(j), m, '(z )', blank

730 else

781 write (iout,183) psav(j), m, '(z )'

733 end if

733 end if

734 end do

735 end if

73« 737 if (Ibdry ) write (iout,184)

738 if (Icoupl) write (iout,133)

739

139
740 return

741 742 111 format (/' Scan a grid of model parameters.'

743 t /' Grid info:', 4x, 'initial,', 6x, 'final,',

744 ft 5x, 'increment' ) 745 112 format ( Ix, i4, ')', 3x, 3fl3.4,

m ft ' • for: ' , iB, ' , • , a6)

747 113 format (/' oops, inconsistent data input')

748 114 format (/' oops, number of model pareuneters in the grid: '

,749 ft /' froz ' ' , i4

750 ft /' use alternate option: ichoic ' 3')

75if 115 format (/' oops, number of model parameters in the grid: '

762 ft /' vary ' ' , i4 ) 753

764 121 format (/' Range of do-loops: ', a4)

766 122 format ( Ix, i4, ')', i7, 3x, 'grid points for:', i6, ', ', a6)

756 767 131 format (/' Couplings between samples involve: ', i3,

758 ft ' distinct model parameters')

759 132 format (9x, i4, ',', 3x, a6)

760 1 33 format (/' Note: The existence of coupling between seunples'

761 ft /* due to the VARY model parameters — '

782 ft /' induces an unusual interpretation unto the residual Igl,'

763 ft /' because, while providing coupling, they are NOT ' 784 ft /' necessarily of similar value on different samples.' /)

785 766 141 format (/' Attempt to read breakpoint information')

767 142 format (Ix, 3i5, lplel5.6, 25x, ' ' mfrozz, mvaryy, ', 768 ft 'ktu, bmin')

789 143 format (Ix, 2i5, 5x, Ip2el5.6, iE, 5x, ' ' i, ip, p, psav, m'

,

770 ft al6 ) 771 144 format (Ix, iB, lOx, lplelB.6, iB, Bx, • ' i, psav, m'

,

772 ft al6 ) 778

774 146 format (/' The attempted restart was NOT acceptable.')

775 147 format (/' The attempted restart was acceptable.')

778 148 format (/' Note: NO attempt was made to restart.')

777

778 151 format (/ ix, 17 ('====') ) 779 152 format ( 4x, »#', i7, 19x, grid: froz» ) 780 153 format ( Ix, i4, ')', 2x, i4, Ix, lplel5.6,

781 ft ' " model parameter for:', i5, ', ', a6)

782

!r83 161 format (/' oops, mvary =', i4, ' < Note, local'

784 ft /' sampl =' , i4 ) 785

786 1 71 format ( 5x, 16 (' ') 787 ft / 8x, 'sample', 17x, '' grid: vary')

788 172 format ( 8x, i4, Ix, lplel5.6, 3x, '' Igl')

789 173 format ( 13x, lplel5.6,

790 ft ' ' for:', i5, ', ', a6, al, 6x, '* boundary')

791 174 format ( 13x, lplel5.6, ' ' |g| ' summed over samples',

792 ft al , ' boundary '

)

140
793

794 181 format (/' number of FROZ grid points scanned, ktu = ilO

795 k /' population along the minimum, ktum = ', ilO

796 k /' norm of residual, |g| = ', 797 k lpel3.6, ' (degrees) ')

798 1 82 format (/' Model pareuneter value along the minimum:', 4x, a4)

799 183 format ( 13x, lplel5.6, ' ' for:', i5, ', ', a6,

800 k al , ' ' boundary '

)

801 184 format (/' Ifote that the minimum point is near a boundary.')

802 803

804 200 format (

' sail clock: time = ', a8, Ix, ' ' hh:mm:ss '

805 k / ' date = ', a9, ' ' dd-mmm-yy' ) 806 807 end

141
6.2.9 ZOOM.FOR

1 subroutine zoom ! unconstrained optimization

2 include 'iounit.'

3 include 'defnit.'

4 include 'lilmmm.'

6 include 'wstack.'

e include 'cgnxxl.'

7

8 data small / l.OE-6 /

9

10 raddeg = 180.0 / 3.14159265

11 llnorm = .false. ! ASMBL

12 call asmbl ! ia,ja,aa,bb

13 call norm (meqns, bb, bn, 1) ! residual

14 call scaljj (meqns ,mvary,ia,ja, aa, XX, aats,w,2) ! scale colujnns, A

15

16 if (bn .eq. 0.0) return

17 bn = bn*raddeg ! degrees <— radians

18 bnl = bn ! initial

le bn2 = bn ! last

20 loop = 0

21 niter = mvary*4 ! number of iterations

22 write (iout.lOl)

23 write (iout,102) loop, bn

24

25 1 itry = 0 ! initialize

26 loop = loop+i

27 do i=l,mvary ! initialize

28 xx(i) =0.0 ! Newton step

20 end do

30 call cgnl (meqns ,mvary, ia, ja,aa,bb,xx,

31 k niter, u,v,w, xw.se)

32 do i=l,mvary ! account for scaling

33 xx(i) = xx(i)/aats(i) ! columns in SCALJJ

34 se(i) = se(i)/aats(i)

35 end do

3637 2 do i=l,mvary ! update

38 j = iptu(i)

30 h = xx(i)*0.2 ! step length.

40 s = se(i)*0.2 ! estimated std dev

4142 if (j .le.mlmnts) then ! n+ik

43 f = diefcn(j)

44 g = uncerl(j)

46 c* write (iout,121) i,j,f,h

46 ha = amaxl (s, 0.001, abs(f*0.2))

47 ha = aminl (g, abs(h), ha)

48 if (h. It. 0.0) ha=-ha

49 aat(i) = f ! retain

50 diefcn(j) = amaxl (0.0, f+ha)

142
61 else ! z

62 j = j-mlmntB

63 i = widthsCj)

64 g = uncerz(j)

66 c* vrite (iout,122) i,j,f,h

66 ha = amaxl (s, 0.01, f>x0.2)

57 ha = aminl (g, abs(h), ha)

58 il (h. It. 0.0) ha=-ha

59 aat(i) = 1 ! retain

00 7idths(j) = amaxl (0.0, f+ha)

ei end if

82 end do

«s64 call asmbl ! ia,ja,aB,'bb

66 call norm (meqns, bb, bn, 1) ! residual

66 call scaljj (meqns ,mvar7,ia,ja, aa, XX, aats,w,2) ! scale coliunns, A

67 bn = bn*raddeg ! degrees < radieuis

68 total = bn /bnl ! total reduction

69 relat = bn /bn2 ! relative reduction

70

71 if (total .le. l.OE-5) then ! convergence

72 bn2 = bn ! retain

73 goto 4 ! escape

74 end if

76

76 if (relat .le. 0.999) then ! converging

77 bn2 = bn ! retain

78 goto 3 ! iterate

79 end if

80

81 do i=l,fflvar7 ! reset

82 j = iptu(i)

83 if ( j . le .mlmnts) then

84 diefcn(j) = aat(i)

85 else

86 j = j -mlmnts

87 7idths(j) = aat(i)

88 end if

89 end do

90

91 if (itry.lt. 3) then ! try again

92 itry = itry+1

93 do i=l,mvary

04 xi(i) = xx(i)*0.B ! reduce stepsize

95 end do

96 goto 2

97 end if

9899 if (loop .le. 3) then ! convenience

100 Brite (iout,104)

101 if (relat .le. 1.0) then ! marginal

102 write (iout,105)

103 else ! divergence

143
104 nrite (iout,106)

105 end it

106 end if

107 goto 5 ! escape

108

100 3 write (iout,103) loop, relat, total, bn

110 goto 1

111 4 write (iout,103) loop, relat, total, bn

113 6 continue

lis

114 c Output results of iterations involving least squares.

115 lie write (iout,lll) ! results

117 do i=l,mvary

118 j = iptu(i)

119 if ( j .le .mlmnts) then ! n+ik

120 write (iout,112) i, diefcn(j), se(i), j 121 else ! z

123 j = j -mlmnts

133 write (iout,113) i, widths(j), se(i), j 134 end if

125 end do

128. write (iout,114) bnl, bn2 ! compare

137

138 return

130

180 101 format (/' zoom: loop, ratio of reduction, Igl'

131 k /' (rel) (total) ') 183 102 format ( 8x, iB, 24x, lplel2.3, ' (degrees)' ) 138 103 format ( 8x, i5, Ip3el2.3)

134 104 format ( 8x, 'stepsize reduction attempted.')

135 lOB format ( 8x, '... slow convergence.')

136 106 format ( 8x, '... divergence.')

137

138 111 format (/' model parameter value along the minimum: ')

130 112 format (Ix, i4, ')', flB.4, fl3.B, ' for:',

140 k i4, ', (n+ik), estimated uncertainty '

)

141 113 format (Ix, i4, ')', flB.4, fl3.B, ' for:',

143 k i4, ', (z ), estimated uncertainty'

)

143 114 format (/' initial Igl =', lplel3.E, ' (degrees)'

144 k /' final Igl =' , el3.B)

145 146 121 format (20x, iB,')',iB. lp2elB.B, ', (n+ik), d(n+ik)')

147 122 format (20x, iB,')',iB, lp2elB.B, ', (z ), d(z )')

148

140 end

144
6.2.10 ZOOM2.FOR

1 subroutine zoom2 (pppl, ppp2, ppp3) ! constrained optimization

3 real pppl(l), ppp2(l), ppp3(l) ! used by: SCM2

3

4 include 'iounit.'

6 include 'defnit.'

a include 'filmmin.'

7 include 'wstack.'

8 include ' cgnzxl .

0

10 data small / l.OE-5 /

11

13 raddeg = 180.0 / 3.14159265 ! degrees < radians

15 llnorm = .false. ! ASMBL

14 call asmbl ! ia,ja,aa,bb

IB call norm (meqns , bb, bn, 1) ! residual

16 call scaljj (meqns ,mvary,ia, ja,aa,xx, aat3,Q,2) ! scale columns, A

17

18 if (bn .eq. 0.0) return

10 bn = bn*raddeg ! degrees < radians

30 bnl = bn ! initial

31 bzi2 = bn ! last

33 loop = 0

35 niter = mvza-y*4 ! number of iterations

34 c vrite (iout.lOl)

36 c write (iout,102) loop, bn

3637 1 itry = 0 ! initialize

as loop = loop+1

30 do i=l,mvary ! initialize

so xx(i) =0.0 ! Newton step

31 end do

33 call cgnl (meqns ,mvary, ia, ja,aa,bb,xx,

88 k niter, u,v,w, xw,se)

84 do i=l,mvary ! account for scaling

36 xx(i) = xx(i)/aats(i) ! columns in SCALJJ

86 Be(i) = se(i}/aat8(i)

87 end do

88

38 *2 do i=l,mvary ! update

40 j = iptu(i)

41 h = xx(i)*0.2 ! step length

43 8 = 8e(i}>x0.2 ! estimated std dev

43

44 if ( j .le .mlmnts) then ! n+ik

46 f = diefcn(j)

49 g = uncerl(j)

47 c* write (iout,121) i,j,f,h

48 ha = amaxl (s, 0.001, abs(f»'0.2)}

40 ha = aminl (g, ab8(h), ha, ppp3(i))

60 if (h. It. 0.0) ha=-ha

145
51 aat(i) = i ! retain

B3 di«fcn(j) = anaxl (0.0, f-t-ha) B8

54 if (diefcn(j) .It. pppl(i}) then ! ensure compactness

55 dielcn(j) = pppl(i)

56 else if (diefcn(j) .gt. ppp2(i}) then

57 dielcn(j) = ppp2(i)

58 end if

59 else ! z

60 j = j-mlmnts

61 f = widths(j)

62 g = uncerzCj)

63 c* write (iout,122) i,j,f,h

64 ha = amaxl (s, 0.01, f*0.2)

65 ha = aminl (g, abs(h), ha, ppp3(i))

66 if (h. It. 0.0) ha=-ha

67 aat(i) = f ! retain

68 vidthsCj) = amaxl (0.0, f+ha)

69

70 if (widths(j) .It. pppl(i)) then ! ensure compactness

71 widthB(j) = pppl(i)

73 else if (widths(j) .gt. ppp2(i)) then

78 widths(j) = ppp2(i)

74 end if

,,„75 end if

76 end do

7778 call asmbl ! ia,ja,aa,bb

70 ' call norm (meqns, bb, bn, 1) ! residual

80 call scaljj (meqns ,mvary,ia, ja,aa,xx, aat8,v,2) ! scale columns, A

81 bn = bn<)<raddeg ! degrees

82 total = bn /bnl ! total reduction

83 relat = bn /bn2 ! relative reduction

84

85 if (total .le. l.OE-B) then ! convergence

86 bn2 = bn ! retain

87 goto 4 ! escape

88 end if

89

00 if (relat .le. 0.999) then ! converging

01 bn2 = bn ! retain

^92 goto 3 ! iterate

93 end if

94

95 do i=l,mvary ! reset

96 j = iptu(i)

97 if (j .le.mlmnts) then

98 diefcn(j) = aat(i)

99 else

100 j = j-mlmnts

101 vidths(j) = aat(i)

. 102 end if

103 end do

146
104

1 flK il (itry.lt. 3) then ! try again

lOfl itry = itry+1

107 do i=l,mvary

zx(i) = xx(i)*0.5 I reduce stepsize

109 end do

1 1 n goto 2

111 111 end if

113

lis C if (loop .le. 3) then ! convenience

114 C vrite (iout,104}

1 1 R if (relat .le . 1.0) then ! marginal

116 Q srite (iout.lOS)

117 c else ! divergence

lis 110 c ?rite (iout,106)

1111 o

V

Q end if

120 Q end if

121 goto 6 ! escape

133

133 continue

134 c srite (iout,103) loop, relat, total, bn

136 goto 1 136 A continue

137 c srite (iout,103) loop, relat, total, bn

139 cD continue

139

1lOvHA w write (iout,114) bnl, bn2 ! compare

191 return

183

LOO 101 format (/' zoom2: loop, ratio of reduction, Igl'

184 k /' (rel) (total) ')

186 102 format ( 8x, i6, 24x, lplel2.3, ' (degrees)' )

1190Ul 103 format ( 8x, iB, Ip3el2.3)

104 format ( 8x, 'stepsize reduction attempted.')

186 106 format ( 8x, '. .

.

slow convergence . '

)

189 100 format ( 8x, '

. .

.

divergence. '

)

140

141 111 format (/' model parameter value along the minimum: ')

143 114 format (/' initial Igl =', lplel3.B, ' (degrees)'

148 k /' final Igl ='. elS.B)

144

145 121 format (20x, 2iB, lp2elB.B, ', diefcn')

146 122 format (20x, 2iE, lp2elB.B. ', widths')

147 end

147
6.2.11 ZOOM3.FOR

1 subroutine zoom3 (pppli FPF2, pppS,

2 1: isx, iwsx, mwsx, iawsx, irawsx, nglx)

8

4 real pppl(l), ppp2(l),, ppp3(l)

6 integer isx, iwsx, mwsx, iawsx, irawsx, nglx

e

r includa 'ionsiit.'

8 include ' defnit .

9 include 'filmimn.'

10 include 'wstack.'

11 include 'cgnxxl.'

12

13 data small / l.OE-5 /

14

15 c This routine is called/used by: SCANS

le

17 raddeg = 180.0 / 3.141E9265 ! degrees < radians

18 llnorm = .false. ! ASMBL

le call asmblS (isx, iwsx, mwsx, iawsx, irawsx, nglx) ! ia,ja,aa,bb

20 call norm (meqns, bb, bn, 1) ! residual

21 call scaljj (meqns ,mvary,ia, ja,aa,xx, aats,w,2) ! scale columns, A

22

23 il (bn .eq. 0.0) »— -_m

24 bn = bn*raddeg I degrees < radians

25 bnl = bn ' ! initial

26 bn2 = bn ! last

27 loop = 0

28 niter = mvary*4 ! number of iterations

29 c write (iout,101)

30 c write (iout,102) loop, bn

31

32 1 itry = 0 ! initialize

33 loop = loop+1

34 do i=l,mvary ! initialize

35 xx(i) =0.0 ! Newton step

30 end do

37 call cgnl (meqns ,mvary , ia, ja,aa,bb,xx,

38 t niter, u,v,w, xw,se)

39 do i=i,mvary ! account for scaling

40 xx(i) = xx(i)/aats(i) f columns in SCALJJ

41 se(i) = se(i)/aats(i)

42 end do

43

44 2 do i=l,mvary ! update

45 j = iptu(i)

48 h = xx(i)*0.2 ! step length.

47 s = se(i)*0.2 ! estimated std dev

48

49 if (j .le.mlmnts) then ! n+ik

50 f = diefcn(j)

148
61 g - imcerl(j)

63 e* vrite (iout,121) i,j,f,h

6S ha = amazl (s, 0.001, abs(f >*>0.2))

64 ha = aminl (g, abs(h}, ha, ppp3(i))

66 if (h. It. 0.0} ha=-ha

6S aat(i) = i ! retain

67

68 diefc&Cj) = amaxl (0.0, f+ha)

89 if (diefcn(j) .It. pppl(i)) then ! ensure compactness

00 diefcn(j) = pppl(i)

01 else if (diefcn(j) .gt. ppp2(i)) then.

03 diefcn(j) = ppp2(i)

88 end if

04 else ! z

06 j = j-mlmnts

08 f = widthsCj)

87 g = uncerz(j)

08 C* Brite (iout,122) i,j,f,h

09 ha = aineixl (s, 0.01, f*0.2)

70 ha = asiinl (g, abs(h), ha, ppp3(i)}

71 if (h. It. 0.0) ha=-ha

73 aat(i) = f ! retain

7874 widthsCj) = amaxl (0.0, f+ha)

76 if (widths(j) .It. pppl(i)) then ! ensure compactness

70 vidths(j) = pppl(i)

77 else if (widths(j) .gt. ppp2(i)) then

78 9idths(j) = ppp2(i)

79 end if

80 end if

81 end do

8388 call asmblS (isz, iwsx, mwsz, iawsx, irawsx. nglx) ! ia,ja,aa

84 call norm (meqns, bb, bn, 1) ! residual

86 call scaljj (meqns ,mvar7,ia, ja,aa,xx, aats.o ,2) ! scale columns

80 bn = bn*raddeg ! degrees

87 total = bn /bnl ! total reduction

88

89 relat = bn /bn2 ! relative reduction

90 if (total .le. l.OE-B) then ! convergence

91 bn2 — bn ! retain

93 goto 4 ! escape

98 end if

94

96 if (relat .le. 0.999) then ! converging

90 bn2 — bn ! retain

97 goto 3 ! iterate

98 end if

99

100 do i=l,mvar7 ! reset

101 j = iptu(i)

103 if (j .le .mlmnts) then

ICS diefcn(j) = aat(i)

149
104 else

105 j = j-mlmnts

106 widths(j) = aat(i)

107 end if

108 end do

loe 110 if (itry.lt. 3) then ! try again

111 itry = itry+1

112 do i=l,mvary

113 xx(i) = xx(i)*O.B ! reduce step

114 end do

116 goto 2

lie end if

117

118 C if (loop .le. 3) then ! convenience

119 C write (iout,104)

120 c if (relat .le. 1.0) then ! marginal

121 c write (iout.lOB)

122 c else ! divergence

123 c write (iout.lOe)

124 c end if

126 c end if

126 goto E ! escape

127

128 3 continue

129 c write (iout,103) loop, relat, total, bn

130 goto 1

131 4 continue

132 c write (iout,103) loop, relat, total, bn

133 5 continue

134

136 c write (iout,114) bnl, bn2 ! compare

136 return

137

138 101 format (/' zoom3: loop, ratio of reduction, Igl'

139 k /' (rel) (total) '

140 102 format ( 8x, iE, 24x, lplel2.3, ' (degrees)' ) 141 103 format ( 8x, iE, Ip3el2.3)

142 104 format ( 3x, 'stepsize reduction attempted.')

143 105 format ( 8x, '... slow convergence.')

144 106 format ( 8x, '... divergence.')

145 146 111 format (/' model parameter value along the minimum: ') 147 114 format (/' initial |g| =', lplel3.E, ' (degrees)'

148 k /> final Igl =', el3.5)

149 150 121 format (20x, 2i5, lp2elB.5, ', diefcn')

161 122 format (20x, 2iB, lp2elB.E, ', widths')

162 end

150
6.2.12 ASMBL.FOR

1 subroutine asmbl

3 include ' iounit .

'

9 include 'defnit.'

4 include 'lilminm.'

5 include 'filmss.'

6

7 include 'seanucl.'

8 logical firstv

910 real a(nrows*2), b(2), c(2)

11 Q The sparse matrix format for the model pareuneters is of the form:

1

2

Q [(ii/k)_(l), .... (n/k)_(mlmnts)] ' diefcn (w)

13 c C z_(l)t z_(mfilms)] ' widths

14

15

10 call arrang

1 7 mm = mlmnts+mfilmm ! model parameters

18 ii = 1 ! lA

19 ia(l) = 1 20 jj = 0 ! JA

21

22 iws = 0

23 mwB = 0

24 iavB = 0

25 iraws = 0

20 ngl = 0 ! measured data

27 do iB=l,msampl

28 mfilm = nnfilm(is) ! FILMSS

39 mwave = nnwave(is)

30 mf ilms = mfilm+1 I films/substrate

31 Z1X09 = mfilm*3+2

32 do iw=l, mwave

33 iws = iws+1

34 iwave = iiwave(iwB)

36 mbien = nnbent(iws)

oO qq = Haveqq(iwave) ! FILMSS

37 do i=l,nrow ! initialize local pointers

38 iptx(i) = 0 ! vary —> imique

ipty(i) = 0 ! vary —> full

end do

41 iv = 0 ! local, full, non-unique

42 kv = 0 ! local, vary, non-unique

43 mv = 0 ! local, vary, compress

44

45 do m=l,mfilms ! films/substrate

40 if (m.ne .mf ilms) then ! films ' z

47 mws = mws+1

48 iz = iifilm(mws)

49 zzz(m) = widths (iz) ! FILMSS

60 iv = iv+1 ! local, full

151
51 il (Ivaryz(iz) .eq.l) then ! vary

52 j = mlmnts+iz

53 i = iptv(j) ! nonlocal, compress

54 kv = kv+1 ! local, non-unique

65 iptx(kv) = i ! local ' nonlocal

66 ipty(kv) = iv ! local

57 if (iptw(i) .eq.O) then ! compress , unique

58 mv = mv+1 ! local counter

59 iptv(i} = mv ! local

ap jj = jj+i ! within row A

61 j^Cjj) ~ i ! column

62 end if

63 end if

64 end if

65 do ink=l,2 ! n+ik

66 mws = mws+1

67 nk = iifilm(mwB)

68 c(ink) = diefcn(nk) ! n,k

60 iv = iv+1 ! local, full

70 if (Ivaryl(nk) .eq. 1) then ! vary

71 i = iptv(nk) ! nonlocal, compress

72 kv = kv+1 ! local, non-unique

73 iptx(kv) = i ! local ' nonlocal

74 ipty(kv) = iv ! local

75 if (iptw(i) .eq.O) then ! compress, unique

76 mv = mv+1 ! local counter

77 iptw(i) = mv ! local

78 jj = jj+l • within row A. 79 j*Cjj) = i ' column

80 end if

81 end if

82 end do

83 die(m) = cmplx (c(l), c(2)) **2 ! FILMSS

84 end do ! mfilms

8586 if (mv.eq.O) then

87 write (iout,100) is,iw,iwave

88 stop

80 end if

90

91 firstv = .true.

93, do ml3n=l,mbien ! ambient

94 iaws = iaws+1

95 imbien = iibent(iaws)

96 mrpeat = nnpeat(iaws)

97 air = ambentC imbien) ! FILMSS

98 do irpeat=l , mrpeat

99 iraws = iraws+1

100 mangl = mangle (iraws)

101 do iangl=l , mangl ! incident angles

102 ngl = ngl+1 ! measured data

103 angl = luigles(ngl)

152
104 call scatr (qq.angl, b,a,c)

105

106 c* write (iout.lOl) ngl, psiiis(ngl), deltas (ngl) , b

107

io« bb(ii ) = psiiis(ngl) - b(l) ! psi

109 bb(ii+l) = deltas(iigl) - b(2) ! delta

110

111 ia(ii+l) = ia(ii )+mv ! psi

112 ia(ii+2) = ia(ii+l)+niv ! delta

113

114 it (mv.ne.O) then ! <==================

iiB if (lirstv) then ! psi completed already

116 lirstv = .lalse.

117 do j=l,mv ! unique

118 jj = jj+1

118 = ja(jj-niv) ! delta

120 end do

121 else

122 do j=l,mv ! unique

123 jj = jj+1

124 ja(jj ) = ja(jj-mv) ! psi

126 jaCjj+mv) = ja(jj ) ! delta

126 end do

127 jj = jj+mv

128 end if

128

130 jl = ia(ii ) 131 j2 = ia(ii+l)-l

132 do j=jl,j2 ! compress

133 aa(j ) = 0.0 ! psi

134 aa(j+mv) =0.0 ! delta

136 end do

136 137 do k=l,kv ! local, vary, non-unique

138 iv = ipty(k) ! local, full

139 iv2 = iv+iv ! delta ' a ' local, full

140 ivl = iv2-l ! psi ' a ' local, full

141

142 i = iptx(k) ! nonlocal, compress

143 imv = iptw(i) ! local, compress —> ja.aa

144 jjl = jl-l+imv ! psi ' aa

145 jj2 = jjl + mv ! delta ' aa

146 147 aa(jjl) = aa(jjl) + a(ivl) ! psi'

148 aa(jj2) = aa(jj2) + a(iv2) ! delta'

140 end do ! two rows in A

150 end if ! <==================

161

152 c Renormalize rows in the matrix, least square.

153 if (llnorm) then

164 bb(ii ) = bb(ii ) /psiiiu(ngl) ! psi

165 bb(ii+l) = bb(ii+l) /deltau(ngl) ! delta

166

153
167 il (mv.ne.O) then ! <==================

168 do j=l,niv

169 aa(jl-l+j) = aa(jl-l+j) /psiiiu(ngl) ! psi

160 aa(j2 +j) = aa(j2 +j) /deltau(ngl) ! delta

161 end do

162 end it ! <==================

163 end if

164

165 ii = ii+2

lee end do ! angle

167 end do ! repeat

168 end do ! ambient

169

170 il (mv.ne.O) then ! <==================

171 do k=l,kv ! re-initialize

172 i = iptx(k) ! unique-ness

173 iptw(i) = 0 ! indicator

174 end do

176 end ±1 ! <==================

176

177 end do ! nave

178 end do ! sample

179 meqns = ii-1

180

181 ii (jj .ne. ia(ii)-l) then

182 write (ioiit,102) ii, jj, ia(ii)

183 stop

184 end if

186 if (jj .gt. nnjaaa) then

186 write (iout,104)

187 stop

188 end if

189 return

190

101 100 format (' oops, there is NO varying model parameter'

192 k /' for the case involving: seunple = ' , i3

193 k /* where the ', i3, '-th wave = ', i3)

194 101 format (' asmbl, ', iB, Ip2el4.4, ' ' ngl, psi, delta'

195 k /' ', 5x, 2el4.4)

196 102 format (' asmbl, inconsistent format of sparse matrix, '

197 k /' ii = ' , ilO

198 k /' jj = '. ilO. ' =/= ilO, ' = ia(ii)-l ')

199 104 format (' asmbl, array allocation for the sparse matrix '

200 k /' has been exceeded. '

201 k /' aa,ja < nnjaaa (DEFNIT.)' ) 202 203 end

154
6.2.13 ASMBL3.FOR

112 callad bv ZDDM3

3

4 subroutine asmbl3 (isx, iwsx, mwsx. iawsx, irawsx, nglx)

5 include ' iounit .

s include ' defnit .

7 include 'filminm. ' include 'filmss.'

include 'seamxl.'

10

11 logical firstv

12

13 real a(nross*2), b(2), c(2)

14 c The sparse matrix format for the model parameters is of the form:

IB c [(n/k)_(l), .... (n/k)_(mlmnts)] ' diefcn (w)

18 c C ••» z_(mfilms)] ' widths

17

18

19 c* call arremg

20 mm = mlmnts+mf ilmm ! model parameters

21 ii = 1 ! lA

22 ia(l) = 1 23 jj = 0 ! 31

24

26 is - isz

28 i7s = ivsx ! 0

27 m7s = mvBZ ! 0

28 iavs = iavsx ! 0

29 irass = ira^sz ! 0

SO ngl = ngli ! 0 ! measured data

SI

32 c* do is=l,mBampl

33 mfilm = nnfilm(is) ! FILMSS

34 mwave = nnwaveCis)

35 mfilms = mfilm+1 ! films/substrate

38 nrow = mfilm*3+2

37 do iv=l, mwave

38 iwB = iws+1

39 iwave = iiwaveCiws)

40 mbien = nnbentCiws)

41 qq = waveqqC iwave) ! FILMSS

42 do i=l,nrow ! initialize local pointers

43 iptx(i) = 0 ! vary —> unique

44 ipty(i) = 0 ! vary —> full

45 end do

48 iv = 0 ! local, full, non-unique

47 kv = 0 ! local, vary, non-unique

48 mv = 0 ! local, vary, compress

49

50 do m=i, mfilms films/substrate

155
51 if (ri .no .nif ilms ) lilioii ! ziims z

R9o«53 iz — i.d.f xlin(niws

)

ot FTT Mc:e;

OD iv — ! 56 xt (Ivaryz(iz) .oq^.l) trhezi ! vary

tf f 1 " IuXmXLwS~XZ

OORA i J-P w V V J J 59 local, non~um(]iie

60 ipwA^AVy — X ! 61 ipty Ckv) — iv ! local

62 IXn ^ in T^*^ nfii Oi ATI 1 V "^P^ " \ ^ / • • / ulLOlL ; ^COmpXoSB ATIH^^F ABB 1^ VI n A jUJlXC^lLO 63 mv — mv+l ! local coun'tor

64 xpliwCi.) — itiv ! xocax

65 jj = jj+^ • within ro9 A

66 ja(jj) = i ! coxuinn

67 end 11

68 ond. if

69 end if

70 CIO inx-i , z '. n+xk

f 1 lu w s — inws~x

IT ~ T T ^ T 1 Tn 1 TTl 13 0 1

73 cv.xzla^ — clxoxciivilk^ ; n 9 A

74 iv = iv+1 ! local, full

75 if Clvaxyl(iiJc) .ocj.l) IsIioil ! vary

78 X — XpwVVXLK^ I nonlocal, compress

77 kv = kv+1 ! local , non-unic^ue

78 j.ocax XLOXLXOcax

79 iptyCkv) — iv ! xocax

80 11 vipu^vi J • eq^. u j men ! compress, unique

.81 mv = mv+l ! local counter

82 iptiwCi) = mv ! xocax

83 jj = jj+1 ! within row A

84 ja(jj) = i ! column

85 end if

86 end if

87 end. d.0 88 QXO ^Xny — cmpXA ^C^X/i Q\Z J J ! r XLirl^D OXLU wlv • IiLXXXinS BO

91 c* if (mv.eq.O) then

92 c* write (ioutilOO) is, iw, iwave

93 c* stop

94 end if

9596 fifstv — .tz^e.

97

98 do ml3n=l ,ml3ien ! ambient

99 iaws — iaws+1

100 imbien = iibent(iaws)

101 mrpeat = nnpeat(iaws)

102 air = ambentC imbien) ! FILHSS

103 do irpeat=l , mrpeat

156
104 iraws = iraws+1

105 mangl = mangle (iraws)

100 do iangl=l ,m2mgl ! incident angles

107 ngl = ngl+1 ! measured data

108 azigl = angles (ngl)

109 call scatr (qq.angl, b.a .c)

110

111 C* write (ioutjlOl) ngl, psiiis(ngl), (leltas(ngl) , b

112 113 bb(ii ) = psiiis(ngl) - b(l) ! psi

114 bb(ii+l) = deltas (ngl) - b(2) ! delta

115 116 ia(ii+l) = ia(ii )+mv ! psi

117 ia(ii+2) = ia(ii+l)+mv ! delta

118

119 if (mv.ne.O) then ! <==================

130 it (firstv) then ! psi completed already

131 firstv = .false.

133 do j=l,mv ! unique

133 jj =

134 ja(jj) = ja(jj-mv) ! delta

135 end do

130 else

137 do j=l,mv ! unique

138 jj =

139 ja(jj ) = ja(jj-mv) ! psi

130 ja(jj+mv) = ja(jj ) ! delta

131 end do

133 jj = jj+mv

133 end if

134

136 jl = ia(ii ) 138 j2 = ia(ii+l)-l

187 do j=jl,j2 ! compress

138 aa(j ) = 0.0 ! psi

139 aa(j+mv) =0.0 ! delta

140 end do

141

143 do k=l,kv ! local, vary, non-uni

143 iv = ipty(k) ! local, full

144 iv2 = iv+iv ! delta ' a. ' local, full

148 ivl = iv2-l ! psi ' a ' local, full

148

147 i = iptx(k) ! nonlocal, compress

148 imv = iptw(i) ! local, compress —

>

149 jjl = jl-l+imv ! psi ' aa

160 jj2 = jjl + mv ! delta ' aa

151

153 aa(jjl) = aa(jjl) + a(ivl) ! psi'

153 aa(jj2) = aa(jj2) + a(iv2) ! delta'

164 end do ! two rows in A

155 end if ! <==================

158

157
157 c Renormalize rows in the matrix, least square.

158 if (llziorm) then

159 bb(ii ) = bb(ii ) /psiiiu(ngl) ! psi

leo bb(ii+l) = bb(ii+l) /deltau(ngl) ! delta

lei

162 il (mv.ne.O) then ! <

163 do j=l,mv

184 aa(jl-l+j) = aa(jl-l+j) /psiiiu(ngl) ! psi

165 aa(j2 +j) = aa(j2 +j) /deltau(ngl) ! delta

166 end do

167 end if ! <

168 end if

168 170 ii = ii+2

171 end do ! angle

172 end do ! repeat

173 end do ! ambient

174

176 if (kv.ne.O) then

176 do k=l,kv ! re-initialize

177 i = iptx(k) ! unique-ness

178 iptH(i) = 0 ! indicator

179 end do

180 end if

181

182 end do ! wave

183 c* end do ! sample

184 meqns = ii-1

185 186 if (jj .ne. ia(ii)-l) then

187 write (iout,102) ii, jj, ia(ii)

188 Stop

189 end if

190 if (jj .gt. nnjaaa) then

191 write (iout,104)

192 stop

193 end if

194

195 return

196 197 100 format (' oops, there is NO varying model parzuneter'

198 ft /" for the case involving: sample = ' , i3

199 ft /' where the i3, '-th wave = i3)

200 101 format (' asmbl, i5, Ip2el4.4, ' ' ngl, psi, delta'

201 ft /' 5x, 2el4.4)

202 102 format (' asmbl, inconsistent format of sparse matrix, '

203 ft /' ii = ' , ilO

204 ft /' jj = ilO, •=/=', ilO, ' = ia(ii)-l ')

205 104 format (' asmbl, array allocation for the sparse matrix '

206 ft /' has been exceeded. '

207 ft /« aa,ja < nnjaaa (DEFNIT.)' ) 208

209 end

158
6.2.14 ASMBLX.FOR

1

334

6e

7

8

9

10

11

CC

subroutine asmblx ! called by: SEAHA

include ' iounit .

include ' defnit . include 'filinmm.'

include 'filmsB.'

include 'seainzl.'

logical firstv, firstu

real a(nro7S*2), b(2), c(2)

Construct sparse matrix associated with model experiment.

Configuration: angle , repeat , ambient , wave , SEunple

.

13 c

13

14

c Ordering of indices in IPTU [vary—

>

<~froz]

16 call arrang

la17 mm = mlmnts+mfilmm ! model parameters

18 ii = 1

19 ia(l) = 1 ! vary

30 jj = 0

Si

33 iaa(l) = 1 ! frozen

38 jja = 0

34

36 iws = 0 wave. sampl

38 mwi = 0 nfilms.wBve. sampl

37 iavs = 0 ambient, wave. sampl

38 iraws = 0 repeat , ambient , wave

,

sampl

39 ngl = 0 ! ndegr .repeat .ambient .wave

,

SEunpl

SO do is=l,msampl

31 mfilm = nnfilm(is) ! FILMSS

33 mwave = nnvaveCis)

33 mlilms = mfilm+1 ! film/substrate

34 nrow = mfilm*3+2 ! (a.n.k) (n.k)

35 do i9=l,mvave

36 iws = iws+l

37 ivave = iiwaveCiws)

38 mbien = nnbentCiws)

89 qq = waveqqCiwave) ! FILMSS

40

41 do i=l,nro9

43 iptx(i) = 0 ! vary > unique

43 ipty(i) = 0 ! vary > full

44 kptx(i) = 0 ! froz > unique

46 lcpty(i) = 0 ! froz > full

40 end do

47 iv = 0 ! local, full, non--unique

48 kv = 0 ! local, vary, non--unique

49 mv = 0 ! local, vary, compress

60 ku = 0 ! local, froz, non--unique

159
51 mu = 0 ! local, froz, compress

52

53 do m=l ,mfilins ! films/substrate

54 if (m.ne .mf ilms) then ! films ' z

55 mws = mws+1

56 iz = iijCilm(mws)

57 zzz(m) = vidths(iz) ! FILMSS

58 iv = iv+1 ! local, full

5e j = mlmzits+iz ! nonlocal, full

60 if (IvaryzCiz) .eq.l) then ! vary

61 i = iptv(j) ! nonlocal, compress

62 kv = kv+1 ! local, non-unique

63 iptx(kv) = i ! local ' nonlocal

64 ipty(kv) = iv ! local, full

65 if (iptw(i) .eq.O) then ! compress, unique

66 mv = mv+1 ! local counter

67 iptff(i) = mv ! local

68 jj = jj+1

69 ja(jj) = i

70 end if

71 else ! frozen

72 i = iptv(j) ! nonlocal, compress (baekvards)

73 . ku = ku+1 ! local, non-unique

74 kptx(ku) = i ! local ' nonlocal (backwards)

75 kpty(ku) = iv ! local, full

76 . if (iptw(i) .eq.O) then ! compress, unique

77 mu = mu+1 ! local counter

78 iptw(i) = mu ! local

79 jja = jja+1

80 jaa(jja) = i ! backwards, ma+l-i=k

81 end if

82 end if

83 end if ! 2

84 do ink=l,2 ! n+ik

85 mws = mws+1

86 nk = iifilm(mws)

87 c(ink} = diefcn(nk) ! n,k

88 iv = iv+1 ! local, full, non-uni.que

89 if (Ivaryl(nk) .eq. 1) then ! vary

90 i = iptv(nk) ! nonlocal, compress

91 kv = kv+1 ! local, non-unique

92 iptx(kv) = i

93 ipty(kv) = iv

94 if (iptw(i) .eq.O) then ! compress, unique

95 mv = mv+1 ! local counter

96 iptw(i) = mv ! local

97 jj = jj+1

98 ja(j j) = i

99 end if

100 else ! frozen

101 i = iptv(nk) ! nonlocal, compress (backwards)

102 ku = ku+1 ! local, non-unique

103 kptx(ku) = i ! (backwards)

160
104 kpty(ku) = iv

106 it (iptw(i) .eq.O) then ! compress, unique

106 mu = mu+1 ! local counter

107 iptw(i) = mu ! local

108 jja = jja+1

109 jaa(jja) = i ! backwards, mm+l-i=k

110 end. if

111 end if

112 end do ! n+ik

113 die(m) = cmplx (c(l),c(2)) **2 ! FILMSS

114 end do ! mfilms

116

110 if (mv.eq.O) then

117 write (iout.lOO) is.iw.iwave

118 stop

110 end if

120

121 firstv = .true.

122 f irstu = .true

.

123

134 do mbn=l,mbien ! ambient

8

126 iaws = iavs+1

128 imbien = iibent(iaws)

127 mrpeat = nnpeat(iaws)

138 air = ambentC imbien) ! FILMSS

129 do irpeat=l , mrpeat ! repeats

130 iraws = iraws+l

131 mangl = mangle (iraws)

132 do iBngl=l ,mim.gl ! angles of incidence

133 ngl = ngl+1 ! measurement data

134 angl = angles (ngl)

136 angu = angleu(ngl)

130

137 call scatr (qq,angl, b,a .c)

138

130 DDQii } - psiiisCnglJ - b(l) ! deviation

140 bb(ii+l) = deltas(ngl) - b(2)

141

143 ec(ii ) = c(l) ! d/d incident

143

144 C cc(ii+l) = c(2)

146 ia(ii-M) = ia(ii)+mv ! vary

140 ia(ii+2) = ia(ii)+mv+mv

147 if (mv.ne.O) then

148 if (firstv) then

14S firstv = .false.

160 do j=l,mv

161 jj = jj+1

163 ja(jj) = ja(jj-mv)

163 end do

164 else

166 do j=l,mv

160 jj = jj+1

161
157

158 150 160

161 162 163

164

165 166 167

168 169

170

171 172 173

174

176 176 177

178

179 180

181 182 183

184

185 186 187

188

189

190

191 192 193

194

195 196 197

198

199 200

201 202 203

204

205 206

207

208

209

ja(jj ) = ja(jj-mv)

ja(jj+mv) = ja(jj ) end do

jj = jj+mv

end if

jl = ia(ii ) j2 = ia(ii+l)-l

do j=jl,j2

aa(j ) = 0.0

aa(j+mv) = 0.0

end do

do k=l,kv

iv = ipty(k)

iv2 = iv+iv

ivl = iv2-l

i = iptx(k)

imv = iptw(i)

jjl = jl-l+imv

jj2 = jjl + mv

! compress, initialize

! psi

! delta

local, non-unique

local full

delta ' a ' local, full

psi ' a ' local, full

nonlocal, compress

local, compress —> ja,aa

psi ' aa delta ' aa

aa(jjl) = aa(jjl) + a(ivl)

aa(jj2) = aa(jj2) + a(iv2)

end do

end if

iaa(ii+l) - iaa(ii)+mu ! frozen

iaa(ii+2) = iaa(ii)+mu+mu

if (mu.ne.O) then

if (firstu) then

firstu = .false,

do j=l,mu

jja = jja+1

jaa(jja) = jaa(jja-mu)

end do

else

do j=l,mu

jja = jja+1

jaaCjja ) = jaa(jja-mu)

jaa(jja+mu) = jaa(jja ) end do

jja = jja+mu

end if

jl = iaa(ii ) j2 = iaa(ii+l)-l

do j=jl.j2

aaa(j ) = 0.0

aaa(j+mu) = 0.0

end do

! psi'

! delta'

! compress, initialize

162
310 do k=l,ku ! compress

311 iv = kpty(k) ! a ' local Jacob!

313 iv2 = iv+iv ! dalta

318 ivl = iv2-l ! psi

314

316 i = kptx(k) ! backwards

310 imu = iptw(i) ! local, compress

317 jjl = jl-l+imu

318 jj2 = jjl + mu

319 330 aaa(jjl) = aaa(jjl) + a(ivl)

331 aaa(jj2) = aaa(jj2) + a(iv2)

333 end do

333 end if ! frozen

334 e

335 if (llnorm) then

33« bb(ii ) = bb(ii ) /psiiiu(ngl)

337 bb(ii+l) = bb(ii+l) /doltau(ngl)

338 cc(ii ) = cc(ii ) /psiiiu(ngl)

336 cc(ii+l) = cc(ii+l) /deltau(ngl)

380

381 jl = ia(ii ) 383 j2 = ia(ii+l)-l

388 do j=jl.j2

384 aa(j ) = aa(j ) /psiiiu(ngl)

386 aa(j+mv) = aa(j+mv) /deltau(ngl)

386 end do

387

388 if (mu.ne.O) then ! frozen

380 jl = iaa(ii ) 340 j2 = iaa(ii+l)-l

341 do j=jl.32

343 aaa(j ) = aaa(j )/psiiiu(ngl)

348 aaa(j+mu) = aaa( j-)-mu)/deltau(n£l)

344 end do

346 end if

346 end if ! renormalize

347

348 ii = ii+2

340 end do ! angles

380 end do ! repeat

381 end do ! ambient

363 368 if (kv.ne.O) then ! vary

364 do k=l,kv ! reset

366 i = iptx(k) ! imique-ness

366 iptw(i) = 0 ! indicator

387 end do

388 end if

360 if (ku.ne.O) then ! frozen

360 do k=l,ku ! reset

361 i = kptx(k) ! unique-ness

363 iptw(i) = 0 ! indicator

163
263 end do

264 end if

265 266 end do ! wave

267 end do ! s zunple

268 meqns = ii-1

269

270 if (jj .ne . ia(ii) -1) then

271 write (iout,102) ii, jj, ia(ii)

372 stop

378 end if

ii (jja .ne. iaa(ii)-l) then

275 write (iout,103) ii, jja, iaa(ii)

279 stop

277 end if

278 if (jj. gt.nnjaaa . or. jja. gt.nnjaaa) then

278 write (iout,104)

380 stop

281 end if

282 i$» return

284

285 100 format (/' asmblx

,

there is NO varying model parameter '

286 k /' for the case involving: sample =

387 k /' where the ', i3, '-th wave = ', i3 ) 388 102 format (/' asmblx. inconsistent format of sparse matrix, '

389 k 'aa ' vary'

290 k /• ii = ', ilO

391 k /' jj = ', ilO, '=/=', ilO, ' =/= ia(ii)

292 103 format (/' asmblx. inconsistent format of sparse matrix, '

293 k 'aaa ' froz'

294 k /' ii = ilO

295 k /' jja= ', ilO, ' =/= ', ilO, ' =/= iaaCii

296 104 format (/• asmblx

,

array allocation for the sparse matrix

297 /' has been exceeded.'

298 k /' aa,ja < nnjaaa (DEFNIT.)'

299 k /' aaa,jaa < nnjaaa (DEFNIT.)' ) 300

301 end

164
6.2.15 SCATR.FOR

This subroutine calculates the ellipsometric angles (A,^') and the associated partial derivatives.

1 lubroutine scatr (qq, angl, b,a,c)

a include 'defnit.'

8 include 'filznss.'

4 include 'rstack.'

s• real a(l), b(2), c(2)

T data pi / 3.1415926 /

8t

10 call forvrd (qq,azi.gl, Rs,Rp, dB,s,dRp, dAsa,dIlpa) ! angl 'radians

1113 nro? = mfilm*3+2 ! (z,n,k) (,n,]ic) 18 tx = real (R.s) 14 ly = aimag (Rs)

11 px = real (Rp)

16 py = aimag (Rp)

17 call polar (Bx,8y,sr,sa,l}

la call polair (px.py .pr.pa.l)

10so if (sr.eq.0.0) then

31 if (pr.eq.0.0) then

33 psi = 0.0

3S else

34 psi = O.B^pi

3t end if

30 else if (pr.eq.0.0) then ! sr > 0.0

37 psi =0.0

38 else if (pr.le.sr) then

30 psi = atan (pr/sr)

so else

81 psi = 0.5*pi - atan(sr/pr)

83 ezid if

8884 delta = pa-sa

8B 1 if (delta. It. 0.0) then

80 delta = delta+2.0

87 goto 1

88 else if (delta. ge .2.0) then

80 delta = delta-2.0

40 goto 1

41 end if

43 delta = delta*pi

48

44 b(l) = psi ! radians

41 b(2) = delta ! radians

40 k = 0

165
47

48 do n=l,nroQ ! d(psi, delta) /d(e) ' Jacobian

49 sxd = real (dRs(zi))

60 syd = aimag (dRs(n))

61 pxd = real (dRp(n))

82 pyd = aimag (dRp(ii))

63 ssrd = (sx*sxd+sy*syd)/sr ! iRsI'

64 PP^d = (px*pxd+py*pyd)/pr ! iRpI'

66 Bdel = (8x*syd-sy*sxd)/(8r*sr) ! delta(s)'

56 pdel = (px*pyd-py*pxd)/(pr*pr) ! delta(p)'

67

58 ddel = pdel-sdel ! delta'

69 dpsi = (sr*pprd-pr*ssrd)/(sr*sr+pr*pr) ! psi'

60

61 k = k+1

62 a(k) = dpsi

63 k = k+1

64 a(k) = ddel

65 end do

6667 sxd = real (dHsa)

68 syd = aimag (dRsa)

69 pxd = real (dRpa)

70 pyd = aimag (dApa)

71 ssrd = (8x*sxd+sy*syd)/sr ! iRsI'

72 pprd = (px*pxd+py*pyd)/pr ! iRpI'

73 sdel = (8x*8yd-sy*sxd)/(sr*8r) ! deltaCs)'

74 pdel = (px*pyd-py*pxd)/(pr*pr) ! delta(p)'

75

76 ddel = pdel-sdel ! delta'

77 dpsi = (8r*pprd-pr*88rd)/(8r*8r+pr*pr) ! psi'

78

79 c(l) = dpsi ! d(psi ) /d(angle), Jacobian

80 c(2) - ddel ! d(delta) /d( angle), Jacobian

82 return

83 end

166
6.2.16 FORWRD.FOR

This subroutine calculates the reflection coefficients (Rg^Rp) and the associated partial

derivatives.

1

2 subroutine lorwrd (qq.angl. Rs,Rp, dRs,dRp, dRsa,dRpa)

8 real qq, angl ! incident angle ' radians

4

S complex Rs.Rp, dRs(l) ,dRp(l) , dRsa.dRpa

6 complex half , one , two , four

,

etaO,etaOa, ctaO,ctaOa

7 complex top,bot,ss,pp, ssz ,ppz , sse ,ppe , ssa

,

ppa, ppl,pp2,pp3

8 include ' defnit .

! nfilffls, nrows

0 include 'filmss.

10 complex 7s(nfilffl8+l) , eta(nfilms+1)

11 complex yp(nf ilms+1) , cta(nf ilms+1)

1213 complex ee(nfilm8), em(nfilms), ep(nfilms). zq(nfilms)

14 c Solvethe direct/forward scattering problem.

16 c Discern: the reflection coefficient and Jacobian.

le c Given: dielectric function of films (isotropic,homogeneous .uniform)

17 c incident angle: angl (radians)

18 c Find: Rs, Rp. -> (psi, delta)

19 c dRs.dRp. < — partial wrt: dielectric function

20 e < — partial wrt: n ft k ' (n+ik)

31 e dRsa.dRpa < — partial wrt

- [n( air )*sin( angle)] **2

33 c < — partial wrt: incident angle in radians

38

34 c ... neglected here: < — partial wrt

<1

26 sa = sin (angl)

2fl ca = COB (angl)

27 as - air*sa

38 ac = air*ca

29 a82 = as*as air

30 etaO = cmplx ( ac, 0.0) air TE

31 etaOa = cmplx (-as, 0.0) air d(eta)/d(angl)

32 ctaO = cmplx ( ca/air, 0.0) air TM

83 ctaOa = cmplx (-sa/air, 0.0) air d(cta)/d(angl)

84

86 mlilms = mfilm+1 films, substrate

30 do i=l, mf ilms 1 films, substrate

87 eta(i) = sqrtt (die(i)-cmplx(a82,0.0)) ! TE

38 cta(i) = eta(i)/die(i) 1 TM

89 end do

40 hall = cmplx (O.B, 0.0)

41 one = cmplx (1.0, 0.0)

42 two = cmplx (2.0, 0.0)

43

44 four = cmplx (4.0, 0.0)

45 c Determine the reflection coefficients in air.

4e c Method for TE: admittance = T = - Hx/Ey, Rs uses E field.

167
47 c TM: impedance = Z = Ex/Ey, Rp uses H field.

48

49 ysCmfilns) = eta(mfilms) ! substrate

60 yp(mfilms) = cta(mfilms)

51 if (mfilm.ne .0) then

52 do i=infilm,l,-l ! backwards

63 X = zzz(i)*qq

54 zq(i) = cmplx (0.0, x) ! izq

55 ss = cmplx (0.0, x+x) * eta(i) ! izqn2

66 X = exp (real (ss))

57 y = aimag (ss)

58 ss = cmplx (x*cos(y), x*sin(y)) ! exp (izqn2)

69 ee(i) = ss

60 em(i) = one-ss

61 ep(i) = one+ss

63 ys(i) = eta(i)* ((em(i)*eta(i)+ep(i)*ys(i+l)) /

68 k (ep(i)*eta(i)+em(i)*ys(i+l)) ) 64 yp(i) = cta(i)* ((em(i)*cta(i)+ep(i)*yp(i+l)) /

66 ft (ep(i)*cta(i)+em(i)*yp(i+l)) ) 66 end do

67 end if

68 Rs = (etaO-ys(l)) /(etaO+ys(l)) ! air

69 Rp = (ctaO-yp(l)) /(ctaO+yp(l)) ! air

70 c* Rp = -Rp ! E < H

71

72 c Jacobian

73

74 do i=mf ilms ,1 ,-1 ! backwards

75 if (i.eq.mfilms) then I source substrate, T'

76 sse = half /eta(i) ! d(eta) /d(e)

77 ssa = sse ! d(eta) /d(-(air*sin)**2)

78 ppe = (cmplx (2.0*as2, 0.0) - die(i))

79 ft * half / (eta(i)* die(i)*die(i)) ! d(cta)/d(e)

80 ppa = half / (eta(i)*die(i)) ! d(cta)/d(-as**2)

81 else ! source film

82 bot = ep(i)*eta(i) + em(i)*ys(i+l) ! denominator, TE

83 top = em(i)*eta(i) + ep(i)*ys(i+l) ! numerator

84 ss = em(i) + zq(i)*ee(i)*(ys(i+l)-eta(i))

85 ft + ep(i)*half*(ys(i+l)/eta(i))

86 pp = ep(i)*half - zq(i)*ee(i)*(ys(i+l)-eta(i))

87

88 sse = (ss/bot) - (pp*top)/(bot*bot)

89 ssa = (ss + ep(i)*ota(i)*ssa) /bot -

90 ft (pp + em(i)*eta(i)*8sa)*top /(bot*bot)

91 ssz = two*ee(i)* (eta(i)**2) * ! d/d (izq2)

92 ft (ys(i+l)-eta(i)) * (ys(i+l)+eta(i)) /(bot*bot)

93

94 bot = ep(i)*eta(i) + em(i)*yp(i+l)*die(i) ! denominator, TM

95 top = em(i)*eta(i) + ep(i)*yp(i+l)*die(i) ! numerator

96 pp = (cmplx (2.0*a82, 0.0) - die(i))

97 ft * half / (eta(i)* die(i)*die(i)) ! d(cta)/d(e)

98

99 ppl = pp*top/bot

168
pp2 = em(i)*half/die(i) + ep(i)*cta(i)*yp(i+l) + 2q(i)*e8(i)*(yp(i+l)-cta(i))

pp3 = ep(i)*hall/die(i) + em(i)*cta(i)*yp(i+l) - z<i(i)*ee(i)*(yp(i+l)-cta(i))

ppe = ppl + pp2/bot - ppS+top/Cbot+bot)

ppl = hall*top /(bot*eta(i)*die(i))

pp2 = em(i)*h.all/die(i) + ep(i)*eta(i)*ppa + zq(i)*ee(i)*(yp(i+l)-cta(i))

pp3 = ep(i)*half/die(i) + em(i)»'eta(i)>*<ppa - zq(i)*ee(i)*(yp(i+l)-cta(i))

ppa = ppl + pp2/bot - pp3*top/(bot*bot)

pp = (ata(i)-die(i)*yp(i+l)) * («ta(i)+die(i)*yp(i+l))

ppz = -two*ee(i)*eta(i)*cta(i)* (pp/(bot*bot))

end if

if (i.ne.l) then ! transport, T'(e)

k = i-1

do j=]E,l,-l ! backwards

Bse = 8se*f our*ee( j )* ((eta(j)**2) /

((ep(j)*eta(j)+em(j)*ys(j+l))**2))

ppe = ppe*f our*oe( j )* ((cta(j)**2) /

((op(j)*cta(j)+em(j)*yp(j+l))**2))

end do

end if

Bse = -B8e*tBo*etaO /((eta0+ys(l))**2) ! R'(e)

ppe = -ppe*tso*ctaO /((cta0+yp(l))**2)

if (i .ne .mf ilms) then

if (i.ne.l) then ! transport, T'(izq2)

k = i-1

do j=k,l,-l ! backward

ssz = 8sz*f our*ee( j )* ((eta(j)**2) /

((ep(j)*eta(j)+em(j)*ys(j+l))**2))

ppz = ppz*four*ee(j)* ((cta(j)**2) /

((ep(j)*cta(j)+em(j)*yp(j+l))**2))

end do

end if ssz = -88z*two*etaO /((etaO+y8(l))**2) ! R'(izq2)

ppz = -ppz*two*ctaO /((cta0+yp(l))**2)

end if

The format of the Jacobian vector has the form:

air / f ilm#l / f ilm#2 I ... I mf ilm / substrate

[z,n,k, z,n,k, ... z,n,k, n,k]

k = 3*(i-l)

if (i.eq.mf ilms) then

k = k-1

else

88 = cmplx (0.0, qq*2.0)

ppz = -ppz

! position within Jacobian

! substrate, ( ,n,k)

! film, (z,n,k)

! d(izq2) /dz

! E < H

169
153 dRs(k+l) = ssz *B8 R'(z)

154 dRp(k-M) = ppz *SB R'(z)

155 end if

156 88 = 8qrtt (die(i)) n+ik

167 C* ppe = -ppe E < H

168 dKs (k+2) = sse ss*cmplx (2.0, 0.0) R' (n)

1i ORQV A \,X.J 160 dRp(k+2} = ppe *ss*cmplx (2.0, 0.0) R'(n)

161 dRp(k+3) = ppe *88*cmplx (0.0, 2.0) R'(k)

162 end do

163

164 C Since the angular partial8 involved: dR/d (-(air*sin)**2)

165 166 C and we vant partial8 wrt angle, i.e.: dR/d (angl) angl' radians

167 88 = cmplx (-air4>aiT»<8in(emgl+angl) , 0.0) ! d (--(air*8in)**2) /d(angl)

168 8Sa = 88a*88 ! d(Ts) /d(angl)

169 ppa = ppaf8 8 ! d(Tp) /d(angl)

170

171 ssa = two* (eta0a*ys(l)-eta0*88a) /((eta0+ys(l))**2) ! R'(a)

1 TO ppa = two* (ctaOa*yp(l)-ctaO*ppa) /((cta0+yp(l))**2)

173 c* ppa = -ppa ! E <- H

174 dJlsa = ssa ! R'(a)

176 dRpa = ppa

176 177 c Since the TM calculation utilizes H fields , i.e.

178 c Rp ' H(reflected)/H(incident)

,

179 c and that convention uses E fields, i.e..

180 Rp ' E(x, reflected) / E (x, incident )

,

181 182 c one may induce the minus sign (-) onto Rp above

183 return

184 end

170
6.2.17 STAT22.FOR

1 subroutine s tat 2 2 (iL,b)

2 real b(n)

3 include ' iouziit . *

4 logical llzero

6a data pi / 3.1415926536 /

7 C Perforin: simple statistics of deviations from the model.

8 C Discern: (mean, standard deviation) of deviations.

e c Assume: b(l) ' d(psi ) ' deviation ' experiment-model

10 c b(2) ' d(delta) ' deviation ' experiment-model

11

13 raddeg = 180.0 /pi ! degrees < radians

18 nh = n/2 ! psi, delta

14 h = float (nh)

1616 7rite (iout,lll)

ir if (n.le.l .or. n . ne . nh+nh) then

18 write (iout,112) n

19 stop

30 end if

31

33 al = 0.0

3S a2 = 0.0

34 do i=l,n,2 ! mean deviation

36 al = al + b(i ) ! psi

36 a2 = a2 + b(i+l) ! delta

27 end do

38 al = al /h ! psi

29 a2 = a2 /h ! delta

30

SI llzero = .false. ! zero variance

33 si = 0.0

33 s2 = 0.0

84 s3 = 0.0

36 do i=l,n,2 ! variance of deviations

36 si = si + (b(i )-al)**2 ! <psi I psi>

87 s2 = 82 + (b(i+l)-a2)**2 ! <delta| delta>

38 83 = s3 + (b(i+l)-a2)*(b(i)-al) ! <delta| psi>

39 end do

40 si = sqrt (si /h) ! standard deviation

41 82 = sqrt (s2 /h)

43 s3 = s3 /h ! covariance

43

44 if (sl.eq.0.0 .or. 82.eq.0.0) then ! exact fit ' no scatter

46 llzero = .true.

46 else

47 83 = 83 /(sl*s2) ! correlation coefficient

48 end if

49

60 al = al *raddeg ! degrees

171
51 a2 = a2 >xraddeg

52 si = si x<raddeg

53 s2 = s2 xraddeg

54

66 write (iout,113) al.sl, a2,s2, s3

56 il (llzero) write (iout,114)

57

58 return

5960 111 format (/ Ix, 15(' ')

61 k /' Statistics of deviations ' experiment-model ' g'

62 k //' where : g ' column array of length ' 2M '

63 k /' let: () ' (psi or delta) ' (1 or 2) '

64 * //' mean () = m() = <g()> = (1/M) sum: g() '

65 k /' variance () = < [g( )-m( )]**2 >

'

66 k /' covariance = < [g(l)-m(l)3 * [g(2)-m(2)] >

»

67 k /' std dev = sqrt (variance) '

68 k /' correlat coef = covariance / [std dev (psi) *

69 k 'std dev (delta)]' ) 70

71 112 format (/' stat22, ... oops ' inconsistency, n=', iB)

72

78 113 format (/ 20x, ' mean,', 4x, ' std dev (degrees)'

74 ft / Bx, ' psi:', 4x, flO.3, 3x, flO.3

76 t / Bx, 'delta:', 4x, flO.3, 3x, flO.3

76 ft / Bx, 6x, 4x, flO.3, Ix,

77 ft '' correlation coefficient ' <p8i|delta> ') 78 114 format ( 26x, '' UNnormalized, because atleast one of the '

79 ft / 26x, ' standard deviations vzuiish.'/)

80

81 end

172
6.2.18 CORLAT.FOR

1 subroutine corlat

3 include ' iounit .

3 include 'defnit.'

4 include 'liliimm.'

6 include 'wstack.'

e include 'cgnxxl.'

7

8 dimension det(2), inert (3) ! LINPACK

8

10 raddeg = 180.0 / 3.14159265

11

12 c Discern variance of model parameters, normalized, A(T)*A.

13

14 llnorm = .false.

15 call asmbl ! ia,ja,aa,bb

le call stat22 (meqns, bb) ! mean, std dev.

17 call pltdat (2) ! plot deviations of fit

18

19 kv = 0

20 do jv=l,mvar7 ! 1(T)*A, pareuneters

21 do iv=l,jv ! upper triangle + diagonal

23 Buml = 0.0

23 sum2 = 0.0

24 do i=l,meqns,2

25 jl = ia(i ) 20 j2 = ia(i+l)-l

27 mv = j2-jl+l

28 si = 0.0

29 s2 = 0.0

30 s3 = 0.0

31 s4 = 0.0

32 do j=jl,j2 ! within a row of A. 33 j*j = j*Cj) • column

34 if (jaj.eq.iv) then

35 si = aa(j ) 38 s3 = aa(j+mv)

37 end if

38 if (jaj.eq.jv) then

39 82 = aa(j ) 40 84 = aa(j+mv)

41 end if

42 end do

43 suml = suml + sl>«s2 ! psi ' dot product

44 sum2 = sum2 + s3<fs4 ! delta

46 end do

40 sum = suml+sum2

47 sum = sum /float (meqns) ! normalization

48 kv = kv+1 ! packed format ' storage

49 aat (kv) = sum ! upper triangle + diagonal

60 if (jv.eq.iv) then ! diagonal

173
515253

54

SS5657

686960

61

92

6364

656667

6869

70

7172

73 C

7476

7677

78

79 e*

808182

83

84

85

8687

8889

90

91 C

92 C

9394

959697

98

.99 100

101 102 103

xx(jv) = sqrt (sum)

end if

end do

end do

kv = 0

do jv=l,mvary ! renormalize

do iv=l,jv

kv = kv+1

aat(kv) = aat(kv) / (xx(jv) * xx(iv))

end do

end do

write (iout,lll)

k2 = 0

do i=l,invary

kl = k2+l

k2 = k2+i

write (iout,114) i, (aat(k) ,k=kl,k2)

end do

write (iout,120)

write (iout,121) (xx(i), i=l,mvary) ! normalization coefficients

LII7PACK, Chapter 5, Solving symmetric indefinite matrices.

call sspco (aat, mvary, ipvt, rcond, w) ! nD*T(n) decomposition

write (iout,116) rcond

if (.true.) return 1 <

if (1.0 .eq. 1.0+rcond ) then ! singular matrix

if (1.0 .eq. 1 .0+rcond*O.Ol) then ! ill-conditioning

call sspdi (aat, mvary, ipvt, det, inert, w. 111)

write (iout,117) det, inert

k2 = 0

do i=l, mvary

kl = k2+l

k2 = k2+i

write (iout,112) i, (aat(k), k=kl,k2)

end do

end if

Alternate representation of correlation, normalized.

do jv=l, mvary ! mean ' <A(,j)>

sum = 0.0

do i=l,meqns,2

jl = ia(i ) j2 = ia(i+l)-l

mv = j2-jl+l

do j=jl,j2 ! row of A

jaj = ja(j) ! column

if (jaj .eq. jv) then

sum = sum + aa( j )+aa( j+rav)

174
104 end if

105 end do

106 end do ! meqns

107 stun = sum/float (meqns)

108 v(jv) = sum

109 end do ! mvary

110

111 kv = 0 ! covariance

112 do jv=l, mvary ! <(x-<x>)*(y-<y>)>

113 do iv=l,jv

114 sum = 0.0

lis do i=l,meqns,2

116 jl = ia(i ) 117 j2 = ia(i+l)-l

118 mv = j2-jl+l

119 si = 0.0

120 s2 = 0.0

121 s3 = 0.0

122 84 = 0.0

123 do j=jl,j2 ! row

124 jaj = ! column

125 it (jaj.eq.jv) then

126 si = aa(j )-v(jv)

127 s3 = aa( j+mv)-v( jv)

128 end if

129 if (jaj.eq.iv) then

130 s2 = aa(j )-v(iv)

131 s4 = aa( j+mv)-v(iv)

132 end if

133 end do

134 sum = sum + 8l*82 + s3*s4

136 end do ! meqns

136 sum = sum/float (meqns-l) ! <(x-<x>)*(y-<y>)>

137 kv = kv+1

138 aat(kv) = sum

139 if (iv.eq.jv) then ! diagonal

140 xx(jv) = sqrt (sum)

141 end if

142 end do

143 end do

144 kv = 0 ! renormalize

145 do jv=l, mvary ! correlation

146 do iv=l,jv

147 kv = kv+1

148 if (xx(iv) .eq.0.0 .or. xx(jv) .eq.0.0) then

149 aat(kv) = -2.0

150 else

151 aat(kv) = aat(kv) / (xx(iv)*xx(jv))

152 end if

153 end do

164 end do

166

166 write (iout.llS) ! Print out results

175
157 k2 = 0

168 do i=l,mvary

159 kl = k2+l

160 k2 = k2+i

lei write (iout,114) i, (aat(k) ,k=kl .k2)

162 end do

163 write (iout,120)

164 write (ioiit,121) (xx(i), i=l,mvary) ! normalization coefficients

165 166 return

167

168 , 111 format (/' J(T)*J: (renormaliaed for correlation)')

169 112 format (Ix, i4, ')', Ix, lplOelO.2, : /(7x, lOelO.2))

170 114 format (Ix, i4, ')', Ix, lOflO.B, : /(7x, lOflO.B))

171 116 format (/' rcond=*, lpel2.3, condition number »

)

172 117 format (/' J(T)*J: (renormalized for correlation)'

m k /' Determinant: ', f8.4, ' E ', f8.4

m * /' Inertia: (', 3i4,

176 I: »), number of (+,-,0) eigenvalues'

176 * /' Inverse: upper+diagonal matrix')

177

178 118 format (/' J(T)*J: ' <(x-<x>)*(y-<y>)> »)

179 , 120 format (/' Normalization coefficients : sqrt [J(T)*J] (i,i) ') 180 121 format ( Ix, lplOelO.2)

181 end

176
6.2.19 SEAMA.FOR

1 subroutine seama

3 include ' iounit .

s include ' defnit .

4 include 'filininin.'

5 include 'seamxl.'

e include 'wstack.'

7 include 'cgnxxl.' ! w,xw ' convenience

8

9 real det(2), ss(4)

10 integer inert (3)

11 data pi / 3.14159268 /

13

13 C

14 c Sensitivity analysis for multiple: angle, ambient, wave, seunple.

15 c Ordering ot indices in IPTU: [vary—> <—froz]

1017 c The matrix equation is: g = AV*v + AU*u + AT*t

18 c Bhere: v ' vary,

19 c u ' frozen,

30 c t

' dCphi. ' angle of incidence)

31 c g

' deviations ' experiment - model

33 c

38

34 raddeg = pi/180.0 ! radians <— degrees

36 mm = mlmnts+mfilmm ! model parzuneters

30 llnorm = .false.

37 call asmblx

28

39 c Renormalize the columns of LL, and retain factors in AATS.

30 call scaljj (meqns ,mvary, ia,ja,aa,xx, aats,9,2) ! aa,aats

81

83 c Formulate the "Normal" equations.

88 c Note that: J(v,T)*J(v) ' symmetric matrix.

84 c Construct: upper triangle, i<= j.

85

30 do jv=l,mvary

37 do iv=l,jv ! upper triangle

38 s = 0.0

39 do i=l,meqns,2

40 jl = ia(i ) 41 j2 = ia(i+l)-l

42 mv = j2-jl+l

43 Sl = 0.0

44 s2 = 0.0

45 s3 = 0.0

40 s4 = 0.0

47 do j=jl,j2

48 jaj = jaCj) ' column

49 if (jaj.eq.iv) then

60 sl = aa(j ) ! psi

177
SI s3 = aa(j+mv} ! delta

S3 end if

63 it (jaj.eq.jv) then

64 s2 = aa(j ) \ psi

66 b4 = aa(j+mv) ! delta

so end if

67 end do

68 S = S + Si><<s2 + b3*s4:

59 end do

60 ij = iindex (3,mvary, iv,jv) ! column-vise

61 aat(ij) = B ! upper triangle

62 end do ! rows

63 end do ! columns

64

65 gggPBi = 0.0 ! maximum magnitude

66 gggdel =0.0

67 gggaiig = 0.0

68 do ii=l,meqns,2

60 ngl = (ii+l)/2

70 gggpsi = amaxl (gggpsi, abs ( bb(ii )))

71 gggdel = amaxl (gggdel, abs ( bb(ii+l)))

72 ggga»g = amaxl (gggang, abs (angleu(ngl))) ! radians

73 end do

74 ggpsi =0.0 ! estimate variances

J 76 ggdel = 0.0

76 ggang = 0.0

77 do ii=l,meqns,2 ! rescale

78 ngl = (ii+l)/2 ! index uncertainties

70 ggpsi = ggpsi + ( bb(ii ) /gggpsi )>t>*2 ! psi deviations

80 ggdel - ggdel + ( bb(ii+l)/gggdel)'«'*2 ! delta deviations

81 gg"^g = gg«^g + (angleu(ngl)/gggang)**2 ! anglei radians

83 end do

83 ggpsi = ggpsi* gggp8i**2

84 ggdel = ggdel* gggdel**2

85 ggang = ggang* gggang**2

8687 ggvar = (ggpsi+ggdel) /float (meqns-mvary) ! <gg> variance

88 ggazi'g = ggBAg /float (meqns/2) ! <aa>

80 ggvars - sqrt (ggvar) ! standard deviation

90 ggangs = sqrt (ggang)

9102 write (iout.lll)

03 write (iout,126) ggvar , ggvars , ggang, ggangs

94 write (iout,112)

95 write (iout,121)

06 c write (iout,112)

07

08 call sspco (aat .mvary ,ipvt ,rcond, xx) ! nD>xn(T)

00 100 c if (1.0 .eq. 1.0+rcond ) then

101 if (1.0 .eq. 1 .0+rcond*0.01) then ! ill-conditioned

102 write (iout,101)

103 return

178
104 end if

105 loe call aspdi (aat,mvar7,ipvt,det, inert, xz,l) ! inverse

107

108 cclxxx = 0.0 ! psi, max magnitude

109 cc2xxx =0.0 ! delta, max magnitude

110 do ii=l,meqn8,2

111 cclxxx = amajcl (cclxxx, abs (cc(ii )))

113 cc2xxx = anaxl (cc2xxx, abs (cc(ii+l)))

118 end do

114

115 do jv=l,ravary ! column

lie bbblxx = 0.0 ! psi, max magnitude

117 bbb2xx =0.0 ! delta, max magnitude

118 do ii=l,meqna,2 ! CA(T)*A]**-1 i<A(T)

lie jl = ia(ii ) ijo j2 = ia(ii+l)-l

121 mv = j2-jl+l

133 si = 0.0

133 s2 = 0.0

1J4 do jj=jl,j2 ! row

135 jaj = ja(jj) ! coliunn

128 k = iindex (3,mvary, jv,jaj)

127 si = si + aat(k)*aa(jj ) ! psi

128 s2 = 82 aat(]iE)*aa( j j+mv) ! delta

129 end do

130 bbb(ii ) = si ! psi

131 bbb(ii+l) = s2 ! delta

132 bbblxz = aaaxl (bbblxx, abs (si)) ! maximum

133 bbb2xz = anaxl (bbb2xx, abs (82))

134 end do

135

138 vrite (iout,112)

187

138 do iv=l,jv ! row

139 bblxxx = 0.0

140 bb2xxx = 0.0

141 do ii=l,meqns,2 ! [A(T)*A]**-1 *A(T)

142 jl = ia(ii ) 143 j2 = ia(ii+l)-l

144 mv = j2-jl+l

146 il = 0.0

148 s2 = 0.0

147 do jj=jl,j2 ! row

148 jaj = ja(jj) ! column

149 k = iindex (3,mvary, iv,jaj)

160 si = si + aat(k)*aa(jj ) ! psi

isi s2 = s2 + aat(k)*aa(jj+mv) ! delta

153 end do

158 bb(ii ) = 8l ! psi Sote:

154 bb(ii+l) = s2 ! delta overwriting

155 bblxxx = amaxl (bblxxx, abs (si))

160 bb2xxz = amaxl (bb2xxx, abs (s2))

179
167 end do

158

159 do j =1,4 ! convaziience

160 ss(j) = 0.0 ! initialize

161 end do

162 do ii=l ,ineqns ,2

163 88(1) = ss(l) + (bbbCii )/bbblxx)

164 ft * ( bb(ii )/bblxxx) ! psi

165 8s(2) = 8s(2) + (bbb(ii+l)/bbb2xx)

166 ft * ( bb(ii+l)/bb2xxx) I delta

167 88(3) = ss(3) + (bbb(ii )/bbblxx)

168 ft * ( bb(ii )/bblxxx)

169 ft * ( cc(ii )/cclxxx)**2 ! psi

170 ss(4) = ss(4) + (bbb(ii+l)/bbb2xx)

171 ft ( bb(ii+l)/bb2xxx)

172 ft * ( cc(ii+l)/cc2xxx)**2 ! delta

173 end do

174 88(1) = 88(l)*bbblxx*bblxxx

175 88(2) = 88(2)*bbb2xx*bb2xxx

176 88(3) = 88(3)*bbblxx*bblxxx* cclxxx**2

177 88(4) = S8(4)*bbb2xx*bb2xxx'K cc2xxx**2

178

179 88(1) = (8s(l) + 88(2))*ggvar ! BggB

180 88(3) = (ss(3) + 8s(4))*ggang ! BJaaJB

181

182 88(1) = 8s(l) /(aats( jv)*aats(iv)) ! scale

183 88(3) = ss(3) /(aata(jv)*aats(iv))

184

186 88(2) = sqrt (abs (ss(l))) ! ' std dev

186 8s(4) = sqrt (abs (ss(3)))

187

188 write (iout,13l) jv,iv, ss(l),s8(3), 88(2), 88(4)

180 end do ! iv

190

191 random = sqrt (ss(l) + ss(3)) ! diagonal, (j,j)

192 system = 0.0

193 194 if (mfroz.ne.O) then ! systematic errors

196 do k=l,mfroz

106 xxx(k) =0.0 ! initialize

197 end do

198 do ii=l,meqns,2

100 jl = iaa(ii ) 200 j2 = iaa(ii+l)-l

201 if (jl.le.j2) then

202 mu = j2-jl+l

208 do j=jl,j2

204 km = jaa(j) ! backwards

206 k = mm+l-km ! column

206 xxx(k) = xxx(k)

207 ft + bbb(ii )*aaa(j ) 208 ft + bbb(ii+l)*aaa( j+mu)

209 end do

180
310 end if ! row

311 end do ! meqns

313 315 do k=l,mfroz

314 km = min+l-k ! backwards

316 m = iptu(km)

310 if (m.le .mlmnts) then

317 uncert = uncerl(ni)

318 else

310 m = m-inlmnts

330 uncert = uncerz(m)

331 end if

333 zzx(k) = abs (xxx(k)>Mincert) ! iBJul

33S xxz(k) = xxx(k) /aats(jv) ! scale

334 system = system + xxx(k)

335 end do

330 end if ! frozen

337

J38 c Output results

339

3S0 write (iout,113)

3S1

333 total = random + system ! diagonal

388 m = iptu(jv) ! unique,nonlocal, full

384 if (m.le .mlmnts) then

385 si = diefcn(m)

380 82 = uncerl(m)

337 write (iout,122) jv, total, s2, si, m, ' (n+ik)

388 write (iout,123) random, S8(2), ss(4)

389 else

340 ffl = m-mlmnts

341 si = widths (m)

343 s2 = uncerz(m)

343 write (iout,122) jv, total, s2, si, m, '(z )'

344 write (iout,123) random, ss(2), ss(4)

345 end if

340 347 if (mfroz.ne.O) then ! systematic errors

348 write (iout,124) system

349 write (iout.llO)

350 do k=l,mfroz

351 km = mm+l-k

363 m = iptu(km)

368 if (m.le .mlmnts) then

354 write (iout,12B) k, xxx(k), m, ' (n+ik)

355 else

350 n = m-mlmnts

357 write (iout,125) k, xxx(k), m, '(z )'

368 end if

369 end do

300 end if

301

303 end do ! vary

181
263

264 writs Ciout.lll)

265 return

266 267 100 format (/' seeuna. insufficient allocation for array, AAT')

288 101 format (/' seama, singular or ill-conditioned matrix ') 269 102 format (/' seama. uncertainties '

)

270

271 110 format (' ')

272 111 format ( Ix, 17(' ===='))

273 112 format ( Ix, 17(' •))

274 113 format (13x, 14(' - -'))

276 276 121 format (

' Discern: Uncertainty in model parameters '

277 k /' where

|v| = sqrt( BB(T) <gg> + (BJ)(BJ)(T) <aa>)'

278 k /' + iBJilul, '

279 k //' B ' [J(T)*J]**-1 *J(T), (nonsquare J)'

280 k //' vary '

,

6x, 'total ', 4x, 'initial', 4x, 'parameter')

281

282 122 format ( 3x, i4. ')', 2x, lp2ell.2, elB.6,

283 k ', for:', i4, ', ', a)

284 123 format ( lOx, lp3ell.2, 4x, 'random, |Bg|, iBJal')

285 124 format ( 21x, lplell.2, 4x, 'systematic ' total ') 286 12B format ( lOx, 6x, i4, ')',

287 k lplell.2, 4x, 'systematic ' |BJu| '',i4,', ',a)

288

289 126 format (' <gg>

' ', Ip2el2.3, 4x, '(variance, stddev)'

290 k /' <aa> ' ', 2el2.3, 4x, '(variance, stddev)')

291

292 131 format ( lOx, 2iB , lp2ell.2, 4x, ' (j.i), iBggBl, iBJaaJBl'

293 k / 20x, 2ell.2, 4x, ' IBgl , |BJa| ') 294 end

182
6.2.20 SEAMAX.FOR

1 c

3 c Note: This routine should be compared to: SEAMA

3 c Here: Methods 2,3 are not available.

4 c There are tvo estimates of errors, but

6 c NO use is made ol that retained in: X9

6 C

78 subroutine seamax

9 include ' iounit .

10 include 'delnit.'

11 include 'filmmm.'

13 include 'sezunxl.'

13 include 'seamx2.'

14 include 'cgnxxl.'

15 include 'wstack.'

16

17 logical square, Isout

18 integer inert(3), ks(mrowss*2+nrowss)

19 real det(2), ss(4), sss(4,2), sk(mrowss'X2+nrowss)

30

31 data pi / 3.14159265 /

33

33 c Sensitivity/error analysis lor multiple: angle, ambient, nave, sample.

34 c Ordering ol indices in IPTU: [vary—> <—froz]

35 call arrang

30

37 raddeg = pi/180.0 ! radians <— degrees

38 mm = mlmnts+mfilmm ! model parameters

29 call seam2 ! construct matrix table

30

31 Isout = maraws.le.2 ! single/double angle

32 if (Isout) then ! output header cards

33 open (unit=isout, file='x.sout' , status= 'unknown'

)

34 write (isout, 104) msampl, mvary, ndegr

35 write (isout, 104) (nnwave(is), is=l, msampl)

30 iws = 0

37 iaws = 0

38 iraws = 0

39 do is=l,mseunpl

40 mwave = nnwave(is)

41 do iw=l, mwave

42 iws = iws+1

43 mbien = nnbent(iws)

44 write (isout, 104) mbien

45 do mbn=l, mbien

40 iaws = iaws+1

47 c* mrpeat = nnpeat(iaws)

48 c* do irpeat=l .mrpeat

49 iraws = iraws+1

50 istep = isteps(iraws)

183
61 mem.gl = mangle (iravs)

62 write (isout,104) istep, mangl

63 C* end do ! repeat

54 end do ! eunbient

66 end do ! wave

66 end do ! seunple

87 end if

68 call poplat (xx, 1) ! initialize

69 c

eo c Provide: do-loop nesting to the necessary depth.

61 c Utilize: goto, if, and three vectors.

62 c (angle I ambient, wave, seunple) , i.e ., without repeats.

63 c For each distinct set of (ambient , wave , sample)

,

64 c scan a set of multiple angles.

66 c where each set of multiple angles are of the form:

66 c do i(l)=l+(manglm-l)*step. ndegr , step

67 c do i(2)=l+(manglm-2)*step. i(l)-step, step

68 c do i(3)=l+(manglm-3)*step. i(2)-step, step

ee c

70

71 c do i(manglm)=l, i(manglm-l)-step, step

72 kt = 0 ! index counter

73

74 kts = 0 ! index singulzu: events

75 j2 = 0 ! (euigle, ambient, wave, sample)

76 k = 0 ! ( ambient, wave, sample)

77 1 k = k+i

78 if (k.gt.mraws) goto 4 ! work

79 mangl = mangle(k) ! multiple angle

80 istep = isteps(k) ! do-loop increment

81 jl = j2+l

82 j2 = j2+mangl

83 iii2(jl) = ndegr ! limit outer do-variable

84 do j=jl,j2 ! multiple angle

86 iiil(j) = 1 + (j2-j)*istep ! fixed, first do-parameter

86 iiii(j) = iiil(j) - istep ! initialize do-variable

87 end do

88

89 j = jl-1 ! index of: nested do-variables

90 2 j = j+1 ! index of: j-th nested do.

91 if (j .gt . j2) goto 1

92 3 iiii(j) = iiii(j) + istep ! update do-loop variable

93 if (iiii(j) .le. iii2(j)) then ! test upper limit

94 if (j.ne.j2) iii2( j+l)=iiii( j )-istep

96 goto 2

96 end if

97 iiii(j) = iiil(j) - istep ! reset inner do

98 j = j-1 ! backup one do-level

99 if (j .ge. jl) goto 3

100

101 if (k.eq.l) goto 6 ! escape do-loop nest

102 k = k-1 ! backup

103 mangl = mangle(k)

184
104 istep = isteps(k)

105 j2 = jl-1

106 jl = jl-mamgl

107 goto 3

108 4 continue ! inner-most nested do.

109

110 jlsave = jl

111 j28ave = j2

113 if ( j .ne .maraws+l) then

113 write (iout,107) maraws, j 114 stop

115 end if

116

117 c write (iout,102) kt , (iiii(j), j=l,maraws)

118 c if (.true.) goto 5

lie c

120 c The matrix equation is : b = AV*v + AU*u + AT*t

121 c where: v ' vary,

122 c u ' frozen,

123 c t

' d(phi ' angle of incidence)

124 c b ' deviations ' experimental uncertainty

125 c The method of solution for |v|,

130 c depends on whether the matrix [AV] is square.

137

138 call seeun3 ! model experiment, table

139

130 square = meqns . eq.mvary

131

133 if ( .not . square) then ! renormalize columns

138 call scaljj (meqns ,mvary, ia,ja,aa,xx, aats,w,2) ! aa,aats

134 end if

135

136 if (square) then ! non-symmetric matrix

137 mvaryy = mvary*mvary ! full, square

138 if (mvaryy .gt. naat) then ! WSTACK, allocation

1S9 write (iout,100)

140 stop

141 end if

142 do i=l,mveuryy ! square matrix

143 aat(i) =0.0 ! initialize

144 end do

146 do i=l,meqn8,2 ! LINPACK format

146 jl = ia(i ) 147 j2 = ia(i+l)-l

148 mv = j2-jl+l

149 do j=jl,j2 ! row

150 jaj = ja(j) ! column

151 kpsi = iindex (B.mvary, i ,jaj) ! stored column-wise

153 kdel = iindex (5,mvary, i+l,jaj)

163 aat(kpsi) = aa(j ) ! psi

154 aat(kdel) = aa(j+mv) ! delta

155 end do

156 end do

185
157 call sgeco (aat ,mvary ,mvary ,ipvt .rcond, xx) ! LU decomposition

158 c if (1.0 .aq. 1.0+rcond ) then ! singular matrix

159 if (1.0 .eq. 1 .0+rcond*0.01) then ! ill-conditioned

lao c write (iout,101} (iiii(i), i=l,maraws)

161 kts = kts+1

162 do i=l,mvary

163 xx(i) = -1.0 ! truncate

164 end do

165 else

166 call sgedi (aat,mvary,mvary,ipvt,det, xx,l) ! inverse

167 do i=l,mvary ! row

168 do 3=1,2

169 do kj=l,4

170 sss(kj,j) = 0.0 ! initialize

171 end do

172 end do

173 do j=l,meqns,2 ! (psi, delta)

174 c* uang = 0 .002*raddeg ! radians, SEAM2

175

176 kpsi = iindex (B.mvary, i,j ) 177 kdel = iindex (B.mvary, i,j+l)

178

179 ss(l) = aat (kpsi )*bb(j ) ! psi

180 ss(2) = aat(kdel)*bb(j+l) ! delta

181 ss(3) = aat(kp8i)*cc(j )*u€m.g ! psi'

182 ss(4) = aat(kdel)*cc( j+l)>t>uang ! delta'

183 do kj=l,4

184 sss(kj,l) = sss(kj,l) + SB(kj)

185 8ss(kj,2) = sss(kj,2) + ss(kj)*')<2

186 end do

187 end do

188 ss(l) = abs (sss(l,l) + sss(2,l)) ! |Dg I 189 k + abs (sss(3,l) + sss(4,l)) ! |DJt|

190 ss(2) = sqrt (sss(l,2) + sss(2,2)) < rms(Dg ) 191 k + sqrt (sss(3,2) + sss(4,2)} ! rms(DJt)

192

193 il (mfroz.ne.O) then ! frozen

194 do k=l,mfroz

196 xxx(k) =0.0 I initialize

196 end do

197 do ii=l,meqns,2 ! even

198 jl = iaa(ii ) 199 j2 = iaa(ii+l)-l

200 if (jl.le.j2) then

201 mu = j2-jl+l

202 do j=jl,j2 ! row

203 km = jaa(j) ! backwards

204 k = mm+l-km ! column

205 kpsi = iindex (5,mvary, i,ii ) 206 kdel = iindex (5,mvary, i,ii+l)

207 xxx(k) = xxx(k)

208 I; + aat (kpsi )*aaa(j ) 209 k + aat (kdel) *aaa(j+mu)

186
210 end do

311 end if

313 end do ! meqns

313 do k=l,mfroz

314 km = mm+l-k ! backwards

315 m = iptu(km)

310 if (m.le.mlmnts) then

317 uncert = tincerl(m)

318 else

319 m = mlmnts-m

330 uncert = uncerz(m)

331 end if

333 uncert = uncert * abs (xxx(k)) ! |DJ||u|

333 ss(l} = ss(l) + uncert

334 ss(2) = 8s(2) + uncert

336 end do

330 end if ! frozen

337

338 Xx(i) = Ss(l)

330 XQ(i) = ss(2)

330 end do ! vary

331 end if

333 goto 5

333 end if ! square matrix

334 C

335

330 if (method. eq.l) then ! "Normal" equations

337 do jv=l,mvary ! A(T)*A, symmetric

338 do iv=l,jv ! upper triangle, i<=j

339 s = 0.0

340 do i=l,meqn8,2

341 j'^ - ia(i ) 343 j2 = ia(i+l)-l

343 mv = j2-jl+l

344 b1 = 0.0

345 S2 = 0.0

340 s3 = 0.0

347 84 = 0.0

348 do j=jl,j2

349 jaj = ' column

350 if (jaj.eq.iv) then

261 si = aa(j ) 262 83 = aa(j+mv)

253 end if

354 if (jaj.eq.jv) then

356 s2 = aa(j ) 350 84 = aa(j+mv)

357 end if

368 end do

359 8 = 8 + Sl<Xs2 -•- 83*S4

300 end do

301 ij = iindex (3,mvary, iv.jv) ! column-wise

303 aat(ij) = 8 ! upper triangle

187
263 end do

264 end do

265 call sspco (aat ,mvary ,ipvt ,rcond, xx) ! DD*U(T)

266 il (1.0 .eq. 1 .0+rcond*O.Ol) then ! ill-conditioned

267 c write (iout.lOl) (iiii(i), i=l,maraws)

268 kts = kts + l 269 do i=l,mvary

270 xx(i) = -1.0 ! truncate

271 end do

272 else

273 call sspdi (aat ,mvar7,ipvt ,det, inert , XX, 1) ! inverse

274 do i=l,mvary

27B do ii=l,meqn8,2 ! [A(T)*A]**-1 *A(T)

276 jl = ia(ii ) 277 j2 = ia(ii+l)-l

278 mv = j2-jl+l

279 Sl = 0.0

280 s2 = 0.0

281 do jj=jl,j2 ! row

282 j*j - column

283 k = iindex (3,mvary, i,jaj)

284 sl = sl + aat(k)>*'aa( j j ) ! psi

285 s2 = s2 + aat(k)*aa(j j+mv) ! delta

286 end do

287 bbb(ii ) = sl ! psi

288 bT3b(ii+l) = s2 ! delta

289 end do

290 do jj=l,2

201 do kj=l,4

292 sss(kj,jj) = 0.0 ! initialize

293 end do

294 end do

295 do ii=l ,meqns ,2

296 c* uang = 0.002'Xraddeg ! radians, SEAM2

297 ss(l) = bbb(ii )*bb(ii ) 298 88(2) = bbb(ii+l)*bb(ii+l)

209 88(3) = bbb(ii )*cc(ii )<(<uang 300 8 8 ( 4) = bbb(ii+l)*cc(ii+l)tTiang

301 do kj=l,4

302 888(kj,l) = S8S(kj,l) + Ss(kj)

303 sss(kj,2) = sss(kj,2) + ss(kj)**2

304 end do

306 end do

306 ssd) = abs (sss(l,l) + sss(2,l)) ! |Dg I 307 k + abs (s8s(3,l) + sss(4,l)) ! iDJtl

308 ss(2) = sqrt (888(1,2) + 8ss(2,2)) ! rms(Dg ) 309 k + sqrt (sss(3,2) + 88s(4,2)) ! rms(DJt)

310

311 if (mfroz.ne.O) then

312 do k=l,mfroz

313 xxx(k) =0.0

314 end do

315 do ii=l .meqns ,2

188
316 jl = iaa(ii ) 317 j2 = iaa(ii+l)-l

318 il (jl.le.j2) then

319 mu = j2-jl+l

320 do j=jl,j2

331 km = jaa(j) ! backwards

332 k = nun+l-km ! column

333 xxx(k) = xxx(k)

324 * + bbbCii )*aaa(j ) 326 t + bbb(ii+l)*aaa(j+mu)

336 end do

327 end if

328 end do

329 do k=l,mfroz

330 km = mm+l-k ! backwards

331 m - iptu(km)

332 if (m.le.mliTJits) then

333 uncert = uncerlCm)

334 else

335 m = m-mlmnts

336 uncert = uncerz(ffl)

337 end if

338 uncert = uncert * abs (xxx(k)) ! |DJ| |u|

339 S8(l) = 88(1) + uncert

340 88(2) = 8s(2) + uncert

341 end do

342 end if ! frozen

343

344 Xx(i) = 88(1)

345 XW(l) = 88(2)

346 end do ! vary

347 end if

348 goto 6

349 350 end if

C

361

352 if (method. eq. 2) then ! Brute force, forward problem

353 if (.true.) stop ! Bote: xw ' not available

354

355 do i=l,mvary ! initialize magnitudes of

356 xx(i) = 0.0 ! stored uncertainties

367 end do

358

359 C Simulate do-loops to scan possible sign-flips.

360 c There is a sign-flip for each component in: b,t,u.

361 c For the case of systematic error in the angle of incidence,

362 c i.e., d(phi) ' t, then 't' is scalar, not vector.

363 364 c Simulate: do il=l,2

385 c do i2=l,2

866 c do i3=l,2

367 c

368 c do i(meqn8+l+mfroz)

189
369

370 C This involves: 2**(nieqiis+l+mlroz) sign permutations.

371 C Unfortunately, this hecomes iinnieldly rather quickly.

372 373 ns = meqns+l+mfroz ! depth of do-nest

374 do i=l. ns

376 ks( i) = 0 ! il-i3, do-variable, initialize

376 end do

377 ms = 0

378 21 ms = ms+1

379 if (ms. gt.ns) goto 23

380 22 ks(ms) = ks(ms} + 1 ! update do-variable

381 if (ks( ms).le.2) then ! test uper limit

382 if (ks(ms) .eq.l) then ! specify sign convention

383 sk(ms) = 1.0

384 else

386 sk(ms) = -1.0

386 end if

387 goto 21

388 end if

389 ks(ms) = 0 ! reset inner do-loop

390 ms = ms -1 ! backup one level of do-s

391 if (ms. eq.O) goto 24 ! escape do-nest

392 goto 22

393 23 ms = ms -1 ! level of deepest do

394 c

896 uangsk - uBng*sk(meqns+l) ! systematic error

396

397 do i=l. meqns ,! form 'b' vector

398 bbb(i ) = bb(i )*sk(i ) - cc(i )'Xuangsk ! psi

399 bbb(i+l) = bb(i+l)*sk(i+l) - cc(i+l)*uangsk ! delta

400 jl = iaa(i ) ! frozen

401 j2 = iaa(i+l)-l

402 if (jl.le.j2) then

403 mu = j2-jl+l

404 si = 0.0

406 s2 = 0.0

406 do j=jl,j2

407 km = jaa(j) ! backwards

408 k = mm+l-km

409 m = iptu(km)

410 if (m.le.mlmnts) then

411 uncert = uncerl(m)

412 else

413 m = m-mlmnt s 414 uncert = uncerz(m)

416 end if

416 uncert = uncert*sk(meqns+l-fk}

417 si = si + aaa(j )*uncert

418 s2 = s2 + aaa( j+mu)*uncert

419 end do

420 bbb(i ) = bbb(i ) - si

421 bbb(i+l) = bbb(i+l) - s2

190
422 423

424

425 436 427

428

429 430

431 4S3 433

434

435 436 437

438

439 C

440

441

443 443

444 C*

445

446 C

447

448 449

460

461 463

453 454

466

466

457

468 C

459 460

461 463 463

464

465 466 467

468

469

470

471 472

473

end if

end do ! meqns

do i=l,mvary

xzx(i) =0.0 ! initialize, C6NL

end do

niter = mv2u:y*4

call cgnl (meqns ,mvMy, ia, ja,aa,bbb,xxx,

k niter, u,v,9, xw,8e)

do i=l,mv8u:7 ! retain maximum

xx(i) = amaxl (xx(i), abs (xxx(i)))

end do

goto 22

24 continue

goto 5 end if

if (method. eq. 3) then ! singular value decomposition

vrite (iout,108)

stop

goto 5 end if

6 continue

if ( .not . square) then

if (xx(l) .ne. -1.0) then ! not singular

do i=l,mvary ! account for scaling

xx(i) = xx(i)/aats(i) ! of columns in SCALJJ

xw(i) = xw(i)/aats(i)

end do

end if

end if

BOTE: X9 is BQT used ! <

kt = kt+1

if (Is out) then

vrite (isout,102) kt,

srite (isout,103)

end if

call poplat (zz, 2)

(iiii(k), k=l,maraws)

( xx(k), k=l,mvary )

! update

k = mravs

j = maravs

jl = jlsave

j2 = j2save

goto 3

6 continue

! inner-most level: ( unbient, wave, sample)

! inner-most level: (zuigle, ambient, nave, sample)

loop back ' nested do, iiii

last line of nested-do, iiii

191
475 write Ciout,lll) kts, kt

476 477 if (Isout) close (uziit=isout)

478 call poplat (xx, 3) ! plot

479 call poplat (xx, 4) ! correlation at minina

480

481 write Ciout,112)

482 do i=l , mvary

483 in := iptu(i) ! unique,nonlocal, full

484 if (m.le.mlmnts) then

486 si = diefcn(m)

486 s2 = uncerl(m)

487 write (iout,113) i, xx(i), s2, si, m, ' (n+ik)

488 else

489 m = m-mlmnts

490 si = widths(m)

491 s2 = uncerz(m)

492 write (iout,113) i, xx(i), s2, si, m, '(z )'

493 end if

494 end do

496 496 return

497

498 100 format (/' seamax, insufficient allocation for array, AAT'

499 101 format (' singular mtx, iiii: ', 20i4, : /(21x, 20i4))

600 102 format (Ix, ilO, 20i4, : /(12x, 20i4))

501 103 format (Ix, Ipl0el2.4)

502 104 format ( Ix, 20i4)

503 105 format ( Ix, 3i4, Bx, f3.1)

604

605 107 format (/' seamax, maraws = ', i3, ', j='» i3

606 k / ' should be equal . '

)

607 108 format (/' seamax, method=3, singular value decomposition!

608 k /' not available, ... yet.')

509

510 111 format (/' seeunax, kts = ', ilO, ' ' singular events'

611 k /» kt = ', ilO, ' ' total events')

512 513 112 format (/' Discern: uncertainty '

514 k /' when: not square, D = [J(T)*J]**-1 J(T)

616 k /' square, D = J

516 k /' case: 1, iDgl + iDJal + |DJ||u|'

617 k /• 2, llDgll + 1 IDJal 1 + iDJIIul'

618 k //' vary', 6x, 'case 1', Bx, 'case 2',

619 k Bx, 'initial', 4x, 'parameter' ) 520

521 113 format (3x, i4, ')', 2x, lp2ell.2, llx, elB.6,

622 k ', for:'. i4, ', '. a)

623

624 end

192
6.2.21 SEAM2.FOR

1 subroutine 8eain2 ! construct table < asmblx

a include ' iounit .

s include ' defnit .

4 include 'filinmm.'

6 include 'filmss.'

e include 'seamxl.'

7 include 'seeunx2.'

8

9 real a(nrows*2), b(2), c (2)

10 C Solve the forward scattering problem

11 C on a grid of distinct incident angles

13 c for each distinct wavelength incident on the sample

13

14

c Construct matrix of possible scatterings

15 fflws = 0 nfilms ,wave , sampl

10 i98 = 0 wave, sampl

17 iavs = 0 ambient ,wave , sampl

18 iravs = 0 ! repeat, ambient, wave, sampl

19 marass = 0 ! mangl, repeat, ambient, wave, sampl

30 ngl = 0 ! ndegr, repeat, ambient, wave, sampl

31 do is=l,msampl

33 mfilm = nnfilm(is) j FILMSS

33 mvave = nnnaveCis)

34 mfilms = mfilm+1 j film/ substrate

36 nrow = mfilm*3+2 (z,n,k) (n,k)

30 do iw=l,mwave

37 iws = iws+1

38 iffave = iiwave(iws)

39 mbien = nnbent(i7s)

30 qq = waveqqCivave) FILMSS

31 do i=l,nrow

83 iptx(i) = 0 vary > unique

88 ipty(i) = 0 j vary > full

84 kptx(i) = 0

1 froz > unique

86 kpty(i) = 0 froz > full

oO1M end do

S79

iv = 0

1 local, full, non-unique

90 kv = 0

1 local, vary, non-unique

•a9V mv = 0 j local, vary, compress

An ku = 0 local, froz, non-unique

4143 mu = 0

1 local, froz, compress

48 do m=l, mfilms films/substrate

44 if (m.ne .mfilms) then ! films ' z

45 fflffs = mvs+1

4« iz = iifilmCmws)

47 zzz(m) = widths (iz) ! FILMSS

48 iv = iv+1 local, full

49 j = mlmnts+iz ! nonlocal, full

60 if (Ivaryz(iz) .eq.l) then ! vary

193
51 i = iptv(j) ! nonlocal, compress

52 kv = kv+1 ! local, non-unique

53 iptx(kv) = i ! local ' nonlocal

54 ipty(kv) = iv ! local, lull

55 if (iptw(i) .eq.O) then ! compress, unique

56 mv = mv+1 ! local counter

57 iptw(i) = mv ! local

58 end if

59 else ! frozen

60 i = iptv(j) ! nonlocal, compress

61 ku = ku+1 ! local, non-unique

62 kptx(ku) = i ! local ' nonlocal

63 kpty(ku) = iv ! local, full

64 if (iptffCi) .eq.O) then ! compress, unique

65 mu = mu+1 ! local counter

66 ' iptw(i) = mu ! local

67 end if

68 end if

69 end if z

70 do ink=l,2 ! n+ik

71 mws = mws+1

72 nk = iifilm(mws)

73 c(ink) = diefcn(nk) ! n,k

74 iv = iv+1 ! local, full, non-unique

75 if (IvaryKnk) .eq. 1) then ! vary

76 i = iptv(nk) ! nonlocal, compress

77 kv = kv+1 ! local, non-unique

78 iptx(kv) = i

79 ipty(kv) = iv

80 if (iptw(i) .eq.O) then ! compress, unique

81 mv = mv+1 ! local counter

82 iptvCi) = mv ! local

83 end if

84 else ! frozen

85 i = iptv(nk) ! nonlocal, compress

86 ku = ku+1 ! local, non-unique

87 kptx(ku) = i

88 kpty(ku) = iv

89 if (iptw(i) .eq.O) then ! compress, unique

90 mu = mu+1 ! local counter

91 iptw(i) = mu ! local

92 end if

93 end if

94 end do ! n+ik

95 die(m) = cmplx (c(l) ,c(2))**2 ! FILMSS

96 end do ! mfilms

97

98 if (mv.eq.O) then

99 write (iout,100) is, iw, iwave

100 stop

101 end if

102 103 mvmu = mv+mu ! compress ' (vary+frozl unique, local)

194
104

106 do nbzi=l,mbien ! lunbiezits

io« iawB = iaws+1

107 imbian = iibent(iaws)

108 e* mxpeat = impeat(iaws)

109 air = ambent(imbieii) ! FILMSS

110 e* do irpaat=l ,mrpeat

111 iraws = iraws+1

112 mazigl = mangle (iraws) ! multiple angles

113 marans = maraws+mangl

114 do iangl=l,ndegr ! grid of incident angles

116 ngl = ngl+1 ! (angl, ambient .wave, sampl)

116

117 angl = float (iangl) ! degrees

118 angl = angl^raddeg ! radians

110 call scatr (qq.angl, b,a,c) ! (psi, delta)

130 c* call tform ( angl, b,a,c) ! (alpha,beta)

131

133 uang = 0 .002'1'raddeg ! d(incident angle)

138 b(l) = 0 .050*raddeg ! d( psi), experimental

134 b(2) = 0.050*raddeg ! d(delta), uncertainty

136 136 c Retain, save, store the tabulation.

137

138 pBii(ngl) = b(l) ! psi

139 dell(ngl) = b(2) ! delta

ISO psia(ngl) = c(l) ! d( psi) /d(incident angle)

181 dela(ngl) = c(2) ! d(delta) /d(incident angle)

183

138 e Combine/compress common coefficients, unique.

184

186 do j=l,mvmu ! local,unique ' (vary+froz)

186 p8id( j ,ngl) =0.0 ! psi

187 deld( 3 ,ngl) =0.0 ! delta

188 end do

180 if (kv.ne.O) then ! vary, compress

140 do k=l,kv ! local, non-unique

141 iv = ipty(k) ! local, full

142 iv2 = iv+iv ! delta ' a ' local, full

148 ivl = iv2-l ! psi ' a. ' local, full

144 i = iptx(k) ! nonlocal, compress

146 imv = iptw(i) ! local, compress

146 p8id(imv,ngl) = p8id(imv,ngl) + a(ivl)

147 deld(imv,ngl) = deld(imv,ngl) + a(iv2)

148 end do ! row

149 end if ! vary

150 if (ku.ne.O) then ! frozen, compress

161 do k=l,ku ! local, non-unique

163 iv = kpty(k) ! local, full

lis iv2 = iv+iv ! delta ' a ' local, full

IJ4 ivi = iv2-l ! psi ' a ' local, full

166 i = kptz(k) ! nonlocal, compress

166 imu = iptw(i) ! local, compress

195
1B7 imu = imu+mv ! append ' (vary+froz)

1B8 pBid(imu,ngl) = psid(imu,iigl) + a(ivl)

150 deld(imu,ngl) = deld(imu,ngl) + a(iv2)

160 end do ! rov

lei end if ! frozen

162 end do ! angle

163 c* end do ! repeat

164 end do ! ambient

165 166 if (kv.ne.O) then ! vary

167 do k=l,kv ! reset

168 i = iptx(k) ! unique-nesB

168 iptw(i) = 0 ! indicator

170 end do

171 end if

172 if (ku.ne.O) then ! frozen

173 do k=l,ku ! reset

174 i = kptx(k) ! unique-ness

175 iptw(i) = 0 ! indicator

176 end do

177 end if

178 end do ! wave

170 end do ! sample

180

181 mravs = iraws

182 return

183 184 1 00 format (/' oops, there is NO varying model pareuneter ' 18B k /' for the case involving: sample = ', i3,

186 k /' where the i3, '-th wave = ' , i3)

187 end

196
6.2.22 SEAM3.FOR

1 lubreutine seamS ! fetch table < asmblx

9 include ' ioirnit .

9 include ' defnit .

4 include 'filsmun.'

$ include 'seanxl.'

• include 'seainx2.'

r logical firstv, firstu

•

• e Conftruct iparse matrix associated with model experiment.

10

11 ii = 1

IJ ia(l) = 1 ! veury

i» jj = 0

14

II iaa(l) = 1 ! frozen

l« jja = 0

ir

It ivi =0 ! 9ave,sampl

It mwt = 0 ! nfilms,wave,siunpl

)0 iavi = 0 ! ambient , wave, sampl

ai iravt = 0 ! repeat, ambient, wave, scunpl

» iarawt = 0

It ngl = 0 ! ndegr, repeat, ambient, wave, sampl

J4 do it=l,mtanpl

» mfilB = nnfilm(is) ! FILMSS

3t mwave = nnwaveCis)

87 mlilai = mfilffl+i ! film/ substrate

at nrov = mf ilm*3-)-2 ! (z,n,k) (n,k)

at do i«=l,mwave

to iws = iws-i-l

ti ivave = iiwave(iws)

ta mbien = nnbent(iws)

M do i=l,nrow

t4 iptx(i) = 0 ! vary > unique

ti ipty(i) = 0 ! vary > full

ta kptx(i) = 0 ! froz > unique

t7 kpty(i) = 0 ! froz > full

tt end do

tt iv = 0 ! local, full, non-unique

40 kv = 0 ! local, vary, non-unique

41 mv = 0 ! local, vary, compress

41 ku = 0 ! local, froz, non-unique

4t nni = 0 ! local, froz, compress

44

41 do m=l,mfiln8 ! films/substrate

4t if (m.ne.mf ilms) then ! films ' z

47 mws = mws+1

4t iz = iifilm(mws)

49 iv = iv+1 ! local, full

io j = mlmnts-t-iz ! nonlocal, full

197
61 if (Ivaryz(iz) .eq.l) then ! vary

52 i = iptv(j) ! nonlocal, compress

53 kv = kv+1 ! local, non-unique

54 iptx(kv) = i ! local ' nonlocal

55 ipty(kv) = iv ! local, lull

56 if (iptw(i) .eq.O) then ! compress, unique

87 mv = mv+1 ! local counter

68 iptw(i) = mv ! local

69 jj = jj+1

60 ja(jj) = i

61 end if

62 else ! frozen

63 i = iptv(j) ! nonlocal, compress

64 ku = ku+1 ! local, non-unique

66 kptx(ku) = i I local ' nonlocal

66 • kpty(ku) = iv ! local, full

67 if (iptw(i) .eq.O) then ! compress, unique

68 mu = mu+1 ! local counter

69 ipt?(i) = mu ! local

70 jja = jja+1

71 jaa(jja) = i ! backwards, mm+l-i=k

72 end if

73 end if

74 end if ! z

75 do ink=l,2 ! n+ik

76 mss = mws+1

77 nk = iifilm(mws)

78 iv = iv+1 ! local, full, non-imique

79 if (Ivaryl(iik) .eq. 1) then ! vary

80 i = iptv(nk) ! nonlocal, compress

81 kv = kv+1 ! local, non-unique

82 - ' iptx(kv) = i

83 ipty(kv) = iv

84 if (iptw(i) .eq.O) then ! compress, unique

85 mv = mv+1 ! local counter

86 iptw(i) = mv ! local

87 jj = jj+1

88 ja(jj) = i

89 end if

90 else ! frozen

91 i = iptv(nk) ! nonlocal, compress

92 ku = ku+1 ! local, non-unique

93 kptx(ku) = i

94 kpty(ku) = iv

95 if (iptB(i) .eq.O) then ! compress, unique

96 mu = mu+1 ! local counter

97 iptw(i) = mu ! local

98 jja = jja+1

99 jaa(jja) = i ! backwards, mm+l-i=k

100 end if

101 end if

102 end do ! n+ik

103 end do ! mfilms

198
104 106 lirstv = .true.

lOfl firstu = .true.

107

108 do m'bii=l,mbieii ! ambieiits

109 laws = iavs+l

110 imbien = iibeiit(iaws)

111 c* mrpeat = luipaat(iays)

113 c* do irpeat=l .mrpeat ! repeats

lis iraws = iravs+1

114 mangl = mangle (iraws)

lis do iaiigl=l .mazigl ! angles

118 iaraws = iarans+l

117 jjjj = iiiiCiaraws) ! angle

118 ngll = ngl+jjjj ! pointer

110 ijo ia(ii+l) = ia(ii)+mv ! vary

iji ia(ii-t-2) = ia(ii)+mv+mv

133 if (firstv) then

133 firstv = .false.

134 do j=l,mv

135 jj = jj+1

136 jaCjj) = ja(jj-mv)

137 end do

138 else

138 do j=l,mv

180 jj = jj+1

181 jaCjj ) = ja(jj-«iv)

183 ja(jj+mv) = jaCjj ) 188 end do

184 jj = jj+mv

185 end if

188 jl = ia(ii ) 187 j2 = ia(ii+l)-l

188 do j=jl,j2

189 jaj = ja(j)

140 imv = iptffCjaj)

141 aa(j ) = psid(imv,ngll)

143 aa(j+mv) = deld(imv,ngll)

148 end do

144

146 e Extract info from the tabulation.

148 147 bb(ii ) = psii(ngll)

148 bb(ii+l) = dell(ngll)

149 cc(ii ) = psiaCngll)

160 cc(ii+l) = dela(ngll)

151

163 iaa(ii+l) = iaa(ii)+mu ! frozen

168 iaa(ii+2) = iaa(ii)+mu+mu

164 if (mu.ne.O) then

166 if (firstu) then

150 firstu = .false.

199
187 do j=l,mu

188 jja = jja+1

158 jaa(jja) = jaa(jja-mu)

160 end do

161 else

162 do j=l,mu

163 jja = jja+1

184 jaaCjja ) = jaa(jja-mu)

185 jaa(jja+rau) = jaa(jja ) 160 end do

187 jja = jja+mu

168 end if

189 jjl = iaa(ii ) iro jj2 = iaa(ii+l)-l

171 do j=jjl.jj2

172 jaj = jaa(j) ! backwards

173 imu = iptv(jaj)

174 imu = imu+mv ! append

176 aaa(j ) = psid(imu,ngll)

176 aaa(j+mu) = deld(imu,ngll)

177 end do

178 end if ! frozen

179 ii = ii+2

180 end do ! angles

181 ngl = ngl+ndegr ! pointer

182 c* end do ! repeat

183 end do ! ambient

184

185 if (kv.ne.O) then ! vary

186 do k=l,kv ! reset

187 i = iptx(k) ! unique-ness

188 iptw(i) = 0 ! indicator

189 end do

190 end if

191 if (ku.ne.O) then ! frozen

192 do k=l,ku ! reset

193 i = kptx(k) ! unique-ness

194 iptw(i) = 0 ! indicator

195 end do

196 end if

197 end do ! wave

198 end do ! sample

199 meqns = ii-1

200

201 if (jj .ne. ia(ii)-l) then

202 write (iout,102) ii,jj,ia(ii)

203 stop

204 end if

205 if (jja .ne. iaa(ii)-l) then

206 write (iout.lOS) ii, j ja,iaa(ii)-l

207 stop

208 end if

209 if ( j

j .gt .nnjaaa .or. j ja.gt .nnjaaa) then

200
310 write (iout,104)

311 stop

313 end if

31S

314 return

315 310 102 format (/' asmblx, inconsistent format of sparse matrix,

317 k »aa ' vary'

318 k /* ii = • , ilO

319 k /' jj = ilO, '=/=', ilO, ' =/= ia(ii)-l')

330 103 format (/' asmblx, inconsistent format of sparse matrix, '

331 k 'aaa ' froz'

333 k /' ii = ' , ilO

335 k /' jja= ', ilO, '=/=», ilO, ' =/= iaa(ii)-l')

334 104 format (/' asmblx, array allocation for the sparse matrix '

336 k /' has been exceeded.'

336 k /' aa,ja < nnjaaa (DEFUIT.)'

337 k /' aaa,jaa < nnjaaa (DEFNIT.)' ) 338 339 end

201
6.2.23 POPLAT.FOR

subroutine poplat (u, job)

8 dimension u(l)

4 byte labx(64), laby(64), labg(64) ! graphics

5 real tlab(4l)

8 include 'iounit .

- f include 'defnit.

'8' include 'filnmn.

8 , include 'filrass.

include ' seamxl .

li include 'seamx2.

12 include 'vstack.

18

14 parameter (ndos =91}

15 integer kdos(ndos ,nroffss}

18 real udos(ndos .nronss) , xdos(ndos} ! graphics

ir real umin(nrovss} , wsav(nrovss} , xx2(2), yy2(2)

18 logical f irst(nrows8}

19

SO parameter (keep=10)

31 integer kkkkCkeep^nseaims , nrovss}, kk(nrowss}

«

38 common / dossav / udos, xdos, umin, wsav.

34 k kkkk, kk, kfull, first

38 equivalence (kdosCl.l), udosCl.l})

38

37

38 goto (1,2, 3,4), job

3080 1 kfull = (]ceep*n8eam8)/maraw8 ! limit /restrict storage

31 kfull = maravs*min (kfull,keep) ! retain minima, truncate

83 do m=l,mvary

88 first (m) = .true.

84 kk(m) = 0 ! pointer

SB do i=l ,ndos ! initialize

88 kdo8(i,m) = 0

87 end do

88 end do

80 return

40

4143 2 do m=l,mvary

48 B = u(m) ! graphics, positioning

44 if ((b .gt.l.0E4} .or. (w. It. 0.0)) then ! truncate, (-B,4)

4S = 4.0

48 else if (« .gt. l.OE-6) then ! map

47 = aloglO (w)

48 else ! truncate

48 = -5.0

50 end if

202
5162 wi = Cw+5.0;/9.0 ! (0,1)

53 1 - ninx v.wi'i'zioai v.iia.os;; ! inaex/posixion. DOS

54 i = max (1, min (i,ndos)) ! assurance

55 JEaos^i,mj - X(ios^i,m>+i : u,pd,a1«e 5667 iz Cfs-rstCm}) then ! discern minimum

58 first (m) = .false. ! initialize

9W60 19 a M w f in 1 " 19 wSttV^Iuy — W

A1vk WiTni jkA — TnAT*ncfis V *u / ulc&x aw B

vLO J ~ X 1 lueix BW B 6S kkkk( j ,in) = ixii(j) ! rataixi aziglos

04 0zid do

65

DO UiuxxL\m/ " uvniy 67 19 0 M t Ht 1 " 19 wSaV^niy — w

JLA ~ nicix aw s 69 J X y ulax awB

f u

71 6iid do

73 6Xs6 if (7 . 6(j . ws&v(in) ) thozL ! itnilliipld inizLiiii& To

74

75 ^ ^ ~ 1 m s s i9fli CLO J — 1 y meuL swB

76

77

7Bf o ozid do

IWonOU XLv XwWOXlWXVXL| WUW

81 XXvin^ — V,Iuy ^XuBXawS ! COZlwlXlUO C01uLbJ.Xlg 83 end if

88 end If

84 end (10 86 return

8687

88 0 aO 1—1 ,nuOB

89 XCLOBvly — —— — DCO* n niff f TiHna— i ^ /"f 1 nitl: fTTclos— 1 ^ ^ . w ^ vH^Av^xiuoB 1 y / xxuB w v^LUV ^JJ

OAmi k +40* ffloatf /float fndos-1))

91 6zid do

92 ZZ2v.lj - XClOS^l J • fllin vB jLjL^\^J — JkUO B B y • iiiBA 94 ^ 4^— AA Ifnin yyz^ij — u.u niixi 9596

97 do ni=l,nivary

98 write ^iout,iby m, umm^m^ , wsav^mv

99 erite (iplt,19) ndos, m

100

101 kmax =0.0 ! Population, DOS

102 do i=l,ndos

103 kmax = max (kmax, kdoB(i,m))

203
104 end do

105 lunax = O.g4/alog (float (kmax)) ! scale ' 0.99 - .05

106 do i=l,ndos ! rescale

107 it (kdos(i,m) .eq. 0) then

108 udos(i,m) =0.0

100 else

110 udos(i,m) = uinax*alog (float (kdos(i,m))) + O.OS

Iti end if

112 write (iplt,20) i, xdos(i), udos(i,in)

lis end do

114

115 encode (12, 21, labx) ! capital letters only

116 encode (32, 22, laby) ! terminated by a

117 encode (26, 23, labg) m ! dollar ($) sign.

118 lie linlog = 1 ! (linear, linear) ' (x,u)

120 call displa (2, 0, linlog)

121 call agsetf ('GRAPH/RIGHT.', 0.8)

122 123 call aggeti ( 'LINE/HAXI . ' , mlln)

124 call aggetf ('LINE/END.', tcln)

126 call agcpyl (!nin0(80,mlln) , tcln, labg, tlab,ncd'uin)

128 call agsetf ( 'LABE/MME . ' , 4H T)

127 call agseti ('LINE/NUMB.', 100)

128 call agsetp ('LINE/TEXT.', tlab, 1)

129 130 call anotat (labx, laby, 1, 1 , 0,0)

131 call agstup (xx2,l,0,2,l, yy2,l,0,2,l)

132. call agback

133 call agcurv (xdos,l,udos(l,in),l,ndos,l) ! line solid

134 call flush

136 call freune ! 138 end do

137

138 do m=l,mvary

130 k = kk(in)/maravs ! population of minima

140 vrite (iout,31) m,k

141 k = min (k,keep) ! truncation

142 k2 = 0

143 do j=l,k ! distinct sets of angles

144 kl = k2+l

146 k2 = k2+maraws

146 write (iout,32) j, (kkkk(i,m), i=kl,k2)

147 end do

148 end do

140 return

160

151

152 c Discern correlation among model parameters at minima.

153 164 4 do m=l,mvary

165 kt = kk(m)/maraws ! distinct minima

166 write (iout,30)

204
1S7 write (lout, 31) m, kt

168

159 kt = min (kt,keep) ! truncate

100 ik = 0

161

les do iki=l,kt

163 do j=l,marB?s ! extract angles at minima

164 ik = ik+1

166 iiii(j) = kkkk(ik,m)

166 end do

167 write (iout,203) (iiii(j), j=l,maraw8)

168

169 call seamS ! model experiment

170

171 kv = 0

172 do jv=l,mvary ! A(T)*A

173 do iv=l,jv ! diagonal, upper triangle

174 SB = 0.0

176 do i=l,meqns,2

176 jl = ia(i ) 177 j2 = ia(i+l)-l

178 mv = j2-jl+i

179 si = 0.0

180 s2 = 0.0

181 sB = 0.0

182 s4 = 0.0

183 do j=jl,j2 ! row

184 jaj = ' column

186 if (jaj.eq.iv) then

186 si = aa(j ) 187 83 = aa(j+mv)

188 end if

189 if (jaj.eq.jv) then

190 8 2 = aa(j ) 191 84 = aa(j+mv)

103 end if

193 end do

104 SS = 88 -)- 8l*s2 + 83K84

196 end do ! meqns

196 88 = 88 /float (meqns)

107 kv = kv+1

108 aat(kv) = ss

109 if (iv.eq.jv) then

200 u(jv) = sqrt (ss)

301 and if

303 end do

308 end do

304 kv = 0

305 do jv=l,mvary ! renormalize

300 do iv=l,jv

307 kv = kv+1

308 aat(kv) = aat(kv)/(u(iv)*u(jv))

30B aud do

205
210 end do

311 write (iout,204)

212 213 k2 = 0

214 do i=l,mvary

216 kl = k2+l

216 k2 = k2+i

217 write (iout,205) i, (aat(k), k=kl,k2)

218 end do

219 write (iout,207)

220 write (iout,208) (u(i), i=l,mvary)

if (iki.ne.kt) write (iout,29)

222 end do ! minima

223 end do ! vary

224 write (iout,30)

226 return

226

227 IB format (/' vary, i =', i4, ', Umin - lpell.4.

228 k W8 = », ell. 4)

229 19 format (Ix, iB, ' 1', iB,' ' ndos, nu, ivary')

230 20 format (Ix, iB, Bx, lp2el3.B)

231

232 21 format ('UNCERTAIIJTT$') ! 12

233 22 format ('POPULATION, (LOG, NORMALIZED)!') ! 32

234 23 format ('VARIATION PARAMETER, 1=', 12, '$') ! 26

235 236 29 format (Ix, IBC •))

237 30 format (Ix, 1B('===='))

238 31 format (/' vary =', i4, ', population at minima =',

239 32 format ( 7x, i4, ')', 20i4, : /(12x, 20i4))

240

241 203 format ( lOx, 'iiii:', 20i4, : /(IBx, 20i4))

242 204 format (/' A(T)*A: (correlation)')

243 205 format (Ix, i4, ')', Ix, lOflO.B, : /(7x, lOflO.B))

244 207 format (/' normalization coefficients :'

)

246 208 format (Ix, lplOelO.2)

246 end

206
6.2.24 PLTE.FOR

1 c Plot the data results from: SEAMAI

3 c Sensitivity/Error Analysis for Multiple:

3 c angle, ambient, wave, szunple.

4

5 progreun plte

8 byte labx(64), laby(64), labg(64)

7 real tlab(41), sO)

8 character*64 filenin

9

10 include 'defnit.'

11 integer zmwaveCnsampl)

13 integer unbent (nbient>4<nwaves>*<nsainpl)

18 integer mangle(nbient*nwaves*nszunpl)

14 integer isteps(nbient*nwaves*nsampl)

16 integer iiiCnseeuns) , iil(nseans), ii2(nseeuns) , kkk(nseams)

18 real u(nxo9ss), unin, ?sbv

17 logical first

18

19 partuneter (keep=10)

20 integer mmmCkeep^nseams) , mm

31

33 parameter (nx = 89) ! degrees

38 real BB(nx*nx), xx(nx), yy(nx) ! graphics

34 integer inf o(2*nx*nx)

3636 pareuneter (ndos = 91)

37 integer kdos(ndos)

38 real udosCndos), xdos(ndos)

39 equivalence (kdos(l), udos(l))

80 data in,iout,idat / B,6,7 /

818388 read ( in, 301, err=102,end=102) f ileum

84 close (unit=in)

86 write (iout,303) filenm

88 open (unit=idat, file=filenm, status= 'old'

87 k readonly, shared, err=103)

88

89 loop = 0

40 11 loop = loop+1 ! ivary

41 rewind (unit=idat)

4348 read (idat,*) msampl, mvary, mdegr

44 read (idat,*) (nnwaveCis), is=l, msampl)

45 iws = 0

48 iaws = 0

47 iraws = 0

48 marawB = 0

49 do i8=l, msampl

60 mwave = nnwaveCis)

207
51 do i9=l,mwave

52 iws = iws+1

53 read (idat,*) mbien

54 imbantCiws) = mbien

55 do mbn=l .mliion

66 laws = iaws+1

67 C* read (idat,»<) mrpeat ! ' 1

58 C* zinpeat(iaws) = mrpeat

59 c* do irpeat=l , mrpeat

60 iraws = iraws+1

01 read (idat,>(<) istep, mangl

62 isteps(irans) = istep

es mcmgle (iraws) - mazvgl

64 maraws = maraws+mangl

66 c* end do ! repeat

66 end do ! ambient

87 end do ! wave

68 end do ! sample

69 mraws = iraws

70 mx = mdegr

71 kfull = (keep>(nseams) /maraws ! prevent exceeding storage

72 kfull = maraws>*<min (kfull,keep) ! retain mixiima, truncation

7374 first = .true.

'75 do i=l,ndos

76 kdos(i) = 0 ! initialize

77 end do

78 kt = 0

79 mm = 0

80

81 c m = loop ! ivary

83 j2 = 0

83 k = 0

84 1 k = k+i

85 if (k.gt .mraws) goto 4

86 istep = isteps(k)

87

88 jl = j2+l

89 j2 = j2+mangl

90 ii2(jl) = mdegr ! limit outer-most do

91 do j=jl,j2 ! multiple angle

92 iil(j) = 1+ (j2-j)*istep

93 iii(j) = iil(j) - istep

94 end do

96

96 d = ji-i

97 2 j = j+i

if (j .gt. j2) goto 1

99 3 iii(j) = iii(j)+istep

100 if (iii(j) .le. ii2(j)) then ! test upper limit

101 if (j.ne.j2) ii2( j+l)=iii( j )-istep

102 goto 2

103 end if

208
104 iii(j) = iil(j)-i8tep ! reset inner do

105 j = j-1 ! backup one do-level

108 if (j .ge. jl) goto 3

107

108 if (k.eq.l) goto 6 ! escape do-nest

109 k = k-1

110 istep = isteps(k)

111 memgl = mzmgleCk)

112 j2 =

lis jl = jl-mangl

114 goto 3

115 4 continue

110 117 j leave = jl

118 j28ave = j2

110 if ( j .ne .maravs+l) then

130 srite (iout,107) maraws,j

131 stop

133 end if

138 c

134 kt = kt+1

136 read (idat,*) kkkk, (kkk(k) ,k=l .maraws)

138 read (idat,*) ( u(k) ,k=l ,mvary ) 137

138 if (kkkk .ne. kt) then ! test consistency

130 write (iout,212) kkkk.kt

ISO goto 101

131 end if

133 do i=l,maraws ! consistency check

iss if (kkk(i) .ne. iii(i)) then

1S4 write (iout,212) kkkk, kt

136 write (iout,213) (kkk(k), k=l,maraws)

138 write (iout,214) (iii(k), k=l,maraws)

187 goto 101

138 end if

180 end do

140

141 B = u(m) ! graphics, positioning

142 if ((w.gt.l.0E4) .or. (w. It. 0.0)) then ! (-5,4)

143 w = 4.0

144 else if (w .gt. l.OE-5) then

146 w = aloglO (w)

148 else ! truncate

147 w = -B.O

148 end if

140

180 wi = (w+B.0)/9.0 ! (0,1)

161 i = nint (wi*float (ndos)) ! Density of States

163 i = max (1, min (i,ndoi))

168 kdos(i) = kdos(i)+l ! update

164

166 if (first) then ! discern minimum

168 first = .false. ! initialize

209
1 R7 uiu — uvm^ 1 retain minimum

i CO

lOU. 1 rebam angxeB

lOl oxid do

162 nun — nifiir&ws pointer/counter

103 OXBO IX \w»X\imVioJ wXlOZl 1 minimum update

iim ^ 11 1 ffi I

16S WS — W

1 AA

oxid do

i AO IBV nun <— moLXawB

i JVM A 1 a M ^ ^ 1 fv A M V9 a I ^ PI AVI 1 multiple minima

171 1 prevent exceeding storag

KLV X**XjIUCIXClWB 179 ITUU — ITUTl ' X

1 poxnwer/ couneer

li4 XTunni vimn^ xxxvxy rewaxn angxes

175 end ao

176 0xSS

177 mm = mm+maravs

I7fi end if

X7w end if

180

1 oi IBI c ITote that all plots involve two dimensions. So, for cases

c involving multiple: angles, ambients , waves, and samples.

183 c ... it is HOT clear what should (or is able to) be plotted.

1Lo*t c For the special case involving: 1 or 2 multiple angles.

185 c 1 ambient. 1 wave, and 1 sample,

186 we may consider plotting the following arrays

187

loo if (maraws .eq. 1) then

IBv i = iii(l) >0

1 oh ww(i ) = float (i) 1 X ' angle

Ivl ww(i+mx) = w 1 u ' uncertainty

IvZ else if (maraws .eq. 2) then

193 i = iii(l) + mx*(iii(2)-l) 1 (il,i2) symmetric

j = iii(2) + mx*(iii(l)-l) ! (i2,il)

1 as ww(i) = w

1 HA ww(j) = w

L9T

198 end ifc

1 aa Ivv k = mraws

200 j = maraws

201 jl = jlsave

202 j2 = j2Bave

208 goto 3

204

206 c

6 continue 1 escape do-loops

206 207 k = mm/maraw

208 write (iout,215) m, k, tun, ws 1 minimum

209 k = min (k,keep) 1 truncate

210
91 A - Jk^ -= 0

311 tin 1 =l.k ! angluar locations

313 kl = k2+l ! along valleys

313 k2 = k2+maravs

314 write (iout,216) j, (inmm(i), i —X.1 ,X.^J do

316 217 do i =l,ndoi

218 xdo8(i) = - B.O * (float(ndo8- 1 j/zioat ^naos-1 J ^ 219 k + 4.0 * (float( i- 1^/zioat vndos-l J

220 end do

231 xx(l) = idosCl ) ! min

222 xx(2) = xdosCxidos) ! max

223 yy(l) = 0.0 ! min

224 yy(2) = 1.0 ! max

22S

228 kmax = 0.0 ! Population, DOS

227 do i =1 ,ndo8

228 kmax = max (kmax, kdosd))

220 and do

230 unax = 0.84 / alog (float (kmax)) ! scale ' 0 99

231 do i=1 ,ndo8 ! rescale

if (kdos(i) .eq. 0) then

238 udoB(i) = 0.0

234 else

236 udo8(i) = uinax*alog (float (kdos(i))) + O.OB

230 end if

237 and do

238

239 encode (12, 221, labx) ! capital letters only

240 encode (32, 222, laby) ! terminated by a

241 encode (26, 223, labg) m ! dollar ($) sign.

243

243 linlog = 1 ! (linear, linear) ' (X

344 call ditpla (2, 0, linlog)

346 call agsetf ('GRAPH/RIGHT.', 0.8)

340

«9 call ftggeti ('LINE/MAII. ' , mlln)

348 call aggetf ('LIUE/Ein). tcln)

349 call agcpyl (min0(80,mlln) , tcln. labg, tlab,ncdum)

360 call agsetf ('LABE/NAME.', 4H T)

261 call agseti ('LIUE/NUMB.', 100)

262 call agietp ( 'LINE/TEXT. ' , tlab, 1)

253 call anotat (labx, laby, 1,1, 0,0)

266 call agstup (xx, 1,0, 2,1, yy,l,0,2 .1)

260 call agback

267 call agcurv (xdos , 1 ,udos , 1 ,ndos ,1) ! line solid

268 call flush

269 call frame 1 200

201

202 C Plot uncertainty

211
363

3A4 if (naraws .eq.l) then single angle

305 mxs = mx assume: istep=l

306 if (istep.ne.l) then compress matrix

367 j = 0 compress

368 do i=l ,mx,istep

369 j = j+1

370 )=ww(i )

1 X

371 ww(3+mx) = ww(i+inx; 1 u

373 end do

373 mxs = j

1 consecutive points

374 end if

376 376 xx(l) = 0.0 1 xmin

377 xx(2) = wwCmxs) xmax

378 yy(l) = -B.O umin

379 yy(2) = 4.0 Umax

380

381 if (xx(2) .It. 4B.0) then ! convenience

383 xx(2) = 4B.0

388 else

384 xx(2) = 90.0

386 end if

386 387 encode (32, 224, labx) 1 capital letters only

388 encode (12, 221, laby) terminated by a

389 encode (26, 223, labg) m dollar ($) sign.

390

391 linlog = 1 (linear, linear) (x

393 call displa (2, 0, linlog)

393 call agsetf ('GRAPH/RIGHT.' , 0.8)

394

395 call aggeti ( 'LINE/MAII . '

,

mlln)

396 call aggetf ('LINE/END.', tcln)

397 call agcpyl (min0(80,inlln)

,

tcln, labg, tlab.ncdum)

398 call agsetf ( 'LABE/NAME. '

,

4H T)

399 call agseti (» LINE/NUMB

,

100)

300 call agsetp ('LINE/TEXT.', tlab, 1)

301 303 call anotat (labx, lahy, 1,1, 0,0)

303 call agstup (xx, 1,0, 2,1, yy, 1,0, 2,1)

304 call agback

306 call agcurv (ww(l),l, ww(l+mx),l, mxs. 1) ! line solid

306 call flush

307 call frame ! 308 end if

309

310

311 il (maraws .eq.2) then ! double angle, surface plot

313 span = 9.0 ! (-6,4)

313 do i=l,mx,istep

314 j = i + (i-l)*mx ! diagonal ' (i.i)

316 ww(j) =4.0 ! maximum

212
S16 xy = (lloat(i-l)/lloat(mx-l)) * 2.0*8pan ! scale plots

Sir xx(i) = xy ! domain ' plot routine

S18 yy(i) = xy ! domain ' plot routine

SIB end do

S30

331 mxs = mx ! assume: istep=l

333 if (istep.ne.l) then ! compress matrix

333 mxs = 0 ! compress index

834 k = 0

S36 do j=l,mx,istep

S36 jmx = (j-l)*mx

337 do i=l,mx,istep

338 k = k+1

339 ww(k) = Hw(i+jmx)

sso end do

881 mxi = rnxs+l

883 xx(mxs) = xx(j)

888 yyCmxs) = yy(j)

334 end do

335 end if

888 887 zn = 1.0 ! viewing vector

888 yn = 1.0

889 zn = 1.0

840

341 C ' defines the line of sight of viewer and object.

843 C the viewer's eye is at : s(l-3) ' (x.y.z) ' NCAR

848 e the point looked at is : s(4-6) ' NCAR

844 c effective radius of obj : s(7-9) ' convenience

345 846 (4) = span ! (xmax+xmin)*O.B center of object or

347 (B) = span ! (ymax+ymin)>)<0.5 point being viewed

348 (0) = 0.0 ! (umax+umin)>xO.B

849

360 (7) = span ! (xmax-xmin)*O.B radius of object

351 (8) = span ! (ymax-ymin)*O.B

353 (9) = 0.0 ! (uinax-umin)*O.B

353

354 radius = amaxl (s(7), s(8), s(9)) ! effective radius

355 dist = radiu8*B.O ! convenient distance from

358 I = xn*xn+3rn*yn+zn*zn ! which to view the object

857 dist = dist/sqrt(ss) ! induce unit vector

858 8(1) = s(4) + xn*dist

359 (2) = 8(B) + yn*dist

380 (3) = s(6) + zn*dist

381 883 call seti (10,10)

883 call srface (xx,yy,ww,info, mxs, mxs, mxs, s,0.0)

384 call ezcntr (ww, mxs, mxs)

885 end if

888 if (loop.ne.mvary) goto 11

387

888 101 close (unit=idat)

213
369 Stop

370 102 write (iout,302) in

371 stop

372 103 write (iout,302) idat

373 stop

374

376 107 format (' oops, maraws,j: 2i5)

376 212 format (' oops: ... input data is out of sync'

377 ft /' card index, kkkk = ', ilO

378 ft /' card count, kt = ' , ilO)

379 213 format (/' card data, kkk:', 10i4, : /(16x, 10i4))

380 214 format (/' do-loop, iii:', 10i4, : /(16x, 10i4))

381 216 format (/' vary, i =',i4,', population of minima

382 ft / 20x, *Umin =*, lpell.4, 5x, 'w='. ell. 4)

383 216 format (5x, i4, ')', 20i4, : /(lOx, 20i4))

384

385 221 format (' UNCERTAINTY!') ! 12

386 222 format ('POPULATION, (LOG. NORMALIZED)!') 32

387 223 format ('VARIATION PARAMETER, 1=', 12, '$') ! 26

388 224 format ('ANGLE OF INCIDENCE, (DEGREES)!') ! 32

389

390 301 format ( a64)

391 302 format (' Unable to open 10 unit = ', i3)

392 303 format ( Ix, a64)

393 end

214
6.3 General Utilities

6.3.1 DOT.FOR

1 subroutine dot (n.x.y, xy,k)

3 real x(l), y(l)

3

4 xy = 0.0

5 xn = 0.0

6 yn = 0.0

7 do i=l,n ! find maximum

8 xn = ameu:l (xn, abs (x(i)))

9 yn = amaxl (jm, abs (y(i)))

10 end do

11 it (xn.eq.0.0 .or. yn.eq.0.0) return

1318 xs = 0.0

14 ys = 0.0

15 do i=l,n

18 XX = x(i)/xn ! scaled vector component

17 yy = y(i)/yn

18 xa = XS + xx*xx ! dot product ' |x*x|

19 ys = ys + yy*yy ! dot product ' ly*yl

30 xy = xy + xx*yy ! dot product ' lx*y|

31 end do

3338 h = float (n)

34 xs = xs/h ! mean square value

36 ys = ys/h

30 xy = xy/h

37 xs = sqrt (xs) ! root mean square value

38 ys = sqrt (ys)

3080 if (k.eq.O) then ! usual dot product

81 xy = xy*xn*yn*h

83 else if (k.eq.l) then ! un-normalized

88 xy = xy*xn*yn

84 else ! normalized

86 xy = xy/(xs*ys)

80 end if

87

88 return

89 end

215
6.3.2 NORM.FOR

1 subroutine norm (ii,x, xn,k)

2 real x(l)

3

4 xn = 0.0

5 do i=l,ii ! fizid maximum

e xn = amaxl (xn, abs (x(i)))

7 end do

8 if (xn .eq. 0.0) return

e

10 XX = 0.0

11 do i=l,n ! dot product

12 XX = XX + (x(i)/xn)**2 ! Ix+xl

13 end do

14

15 if (k.eq.l) then ! mean squared value

16 XX = xx/float (n)

17 end if

18 xn = xn*sqrt (xx) ! Euclidean norm

19

20 return

21 end

216
6.3.3 APROD.FOR

1 Bubroutizie aprod (inode,m,ii,x,y. ia, ja.aa)

a izitegar mode, m, n, ia(l), ja(l)

s real x(n), y(m), aa(l)

4

6 data iout / 6 /

e C

7 c L ' A(ra,n), Transpose operator ' (')

8 c Operation: mode= 1, set : y = y + A *x

9 c mode= 2, set : X = X + A'*y

10 c x' = x' + y»*A

11 c

1213 if (mode.eq.l) then ! y = y + Ax

14 do i=l,m ! sceui rows of matrix A

15 mj = ia(i+l)-ia(i) ! number of columns in row

16 il (mj .ne . 0) then

17 ss = 0.0 ! sum

18 jj = ia(i)-l ! indexing

19 do j=l,mj ! scan columns of row

ao jj = jj+1

31 kk = ja(jj) ! column

33 ss = ss + aa(jj)*x(kk)

38 end do

34 y(i) = y(i)+s8 ! y = y+Ax

3B end if

36 end do

37

38 else if (mode.eq.2) then ! x' = x' + y'*A

39 do i=l,m ! scan rows of matrix A

80 mj = ia(i+l)-ia(i) ! number of columns in row

81 if (mj .ne .0) then

83 yy = y(i)

88 jj = ia(i)-l ! indexing

84 do j=l,mj ! scan columns of row

85 jj = jj+1

86 kk = ja(jj) ! column

87 x(kk) = x(kk) + yy*aa(j j)

88 end do

89 end if

40 end do

4143 else

48 write (iout, 10) mode

44 stop

46 end if

4647 return

48

40 10 format (/' aprod, ... error. mode= ' , i2)

60 end

217
6.3.4 SCALII.FOR

1 subroutine scalii (m,ii, ia,ja,a P.k)

2 integer ia(l), ja(l), m, n, k

3

4 real a(l). b(l), p(l)

5 C

e c Scale the rovs in matrix, A(m,n), b(m)

7 c Retain scaling coefficients in P(m)

8 c Evaluate P only when k = 0 .1,2 ,3.

9 c Re-scale A only when |k| = 2 .3.

10 c Re-scale B only when |k| = 1, 3.

11 c Matrix A is stored (row-wise) in the Tale Sparse Matrix Format.

12 c

1314 ka = iabs (k) 1 convenience

IB if (ka.gt.3) then out of range

16 do i=l,ni scan rows

17 p(i) = 1.0 default

18 end do

19 return

30 end if

21

22 if (k.ge.O) then j determine scaling

23 do i=l,m scan rows

24 mj = ia(i+l)-ia(i) number of columns in

25 if (mj.ne.O) then

26 big = 0.0 initialize

27 jj = ia(i)-l indexing

28 do j=l,mj 1 scan columns in row

29 jj = jj+1

30 big = amaxl (big , abs (a(jj)))

31 end do

32 if (big .eq. 0.0) then j trivial case

33 p(i) = 1.0 1 default

34 else

35 SB = 0.0 initialize

36 jj = jj-n>j j reset indexing

37 do j=l,mj scan columns in row

38 jj = jj+1

30 ss = ss + (a (jj)/big)**2

40 end do

41 p(i) = big*sqrt (ss) scale factor

42 end if

43 end if

44 end do

45 end if

4647 if (ka.eq.2 .or. ka.eq.3) then rescale A

48 do i=l,m j scan rows , A

40 raj = ia(i+l)-ia(i) j number of columns in

SO if (mj.ne.O) then

218
51 pp = p(i) ! scale factor of row

52 jj = ia(i)-l ! indexing

53 do j=l,mj ! scan coliunns in row

64 jj = jj+1

56 = *(jj)/pp • rescale the row

50 end do

67 end if

58 end do

50 end if

00

61 if (ka.eq.l .or. ka.eq.3) then ! rescale b

02 do i=l,m ! scan rows

63 b(i) = b(i)/p(i)

04 end do

05 end if

flfl 07 retiim

08 end

219
6.3.5 SCALJJ.FOR

1 subroutine scaljj (in,n, ia,ja,a,b, P.'.k)

3 integer ia(l), ja(l), k, m, n

3

4 real a(l), b(l), p(l), w(l)

56

c

c Scale matrix A so the diagonal of: [Transpose (A)*A] = 1.

7 c Matrix A is stored row-wise in the Tale Sparse Matrix Format.

8 c Scale the columns of matrices, A(m,n), b(n).

e c Retain the scaling coefficients in P(n).

10 c Use as a dummy work storage array. W(n).

11 c Evaluate P only when k =0,1,2 ,3.

12 c Re-scale A only when lk| = 2 .3.

13 c Re-scale B only when |k| = 1, 3.

14 c

15

16 ka = iabs (k) ! convenience

17 if (ka.gt.3) then ! out of range

18 do j=l,n ! seem, columns

19 pCj) = 1.0 ! default

20 end do

21 return

22 end if

23

24 if (k.ge.O) then ! determine scaling

25 do j=l,n ! scan columns

26 p(j) = 0.0 ! initialize

27 w(j) = 0.0 ! sums

28 end do

29

30 do i=l,m ! scan rows, A

31 mj = ia(i+l)-ia(i) ! number of columns in row

32 if (mj .ne.O) then

33 jj = ia(i)-l ! indexing

34 do j=l,mj ! scan columns of row

35 jj = jj+1

36 kk = ja(jj) ! column

37 p(kk) = eunaxl (p(kk). abs (a(jj))) ! max |A(,j)l

38 end do

39 end if

40 end do

41

42 do i=l,m ! scan rows , A

43 mj = ia(i+l)-ia(i) ! number of columns

44 if (mj.ne.O) then

46 jj = ia(i)-l ! indexing

46 do j=l,mj ! scan columns in row

47 jj = jj+1

48 kk = ja(jj) ! column

49 w(kk) = w(kk) + (a(jj)/p(kk))**2 ! sums

50 end do

220
51 end if

S3 end do

53

64 do j=l,n ! scan columns

66 p(j) = p(j)*8qrt (w(j)) ! retain scale factor

se end do

57 end if

68

59 if (ka.eq.2 .or. ka.eq.S) then ! rescale A

00 do i=l,m ! scan rows, A

fli mj = ia(i+l)-ia(i) ! number of columns

62 if (mj.ne.O) then

83 jj = ia(i)-l ! indexing

04 do j=l,mj ! scan columns in row

05 jj = jj+1

66 kk = ja(jj) ! column

07 (^(jj) - >i(jj)/F(l^) ! rescale column

68 end do

69 end if

70 end do

71 end if

7373 if (ka.eq.l .or. ka.eq.S) then ! rescale b

74 do j=l,n ! scan columns

76 b(j) = b(j)/p(j) ! rescale column

78 end do

77 end if

78

78 return

80 end

221
6.3.6 CGNL.FOR

1 subroutine cgnl (ma,na,ia, ja,aa, b,x,

2 k itmax, u,v,w, xx.se)

34 integer ia(l), ja(l)

6 real aa(l), x(l)

fl real u(l), v(l), w(l), xx(l), se(l)

7 external aprod

8 data iout /6/

9

10 c

11 c real b(ma), u(ma) , aa(ma,na)

12 c real x(na), v(na), «(na) , xx(na), se(na)

13

14 c Solve the linear or matrix algebra problem, Ax=b.

16 c Matrix A is stored row-wise in the Tale Sparse Matrix Format.

16 c Reference: C.C.Paige and M.A.Saunders,

17 c ''LSQR: An Algorithm for Sparse Linear Equations

18 c and Sparse Least Squares'',

le c Association for Computing Machinery,

20 c Transactions on Mathematical Software,

21 c Volume 8, Number 1, March 1982, pp. 43-71, (Note pp. 50-51).

22 c ibid.. Volume 8, Number 2, June 1982, pp. 195-209.

23 c

25 loop = 0 ! initialize

26 1 loop = loop+1 ! update counter

27 rr = 0.0 ! norm of residual

28 do i=l,ma ! scan rows, r=b-Ax

29 mj = ia(i+l)-ia(i) ! number of columns in row

30 if (mj .ne. 0) then

31 ss = 0.0 ! initialize sum

32 jj = ia(i)-l ! indexing

33 do j=l,mj ! scan coliimns of row

34 jj = jj+1

35 kk = ja(jj) ! column

36 ss = ss + aa( j j )>xx(kk) ! Ax

37 end do

38 ss = b(i)-ss ! r = b-Ax = residual

39 u(i) = ss ! r = residual

40 rr = rr+ss*ss ! |r|**2

41 end if

42 end do

43 if (rr .eq. 0.0) return

44

45 if (loop .eq. 1) then ! retain first norm

46 rrr = rr

47 else if (rr .ge. rrlast*0.98) then ! rate of convergence

48 c* ratio = sqrt (rr/rrr)

49 c* write (iout, 103) loop, ratio

60 c* write (iout, 104) istop, anorm, acond, morm, amorm, xnorm

222
51 return

52 end if

53 rrlast = rr ! update

54

56 c ! Set-up lor LSQR

56 relpr = l.OE-06 ! relative precision of floating point arithmetic

67 deunp = l.OE+00 ! 58 atol = l.OE-06 ! relative error of data in A

58 btol = l.OE-06 ! relative error of data in B ' rhs

60 conlim = l.OE+04 ! apparent condition number of matrix A-bar

61 ! (upper limit)

63 itnlim = itmax ! upper limit on number of iterations

65 nout = -iout ! output index to printer

64

66 call Isqr (ma, na, aprod, damp,

66 t ia, ja, aa,

67 k u, V, 7, XX, se,

68 k atol, btol, conlim, itnlim, nout,

69 k istop, anorm, acond, morm, amorm, xnorm)

70

71 do i=l,na

73 x(i) = x(i) + xx(i) ! update solution

75 xx(i) = 0.0 ! reset

74 end do

76 goto 1 ! loop back

7677 101 format (' cgnl, singular row= ', ilO)

78 102 format (' cgnl, singular column= ilO)

79 103 format (' cgnl, i5, lplell.3, ' ' loop, ratio '

80 ft ,

' (residual reduction) '

)

81 104 format (' cgnl, ', i5, IpBell.S)

83 end

223
6.3.7 LSQR.FOR

The following subroutine is located in the software library,

Guide to Available Mathematical Software, by R.F. Boisvert, S.E, Howe, and D.K.

Kahaner, Center for Applied Mathematics, National Institute of Standards and Technology (formerly, National Bureau of Standards), U.S. Department of Commerce,

1985.

The source code is copyrighted by the Association for Computing Machinery, Inc. The

references for the following source code include the following:

1) C.C. Paige and M.A. Saunders, "LSQR: An Algorithm for Sparse Linear Equations

and Sparse Least Squares," ACM Trans. Math. Softw. 8, 43-71 (1982).

2) C.C. Paige and M.A. Saunders, "Algorithm 583, LSQR: Sparse Linear Equations

and Least Squares Problems," ACM Trans. Math. Softw. 8, 195-209 (1982).

1 SUBROUTINE LSQR (M.N.APROD.DAMP,

2 1 lA.JA.AA,

3 2 U.V.W.I.SE,

4 3 ATOL.BTOL.CONLIM.ITNLIM.NOUT,

5 4 ISTOP,ANORM,ACOND,RUORM,ARNORM.XIIORM ) 6 C

7 EXTERNAL APROD

8 INTEGER M.N.ITNLIM.NOUT.ISTOP

9 INTEGER IA(M),JA(M)

10 REAL AA(M), U(M) , V(N) ,W(N) ,X(N) ,SE(N)

,

11 1 ATOL,BTOL,CONLIM,DAMP,ANORM,ACOND,RNORM,ARNORM,XNORM

12 C

13 C

14 C LSQR FINDS A SOLUTION X TO THE FOLLOWING PROBLEMS...

15 C

16 C 1. UNSYMMETRIC EQUATIONS ~ SOLVE A*X = B

17 C

18 C 2. LINEAR LEAST SQUARES — SOLVE A*X = B

19 C IN THE LEAST-SQUARES SENSE

20 C

21 C 3. DAMPED LEAST SQUARES ~ SOLVE ( A )*X = ( B ) 22 C ( DAMP*I ) ( 0 ) 23 C IN THE LEAST-SQUARES SENSE

24 C

26 C WHERE A IS A MATRIX WITH M ROWS AND N COLUMNS,

26 C B IS AN M-VECTOR, AND

27 C DAMP IS A SCALAR (ALL QUANTITIES REAL).

28 C THE MATRIX A IS INTENDED TO BE LARGE AND SPARSE.

29 C IT IS ACCESSED BY MEANS OF SUBROUTINE CALLS OF THE FORM

224
30 C

31 C CALL APROD ( MODE.M.II.I.Y, lA.JA.AA ) 33 C

33 C WHICH MUST PERFORM THE FOLLOWING FUNCTIONS . .

.

34 C

35 C IF MODE = 1, COMPUTE Y = Y + A*X.

39 C IF MODE = 2, COMPUTE 1=1+ A(TRANSPOSE)*Y.

37 C

38 C THE VECTORS I AND Y ARE INPUT PARAMETERS IN BOTH CASES.

30 C IF MODE = 1, Y SHOULD BE ALTERED WITHOUT CHANGING I.

40 C IF MODE = 2, I SHOULD BE ALTERED WITHOUT CHANGING Y.

41 C THE PARAMETERS: lA, JA, AA.

42 C MAY BE USED FOR WORKSPACE AS DESCRIBED BELOW.

43 C

44 C THE RHS VECTOR B IS INPUT VIA U, AND SUBSEQUENTLY OVERWRITTEN

45 C

46 C

47 C NOTE. LSQR USES AN ITERATIVE METHOD TO APPROXIMATE THE SOLUTION.

48 C THE NUMBER OF ITERATIONS REQUIRED TO REACH A CERTAIN ACCURACY

49 C DEPENDS STRONGLY ON THE SCALING OF THE PROBLEM. POOR SCALING OF

60 C THE ROWS OR COLUMNS OF A SHOULD THEREFORE BE AVOIDED WHERE

51 C POSSIBLE.

52 C

63 C FOR EXAMPLE, IN PROBLEM 1 THE SOLUTION IS UNALTERED BY

64 C ROW-SCALING. IF A ROW OF A IS VERY SMALL OR LARGE COMPARED TO

55 C THE OTHER ROWS OF A, THE CORRESPONDING ROW OF (A B ) SHOULD

se C BE SCALED UP OR DOWN.

57 C

68 C IN PROBLEMS 1 AND 2, THE SOLUTION X IS EASILY RECOVERED

50 C FOLLOWING COLUMN-SCALING. IN THE ABSENCE OF BETTER INFORMATION,

ao C THE NONZERO COLUMNS OF A SHOULD BE SCALED SO THAT THEY ALL HAVE

81 C THE SAME EUCLIDEAN NORM (E.G. 1.0).

82 C

as C IN PROBLEM 3, THERE IS NO FREEDOM TO RE-SCALE IF DAMP IS

84 C NONZERO. HOWEVER, THE VALUE OF DAMP SHOULD BE ASSIGNED ONLY

as C AFTER ATTENTION HAS BEEN PAID TO THE SCALING OF A.

88 C

87 C THE PARAMETER DAMP IS INTENDED TO HELP REGULARIZE

88 C ILL-CONDITIONED SYSTEMS, BY PREVENTING THE TRUE SOLUTION FROM

89 C BEING VERY LARGE. ANOTHER AID TO REGULARIZATION IS PROVIDED BY

70 C THE PARAMETER ACOND, WHICH MAY BE USED TO TERMINATE ITERATIONS

71 C BEFORE THE COMPUTED SOLUTION BECOMES VERY LARGE.

72 C

73 C

74 C NOTATION

75 C

78 C

77 C THE FOLLOWING QUANTITIES ARE USED IN DISCUSSING THE SUBROUTINE

78 C PARAMETERS . .

.

79 C

80 C ABAR = ( A ), BEAR = ( B ) 81 C ( DAMP*I ) ( 0 ) 82 C

225
83 C R = B - A*X, REAR = BEAR - ABAR*X

84 C

85 C RNORH = SQRT( N0RM(R)**2 + DAMP**2 N0RM(I)**2 ) 86 C = NORM( REAR ) 87 C

88 C RELPR = THE RELATIVE PRECISION OF FLOATING-POINT ARITHMETIC

89 c ON THE MACHINE BEING USED. FOR EXAMPLE, ON THE IBM 370,

90 c RELPR IS ABOUT l.OE-6 AND l.OD-16 IN SINGLE AND DOUBLE

91 c PRECISION RESPECTIVELY.

92 c

93 c LSQR MINIMIZES THE FUNCTION RNORM WITH RESPECT TO X.

94 c

95 c

9e c PARAMETERS

97 c

98 c

99 c M TMPTIT THF MnMRFR OF RHU^ TTI A 100 c

101 c KTu TWPTTT TTTP WnMT?P''B np mi TTMW^ TW A

102 c

103 c JCi A X J!i AlV All 3£i£i ADUVJIi* 104 c

105 c AMP TWOTTT TUT? TUMOTTIfi T) * B 4 MTTTim TTfTR 'DBnRTVM 9 ATtDiril

loe c V.JJAnr snUULU DC U.U r UA rAUDuCna 1 AflU ^'J

107 c

108 c fW HAMO TW TUT? DAWPW f\ Tfl CnST ^ WT D1> ^ ^VmPM ^ A ^

109 c

T.TTT WXiiLT DDODAQTV ^aUdAsLi aAVJCi 1TAT7V AA lffUPTT/*TBTW UCCLJLviloLC WWHT CrrC(/X.

110 c XjAAuilfA VALiUfiD Uf USLvlr WXLili LdaU XU us»\^aSiSkiia 111 c inti flUAn Ur a AJIU lU A£ii;Ul/C inC JSiUnclul Ur

112 c IXCaAxIUuS AiiljUlAm; 01 LsljA.

113 c

114 c THE WORK PER ITERATION AND THE STORAGE NEEDED

lis c BY LStjR ARE THE SAME FOR ALL VALUES OF DAMP

116 c

117 c lA INPUT CONTAINS ROW INFORMATION OF ARRAY A

118 c JA INPUT CONTAINS COLUMN INFORMATION OF A ROW WITHIN A

119 c AA INPUT THE A ARRAY.

120 c

121 c NOTE. LSQR DOES NOT EXPLICITLY USE THE PREVIOUS FOUR

122 c PARAMETERS, BUT PASSES THEM TO SUBROUTINE APROD FOR

123 c POSSIBLE USE AS WORKSPACE. IF APROD DOES NOT NEED

124 c IW OR RW, THE VALUES LENIW = 1 OR LENRW = 1 SHOULD

126 c BE USED, AND THE ACTUAL PARAMETERS CORRESPONDING TO

126 c IW OR RW MAY BE ANY CONVENIENT ARRAY OF SUITABLE TYPE.

127 c

128 c U(M) INPUT THE RHS VECTOR B. BEWARE THAT U IS

129 c OVER-WRITTEN BY LSQR.

130 c

131 c V(N) WORKSPACE

132 c wen) WORKSPACE

133 c

134 c X(N) OUTPUT RETURNS THE COMPUTED SOLUTION X.

135 c

226
c SE(!r) OUTPUT RETURNS STANDARD ERROR ESTIMATES FOR THE

isr c COMPONENTS OF X. FOR EACH I, SE(I) IS SET

138 c TO THE VALUE RNORM * SQRT( SIGMA(I,I) / T ),

138 c WHERE SIGMACI.I) IS AN ESTIMATE OF THE I-TH

140 c DIAGONAL OF THE INVERSE OF ABAR(TRANSPOSE)*ABAR

141 c AND T = 1 IF M .LE. N,

143 c T=M-N IF M.GT.N AND DAMP = 0,

143 c T = M IF DAMP .NE. 0.

144 c

145 c ITOL IHPUT AN ESTIMATE OF THE RELATIVE ERROR IN THE DATA

146 c DEFINING THE MATRIX A. FOR EXAMPLE,

147 c IF A IS ACCURATE TO ABOUT 6 DIGITS, SET

148 c ATOL = l.OE-6 . 140 c

160 c BTOL INPUT AN ESTIMATE OF THE RELATIVE ERROR IN THE DATA

Itl c DEFINING THE RHS VECTOR B. FOR EXAMPLE,

153 c IF B IS ACCURATE TO ABOUT 6 DIGITS, SET

153 c BTOL = l.OE-6 . 164 c

165 c COBLIM lUPUT AN UPPER LIMIT ON COND(ABAR), THE APPARENT

160 c CONDITION NUMBER OF THE MATRIX ABAR.

167 c ITERATIONS WILL BE TERMINATED IF A COMPUTED

158 c ESTIMATE OF COND(ABAR) EXCEEDS CONLIM.

150 c THIS IS INTENDED TO PREVENT CERTAIN SMALL OR

160 c ZERO SINGULAR VALUES OF A OR ABAR FROM

161 c COMING INTO EFFECT AND CAUSING UNWANTED GROWTH

163 c IN THE COMPUTED SOLUTION.

163 c

164 c CONLIM AND DAMP MAY BE USED SEPARATELY OR

165 c TOGETHER TO REGULARIZE ILL-CONDITIONED SYSTEMS.

166 c

167 c NORMALLY, CONLIM SHOULD BE IN THE RANGE

168 c 1000 TO 1/RELPR.

160 c SUGGESTED VALUE ~

170 c CONLIM = 1/(100*RELPR) FOR COMPATIBLE SYSTEMS,

171 c CONLIM = l/(10*SqRT(RELPR)) FOR LEAST SQUARES.

173 c

178 c BOTE. IF THE USER IS NOT CONCERNED ABOUT THE PARAMETERS

174 c ATOL, BTOL AND CONLIM, ANY OR ALL OF THEM MAY BE SET

176 c TO ZERG . THE EFFECT WILL BE THE SAME AS THE VALUES

176 c RELPR. RELPR AND 1/RELPR RESPECTIVELY.

177 c

178 c ITNLIM INPUT AN UPPER LIMIT ON THE NUMBER OF ITERATIONS.

170 c SUGGESTED VALUE ~

180 c ITNLIM = N/2 FOR WELL CONDITIONED SYSTEMS,

181 c ITNLIM = 4*N OTHERWISE.

183 c

183 c HOUT INPUT FILE NUMBER FOR PRINTER. IF POSITIVE,

184 c A SUMMARY WILL BE PRINTED ON FILE NOUT.

185 c

186 c ISTOP OUTPUT AN INTEGER GIVING THE REASON FOR TERMINATION...

187 c

188 c 0 1=0 IS THE EXACT SOLUTION.

227
189 c NO ITERATIONS WERE PERFORMED.

190 c

191 c 1 THE EQUATIONS A*I = B ARE PROBABLY

192 c COMPATIBLE. NORM(A*I - B) IS SUFFICIENTLY

193 c SMALL, GIVEN THE VALUES OF ATOL AND BTOL.

194 c

19S c 2 THE SYSTEM A*I = B IS PROBABLY NOT

196 c COMPATIBLE. A LEAST-SQUARES SOLUTION HAS

197 c BEEN OBTAINED WHICH IS SUFFICIENTLY ACCURATE,

198 c GIVEN THE VALUE OF ATOL.

199 c

200 c 3 AN ESTIMATE OF COND(ABAR) HAS EXCEEDED

201 c CONLIM. THE SYSTEM A*I = B APPEARS TO BE

202 c ILL-CONDITIONED. OTHERWISE, THERE COULD BE AH

203 c AN ERROR IN SUBROUTINE APROD.

204 c

206 c 4 THE EQUATIONS L*l = B ARE PROBABLY

206 c COMPATIBLE. NORM(A>xX - B) IS AS SMALL AS

207 c SEEMS REASONABLE ON THIS MACHINE.

208 c

209 c 5 THE SYSTEM A*I = B IS PROBABLY NOT

210 c COMPATIBLE. A LEAST-SQUARES SOLUTION HAS

211 c BEEN OBTAINED WHICH IS AS ACCURATE AS SEEMS

212 c REASONABLE ON THIS MACHINE.

213 c

214 c 6 COND(ABAR) SEEMS TO BE SO LARGE THAT THERE IS

215 c NOT MUCH POINT IN DOING FURTHER ITERATIONS,

216 c GIVEN THE PRECISION OF THIS MACHINE.

217 c THERE COULD BE AN ERROR IN SUBROUTINE APROD.

218 c

219 c 7 THE ITERATION LIMIT ITNLIM WAS REACHED.

220 c

221 c ANORM OUTPUT AN ESTIMATE OF THE FROBENIUS NORM OF ABAR.

222 c THIS IS THE SQUARE-ROOT OF THE SUM OF SQUARES

223 c OF THE ELEMENTS OF ABAR.

224 c IF DAMP IS SMALL AND IF THE COLUMNS OF A

226 c HAVE ALL BEEN SCALED TO HAVE LENGTH 1.0,

226 c ANORM SHOULD INCREASE TO ROUGHLY SQRT(N)

227 c A RADICALLY DIFFERENT VALUE FOR ANORM MAY

228 c INDICATE AN ERROR IN SUBROUTINE APROD (THERE

229 c MAY BE AN INCONSISTENCY BETWEEN MODES 1 AND 2)

230 c

231 c ACOND OUTPUT AN ESTIMATE OF COND(ABAR), THE CONDITION

232 c NUMBER OF ABAR. A VERY HIGH VALUE OF ACOND

233 c MAY AGAIN INDICATE AN ERROR IN APROD.

234 c

235 c RNORM OUTPUT AN ESTIMATE OF THE FINAL VALUE OF NORM(RBAR),

236 c THE FUNCTION BEING MINIMIZED (SEE NOTATION

237 c ABOVE). THIS WILL BE SMALL IF A*I = B HAS

238 c A SOLUTION.

239 c

240 c ARNORM OUTPUT AN ESTIMATE OF THE FINAL VALUE OF

241 c NORM( ABAR(TRANSPOSE)*RBAR ), THE NORM OF

228
342 c THE RESIDUAL FOR THE USTIAL UDRMAI POTIiTTnw^

343 c THIS SHOULD BE SMALL TH ALL CiSFS fimjfTRM

344 c WILL QFTEW BE SMATTPP TTTAW TTTP TBTTT? TTATTTT? 345 c V Wilf W i XJiy f AbUli X UwXr^UX VfiwXUXb A 9 J 346 c

347 c mORM OUTPUT AN ESTIMATE OF THE WORM HF THF FTTTiT

348 c SOLUTION VECTOR X

34S c

350 c

351 c SUBROUTINES AND FUNCTIONS USED

353 c

258 c

354 c USER APROD

366 c LSOR HORMLZ

366 c BLAS SCOPY SNRM2 SSCAL fSEE LAySON ET AL BFI OU'^ 367 c fSNRM2 IS USED ONLY IN NORMLZ'i

258 c FORTRAN ABS MOD SORT

260 c

260 c

261 c PRECISIOH

262 c

263 c

264 c THE NUMBER OF ITERATIONS REQUIRED BY LSQR WILL USUALLY DECREASE

265 c IF THE COMPUTATION IS PERFORMED IN HIGHER PRECISION. TO CONVERT

266 c LSQR AND NORMLZ BETWEEN SINGLE- AND DOUBLE-PRECISION, CHANGE

267 c THE WORDS

268 c SCOPY, SNRM2, SSCAL

260 c ABS, REAL, SQRT

270 c TO THE APPROPRIATE BLAS AND FORTRAN EQUIVALENTS

.

271 c

272 c

278 c REFERENCES

274 c

276 c

276 c PAIGE C C AND SAUNDERS M A LSORQD AN ALGORITHM FOR SPARSE

277 c LINEAR EQUATIONS AND SPARSE LEAST SQUARES

.

378 c ACM TRANSACTIONS ON MATHEMATICAL SOFTWARE 8, 1 (MARCH 1982).

370 c

380 c LAWSON C L HANSON R J KINCAID . D.R. AND KROGH. F.T.

381 c BASIC LINEAR ALGEBRA SUBPROGRAMS FOR FORTRAN USAGE.

383 c ACM TRANSACTIONS ON MATHEMATICAL SOFTWARE B, 3 (SEPT 1979),

383 c 308-323 AND 324-325.

384 c

385 c

386 c LSQR. THIS VERSION DATED 22 FEBRUARY 1982.

387 c

• 99 c

380 c FUHCTIONS fWJMwX^WXIhJ AND MiM *J LOCAL XJ W WJXXJ VARIABLES ¥ AXhAAX^XJXJw 300 c

301 INTEGER I.ITN.MOD.NCONV.NSTOP

303 REAL ABS, SQRT

303 REAL ALFA, BBNORM, BETA. BNORM,

304 1 . CS,CS1,CS2,CT0L,DAMPSQ,DDN0RM, DELTA,

229
296 296 297

298

299 C

300 C

301 C

302 C

303

304

SOS 300 307

308

309

3ib

311 312 313

314

316 319 317

318 319

320

331

322 323 C

324

326 326 327

328

320 C

330 C

331 C

332 C

333 334

336

336 337 C

338

330

340

341 342 343

344

346 346 347

2 GAMMA . 6AMBAR , ONE , PHI . PHIBAR . PSI

,

3 RESl , RES2 . RHO , RHOBAR . RHBARl . REBAR2 , RES , RTOL

,

4 SN , SNl , SN2 , T , TAU , TESTl , TEST2 , TEST3

,

B THETA . Tl . T2 , T3 , XXNQRM , Z , ZBAR , ZERO

INITIALIZE.

IF (NOUT .GT. 0)

1 WRITE(NOUT, 1000) M.H.DAMP.ATOL.CONLIM.BTOL.ITHLIM

ZERO = 0.0

ONE =1.0

CTOL = ZERO

IF (CONLIM .GT. ZERO) CTOL = ONE/CONLIM

DAMPSQ = DAMP**2

ANORM = ZERO

ACOND = ZERO

BBNORM = ZERO

DDNORM = ZERO

RES2 = ZERO

XNORM = ZERO

XXNORM = ZERO

CS2 = -ONE

SN2 = ZERO

Z = ZERO

ITN = 0

ISTOP = 0

NSTOP = 0

DO 10 I = 1, N

V(I) = ZERO

X(I) = ZERO

SE(I) = ZERO

10 CONTINUE

SET UP THE FIRST VECTORS

THESE SATISFY BETA*U =

CALL NORMLZC M,U,BETA ) CALL APROD ( 2,M,N,V,U,

CALL NORMLZC N.V.ALFA ) CALL SCOPT ( N.V.l.W.l )

FOR THE BIDIAGONALIZATION.

B. ALFA*V = A(TRANSPOSE)t>U.

lA.JA.AA )

RHOBAR = ALFA

PHIBAR = BETA

BNORM = BETA

RNORM = BETA

ARNORM = ALFA>xBETA IF (ARNORM .LE. ZERO) GO TO 800

IF (NOUT .LE. 0 ) GO TO 100

IF (DAMPSq .LE. ZERO) WRITE(NOUT, 1200)

IF (DAMPSQ .GT. ZERO) WRITE(NOUT, 1300)

TESTl = ONE

230
348 TEST2 = ALFA/BETA

349 URTTEfNQDT IBOO^ ITU Xfl'i RNQRM TESTl TEST2

350 WRITEfKOUT 1600') c

vet c

353 w MATH TTVTlATTmff T nnp

r

355 100 ITH = ITS + 1

356 c

357 c PERFORM THE HEXT STEP OF THE BIDIAGOHALIZATION TO OBTAIN THE

358 c 5EIT BETA. U. ALFA. V. THESE SATISFY THE RELATIONS

350 c BETA*n = A*V - ALFA>i<n. c ALFA*V = A f TRANSPOSE^ *n - BETA*V

OQ

362 CALL SSCAL ( M f-ALFA) U 1 ^ 363 CALL APROD ( 1,M,N,V,U, IA,JA,AA ) 364 CALL NORMLZ( M.U.BETA ) 365 BBNORM = BBNORM + ALFA**2 + BETA**2 + DAMPSQ

366 CALL SSCAL ( N f-BETA^ V 1 ) 367 CALL APROD ( 2,M,N,V,U, lA.JA.AA ) 366 CALL NORMLZC N.V.ALFA ) 360 c

370 c

c USE A PLANE ROTATION TO ELIMINATE THE DAMPING PARAMETER.

372 c THIS ALTERS THE DIAGONAL (RHOBAR) OF THE L0WER-BIDIA60NAL MATRIX.

378 c

374 RHBAR2 = RH0BAR**2 + DAMPSQ

376 RHBARl = SqRT(RHBAR2)

376 CSl WmA = RHOBAR/RHBARl AWAAWWAAk/ A A * A^ OA9 A

or ( SHI = DAMP /RHBARl

378 PSI = SN1*PHIBAR

O970IV PHTBAR = CS1*PHIBAR

rw

ool c

do« USE A PLANE ROTATION TO ELIMINATE THE SUBDIAGONAL ELEMENT (BETA)

AAA OF THE LOWER-BIDIAGONAL MATRIX, GIVING AN UPPER-BIDIAGONAL MATRIX

c

^AR RHO = SQRT(RHBAR2 + BETA**2)

386 CSW kJ = RHBARl/RHO *>l>lr TM km A f

w

387 SN = BETA/RHO

388 THETA = SN*ALFA

RHOBiR = -CS*ALFA

890 PHI = CS*PHIBAR

9wL PHTBAR = SN*PHIBAR

802

303 cV

304 c

805 /« rroniTP T U AWn THE STANDARD ERROR ESTIMATES.

396 c

897 Tl = PHI/RHO

808 T2 = -THETA/RHO

899 T3 = ONE/RHO

400 c

231
401 402 403

404

40S 406 407

408

400 C

410 C

411 C

412 C

413 C

414 C

415 41^

417 4li

419

420

421 422 423

424

425 C

426 C

427 C

428 C

428 C

430 C

431

|4S2 433

434

435

436 437 C

438 C

430 C

440 C

441 442 443 444

445

446 C

447 C

448 C

449 C

460 C

451 C

452 C

453

DO 200 I = 1, N T = W(I)

I(I) = T1*T + X(I)

W(I) = T2*T + V(I)

T =(T3*T)**2

SE(I) = T + SE(I)

DDNORM= T + DDNORM

200 CONTINUE

USE A PLANE ROTATION ON THE RIGHT TO ELIMINATE TEE

SUPER-DIAGONAL ELEMENT (THETA) OF THE UPPER-BIDlAGONAL MATRIX.

THEN USE THE RESULT TO ESTIMATE NORM(X)

DELTA SN2*RH0

6AMBAR -CS2*RH0

RHS PHI - DELTA+Z

ZBAR RHS/GAMBAR

XNORM SQRTCXXNORM + ZBAR**2)

GAMMA SqRT(GAMBAR**2 + THETA**2)

CS2 6AMBAR/6AMMA

SN2 THETA/GAMMA

Z RHS/GAMMA

XXNORM XXNORM + Z**2

TEST FOR CONVERGENCE.

FIRST, ESTIMATE THE NORM AND CONDITION OF THE MATRIX ABAR,

AND THE NORMS OF RBAR AND ABAR(TRANSPOSE)*RBAR.

ANORM = SQRT(BBNORM)

ACOND = ANORM*SqRT(DDNORM)

RESl = PHIBAR**2

RES2 = RES2 + PSI**2

RNORM = SQRT(RES1 + RES2)

ARNORM = ALFA*ABS(TAU)

NOU USE THESE NORMS TO ESTIMATE CERTAIN OTHER QUANTITIES.

SOME OF WHICH WILL BE SMALL NEAR A SOLUTION.

TESTl = RNORM/BNORM

TEST2 = ARNORM/ (ANORM*RNORM)

TESTS = ONE/ACOND

Tl = TESTl/ (ONE + ANORM*XNORM/BNORM)

RTOL = BTOL + ATOL*ANORM*XNORM/BNORM

THE FOLLOWING TESTS GUARD AGAINST EXTREMELY SMALL VALUES OF

ATOL. BTOL OR CTOL. (THE USER MAT HAVE SET ANT OR ALL OF

THE PARAMETERS ATOL, BTOL, CONLIM TO ZERO.)

THE EFFECT IS EQUIVALENT TO THE NORMAL TESTS USING

ATOL = RELPR, BTOL = RELPR, CONLIM = 1/RELPR.

T3 = ONE + TESTS

232
454

455 456

457

458

469

400 c

461 c

462 c

463 404

406

466 c

467 c

468 c

460 c

470

471 473 47S

474

475 476 477

478

470 c

480 c

481 c

483

483 484 c

485 c

486 c

487 c

488 c

480 c

400 c

401 403 498

494

495 406

407 c

408 c

400 c

500 c

501 c

602 c

603 c

504 605 506

T2 = ONE + TEST2

Tl = ONE + Tl

IF (ITN .GE. ITNLIM) ISTOP = 7 IF (T3 .LE. ONE ) ISTOP = 6 IF (T2 .LE. ONE ) ISTOP = E IF (Tl .LE. ONE ) ISTOP = 4

ALLOW FOR TOLERANCES SET BT THE USER.

IF (TEST3 .LE. CTOL) ISTOP = 3

IF (TEST2 .LE. ATOL) ISTOP = 2 IF (TESTl .LE. RTOL) ISTOP = 1

SEE IF IT IS TIME TO PRINT SOMETHING.

IF (NOUT .LE. 0) GO TO 600

IF (M.LE.40 .OR. N.LE.40) 60 TO 400

IF (ITN .LE. 10) GO TO 400

IF (ITN .GE. ITNLIM-IO) GO TO 400

IF (HODdTN.lO) .EQ. 0) 60 TO 400

IF (TESTS .LE. 2.0*CT0L) 60 TO 400

IF (TEST2 .LE. 10.0*AT0L) 60 TO 400

IF (TESTl .LE. lO.OfRTOL) 60 TO 400

60 TO 600

PRINT A LINE FOR THIS ITERATION.

400 WRITE(NOUT, 1500) ITN,X(1) ,RN0RM,TEST1,TEST2,AN0RM,AC0ND

IF (HODdTN.lO) .EQ. 0) WRITE(NOUT, 1600)

STOP IF APPROPRIATE.

THE CONVERGENCE CRITERIA ARE REQUIRED TO BE MET ON NCONV

CONSECUTIVE ITERATIONS, WHERE NCONV IS SET BELOW.

SUGGESTED VALUE ~ NCONV = 1, 2 OR 3.

600 IF (ISTOP .EQ. 0) NSTOP = 0 IF (ISTOP .EQ. 0) 60 TO 100

NCONV = 1 NSTOP = NSTOP + 1 IF (NSTOP .LT. NCONV .AND. ITN .LT. ITNLIM) ISTOP = 0

IF (ISTOP .EQ. 0) 60 TO 100

END OF ITERATION LOOP.

FINISH OFF THE STANDARD ERROR ESTIMATES,

T = ONE

IF (M .6T. N) T = M - N

IF (DAMPSQ .6T. ZERO) T = M

233
607 T = RNORM/SqRT(T)

608 C

609 DO 700 I = 1, U

510 SE(I) = T*SQRT(SE(I))

611 700 CONTIinjE

612 C

513 C PRIITT THE STOPPING CONDITION.

514 C

516 800 IF (NOUT .LE. 0) GO TO 900

516 VRITE(NOUT, 1900) ITN.ISTOP

B17 IF (ISTOP .EQ. 0) WRITE(NOUT, 2000)

518 IF (ISTOP .EQ. 1) WRITE(NOUT, 2100)

616 IF (ISTOP .EQ. 2) WRITE(NOin', 2200)

520 IF (ISTOP .EQ. 3) WRITE(NOUT, 2300)

821 IF (ISTOP .EQ. 4) WRITE(NOUT, 2400)

622 IF (ISTOP .EQ. B) WRITE(NOUT, 2B00)

523 IF (ISTOP .EQ. 6) WRITE(NOUT, 2600)

624 IF (ISTOP .EQ. 7) WRITE(NOUT, 2700)

626 900 RETURN

626 C

627 C

528 1 000 FORMAT(

62g 1 // 251, 46HLSqR ~ LEAST-SQUARES SOLUTION OF A*I = B

680 2 // 25X. 18HTHE MATRIX A HAS, 16, IIH ROUS AND, 16. BH COLS

581 3 / 2BI. 36HTHE DAMPING PARAMETER IS DAMP =, 1PE10.2

582 4 // 2BX, 8HAT0L =, 1PE10.2, lOX, 8HC0NLIM =, 1PE10.2

538 B / 2BX, 8HBT0L =, 1PE10.2, lOX, 8HITNLIM =, 110)

634 1200 FORMAT(// 3X, 3HITN, 91, 4HX(1), 14X, 8HFUNCTI0N, 7X,

636 1 4BHC0MPATIBLE INCOMPATIBLE NORM(A) COND(A) /)

636 1300 FORMAT(// 31, 3HITN, 91, 4HX(1), 14X, 8HFUNCTI0N, 7X,

537 1 4BHC0MPATIBLE INCOMPATIBLE NORM(ABAR) COND(ABAR) /)

638 IBOO F0RMAT(I6, 1PE20.10, 1PE19.10, 1P2E13.3, 1P2E11.2)

639 1600 FORMAT(IX)

640 1900 FORMAT(/ 20H NO. OF ITERATIONS =, 16,

641 1 8X, 21H STOPPING CONDITION =, 13)

642 2000 FORMAT(/ B2H THE EXACT SOLUTION IS X = 0.

643 2100 FORMAT(/ B2H A-«<X - B IS SMALL ENOUGH, GIVEN ATOL, BTOL

644 2200 FORMAT(/ B2H THE LEAST-SQRS SOLN IS GOOD ENOUGH, GIVEN ATOL

646 2300 FORMAT(/ B2H THE ESTIMATE OF COND(ABAR) HAS EXCEEDED CONLIM ; 646 2400 FORMAT(/ B2H A*X - B IS SMALL ENOUGH FOR THIS MACHINE

547 2B00 FORMAT(/ B2H THE LEAST-SQRS SOLN IS GOOD ENOUGH FOR THIS MACHINE

648 2600 FORMAT(/ B2H COND(ABAR) SEEMS TO BE TOO LARGE FOR THIS MACHINE

549 2700 FORMAT(/ B2H THE ITERATION LIMIT HAS BEEN REACHED

660 C END OF LSQR

661 END

652 C

553 SUBROUTINE NQRMLZ( N,X,BETA ) 554 INTEGER N

555 REAL X(N) ,BETA

656 C

667 C NORMLZ IS REQUIRED BT SUBROUTINE LSQR. IT COMPUTES THE

558 C EUCLIDEAN NORM OF X AND RETURNS THE VALUE IN BETA.

559 C IF X IS NONZERO, IT IS SCALED SO THAT NORM(X) = 1.

234
500 C

561 C

se2 C

SOS C

504 C

506 500 C

507 C

568 sas

670

571

572

573 C

574 C

S7S

FinrcTioirs im) suBRonriirES

BLAS SiniM2,SSCAL

REAL ONE. S]niH2. ZERO

ZERO =0.0

ONE =1.0

BETA = SNRM2( N.X.l ) IF (BETA .6T. ZERO) CALL SSCAL( H. (ONE/BETA) .1,1 ) RETURN

END OF NORMLZ

END

235
6.3.8 SQRTT.FOR

1 function sqrtt (z) ! assure proper

2 complex sqrtt, z, cmplx

3

4 data pi / 3.1415926E0 /

5 X = real (z)

6 y = aimag (z)

7 call polar (x,y,r,a,l) ! CO. 2)

8 if (r.eq.0.0) then

9 sqrtt = cmplx (0.0, 0.0)

10 else

11 r = sqrt (r)

12 a = a*pi*0.5 ! [0, pi)

18 sqrtt = cmplx (r*cos(a), r*sin(a))

14 end if

IB retiim

16 end

236
6.3.9 POLAR.FOR

1 c

2 subroutine polar (x, j, t, a, icase)

3 c given: x,j

4 c discern: r,a

6 c vhere: r>0, x=r*cos(a*pi) , y=r*sin(a*pi)

6 c case 1: a '

[ 0, 2)

7 c 2: a • (-1, 1]

8 c 3: a '

[ 0, 2*pi) ! radians

9 c 4: a '

C 0, 360) ! degrees

10u data pi / 3.1415926SE0 /

1318 if (7 .eq. 0.0) then ! z axis

14 if (z .It. 0.0) then

15 a = 1.0

le r = -X

17 else

18 a = 0.0

19 r = X

30 end if

31 goto 1

33 end if

38 if (x .eq. 0.0) then ! 7 axis

34 if (7 .It. 0.0) then

3B a = 1.5

36 r = -y

37 else

38 a = 0.5

39 r = y

80 end if

81 goto 1 83 end if

88 XX = abs (x)

84 y7 = abs (7)

86 if (xx .It. 77) then

se a = x/7 ! ratio < 1 87 r = 77 * sqrt (a*a+1.0)

88 a = 0.5 - atan (a) /pi ! top

89 if (7 .It. 0.0) a=a+1.0 ! bottom

40 else

41 a = 7/x ! ratio < 1

43 r = XX * sqrt (a*a+1.0)

48 a = atan (a) /pi

44 if (x .It. 0.0) then ! Ihs

45 a = a+1.0

40 else if (7 .It. 0.0) then

47 a = a+2.0 ! rhs

48 end if

40 end if

50

237
51 1 ii (lease .oq. 1) return

52 if (lease .eq. 2) then

53 If (a .gt. 1.0) a=a-2.0

54 return

65 end If

68 If (lease .eq. 3) then « radians

67 a = a*pl

! degrees

59 a = a*180.0

60 end If

61:

62' return

63 end

238
6.3.10 IINDEX.FOR

1 c Discern the sequential index (k) for the (i,j) matrix element,

2 c where the matrix is symmetric, a(i,j) = a(j,i) = a(lt)

,

3 c but where only the upper/lover triangle is stored, k=k(i,j).

4 c V ' size of the square matrix, i.e., A ' a(i,j) is NxN.

5 c L ' indicates the storage format, 1-4.

67 function iindex (l,n,i,j)

8 integer iindex, l,n,i,j

9

10 if (l.lt.l .or. n.lt.l .or. i.lt.l .or. j.lt.l .or.

11 k l.gt.6 .or. i.gt.n .or. j.gt.n ) then

13 call exit (2) ! 2'error, 4'severe error

IS end if

14

15 mn = min (i,j)

le mx = max (i,j)

17 goto (1,2,3,4,5,6), 1

•

18

19 c Symmetric Hatix

30

31 c Lower triangular matrix, j<=i, stored column by column.

32 1 iindex = mx + ((n+n-mn)*(mn-l))/2

3S return

34

35 c Lower triangular matrix, j<=i, stored row by row.

38 2 iindex = mn + ((mx-l)*mx)/2

37 return

38

39 c Upper triangular matrix, i<=j , stored column by column.

30 3 iindex = mn + ((mx-l)*mx)/2

SI return

S353 c Upper triangular matrix, i<=j , stored row by row.

54 4 iindex = mx + ((n+n-mn)*(mn-l))/2

S6 return

S0

37 c Asymmetric Matrix

38

39 c FuJ.1 matrix, stored column by column.

40 5 iindex = i + (j-l)*n

41 return

43

43 c Full matrix, stored row by row.

44 6 iindex = j + (i-l)*n

46 retvim

4647 and

239
6.3.11 ISTIME.FOR

1 fuaction istime (i)

2 integer istime, iftime,

3 logical first

4 data first /.true./

» entry iftime (i)

- t' if (first) then

S first = .false.

9 call times (-l,it)

10 end if

11 call times (l,it)

12 istime = it*10

13 return

14 end

! dummy argument

i, it

! initial

! initialize cpu clock

! query elapsed cpu time (centi-seconds)

! milli-seconds

240
6.3.12 TIMES.FOR

1 subroutine times (is, it)

3 include 'sys$li'brary:libdef .for'

3 include ' sys$library : sigdef .for'

4 c* include ' sys$library :mthdef .f or'

5 c* include ' sys$library :f ordef .f or'

0

7 parauneter (io=6, nh=2)

8 integer>4<4 h,andle(nh), status

9 save handle

10

11 c

13 c This routine maintains or keeps track of several distinct

15 e or separate and independent clocks.

14 c Each clock is equivalent to any other clock,

16 c i.e., among themselves.

le c The quantity of clocks is restricted by the magnitude

17 c or dimension of the array, "handle", i.e., "nh"

.

18 c The clocks are indexed by the magnitude of "is" = I is I. 19 c A clock is initalized nhenever "is" is negative;

30 c all clocks are initalized whenever "is" is zero.

31 c Time displacements or intervals, "it", are:

33 c a) evaluated whenever "is" is positive

38 c b) expressed in units of: centi-seconds

34 C

3636 if (is.eq.O) then

37 do i=l,nh

38 status = lib$init_timer (handle(i)}

39 if (status .ne . ss$_normal) then

80 write (io,6)

81 stop

S3 end if

88 end do

84 return

85 end if

8887 if (iab8(is) .gt .nh) then

88 write (io,8) is

89 stop

40 end if

4143 if (is.lt.O) then

48 status = lib$init_timer (handle(-is))

44 if (status. eq.ss$_normal) return

46 write (io,6)

46 s'top 47 else

48 Status = lib$8tat_timer (2,it ,handle(is))

49 if (status. eq.ss$_normal) return

so write (io,7)

241
stop

end if

6 format (' times, error: clock initalization problem')

7 format (' times, error: clock evaluation problem'

)

8 format (' times, error: attempting use of non-existing'

k ,' clock #', i3)

end

242
7. Acknowledgments

It is the author's pleasure to acknowledge Drs. Stanley Ruthberg and George Candela for

having suggested and supported this project. On a melancholy note, we mourn the loss

of Dr. Ruthberg, whose untimely death occurred during the course of the work which led

to the preparation of this msuiuscript. His vitality and friendship are missed. On a much

happier note, the author appreciates the questions and suggestions from Deane ChandlerHorowitz and Pradip Dutta, who have been among the first to apply the software package.

The author also appreciates the discussions with M. Carroll Croarkin regarding things statistical.

243
8. References

[1] M. Born and E. Wolf, Principles of Optics, sixth corrected edition (Pergamon Press,

Oxford, 1980).

[2] R. M. A. Azzam and N. M. Bashara, Ellipsometry and Polarized Light, paperback edition (North-Holland, Amsterdam, 1987).

[3] Z. Knittl, Optics of Thin Films (John Wiley k Sons, Ltd., London, 1976).

[4] J, Lekner, Theory of Reflection (Martinus NijhofF Publishers, Dordrecht, Netherlands,

1987).

[5] Handbook of Optical Constants of Solids, edited by E. W. Palik (Academic Press, Orlando, 1985).

[6] F. E. Jones, "The Refractivity of Air," J. Res. Natl. Bur. Stand. (U.S.) 86, 27-32

(January-February 1981).

[7] F. L. McCrackin, "A Fortran Program for Analysis of EUipsometer Measurements,"

NBS Tech. Note 479, Natl. Bur. Stand. (U.S. Department of Commerce), April 1969.

[8] J. Mouchart, "Calcul Matriciel Applique aux Couches Minces Elaboration des Derivees

Partielles du Coefficient de Reflexion," Optica Acta 27, 401-408 (1980).

[9] J. HumHcek, "Evaluation of Derivatives of Reflection and Transmittance by Stratified

Structures and Solution of the Reverse Problem of Ellipsometry," Optica Acta 30, 97-

105 (1983).

[10] J. HumKcek, "Sensitivity Extrema in Multiple-Angle Ellipsometry," J. Opt. Soc. Am.

2, 713-722 (1985).

[11] G. H. Bu-Abbud, N. M. Bashara, and J. A. Woolam, "Variable Wavelength, Variable

Angle Ellipsometry Including a Sensitivities Correlation Test," Thin Solid Films 138,

27-41 (1986).

[12] G. H. Bu-Abbud and N. M. Bashara, "Parameter Correlation and Precision in MultipleAngle Ellipsometry," Appl. Opt. 20, 3020-3026 (1981).

244
[13] M. M, Ibrallim and N. M. Bashara, "Parameter- Correlation and Computational Considerations in Multiple-Angle Ellipsometry," J. Opt. Soc. Am. 61, 1622-1629 (1971).

[14] D. H. Loescher, R. J. Detry, and M. J. Clauser, "Least-Squares Analysis of the FilmSubstrate Problem in Ellipsometry," J. Opt. Soc. Am. 61, 1230-1235 (1971).

[15] S. Y. Kim eind K. Vedam, "Proper Choice of the Error Function in Modeling Spectroellipsometric Data," Appl Opt. 25, 2013-2021 (1986).

[16] R. F. Boisvert, S. E. Howe, and D. K. Kahaner, Guide to Available Mathematical Software, Center for Applied Applied Mathematics, National Bureau of Standards (U.S.

Department of Commerce), 1985.

[17] J. J. Dongarra, C. B. Moler, J. R. Bunch, and G. W. Stewart, UNPACK Users' Guide

(Society for Industrial and Applied Mathematics, Philadelphia, 1979).

[18] C. C. Paige and M. A. Saunders, "LSQR: An Algorithm for Sparse Linear Equations

and Sparse Least Squares," ACM Trans. Math. Softw. 8, 43-71 (1982).

[19] C. C. Paige eind M. A. Saunders, "Algorithm 583, LSQR: Sparse Linear Equations

and Least Squares Problems," ACM Trans. Math. Softw. 8, 195-209, (1982).

[20] M. R. Hestenes and E. Stiefel, "Methods of Conjugate Gradients for Solving Linear

Systems," J. Res. Natl. Bur. Stand. (U.S.) 49, 409-436 (1952).

[21] S. C. Eisenstat, H. C. Elman, and M. H. Schultz, "Variational Iterative Methods for

Nonsymmetric Systems of Linear Equations," SIAM J. Numer. Anal. 20, 345-357

(1983).

[22] V. Faber and T. ManteufFel, "Necessary and Sufficient Conditions for the Existence of

a Conjugate Gradient Method," SIAM J. Numer. Anal. 21, 352-362 (1984).

[23] R. V. Hogg and A. T. Craig, Introduction to Mathematical Statistics, third edition

(Macmillan, New York, 1970).

[24] D. Chandler- Horowitz, "Semiconductor Measurement Technology: Analytical Analysis

of Ellipsometric Errors," NBS Spec. Publ. 75, Natl. Bur. Stand. (U.S. Department of Commerce), May 1986.

245
[25] D. Chandler-Horowitz, "EUipsometric Metrology of Ultrathin Films: Dual Angle of

Incidence," Proc. Soc. Photo-Optical & Instrum. Engrs., Micron and Submicron Inte- grated Circuit Metrology 565, 93-97 (1985).

[26] G. A. Candela, D. Chandler-Horowitz, J. F. Marchiando, D. B. Novotny, B. J. Belzer,

and M. C. Croarkin, ^''Standard Reference Materials: Preparation and Certification of

SRM-2530, EUipsometric Parameters A and rj) and Derived Thickness and Refractive

Index of a Silicon Dioxide Layer on Silicon," NIST Spec. Publ. 260-109, Natl. Inst.

Stand. Technol. (U.S. Department of Commerce), October 1988.

[27] "The SCD Graphics Utilities", edited by G. R. McArthur, NCAR Technical Note 166-fIA,

Scientific Computing Division, National Center for Atmospheric Research, Boulder,

Colorado (1981).

[28] "The System Plot Package," edited by G. R. McArthur, NCAR Technical Note 162+IA,

Scientific Computing Division, National Center for Atmospheric Research, Boulder,

Colorado (1981).

246
NBS-lUA (REV. 2-8C) U.S. DEPT. OF COMM. 1. PUBLICATION OR 2. Performing Organ. Report No. 3. Publication Date BIBLIOGRAPHIC DATA

REPORT NO.

SHEET (See instructions) NIST/SP-400/83 July 1989

4. TITLE AND SUBTITLE

Semiaonduatov Measurement Technology: A Software Program for Aiding the Analysis

of Ellipsometric Measurements, Simple Models

5. AUTHOR(S)

J. F. Marchiando

6. PERFORMING ORGANIZATION f/f joint or other than NBS. see instructions)

NATIONAL BUREAU OF STANDARDS

U.S. DEPARTMENT OF COMMERCE

GAITHERSBURG, MD 20899

7. Contract/Grant No.

8. Type of Report & Period Covered

9. SPONSORING ORGANIZATION NAME AND COMPLETE ADDRESS (Street. City. State, ZIP)

National Institute of Standards and Technology

U.S. Department of Commerce

Gaithersburg, MD 20899

10. SUPPLEMENTARY NOTES

Library of Congress Catalog Card Number: 89-600743

I I Document describes a computer program; SF-185, FIPS Software Summary, is attached.

11. ABSTRACT (A 200-word or less factual summary of most significant information . If document includes a si gnificant

bibliography or literature survey, mention it here) MAINl is a software program for aiding the analysis of ellipsometric measurements.

MAINl consists of a suite of routines written in FORTRAN that are used to invert the

standard reflection ellipsometric equations for simple systems. Here, a system is

said to be simple if the solid material sample may be adequately characterized by

models which assume at least the following: (1) materials are nonmagnetic; (2)

samples exhibit depth-dependent optical properties, such as one with layered or laminar structure atop a substrate that behaves like a semi-infinite half-space;

(3) layers are flat and of uniform thickness; and (4) the dielectric function within

each layer/substrate is isotropic, homogeneous, local, and linear. Each layer is char

acterized in part by a thickness (3) , while the optical properties for a given material and wavelength are expressed in terms of a refractive index in) and extinction

coefficient ik) . The ellipsometric equations are formulated as a standard damped

nonlinear least-squares problem and then solved by an iterative method when possible.

Estimates of the uncertainties associated with assigning numerical values to the

model parameters are calculated as well.

12. KEY WORDS (Six to twelve entries; alphabetical order; capitalize only proper names; and separate key words by semicolons)

ellipsometry ; FORTRAN; measurement; modeling; program; sensitivity; software;

uncertainty

13. AVAILABILITY

Unlimited

I I For Official Distribution. Do Not Release to NTIS rn Order From Superintendent of Documents, U.S. Government Printing Office, Washington, D.C. 20402. 25 Order From National Technical Information Service (NTIS), Springfield, VA. 22161

14. NO, OF

PRINTED PAGES

252

15. Price

llr U.S. GOVERNMENT PRINTING OFFICE; 1989—2 k 2 -311 '0if077

USCOMM-DC 6043-P80


I

1
i 1 A. Technical Publications

Periodical

Journal of Research of the National Institute of Standards and Technology—Reports NIST research

and development in those disciplines of the physical and engineering sciences in which the Institute

is active. These include physics, chemistry, engineering, mathematics, and computer sciences.

Papers cover a broad range of subjects, with major emphasis on measurement methodology and

the basic technology underlying standardization. Also included from time to time are survey articles on topics closely related to the Institute's technical and scientific programs. Issued six times a year.

Nonperiodicals

Monographs—Major contributions to the technical literature on various subjects related to the

Institute's scientific and technical activities. Handbooks—Recommended codes of engineering and industrial practice (including safety codes) de- veloped in cooperation with interested industries, professional organizations, and regulatory bodies.

Special Publications—Include proceedings of conferences sponsored by NIST, NIST annual reports,

and other special publications appropriate to this grouping such as wall charts, pocket cards, and

bibliographies.

Applied Mathematics Series—Mathematical tables, manuals, and studies of special interest to physicists, engineers, chemists, biologists, mathematicians, computer programmers, and others engaged in scientific and technical work.

National Standard Reference Data Series—Provides quantitative data on the physical and chemical

properties of materials, compiled from the world's literature and critically evaluated. Developed un- der a worldwide program coordinated by NIST under the authority of the National Standard Data

Act (Public Law 90-396). NOTE: The Journal of Physical and Chemical Reference Data (JPCRD)

is published quarterly for NIST by the American Chemical Society (ACS) and the American Insti- tute of Physics (AIP). Subscriptions, reprints, and supplements are available from ACS, 1155 Six- teenth St., NW., Washington, DC 20056.

Building Science Series—Disseminates technical information developed at the Institute on building

materials, components, systems, and whole structures. The series presents research results, test methods, and performance criteria related to the structural and environmental functions and the

durability and safety characteristics of building elements and systems.

Technical Notes—Studies or reports which are complete in themselves but restrictive in their treat- ment of a subject. Analogous to monographs but not so comprehensive in scope or definitive in treatment of the subject area. Often serve as a vehicle for final reports of work performed at NIST

under the sponsorship of other government agencies.

Voluntary Product Standards—Developed under procedures published by the Department of Commerce in Part 10, Title 15, of the Code of Federal Regulations. The standards establish nationally

recognized requirements for products, and provide all concerned interests with a basis for common

understanding of the characteristics of the products. NIST administers this program as a supplement

to the activities of the private sector standardizing organizations.

Consumer Information Series—Practical information, based on NIST research and experience, covering areas of interest to the consumer. Easily understandable language and illustrations provide useful background knowledge for shopping in today's technological marketplace.

Order the above NIST publications from: Superintendent of Documents, Government Printing Office,

Washington, DC 20402.

Order the following NIST publications—FIPS and NISTIRs—from the National Technical Information

Service, Springfield, VA 22161.

Federal Information Processing Standards Publications (FIPS PUB)—Publications in this series col- lectively constitute the Federal Information Processing Standards Register. The Register serves as the official source of information in the Federal Government regarding standards issued by NIST

pursuant to the Federal Property and Administrative Services Act of 1949 as amended. Public Law

89-306 (79 Stat. 1127), and as implemented by Executive Order 11717 (38 FR 12315, dated May 11, 1973) and Part 6 of Title 15 CFR (Code of Federal Regulations).

NIST Interagency Reports CNISTIR)—A special series of interim or final reports on work performed

by NIST for outside sponsors (both government and non-government). In general, initial distribu- tion is handled by the sponsor; public distribution is by the National Technical Information Service,

Springfield, VA 22161, in paper copy or microfiche form.
U.S. Department of Commerce

National Institute of Standards and Technology

(formerly National Bureau of Standards)

Gaithersburg, MD 20899

Official Business

Penalty for Private Use $300