A11107 EMM41^

MIST

PUBLICATIONS

\

/

.«•»' " ',

i/l O NBS TECHNICAL NOTE 1200

U.S. DEPARTMENT OF COMMERCE/National Bureau of Standards

QC

100

I.U5753

1200

193^

A Fortran Version of the

Quantitative EnergyDispersive Electron Beam

X-ray Analysis Program

FRAME C
NATIONAL BUREAU OF STANDARDS

The National Bureau of Standards' was established by an act ot Congress on March 3, 1901. The Bureau'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 Bureau conducts

research and provides: (1) a basis for the Nation's physical measurement system, (2) scientific and technological services for industry and government, (3) a technical basis for equity in trade, and (4) technical services to promote public safety. The Bureau's technical work is per- formed by the National Measurement Laboratory, the National Engineering Laboratory, and

the Institute for Computer Sciences and Technology.

THE NATIONAL MEASUREMENT LABORATORY provides the national system of

physical and chemical and materials 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; conducts materials research leading to improved methods of measurement,

standards, and data on the properties of materials needed by industry, commerce, educational

institutions, and Government; provides advisory and research services to other Government

agencies; develops, produces, and distributes Standard Reference Materials; and provides

calibration services. The Laboratory consists of the following centers:

Absolute Physical Quantities^ — Radiation Research — Chemical Physics —

Analytical Chemistry — Materials Science

THE NATIONAL ENGINEERING LABORATORY provides technology and technical ser- vices 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 measurement 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:

Applied Mathematics — Electronics and Electrical Engineering^ — Manufacturing

Engineering — Building Technology — Fire Research — Chemical Engineering^

THE INSTITUTE FOR COMPUTER SCIENCES AND TECHNOLOGY 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 Institute consists of the following centers:

Programming Science and Technology — Computer Systems Engineering.

'Headquarters and Laboratories at Gaithersburg, MD, unless otherwise noted; mailing address Washington, DC 20234, 'Some divisions within the center are located at Boulder, CO 80303.
A Fortran Version of the Quantitative ^ Energy-Dispersive Electron Beam X-ray

Analysis Program FRAME C

R.L. Myklebust and BE. Thorne

Center for Analytical Chemistry

National Measurement Laboratory

National Bureau of Standards

Gaithersburg, MD 20899

\

Q

ft-

^^ftEAU O^

U.S. DEPARTMENT OF COMMERCE, Malcolm Baldrige, Secretary

NATIONAL BUREAU OF STANDARDS, Ernest Ambler, Director

Issued July 1 984
^si*^X

National Bureau of Standards Technical Note 1 200

Natl. Bur. Stand. (U.S.), Tech. Note 1200, 42 pages (July 1984)

CODEN: NBTNAE

U.S. GOVERNMENT PRINTING OFFICE

WASHINGTON: 1984

For sale by the Superintendent of Documents, U.S. Government Printing Office, Wastiington, DC 20402
Foreword

This publication was written as a supplement to NBS Technical

Note 1106 entitled FRAME C: A Compact Procedure for Quantitative

Energy- Dispersive Electron Probe X-ray Analysis. The original

publication documented a BASIC language computer program for on-line

use with a multi-channel analyzer. This publication documents a FORTRAN version of a similar program. The description of the

quantitative analysis procedure is not reproduced in this publication.

Readers should consult NBS Technical Note 1106 for this description.

Together with the documented program listing, a description of the

input and output of the program is presented, as well as an example.

The program is written in FORTRAN 77 for a VAX 11/780. A

description of the program, a documented listing, and three examples

are presented in this publication. Commentaries and criticisms,

particularly from potential or actual users of the program, are

welcomed

.
A Fortran Version of the Quantitative Energy-Dispersive

Electron Beam X-ray Analysis Program FRAME C

R. L. Myklebust and B. B. Thorne

Center for Analytical Chemistry

National Bureau of Standards

Gaithersburg , MD 20899

ABSTRACT

A Fortran listing of the quantitative electron microprobe

analysis routine, FRAME C, is presented. The source code is

extensively documented and there are short summaries of the various

parts of the program. Examples are also presented to demonstrate the

versatility of the program.

Key words: computer program; electron microprobe;

energy-dispersive detector; quantitative analysis; x-ray spectra
I. Introduction

The program FRAME C has been previously described in NBS

Technical Note 1106.1 jn that publication, the program was listed in

BASIC. This publication contains a listing of the Fortran 77 version

of the FRAME C program together with descriptions of the differences

between the BASIC and Fortran versions.

The BASIC version was written to run on a specific multi-channel

analyzer and had many instructions that were unique to that

instrument. The Fortran version was written to operate on a computer

that is independent from the multi-channel analyzer. This eliminates

all of the analyzer specific instructions from the program and makes

the program more universally useful. Anyone operating the program on

a computer other than a VAX 11/780* may have to make some

alterations to the data file open statements. Also, the subroutine

RDFIL was written to read a data file containing an entire spectrum as

written by a Tracer Northern* TN 2000 multi-channel analyzer. The

user will have to rewrite this subroutine to read the spectral data

file as written by his multi-channel analyzer.

The program has been constructed to operate interactively with a minimum of user input. Information from each standard spectrum is

processed and stored in a data file. This information is recalled by

the program for quantitative analysis computations from the data file.

Data files may be stored for future analyses if desired. Since these

files are all named, the user may keep as many different files as he

desires. The files can be changed at will by the user to include

different elements, to change the analytical x-ray lines, or any of

the analysis conditions. Some changes require either the same

standard spectrum for an element, a new standard spectrum for the

element, or merely a change in the list of analyzed elements if the

standards are already in the data file.

Some of the equations, particularly those dealing with the

relative line intensities, may have been changed in the Fortran

version; however, the magnitude of these changes is not very large.

As in the BASIC version, the program has been divided into a large

number of subroutines. The program listing contains extensive

documentation; therefore, we will not describe the individual

subroutines

.

* In order to describe adequately materials and experimental procedures, it

was necessary to identify commercial products by manufacturer's name or label.

In no instance does such identification imply endorsement by the National Bureau

of Standards nor does it imply that the particular products or equipment is

necessarily the best available for that purpose.
II. Operation Description

A. Input

The input to FRAME C was designed to minimize any operator

interactions while at the same time making the program as flexible as

possible. The main program determines the path the computation will

take as governed by the user's answers to the questions presented by

the program. The following section explains the possible answers to

the questions in the order that they appear in the program. This is

not necessarily the order for any particular analysis. The examples

show the questions and answers in the proper order for typical

analyses. Note that only the first letter of a Yes or No answer is

required, and that the letter must be upper case.

1. Do you wish to create or add to a data file? (Y)es or (N)o

The program requires a data file for storing all the

standards parameters calculated by the program. If this

file already exists and no changes are required, answer the

question (N)o. If the file does not exist, you must answer

(Y)es. An existing file can also be changed by answering

(Y)es.

2. Do you wish to add more standard data? (Y)es or (N)o

After each standard spectrum has been processed, this

question is asked. Answer (Y)es if more standard spectra

are to be processed or (N)o to begin computing the unknown

spectra

.

3. Do you wish to change the standard file? (Y)es or (N)o

After exiting from the computation of unknown spectra, you

may alter the standards file by answering (Y)es. This will

allow you to run additional standard spectra. If you only

wish to change the list of elements analyzed and not the

standards themselves, answer (N)o. Also answer (N)o if you

have completed your analysis.

4. Do you wish to change the element list? (Y)es or (N)o

This question follows question 3 if that question is

answered (N)o. A (Y)es here will allow you to change the

list of elements analyzed in the unknown spectra. A (N)o at

this point will terminate the program.

5. Enter name of standard file

If you are using a previously created standards data file

(see question 1) enter the file name of that file. If the

standards data file has not been created, enter the file

name that you want to create.
6. EO =

Enter the beam voltage in keV. This is stored in the data

file and cannot be changed. All spectra, both standards and

unknowns must be run at the same beam voltage.

7. Take-off angle =

Enter the x-ray emergence angle in degrees. This must also

be the same for all spectra and cannot be changed once it

has been stored in the data file.

8. Number of elements in standard =

Enter the total number of elements in the standard including

all unanalyzed elements.

9. Enter Cone, At. No., Line code, & Valence for each

For each element in the standard enter its mass fraction,

atomic number, line code (1 = K-line, 2 = L-line, 3 = M-line, = not analyzed), and valence. The valence is used

for computing oxygen by stoichiometry - if this calculation

is not required, enter zeros for the valence.

10. A file for element already exists - do you wish to replace

it?

Enter (Y)es if you wish to change the standard data for the

element in question to the current values. Enter (N)o if

you wish to retain the old values already stored in the

file.

11. Do you wish to change the specimen elements? (Y)es or (N)o

If the unknown computation is entered directly (by answering

(N)o to question 1), you can still change the list of

elements analyzed, provided that the standards for those

elements are present in the data file, by answering (Y)es to

this question. (N)o will run the elements as listed in the

data file.

12. Number of elements in specimen =

Enter the total number of elements in the unknown specimen

including any unanalyzed element. There may only be one

unanalyzed element in an unknown.

13. Enter At. No. for each element (unanalyzed last)

Enter the atomic number for each element in the unknown

specimen including any unanalyzed element. The preferred

order is in order of increasing x-ray peak energy. Any

unanalyzed element must, however, be last in the order.
14. Spectrum File name?

Enter the file name of the data file containing the spectrum

(standard or unknown) , Typing Control Z terminates

processing files and allows the user to alter standard files

or to end the program.

15. Enter mean energies for two background points

The program requires two background regions. The user

should enter the two energies that he would like the two

regions centered around. The program will then set the

regions using the same method as is used for setting peak

regions and check to see if any peaks are within the

regions. If there are interferences, the next two questions

will be asked.

16. Energy interferes with a peak at energy

Do you wish to omit it? (Y)es or (N)o

If the interference is from a very small peak of a minor

element, you may not wish to omit it - enter (N)o. (Y) es

will delete that background point.

17. You have too few background points - Try again

If you omit a background point (question 16) , you will not

have enough points. The program will ask you for the

background points again (question 15) - you will have to

enter both background energies again, not just the one you

omitted

.

In addition, there are many warnings or errors that may be

printed if the need should arise. Errors are generated by missing

data or problems in opening, reading or writing data files. Warnings

usually relate to analytical problems. In some cases, the warnings

may help you to select better analytical operating conditions (beam

voltage, x-ray line selection, etc.) and in other cases, nothing can

be done (x-ray line may be too close to an x-ray absorption edge) . In

any case, the user should be aware of any conditions that may lead to

less than optimum results.

The data file containing the spectrum has a special format on our

system. The computer that created the file has only a 16-bit (2

bytes) word instead of the 32-bit (4 bytes) word on the VAX 11/780.

Each data point, however, was written into 3 bytes. The data files

were written in 512 byte blocks where the first block contains all the

header material. If 2048 channels were stored, the next 8 blocks

contain the 2048 least significant 2-byte words for each channel and

the last 4 blocks contain the 2048 most significant bytes for each

channel. The subroutine RDFIL reads this data file and puts the bytes

for each data point together into a single number. Unless your

spectrum data file has this format, you will have to write a subroutine to read the spectrum data file as formatted at your

installation .
B. Output

The output should be reasonably self-explanatory. The standards

calculation prints out the multi-element standard factor (MELS) , (the

computed k-value) for each analyzed element. For a pure element, this

value is 1.0. It is printed out for information only; the corrected

standard intensity for each element is stored in the standards data

file.

The table printed for analysis results contains the atomic

number, the mass fraction, the absorption factor (F(X)), and the

measured relative intensity ratio (k-value). The total for the

analysis is also printed at the end.

C. Examples

In the examples listed below, the > symbol precedes the user

input. This symbol does not appear when actually executing the

program. The Yes or No answers must be upper case; however, the file

name could be either upper or lower case. The symbol ^Z is a Control

Z.
Example 1. Create a standard file for two elements, gold and

copper, from spectra of each pure element. Then analyze a gold-copper

alloy.

Frame C:

Do you wish to create or add to a data file?

>Y

*** FRAMEC STANDARDS *** Enter name of standard file

>STD

EO = >20.

Take-off angle = >40.

Number of elements in standard = >1

Enter Cone., At. No., Line code, & Valence for each

>1. ,79,2,0

Spectrum File name? >GOLD20

GOLD STANDARD 20 KEV

Enter mean energies for two background points

>4.3,9.2

MELS = 1.00000

79 2 28182.67

Do you wish to add more standard data?

>Y

*** FRAMEC STANDARDS ***

EO = 20.0 Take-off angle = 40.0

Number of elements in standard = >1

Enter Cone., At. No., Line code, & Valence for each

>1. ,29,1,0

Spectrum File name? >COPP20

PURE COPPER20^KEV

Enter mean energies for two background points

>4.3,9.2

MELS = 1.00000

29 1 102433.3

Do you wish to add more standard data?

>N *** FRAMEC ANALYSIS *** Number of elements in specimen = >2

Enter At. No. for each element (unanalyzed last)

>79,29

Spectrum File name? >AU60CU

GOLD 60 COPPER20 KEV

Enter mean energies for two background points

>4.3,9.2

Z C F(X) K

79 0.3994 0.9619 0.3296

29 0.6099 0.9799 0.6579

TOTAL = 1.0093

*** FRAMEC ANALYSIS *** Spectrum File name? >"Z

Do you wish to change the standard file? >N

Do you wish to change the element list? >N
Example 2. Analyze a gold-copper alloy using an existing

standard file.

Frame C:

Do you wish to create or add to a data file?

>N *** FRAMEC ANALYSIS *** Enter name of standard file

>STD

Do you wish to change the specimen elements?

>N

Spectrum File name? >GOLD20

GOLD STANDARD 20 KEV

Enter mean energies for two background points

>4.3,9.2

Z C F(X) K

79 1.0000 0.9619 1.0000

29 0.0003 0.9799 0.0004

TOTAL = 1.0003

*** FRAMEC ANALYSIS *** Spectrum File name? >^Z

Do you wish to change the standard file?

>N

Do you wish to change the element list?

>N
Example 3. Procedure for optionally changing elemental data in

the standard file and then analyzing the gold-copper alloy.

Frame C:

Do you wish to create or add to a data file?

>Y *** FRAMEC STANDARDS *** Enter name of standard file

>STD

EO = 20.0 Take-off angle = 40.0

Number of elements in standard = >1

Enter Cone, At. No., Line code, & Valence for each

>1. ,79,2,0

Spectrum File name? >GOLD20

GOLD STANDARD 20 KEV

Enter mean energies for two background points

>4. 3,9.2

A file for element 79 already exists - do you wish to replace it? >N

Do you wish to add more standard data?

>Y

*** FRAMEC STANDARDS ***

EO = 20.0 Take-off angle = 40.0

Number of elements in standard = >1

Enter Cone, At. No., Line code, & Valence for each

>1. ,29,1,0

Spectrum File name? >COPP20

PURE COPPER20 KEV

Enter mean energies for two background points

>4.3,9.2

MELS = 1.00000

A file for element 29 already exists - do you wish to replace it? >Y

Do you wish to add more standard data?

>N

*** FRAMEC ANALYSIS *** Number of elements in specimen = >1

Enter At. No. for each element (unanalyzed last)

>79,29

Spectrum File name? >AU60CU

GOLD 60 COPPER20 KEV

Enter mean energies for two background points

>4.3,9.2

MELS = 1.00000

Z C F(X) K

79 0.3994 0.9619 0.3296

29 0.6099 0.9799 0.6579

TOTAL = 1.0093

*** FRAMEC ANALYSIS

Spectrum File name? >"Z

Do you wish to change the standard file? >N

Do you wish to change the element list? >N

10
III. References

1. Myklebust, R.L., Fiori, C.E. and Heinrich, K.F.J. , FRAME C:

A Compact Procedure for Quantitative Energy-Dispersive Electron Probe

X-ray Analysis, NBS Tech. Note 1106, (1979)

IV. Program Listing

C FRAME C MAIN PROGRAM

C

C Program for quantitative electron probe microanalysis.

C Written by R.L. Myklebust & B. Thorne

C National Bureau of Standards

C Fortran IV+ for a VAX 11/780 vers. VMS 3.0

C

CHARACTER*10 NAM

CHARACTER*1 NY,NYE,NYS

1 FORMAT (Al)

TYPE *, • Frame C:

TYPE 5

5 FORMAT (

• Do you wish to create or add to a data file? ',$)

ACCEPT 1,NY

C

C Add to or create a data file to store the standards information,

C

10 IOPT=0

IF(NY.EQ. 'Y' ) THEN

20 CALL FRCSTD(NAM,IOPT) ! Standards subroutine

TYPE 25

25 FORMAT (• Do you wish to add more standard data? ',$)

ACCEPT 1,NYE

IF(NYE.EQ. 'Y' ) GO TO 20

I0PT=-1

END IF

30 CALL FRC(NAM, lOPT) {specimen subroutine

IF(IOPT.EQ.l) GO TO 30

TYPE 35

35 FORMAT(' Do you wish to change the standard file? ',$)

ACCEPT 1,NY

IF(NY.EQ. 'Y' ) GO TO 10

TYPE 40

40 FORMAT (

' Do you wish to change the element list? ',$)

ACCEPT 1,NYS

IF(NYS.EQ. 'Y' ) GO TO 30

STOP

END

C Main FRAMEC program for standards

C

n
SUBROUTINE FRCSTD (NAM, lOPT)

INCLUDE 'BLNK.CMN'

INCLUDE 'CONC.CMN'

INCLUDE 'SPECTM.CMN'

INCLUDE 'ENER.CMN'

INCLUDE 'KFAC.CMN'

INCLUDE 'ROIC.CMN'

C

INTEGER*2 ZT , LT ,QT ,NKEY

CHARACTER* 10 NAM

DIMENSION QM(15)

TYPE 5

5 FORMAT (' *** FRAMEC STANDARDS ***')

IF(IOPT.LT.l) THEN

TYPE 10

10 FORMATCO Enter name of standard file ',$)

READ(5r20) NAM

20 FORMAT (AlO)

END IF

I0PT=1

C

C Open the standards data file if it exists - if it does

C not exist then create it

C

OPEN (UNIT=10,FILE=NAM,STATUS=' UNKNOWN' , ORGANIZATION=' INDEXED*

1 ,FORM=' UNFORMATTED' ,ACCESS= ' KEYED' , KEY= ( 1 : 2 : INTEGER)

2 ,RECL=3,REC0RDTYPE=' VARIABLE' , IOSTAT=IOS , ERR=995)

READ(UNIT=10,KEY=200,KEYID=0, IOSTAT=IOS,ERR=25) ZT,E0,TOA

25 IF(IOS.EQ.36) THEN !if new file, ask for input

TYPE 30

30 FORMAT (

' EO = ' ,$)

ACCEPT *,E0

TYPE 40

40 FORMAT (• Take-off angle = ',$)

ACCEPT *,TOA

NKEY=200

WRITE (UNIT=10,IOSTAT=IOS,ERR=990) NKEY,E0,TOA

ELSE

IF(IOS.NE.O) GO TO 980

TYPE 45,E0,TOA !if old file, print out data

45 FORMATC EO = ',F5.1,' Take-off angle = ',F4.1)

END IF

CALL COEF(TOA) "get coefficients

TYPE 50

50 FORMAT (' Number of elements in standard = ',$)

ACCEPT *,N

TYPE 60

60 FORMAT(' Enter Cone, At. No., Line code, & Valence for each')

DO 70 1=1,

70 ACCEPT *,XC(I) ,Z(I) ,L(I) ,Q(I)

Z(N+1)=4 ! Be for detector window

Z(N+2)=14 !Si for detector dead layer

Z(N+3)=79 !Au for detector

NX=0

DO 80 I=N+l,N+3

12
80 L(I)=0

DO 90 1=1, N+3

CALL EDGES(I) Icalculate absorption edges

IF(L(I) .GT.O) THEN

NX=NX+1

CALL LINES(I) "calculate x-ray line energies

LI=L(I)

IF(Z(I) .NE.29) GO TO 81

IF(EL(LI,I) .LT.l.) THEN

TYPE 85,Z(I)

85 FORMATC The line of ',13,' is less than IkeV ) GO TO 999

END IF

IF(E(LI*LI,I) .GE.EO) THEN

TYPE 87,Z(I)

87 FORMAT (

' The excitation potential of ,13,' is greater',

1' than EO')

GO TO 999

END IF

END IF

90 CONTINUE

CALL RDSPEC !get spectrum

CALL ROI(NX) !set windows for each element

N3=l !set number of iterations to 1

CALL OCOEF "calculate overlap factors

CALL BKG Icalculate background

CALL OLAPS "correct for overlaps

DO 100 1=1, NX

100 XM(I)=W(I)

CALL MATRIX(QM,N3) !do matrix corrections on standards

C

C Write standards information into data file.

C

DO 130 1=1, NX

READ(UNIT=10,KEY=Z (I) ,KEYID=0 , IOSTAT=IOS , ERR=110 ) ZT,LT,XT,QT

110 IF(IOS.EQ.36) THEN

WRITE (UNIT=10,IOSTAT=IOS,ERR=990) Z(I),L(I),XM(I),Q(I)

TYPE *,Z(I) ,L(I) ,XM(I) ,Q(I)

ELSE

TYPE 115, ZT

115 FORMATC A file for element ',13,' already exists - do you'

1 ' wish to replace it? ',$)

ACCEPT 120, NY

120 FORMAT (Al)

IF(NY.EQ. 'Y' ) THEN

REWRITE (UNIT=10,IOSTAT=IOS,ERR=990) Z(I),L(I),XM(I),Q(I)

END IF

END IF

130 CONTINUE

GO TO 999

980 TYPE 985, lOS

985 FORMATC Error reading file - error # = ',15)

GO TO 999

990 TYPE 991, lOS

991 FORMATC Error writing file - error # = ',15)

13
GO TO 999

995 TYPE 996, lOS

996 FORMATC Error opening file - error # = ',15)

999 CLOSE(UNIT=10)

RETURN

END

C Main FRAMEC program for unknown analysis

C

SUBROUTINE FRC (NAM, lOPT)

INCLUDE 'BLNK.CMN'

INCLUDE 'CONC.CMN'

INCLUDE 'ENER.CMN'

INCLUDE 'KFAC.CMN'

INCLUDE 'ROIC.CMN'

INCLUDE 'SPECTM.CMN'

C

INTEGER*2 NKEY

CHARACTER*1 NY

CHARACTER* 10 NAM

DIMENSION QM(15)

C

1 FORMAT (Al)

TYPE 5

5 FORMATC *** FRAMEC ANALYSIS ***')

IF(IOPT.EQ.O) THEN

TYPE 10

10 FCtf^MATCO Enter name of standard file ',$)

READ (5, 20) NAM

20 FORMAT (AlO)

TYPE 15

15 FORMAT (' Do you wish to change the specimen elements'

1,'? ',$)

ACCEPT 1,NY

IF(NY.EQ. 'Y') I0PT=-1

END IF

C

C Open the standards file - this file is created FRCSTD

C and contains all information on the standards for the analysis

C

OPEN (UNIT=10,FILE=NAM,STATUS=' OLD' ,ORGANIZATION= ' INDEXED'

,

1 FORM=' UNFORMATTED' ,ACCESS= ' KEYED' ,KEY=(1:2 :INTEGER) ,RECL=3,

2 RECORDTYPE=' VARIABLE' , IOSTAT=IOS , ERR=950)

C

C Read beam voltage and take-off angle - then number of elements

C

READ (UNIT=10,KEY=200, KEY ID=0,IOSTAT=IOS,ERR-=990) NKEY,E0,TOA

READ(UNIT=10,KEY=201,KEYID=0,IOSTAT=IOS,ERR=25) NKEY,N

25 IF( (lOS.EQ.O) .AND. (lOPT.EQ.-D) THEN

GO TO 27

ELSE IF(IOS.EQ.36) THEN

27 TYPE 30 "create or change element table

30 FORMAT (

' Number of elements in specimen = ',$)

14
ACCEPT *,N

TYPE 40

40 FORMAT (• Enter At. No. for each element (unanalyzed last)')

ACCEPT *, (Z(I) ,I = 1,N)

50 IF(IOPT.EQ.-l) THEN 'rewrite the table

REWRITE (UNIT=10, IOSTAT=IOS,ERR=980) NKEY,N

READ(UNIT=10, IOSTAT=IOS,ERR=940) NKEY

REWRITE ( UNIT= 10, IOSTAT=IOS,ERR=980) NKEY, (Z(I) ,I=1,N)

ELSE ! create the element table

NKEY=201

WRITE (UNIT=10,IOSTAT=IOS,ERR=980) NKEY,N

NKEY=202

WRITE ( UNIT= 10, IOSTAT=IOS,ERR=98 0) NKEY, (Z(I) ,I=1,N)

END IF

ELSE

IF(IOS.NE.O) GO TO 970

READ(UNIT=10,KEY=20 2,KEYID=0,IOSTAT=IOS,ERR=990)

1 NKEY, (Z(I) ,1=1, N)

END IF

I0PT=1

C

C Read in the standards data for each element

C

NX=N

DO 100 1 = 1,

N

READ(UNIT=10,KEY=Z(I) ,KEYID=0 , IOSTAT=IOS , ERR=60 ) NKEY , L ( I )

,

1 QM(I),Q(I)

C

C See if the element is present in the file

C

60 IF(IOS.EQ.36) THEN

IF(I.EQ.N) THEN

NX=N-1

L(I)=0

ELSE

TYPE 65,Z(I)

65 FORMAT (' Standard file missing for element ',13)

GO TO 999

END IF

ELSE

IF(IOS.NE.O) GO TO 960

END IF

100 CONTINUE

Z(N+1)=4 ! Be for detector window

Z(N+2)=14 !Si for detector window

Z(N+3)=79 !Au for detector window

DO 110 I=N+l,N+3

110 L(I)=0

CALL COEF(TOA) !get coefficients

DO 120 1=1, N+3

CALL EDGES(I) 'calculate absorption edges

IF(L(I) .GT.O) THEN

CALL LINES(I) "calculate x-ray line energies

END IF

120 CONTINUE

15
CALL RDSPEC(IOPT) !get the spectrum

IF(IOPT.EQ.-l) GO TO 999

CALL ROI (NX) !set peak windows for each element

N3 = 3

CALL OCOEF Icalculate overlap coefficients

CALL MATRIX(QM,N3) !do matrix corrections ZAF

GO TO 999

C

C Error conditions for reading, writing and opening files

C

940 TYPE 945, lOS

945 FORMAT(' Error reading element list - error # = ',15)

GO TO 999

950 TYPE 955, lOS

955 FORMAT(' Error opening data file - error # = ',15)

GO TO 999

960 TYPE 965, lOS

965 FORMATC Error reading element entry - error # = ',15)

GO TO 999

970 TYPE 975, lOS

975 FORMAT(' Error reading number of elements - error # = ',15)

GO TO 999

980 IF(IOS.EQ.53) THEN ! if record does not exist, change

I0PT=1 ! to write a new record.

GO TO 50 !try again

ELSE

TYPE 985, lOS

985 FORMAT (

• Error writing no. of elements or element list -'

1 ,' error # = • ,15)

END IF

GO TO 999

990 TYPE 995, lOS

995 FORMATC Error reading EO & TOA - error # = ',15)

999 CLOSE(UNIT=10)

RETURN

END

SUBROUTINE ABSFAC (El ,F1 , T2)

INCLUDE 'BLNK.CMN'

INCLUDE 'GEOM.CMN'

C

C Absorption factor - El is the excitation potential

C

X3=T2*Q1 labsorption coef * esc (take-off angle)

GA=(E0**1.65-E1**1.65) *Q2 Igamma in Heinrich's eqn

F1=1/(1+1.2E-6*GA*X3) **2 If(chi)

RETURN

END

SUBROUTINE AREA ( I , E7 , El , 01 , E8 , E9)

16
C Compute the area of the Gaussian peak that is integrated

C within the energy window for each element.

C

INCLUDE 'ROIC.CMN'

E3=EHI(I) lupper energy of window

E2=EL0W(I) llower energy of window

X2=(E2-E7) /SI (El)/1.4142 Ifactor required by integration routine

CALL GAUS (E8,E9,X2) 'integrate low energy side

CALL ICHG(E7,G4) 'add in incomplete charge effect

TE=ABS(E8)/2 "integral from low to peak energy

X2=(E3-E7)/S1 (El)/1.4142 "factor required by integration routine

CALL GAUS (E8,E9,X2) ! integrate high energy side

E8=ABS(E8)/2 ! integral from peak to high energy

IF(E2.LT.E7)GO TO 100

01=E8-TE "window on high side of peak

RETURN

100 IF(E3.GT.E7)GO TO 200

01=TE-E8+G4 Iwindow on low side of peak

RETURN

200 01=TE+E8+G4 Ipeak energy inside window

RETURN

END

C This is the FRAME C background calculation

C

SUBROUTINE BKG

INCLUDE 'ABSB.CMN'

INCLUDE 'BLNK.CMN'

INCLUDE 'CONC.CMN'

INCLUDE 'ENER.CMN'

INCLUDE 'KFAC.CMN'

INCLUDE 'ROIC.CMN'

C

DIMENSION X(2) ,Y(2) ,U(2)

DO 40 1=1, NB

E2=EL0W(I) !low energy of bg window

E3=EHI(I) "high energy of bg window

T5=CNTS(I) ! counts in bg window

X1=T5/(E3-E2+.01)/100. "counts per channel in bg window

El= (E2+E3)/2. icentroid energy of bg window

T2 = 0.

DO 10 J=1,N

CALL MAC (El, FA, J)

T2=T2+XC(J) *FA ! concentration average of abs. coef.

10 CONTINUE

CALL DET(ED,E1,N) Idetector efficiency ED

CALL ABSFAC(E1,F1,T2) !f(chi) Fl

T1=ED*F1/E1

X(I)=E0-E1

Y(I)=X1/T1

U(I)=X(I)**2

40 CONTINUE

17
C Set up matrix for fit to background

C

D1=X(1) *U(2)-U(1)*X(2)

XK1=(Y(2)*X(1)-Y(1)*X(2) )/Dl

XK2=(Y(1)*U(2)-Y(2)*U(1))/D1

IF(L(1) .EQ.20) GO TO 999 'exit if determining detector param.

DO 60 1 = 1,

IF (L(I) .EQ.O) GO TO 60 "skip if unanalyzed element

L1=L(I)

E1=EL(L1,I) "energy of peak

T5=CNTS (I+NB) ! counts in peak window

T2 = 0.

DO 50 J=1,N

CALL MAC(E1,FA,J)

T2=T2+XC ( J) *FA ! concentration average of peak abs. coef.

50 CONTINUE

CALL DET(ED,E1,N) 'detector efficiency for peak energy

LEG=L1*L1

E4=E(LEG,I) lexcitation potential for peak

CALL ABSFAC(E4,F1,T2) !f(chi) for peak

T1=ED*F1/E1

X1=E0-E1

G1=T1*(XK1*X1*XH-XK2*X1) ! bg per channel at peak energy

GS=100.* (EHI (I+NB) -ELOW(I+NB)+.01) Inumber of channels in

! window

XM(I)=T5-G1*GS !bg corrected peak intensity

C TYPE *,'BKG • ,T5,G1,GS,ED,F1

60 CONTINUE

999 RETURN

END

SUBROUTINE COEF(TOA)

INCLUDE 'KBKA.CMN'

INCLUDE 'ATWT.CMN'

INCLUDE 'GEOM.CMN'

INCLUDE • DETECT. CMN'

C

C Coef. for calculations

C

C Kb/Ka ratios

C

DATA VB/10*0. ,.011,. 27,. 04,. 055,. 066,. 078,. 085, .097, .108

2,. 11 4,. 115,. 117,. 119,. 119,. 121,. 121,. 121,. 123,. 1235,. 125/

C

C Table of atomic weights

C

DATA WA/1. ,4. ,6.94,9.013,10.8 2,12.011,14.007,16. ,19., 20. 18, 22. 99

2,24.31,26.98,28.09,30.97,32.06,35.45,39.95,39.1,40.08,44.96,47.9

3,50.94,5 2. ,54.94,55.8 5,58.93,58.71,6 3.54,65.37,69.72,72.59,74.92

4, 78. 96, 79. 9 1,83. 8, 85. 47, 87. 62, 88. 91, 9 1.22, 92. 91, 95. 94, 99., 101.1

5,10 2.9,106.4,107.9,112.4,114.8,118.7,121.8,127.6,126.9,131.3

6, 132. 9, 137. 3, 138. 9, 140. 1,1 40. 9, 144. 2, 145., 150. 4, 152., 157., 158.

7, 162. 5, 164. 9, 167. 3, 168. 9, 17 3., 17 5. ,178.5,180.95,183.85,186.2

18
8,190.2,192.2,195.1,196.97,200.6,20 4.4,207.2,209. ,210., 210., 222

9,223. ,226. ,227. ,232. ,231. ,238., 237. ,244., 24 3. ,247., 247. ,251.

0,254./

Q3=149. Iresolution of Si detector (eV on MnKa)

Q2=90. Ibeam incidence angle

P6=1.57E-3 Ithickness of Be window (fitted from C)

P7=9.76E-6 'thickness of Si dead layer (fitted)

Q3=Q3**2-14737 . 5 Inoise factor for peak width calc.

Ql = l/SIN(TOA/57.2958) I esc ( take-off angle)

Q2= SIN(Q2/57.2958) Isine of beam incidence angle

RETURN

END

SUBROUTINE CONAVE (I , S2 , T2 , X2)

INCLUDE 'BLNK.CMN'

INCLUDE 'CONC.CMN'

INCLUDE 'ZAFF.CMN'

C

C Concentration ave. factors

C

S2=0.

X2 = 0.

T2=0.

DO 100 J=1,N

S2=S2+XC ( J) *S ( J, I) !conc. ave. of stopping power

X2=X2+XC(J)*V(J,I) Iconc. ave. of R factor

T2=T2+XC(J) *H(J,I) Iconc. ave. of absorption coef

100 CONTINUE

999 RETURN

END

SUBROUTINE DET(ED,E1,N)

INCLUDE ' DETECT. CMN'

C

C Detector efficiency

C

I = N+1

CALL MAC(E1,FA,I) labs. coef. for Be

T3=FA*1.82*P6 'linear absorption in Be window

I=N+3

CALL MAC(E1,FA,I) labs. coef. for Au

T4=FA*19.3*8.E-7 Uinear absorption in Au layer

I=N+2

CALL MAC(E1,FA,I) labs. coef. for Si

C

C Detector efficiency - the last term is for high energy X-rays

C that may be lost by passing through the detector without being

C absorbed, (detector is 0.3 cm thick)

C

ED=EXP(-T3-T4-FA*2.33*P7)*(1-EXP(-FA*2.33*.3)

)

RETURN

19
END

SUBROUTINE DIST(S3)

INCLUDE 'ATWT.CMN'

INCLUDE 'BLNK.CMN'

INCLUDE 'CONC.CMN'

INCLUDE 'ENER.CMN'

C

C Compute element by difference or stoichiometry

C

S3 = 0.

DO 20 1=1,

IF(L(I) .EQ.0)GO TO 20 !do not sum unanalyzed element

IF(XC (I) .GT.O. ) GO TO 10 ! do not sum any negative cone.

XC(I)=0.

10 S3=S3+XC(I) !S3 is the sum of the calculated cone.

20 CONTINUE

IF(L(N) .GT.0)GO TO 999 Iskip if all elements analyzed

IF(Q(1) .GT.O. )G0 TO 30 !skip if stoichiometry calc.

XC(N)=1-S3 Icalc. last element by difference

S3 = l

GO TO 999

C

C stoichiometry calculation

C

30 XC(N)=0

DO 50 1=1, N-1

F3=.5*XO-(I) *Q(I) *WA(Z(N))/WA(Z(I) ) !calc. oxygen by stoic

XC(N)=XC(N)+F3 'sum all oxygen concentrations

50 CONTINUE

S3=S3+XC(N) !add oxygen cone, to sum of elements

999 RETURN

END

SUBROUTINE EDGES (I)

INCLUDE 'BLNK.CMN'

INCLUDE 'ENER.CMN'

C

C Absorption edges

C All edges are computed for each element whether they exist or

C not. This fit is NOT good below IkeV.

C

DIMENSION TD(4) ,XE(3,9)

DATA XE/-. 039793 1,2. 4 23, -5. 5091, -.0339 16, 2. 82 526, -9. 03526,

2-. 08 65 397, 3. 3 23 15, -10. 2505, -.2 28 343, 4. 3 1172, -12. 0025, 1.25 179,

3-7.838,11.580 3, .834903,-4.14925,3.33802, . 442217 ,-. 979241

,

4-3. 15348,. 25141,. 9 3 19 13, -8. 3561,. 27 29 51,. 688906, -7. 4 243/

ZR=Z(I) 'atomic number (int->real)

Z1=L0G(ZR)

DO 100 Ml=l,9 !calc. all edges for element Z(I)

E(M1,I)=EXP(Z1*Z1*XE(1,M1)+XE(2,M1)*Z1+XE(3,M1))

20
IF(M1.EQ.1)G0 TO 100

IF(E (1, I) .GT.4)G0 TO 100 Iskip very low energy L and M lines

E(M1,I)=0. !K-edge is less than 4keV

100 CONTINUE

RETURN

END

SUBROUTINE ESP ( I ,N , E6 , E7 , S7 , S8 , YD)

C

C Calculate counts in escape peak

C

01 = 0.

IF(E7.LT. 1.838) GO TO 999 Iskip if peak E<Si energy

E1 = E7

E7=E7-1.74 lenergy of escape peak

IF(E6.LT.E7-YD.OR.E6.GT.E7+YD) THEN ! see if escape peak

! inter fers

II=N+2

CALL MAC(E1,FA, II) !abs. coef. of line in Si

S7=.5*(l-3 27.9/FA*LOG(l+FA/3 27.9)

)

S8=.038*S7/(1-.038*S7) irelative weight of escape peak

E7=S1(E7) 'Sigma (width) of escape peak

CALL AREA(I ,E7,E1,01,E8,E9) lintegral of overlap portion

END IF

999 RETURN

END

SUBROUTINE FACTOR ( El , Fl , F2 , I , S2 , T2 , X2 , Wl

)

INCLUDE 'ABSB.CMN'

INCLUDE 'BLNK.CMN'

INCLUDE 'CONC.CMN'

INCLUDE ' FLUOR. CMN'

INCLUDE 'GEOM.CMN'

INCLUDE 'ZAFF.CMN'

C

C Correction factors in loop

C

W1=(V(I,I) *S2)/(S(I,I)*X2) latomic number factor

F(2,I)=F1 !f(chi) for specimen

F2 = DO 200 J=1,N

IF(AP(I , J) .EQ.O) GO TO 200 Iskip if no fluorescence correction

T3 = 0.

DO 100 11 = 1,

T3=T3+XC(I1) *H(I1+15,J) labs. coef. of exciting line in spec.

100 CONTINUE

X1=Q1*T2/T3

GB=33 3000./( (E0**1.65)-(E1**1.65))/T3*Q2

F4=L0G(1+X1)/X1+L0G(1+GB)/GB

F2=F2+XC(J) *0(I ,J)/T3*F4 ! sum of fluor. of element I 200 CONTINUE

21
999 RETURN

END

FUNCTION FT2(E1)

INCLUDE 'BLNK.CMN'

INCLUDE 'CONC.CMN'

c

c Cone average of abso

c

FT2=0.

DO 100 1=1,

N

CALL MAC (El, FA, I)

FT2=FT2+XC(I)*FA

100 CONTINUE

RETURN

END

coef. for overlap correction

•calculate absorption coef, for energy El

•cone, average of absorption coef.

SUBROUTINE GAUS (E8 , E9 ,X2)

C

C Integrate Gaussian - C this routine, when it is called with the proper

C arguments, will integrate a Gaussian between two

C points symetrically placed with respect to the

C centroid of the Gaussian.

C

C

S27=-27

T1=2.**S27

IF(X2.EQ.0)GO TO 900

Y1=ABS(X2)

Y2=Y1*Y1

IF(Y1.LE.1)G0 TO 100

YC=2.**3.5

U1=.83*YC

S6=2.**(YC*YC-8)

IF(Y1.LE.U1)G0 TO 400

E8=l.

E9=0.

GO TO 300

100 W2=0.

Al = l.

T2=l.

P2=2*Y2

200 Al=Al+2

T2=P2*T2/A1

S2=T2+S2

IF(T2.GE.T1)G0 TO 200

E8=(S2+1)*1.128 38*Y1*EXP(-Y2)

E9=l-E8

300 IF(X2.GE.0)GO TO 999

E9=2-E9

22
400 F2=0

GS = 1

F1=2*X1

GI=2*Y2+1

P3=F1/GI

A2 = l.

YB=GI+4

500 F5=-A2*(A2+1)

F3=YB*F1+F5*F2

G3=YB*GI+F5*GS

F4=F3/G3

IF(ABS(1-F4/P3) .GT.TDGO TO 800

IF(P3.GT.F4)GO TO 700

IF(G3.LT.56)GO TO 600

F3=F3/S6

G3=G3/S6

F1=F1/S6

GI=GI/S6

600 F2=F1

GS=GI

F1=F3

GI=G3

A2=A2+2

YB=YB+4

P3=F4

GO TO 500

700 F4=P3

800 E9=F4*EXP(-Y2) *1. 12838/2

E8=l-E9

GO TO 300

900 E8=0.

E9=l.

999 RETURN

END

SUBROUTINE ICHG (E7 ,G4 , J

)

C

C Compute incomplete charge correction

C

INCLUDE 'ROIC.CMN'

E2=EL0W( J+NB) !low energy side of window

E3=EHI (J+NB) Ihigh energy side of window

G4 = 0.

Xl = 6.

X3=.l

IF(E7.GE.6.4)GO TO 10 ! select the constants for the fit

X1=.86*E7*E7-7.44*E7+18.34

X3=-.0168*E7*E7+.141*E7-.115

IF(X3.LE.0)GO TO 999 ! if X3 too small, exit

10 IF(E2.GE.E7)GO TO 999 !exit if E2 on high energy side

X2=(E2-E7)/X3

G4=X1*X3*X3*(1-EXP(X2) *(1-X2) ) Iresult for low energy side of

! window

23
IF(E3.GE.E7)GO TO 999 lexit if E3 on high energy side

X2=(E3-E7)/X3

G4=G4-X1*X3*X3*(1-EXP(X2)*(1-X2)) Uesult for high energy side

999 RETURN

END

SUBROUTINE LINES (I)

INCLUDE 'BLNK.CMN'

INCLUDE 'ENER.CMN'

C

C Line energies

C All lines are computed for each element whether they exist or

C not. This fit is NOT good for lines below IkeV.

C

DIMENSION T(3,17)

DATA T/-. 01997 26, 2. 2241 2, -5. 1774, -.123941, 3. 29533,

2-9. 7 5836, -.47555, 6. 84662, -20. 08 33, -.060101, 2. 52781, -5. 6437,

3-. 117102, 3. 224 14, -9. 587 11, -.192466, 3. 83158, -10. 9293, -.197431,

44. 017 18, -11. 33 23, -.00322523, 2. 486 13, -8. 37742,. 35676, 2. 29 113,

5-8. 09392,. 00288553, 2. 49221, -8. 60965,. 0957107, 1.691 57, -6. 76302

6,. 09 2961, 1.7559, -6. 8 18 39,. 050 5888, 2. 00 35, -7. 30 182, -.390705,

76. 17432, -19. 0119, -.386042, 6. 14822, -18. 7034, -.6031 32, 7. 75598

8, -21. 4878,. 322877,. 102358, -5. 58269/

RZ=Z(I)

Z1=L0G(RZ) "log of atomic number of element

DO 100 Ml=l,17 icalculate all x-ray lines for element

EL(M1,I)=EXP(Z1*Z1*T(1,M1)+T(2,M1)*Z1+T(3,M1))

100 CONTINUE

RETURN

END

SUBROUTINE MAC (El, FA, I)

INCLUDE 'BLNK.CMN'

INCLUDE 'ENER.CMN'

C

C Mass absorption coef.

C El is the energy of the x-ray line being absorbed. FA is the

C absorption coefficient and I is the index of the absorber.

C

DIMENSION GJ(3) ,GK(3) ,R(10) ,XD(4,4)

R is edge jump ratio

DATA R/1. ,1. ,1.17,1.63,1. ,1.16,1.4,1.621,1.783,1./

DATA GJ/-. 0045522, -.0068535, 1.070181/

DATA GK/-. 1131595, .8368829 ,-. 5459687/

DATA XD/-. 2322294, 4. 070053, -6. 2 20746,1., -.2544711

2, 4. 76924 5, -10. 37878, 2. 73,. 2562163

3,1.15119,-5.684848,2.6,1.359165,-9.492116

4, 18. 64081, 2.-22/

XD(4,2)=2.73

RZ=Z(I) ! absorber atomic number

Z1 = L0G(RZ) Hog of atomic number

24
XD(4,1)=EXP(GJ(1)*Z1*Z1+GJ(2)*Z1+GJ(3))

IF(Z(I) .LT.42)GO TO 100 "select XD constant

XD ( 4 , 2

) =EXP ( GK ( 1

) * Z1 *Z l+GK ( 2

) * Z 1+GK ( 3 )

)

100 DO 300 Ml=l,10

IF(M1.EQ.10)GO TO 200 Iscan edges

IF(E1.LT.E(M1,I) )G0 TO 300

200 Ll=Ml-INT(Ml/3)-INT(Ml/4)-INT(Ml/7) Iselect proper edge

c

c Ml LI edge

c 1 1 K

c 2 2 LI

c 3 2 L2

c 4 2 L3

c 5 3 Ml

c 6 3 M2

c 7 3 M3

c 8 3 M4

c 9 3 M5

c 10 4 Nl

c

ZC=EXP(XD(1,L1)*Z1*Z1+XD(2,L1)*Z1+XD(3,L1))/R(M1)

FA=ZC*(12.398/E1)**XD(4,L1) 'absorption coefficient

RETURN

300 CONTINUE

RETURN

END

SUBROUTINE MATRIX (QM,N3)

INCLUDE 'ABSB.CMN'

INCLUDE 'BLNK.CMN'

INCLUDE 'CONC.CMN'

INCLUDE 'ENER.CMN'

INCLUDE ' FLUOR. CMN'

INCLUDE 'KFAC.CMN'

INCLUDE 'ROIC.CMN'

INCLUDE 'ZAFF.CMN'

C

C Matrix corrections

C

DIMENSION QM(15) ,U(15) ,UB(15) ,UC(15)

DIMENSION VZ(15,15)

N1=0

DO 200 J=l,15

DO 100 1=1,15

AP(l,j)=o. linitialize fluorescence matrix

100 CONTINUE

200 CONTINUE

DO 300 J=1,N

IF(L(J) .EQ.0)GO TO 300

CALL SETUP (J) Iset up cone, independent parameters

300 CONTINUE

IF(N3.EQ.1)G0 TO 500 Iskip if calculating a standard

S3=0

25
DO 400 1=1,

N

IF(L(I) .EQ.0)GO TO 450

JJ=NB+I ! JJ is the region number for peak I T5=CNTS(JJ) ! integrated counts in region JJ

XM(I)=T5/QM(I) 'relative intensity (k-value)

UB(I)=XM(I)

XC(I)=XM(I) "assume cone, equal to k-value

IF(XC(I) .GT.l.) XC(I)=1.

AZ = 0.

400 CONTINUE

450 CALL DIST(S3) !calc. method for unanalyzed element

CALL N0RM(S3) 'normalize concentrations

AZ = 1.

500 DO 900 1 = 1, N3 ! beg in iteration loop

1100 DO 1200 IJ=1,N

IF(L(IJ) .EQ.0)GO TO 1180 Iskip if element unanalyzed

CALL CONAVE (IJ,S2,T2,X2) 1 cone . average of S, R, and absorp.

! coef

.

L1=L(IJ)

E1=EL(L1,IJ) nine energy

E2=E(L1*L1,IJ) ledge energy

CALL ABSFAC(E2,F1,T2) 'get absorption coefficients

CALL FACT0R(E2,F1,F2,IJ,S2,T2,X2,W1) !get matrix factors

IF(XC(IJ) .EQ.0)GO TO 1200

G3=XC(IJ)/W1*(1+F2)*F(2,IJ)/F(1,IJ) !k-value for cone. XC

: WRITE(6,*) W1,F2,F(2,IJ)/F(1,IJ)

IF(N3.GT.1)G0 TO 1180 'skip if calculating an unknown

XM(IJ)=XM( IJ)/G3 icounts for pure element (store in file)

WRITE(6,1160)G3

1160 FORMAT (»* M ELS =',F8.5)

GO TO 1200 !skip if calculating a standard

1180 IF(XM(IJ) .EQ.l.OR.XC(IJ) .EQ.DGO TO 1200

G4=XM(IJ)*XC(IJ) !new concentration by

UB(IJ)=G4*(1-G3)/(G4+G3*(1-XM(IJ)-XC(IJ) ) ) ! hyperbolic equation

1200 CONTINUE

DO 1210 IJ=1,N

1210 XC(IJ) =UB(IJ) ! replace old cone, with new cone.

CALL DIST(S3) !calc. method for unanalyzed element

IF(N3.EQ.1)G0 TO 9999 Iskip to end if calculating a standard

IF(I .EQ.N3)G0 TO 910 Iskip if iteration complete

CALL N0RM(S3) Inormalize concentrations

CALL BKG I do background correction

CALL OLAPS Ido overlap corrections

DO 800 IJ=1,N

IF(L(IJ) .EQ.0)GO TO 580

XM(IJ)=W(IJ)/QM(IJ) Recalculate k-values

580 U(IJ)=0.

800 CONTINUE

900 CONTINUE lend of iteration loop

910 WRITE(6,920) Iwrite headings for output

920 FORMAT (5X, ' Z

' , 9X, ' C' , 9X, ' F (X) ' , 6X ,

' K

'

)

940 FORMATC ' , 2X, 13 , 6X ,F6 . 4)

960 FORMATC ' , 2X, 13 , 6X, F6 . 4 , 4X, F6 . 4 , 2X, F6 . 4)

DO 1000 1=1,

N

IF(L(I) .EQ.0)WRITE(6,940) Z(I) ,XC(I) lunanalyzed element

26
IF(L(I) .GT.O) WRITE (6,960) Z(I),XC(I),F(1,I),XM(I) ! analyzed

! element

1000 CONTINUE

WRITE (6,1020) S3 'output analysis total

1020 FORMAT (IHO,' TOTAL = ',F6.4)

9999 RETURN

END

SUBROUTINE NORM (S3)

INCLUDE 'BLNK.CMN'

INCLUDE 'CONC.CMN'

C

C Normalize concentrations to 100%

C

DO 100 1=1,

XC(I)=XC(I)/S3 !S3 is sum of concentrations

100 CONTINUE

RETURN

END

SUBROUTINE OCOEF

INCLUDE 'ABSB.CMN'

INCLUDE 'ENER.CMN'

INCLUDE 'GEOM.CMN'

INCLUDE 'ROIC.CMN'

INCLUDE 'ZAFF.CMN'

DIMENSION WQ(15)

C

C Compute overlap coefficients

C

DO 500 J=1,N

IF(L(J) .EQ.0)GO TO 500 !skip if element not analyzed

L1=L(J)

E7=EL(L1,J) lenergy of x-ray line

E2=EL0W(J+NB) ! low energy of window (E2)

E3=EHI(J+NB) !high energy of window (E3)

X2=(E2-E7)/S1 (E7)/1.4142 'Gaussian integration factor (low)

CALL GAUS (E8,E9,X2) ! integrate Gaussian peak

CALL ICHG (E7 ,G4, J) Icalc. incomplete charge collection

E5=ABS(E8)/2 'integral - centroid to low energy

X2=(E3-E7)/S1 (E7)/1.4142 IGaussian integration factor (high)

CALL GAUS (E8,E9,X2) ! integrate Gaussian peak

E4=ABS(E8)/2 ! integral - centroid to high energy

IF(E2.LE.E7)GO TO 100

WQ(J)=E4-E5 !E2>peak energy

GO TO 300

100 IF(E3.GE.E7)GO TO 200

WQ(J)=E5-E4+G4 !E3<peak energy

GO TO 300

200 WQ(J)=E5+E4+G4 !E2<peak energy>E3

27
300 CONTINUE

500 CONTINUE

DO 650 J=l,12

DO 600 11=1,12

DO 550 IJ=1,17

550 HI (IJ, J, I1)=0. Unitialize overlap factors

600 CONTINUE

650 CONTINUE

DO 900 Kl=l,2 !l=self overlap, 2=other overlap

DO 800 11=1, N !Il=analyzed line to be checked

IF(L(I1) .EQ.0)GO TO 800 "skip if unanalyzed element

L1=L(I1)

E6=EL(L1,I1) Iline energy of analyzed line

YD=4*S1(E6) !4*sigina of analyzed line

E2=EL0W(I1+NB) !low energy of window for II

E3=EHI (Il+NB) 'high energy of window for II

DO 700 J=1,N !J=possible overlapping line

L2=L(J) nine code for measured line of J

IF(L2.EQ.0)GO TO 700 'skip if not an analyzed line

C

C Next two lines have the following effect:

C If Kl=2, skip if II and J are the same element.

C If Kl=l, skip if II and J are NOT the same element.

C

IF( (K1.EQ.2) .AND. (I1.EQ.J))G0 TO 700

IF( (Il.NE.J) .AND. (Kl.EQ.l) )G0 TO 700

IF(L2.EQ.1)G0 TO 680 !L2 is a K line

X2=l/LOG(E0*E0/E(4,J)/E(9,J) ) Idefine X2 for L and M lines

GO TO 690

680 X2=l 'define X2 for K lines

690 CALL 0LAP(WQ,E6, J,I1) !calc. overlap coefficient

700 CONTINUE

800 CONTINUE

900 CONTINUE

RETURN

END

SUBROUTINE OLAP (WQ, E6 , J, II

)

INCLUDE 'ABSB.CMN'

INCLUDE 'BLNK.CMN'

INCLUDE 'ENER.CMN'

INCLUDE 'KBKA.CMN'

INCLUDE 'GEOM.CMN'

C

C Overlap for each line

C

DIMENSION U(15) ,X(15) ,WQ(15) ,S(17,15)

CALL YIELD(J,X(1) ,X(2) ,X(3) ) !get fluorescence yield

DO 100 L2=l,9 Iscan each absorp. edge

IF(E (L2, J) .EQ.0)GO TO 9999 iskip if edge energy=0

I2=L2-INT(L2/3)-INT(L2/4)-INT(L2/7) ledge number

M3=2*(INT(L2/I2)-INT(L2/6)+INT(L2/7) ) 'electrons per shell

28
C L2 12 M3

C 1 1 2

C 2 2 2

C 3 2 2

C 4 2 4

C 5 3 2

C 6 3 2

C 7 3 4

C 8 3 4

C 9 3 6

C

IF(E(L2,J) .GE.E0)GO TO 100 'skip if edge energy>EO

E1=E0/E(L2, J) lovervoltage

E4=1166*E(L2,J)/XJ(Z(J))

X1=E1*E4

C Compute the cross-section function

U(L2)=M3*(E1-1-LOG(E4)/E4*2.905*(SQRT(X1)-SQRT(E4) ) )*X(I2)

100 CONTINUE

V5=l.

V4 = l.

V3=l.

V2 = l.

Vl = l.

C

C Calculate line weights ZF & ZM (these are empirical fits)

C

ZF=.2567*Z(J)-6.8176

ZM=EXP(34.165*X2-30.027*SQRT(X2)+8.5268)/1.6

C

C Set up cross-section ratios for K-L and L-M lines

C

GO TO (120,200,300) ,L(J) Isort K,L, or M lines

120 V2=U(4)/U(1)*ZF !K to L3 edge

V4=U(2)/U(1)*ZF !K to LI edge

V5=U(3)/U(1)*ZF !K to L2 edge

GO TO 400

200 V1=U(1)/U(4)/ZF !L3 to K edge

V3=ZM !L3 to M edges

V4=U(2)/U(4) !L3 to LI edge

V5=U(3)/U(4) !L3 to L2 edge

GO TO 400

300 V2=1/ZM !M to L3 edge

V4=U(2)/U(4)/ZM !M to LI edge

V5=U(3)/U(4)/ZM !M to L2 edge

C

C The S values that follow are line intensities relative to the

C measured line for each element. For example, S(1,J) is the

C relative intensity for the Ka line. If the Ka line is

C measured, then S(1,J)=1. If the La line is measured, then

C S(1,J)= the VI computed above in line 200.

C

400 S(1,J)=V1 !Ka

IF(Z(J) .GT.30)GO TO 500 'select the Kb/Ka ratio

R1=VB(Z(J))

IF(Z(J) .LE.30.)GO TO 600

29
500 RZ=Z(J)

R1=.115*L0G (RZ)-2.3 Icompute Kb/Ka for elements> (Z=30)

600 S(2,J)=V2 !Lal

S(3,J)=V3 !Ma

S(4,J)=R1/(1-R1)*V1 1Kb

S(5,J)=.1*V2 !La2

S(6,J)=.044*V2 !L1

S(7,J)=V2*( .2808-.0016*Z(J)) !Lb2

S(8,J)=V5 !Lbl

S(9,J)=.154*V5 ILgl

S(10,J)=.02*V5 !Ln

S{11,J)=.166*V4 !Lb3

S(12,J)=.068*V4 !Lg3

S(13,J)=.104*V4 !Lb4

S(14,J)=.06*V3 !Mzl

S(15,J)=.5*V3*U(9)/U(10) 1Mb

S(16,J)=.05*V3*U(8)/U(10) ! Mg

S(17,J)=.01*V3*U(7)/U(10) !M2N4

IF(I1.EQ. J)GO TO 820 Iskip if for self-overlap

DO 800 12=1,17

IF(S(I2, J) .GT.0)GO TO 800 !make sure all overlaps are positive

S(I2,J)=0. !or zero

800 CONTINUE

C

C Test for overlaps and compute the relative overlapping area

C

820 DO 1100 12=1,17

S8 = l

E7 = EL(I2,J) nine energy

IF(E6. EQ.E7. OR. E7.LT.1. .OR. E7. GT.E0.OR.E7.lt. E6-YD)G0 TO 1100

SIG=S1(E7) ipeak width (sigma)

IF(E7.LT.E6+YD)GO TO 900

CALL ESP (J,N,E6,E7,S7,S8,YD) Icheck for escape peak overlap

900 CALL AREA(J,E7,E1,01,E8 ,E9) !get overlapping area

IF(K1.EQ.2)G0 TO 1000

IF(I2.EQ.L(J) ) GO TO 1100

WQ(J)=WQ(J)+01*S(I2,J) !sum of self-overlaps

GO TO 1100

1000 HI (I2,J, I1)=01/WQ(J) *S8*S(I2,J) Istore each overlap

1100 CONTINUE

9999 RETURN

END

SUBROUTINE OLAPS

INCLUDE 'ABSB.CMN'

INCLUDE 'BLNK.CMN'

INCLUDE 'ENER.CMN'

INCLUDE 'KFAC.CMN'

INCLUDE 'LINEDG.CMN'

C

C Correct overlaps for each line

C

DO 100 J=1,N !get parameters for each element

30
IF(L(J) .EQ.0)GO TO 100 'skip if not analyzed

L1=L(J)

E1=EL(L1,J) 'line energy

L6=LED(L1)

E2=E(L6,J) 'edge energy

CALL DET(ED,E1,N) Idetector efficiency (det. eff.)

T2=FT2(E1) ! cone . average of absorption coef.

CALL ABSFAC(E2,F1,T2) 'absorption factor f(chi)

F(4,J)=F1*ED istore f(chi)*(det. eff.)

W(J)=XM(J) Iboth W and XM contain measured intensity

100 CONTINUE

DO 400 JA=1,3 literate the overlap correction

DO 300 JB=1,N !JB is element number to be checked

IF(L(JB) .EQ.0)GO TO 300 Iskip if not analyzed

R1=0.

C

C Begin checking for overlapping lines

C

DO 200 KB=1,N 1KB is element number of overlapping line

DO 150 L2=l,17 1L2 is the line code for KB

Y1=HI (L2,KB,JB) iget the overlap factor

IF(Y1.EQ.O)GO TO 150 lif factor=0 then skip

E1=EL(L2,KB) lenergy of overlapping line

L6=LED(L2)

E2=E(L6,KB) lenergy of edge of overlapping line

CALL DET(ED,E1,N) Idet. eff.

T2=FT2(E1) Iconc. average of absorption coef.

CALL ABSFAC(E2,F1,T2) If(chi)

R1=R1+F1*ED*W(JB) *Y1/F(4,JB) IRI is sum of individual overlaps

150 CONTINUE

200 CONTINUE

W(JB) =XM(JB) -Rl !W contains the corrected intensity

300 CONTINUE land XM still contains the original

400 CONTINUE 1 intensity

RETURN

END

SUBROUTINE PARA(I,J,ZD)

INCLUDE ' FLUOR. CMN'

C

C Select parameters for fluorescence correction

C

CALL YIELD(I,T1,T4,T7) Iget fluorescence yield

NT=INT(AP(J,I) ) iget the parameters for the

GO TO (100,200,300,400,500,600) , NT Iparticular fluor. correction

100 ZD=.88*T1 IK exciting K

RETURN

200 ZD=3.696*T4 IL exciting K

RETURN

300 ZD=.18*T1 IK exciting L

RETURN

400 ZD=.75*T4 IL exciting L

RETURN

31
500 ZD=.01*T1 !K exciting M

RETURN

600 ZD=.01*T4 IL exciting M

RETURN

END

SUBROUTINE RDSPEC(IOPT)

C

C Subroutine to read a spectrum written by TNTVX.

C This data file contains blocks of two byte words (the least

C significant part of the number) and blocks of byte integers (the

C most significant part of the number) . These are read and combined

C in this routine.

C

INCLUDE 'SPECTM.CMN'

CHARACTER*10 NAMSP

INTEGER*2 lARY ( 2048) , IHDR ( 256)

BYTE IBYT(2048)

CL0SE(UNIT=1)

C

C Enter the file name for the spectrum

C

TYPE 10

10 FORMATC Spectrum File name? ',$)

READ(5,15,END=1999) NAMSP

15 FORMAT (AlO)

IAV=1

C

C Open the file containing the spectrum.

C

0PEN(UNIT=1,NAME=NAMSP,TYPE=' OLD' ,FORM=' UNFORMATTED'

,

1 ACCESS=' DIRECT' , ASSOCIATEVARIABLE=IAV, RECL=128)

C

C Read the header of the file (block 1)

C

READ(1'IAV,IOSTAT=IS,ERR=60) (IHDR(J) ,J=1,256)

20 ICH=IHDR(153) 'number of two byte words in file

ICH=ICH*2/3 !2/3 of words are read as 2-byte

TYPE 25, (IHDR(J) ,J=4, 13) ! types out the file label

25 FORMAT (1X20A2)

IAV=2 Idata block 2

C

C Read the 2-byte part of the data

C

DO 30 I=1,ICH,256 !512 bytes per block

30 READ(1' IAV,IOSTAT=IS,ERR=60) (lARY(J) ,J=I, 1+255)

C

C Read the 1-byte part of the data

C

DO 40 I=1,ICH,512

40 READ(1' IAV,IOSTAT=IS,ERR=60) (IBYT(J) ,J=I, 1+511)

DO 50 1=1, ICH

32
C Decode 2-byte data

C

IFdARYd) .LT.O) THEN J if negative,

SPEC(I)=IARY(I)+65536 ! add 65536

ELSE

SPEC(I)=IARY(I)

END IF

C

C Decode 1-byte data

C

IF(IBYT(I) .LT.O) THEN 'if negative,

ITEMP=IBYT(I)+256 'add 256

ELSE

ITEMP=IBYT(I)

END IF

C

C If third byte contains data, add it to S^PEC

C

IF(ITEMP.GT.O) THEN

SPEC(I)=SPEC(I)+65536*ITEMP

END IF

50 CONTINUE

GO TO 999

60 TYPE *, 'Error number = ',XS loutput errors

TYPE *

,

' lAV = •

,

lAV

999 CLOSE (UNIT=1) Iclose spectrum file

GO TO 2999

1999 I0PT=-1

2999 RETURN

END

SUBROUTINE ROI (NX)

C

C Assign the windows around each peak and fop the

C background regions,

C

INCLUDE 'ROIC.CMN'

INCLUDE 'ENER.CMN'

INCLUDE 'SPECTM.CMN'

DIMENSION EM(IO)

IN=5

C 1 TYPE 10

C 10 FORMAT (• Enter number of backgroynd regions desired: •,$)

C READ(IN,*)NB

1 TYPE 20

20 FORMAT (' Enter mean energies for two background points')

NB=2

READ(IN,*) (EM(I) ,I=1,NB)

DO 100 1=1, NX iMake sure there are no peaks

DO 90 J=l,17 ! in the background windows,

F0RSIG=4,*S1(EL(J,I))

FORSIN=EL ( J , I) -FORSIG

FORSIP=EL ( J , I) +FORSIG

33
K=l

30 IF( (EM(K) .GT.FORSIN) .AND. (EM(K) .LT.FORSIP)) THEN

TYPE 40, EM(K) , EL(J,I)

40 FORMATC Energy ',F7.3,' interfers with a peak at energy'

2 ,F7.3)

TYPE 50

50 FORMATC Do you wish to omit it? • ,$)

READ(IN,60)NY

60 FORMAT (Al)

IF(NY.EQ. 'Y') THEN

NB=NB-1

DO 70 M=K,NB

70 EM(M)=EM(M+1)

END IF

END IF

K=K+1

IF(K.LE.NB) GO TO 30

90 CONTINUE

100 CONTINUE

IF(NB.LT.2) THEN

TYPE 110

110 FORMATC You have too few background points - Try again")

GO TO 1

END IF

DO 120 1=1,20

120 CNTS(I)=0.

NR=NB + NX

DO 140 1=1, NR !I is the window number

IF (I. LE. NB) THEN

EX=EM(I) Ibackground window energy

ELSE

K= I - NB

LI = L(K)

EX = EL(L1,K) "peak energy

END IF

SK = 1.1775 * Sl(EX) !l/2 FWHM of peak at energy EX

ELOW(I) = (EX- SK) How side of window

EHI(I) = (EX + SK) Ihigh side of window

IL = INT( ELOW(I)*100. + .5) 'channel number of ELOW

IH = INT( EHI (I)*100. + .5) ichannel number of EHI

DO 130 J=IL,IH

130 CNTS(I) = CNTS(I) + SPEC(J) lintegrate counts from IL to IH

140 CONTINUE

RETURN

END

FUNCTION SI (El)

INCLUDE 'GEOM.CMN'

C

C Function to compute sigma of a peak of energy El

C

S1=SQRT(2500* El +Q3) *4 . 2466E-4

RETURN

34
END

SUBROUTINE

INCLUDE

INCLUDE

INCLUDE

INCLUDE

INCLUDE

INCLUDE

SETUP(J)

'ABSB.CMN'

•ATWT.CMN'

'BLNK.CMN'

•ENER.CMN'

•FLUOR. CMN'

'ZAFF.CMN'

C

c

c

100

200

300

Setup matrix correction

DIMENSION U(15),UB(15)

IB=L(J)**2

IF(IB.LE.9)G0 TO 100

IB=1

U(J)=EO/E(IB,J) lovervoltage for

IF(U(J) .GE.1.5)G0 TO 300 ! test if

WRITE(6,200)

FORMAT (• OVERVOLTAGE TOO LOW)

L1=L(J)

E1=EL(L1,J) 'energy of line

DO 400 1=1,

N

CALL MAC(E1,FA,I) !get mass absorption coef

H(I,J)=FA land store them

CONTINUE

T2=H(J,J) labsorption coef

E2=E(IB,J) 'edge energy

CALL ABSFAC(E2,F1,T2) 'get f(chi)

F(1,J)=F1 land store it

A3=L(J)-1 lline code minus 1

GX=5

element J

overvoltage

for element J

too low

400

for pure element

for pure element J

500

IF(L(J) .EQ.l)

IF(L(J) .GT.3)

GX=3.5

DO 800 11=1,

N

IF(I1.EQ.J)G0

DO 700 IP=1,2

E1=EL(IP,I1)

GO

GO

TO

TO

500

500

•begin checking for fluorescence

TO 800 Iskip if same element

!1 for K lines - 2 for L lines

•line energy to test

L2=IP**2 ledge number

IF(1.022*E(L2,I1) .GE.E0)GO TO 700 'skip if line > EO

IF(E1.LT.E(IB,J) ) GO TO 700 'skip if line < E(IB,J)

IF(E1.GT.E(IB,J)+GX)G0 TO 700 Iskip if line

AP (J,I1) =IP+2*A3 'code for fluorescence

> E(IB,J)+GX

cc code fluorescence

c none

c 1 K excites K

c 2 L excites K

c 3 K excites L c 4 L excites L c 5 K excites M

c 6 L excites M

35
c

UB(I1)=E0/E(L2,I1) lovervoltage

DO 600 1=1,

N

CALL MAC(E1,FA,I) !get absorption coef. for fluor.

H(I+15,I1)=FA land store them

600 CONTINUE

700 CONTINUE

800 CONTINUE

DO 900 1=1,

N

IF(AP(J,I) .EQ.0)GO TO 900 'skip if no fluorescence

IZ=Z(I) !Z for exciting line

JZ=Z(J) !Z for excited line

Y2=(UB(I)-1)/(U(J)-1)

Y2=Y2**1.67

Y1=WA(JZ)/WA(IZ) *H(J+15,I)/2*Y2

CALL PARA(I,J,ZD) !get fluorescence factors

0(J,I)=ZD*Y1 ! fluorescence correction factor

900 CONTINUE

C

C Calculate backscatter loss factor R (the loss is 1-R)

C

U1=U(J)

IF(U1.LE.10)GO TO 1000

Ul = 10

1000 G3=. 0087 3*U1**3-.1669*U1**2+.9662*U1+. 4523

G4= .002703 *U1 **3 -.05182 *U1 **2 +.302 *U1 -.1836

P2=.887 -3.44/Ul +9.33/ Ul**2- 6.43/Ul**3

DO 1100 1=1,

N

V(I,J)=G3-G4*LOG(P2*Z(I)+25) Ithis is the R factor

IZ=Z(I)

C

C Calculate the stopping power S

C

S(I,J)=2*IZ/(WA(IZ) *(EO+E(IB,J)) ) *LOG ( 583* ( EO+E (IB, J) ) /XJ (IZ)

)

1100 CONTINUE

9999 RETURN

END

FUNCTION XJ(IZ)

C

C Berger-Seltzer J

C

S19=-.19

XJ =9.76*IZ+58.5*(IZ**S19) !IZ is atomic number

RETURN

END

SUBROUTINE YIELD ( I ,T1 ,T4 ,T7)

INCLUDE 'BLNK.CMN'

C

C Fluorescence yields

36
RZ=Z(I)

ZL=LOG(RZ)

OM1=(.015+.0327*RZ-6.4E-7*RZ**3) **4

T1=0M1/(1.+0M1) !K lines

T4=EXP(2.946*ZL-13.94) !L lines

T7=2.27E-5*Z(I)**2-.001359*Z(I)-. 00657 !M lines

RETURN

END

Files containing common blocks that are used in the INCLUDE

C Variables in common block ABSB

C F = absorption factors

C HI = overlap factors

C

COMMON/ABSB/F(4,15) ,HI(17,12,12)

C Variable in common block ATWT

C WA = atomic weights

C

COMMON/ATWT/WA ( 99

)

C Variables in common block BLNK and 2-byte integers

C Z = atomic number

C Q = valence for each element

C EO = beam voltage

C N = number of elements in standard or unknown

C NX = number of analyzed elements

C

INTEGER*2 Z(15) ,Q(15)

COMMON/BLNK/EO ,N , NX , Z ,

Q

C Variables in common block CONC

C XC = concentration of each element

C

COMMON/CONC/XC (15)

C Variables in common block DETECT

C P6 = thickness of Be window in Si detector in cm.

C P7 = thickness of Si dead layer in Si detector in cm

C

C0MM0N/DETECT/P6 , P7

37
C Variables in common block ENER

C L = line code for x-ray lines (l=Ka , 2=La , 3=Ma , O=not analyzed)

C E = edge energies for each element

C EL = x-ray line energies for each element

C

INTEGER*2 L(15)

COMMON/ENER/E(10,15) ,EL(17,15) ,L

C Variables in common block FLUOR

C AP = code for fluorescence corrections (see SETUP)

C = factor in the fluorescence correction

C

COMMON/FLUOR/AP(15,15) ,0(15,15)

C Variables in common block GEOM

C Ql = CSC ( take-of f-ang le)

C Q2 = sine of beam incidence angle

C Q3 = noise factor for peak width calculation

C

COMMON/GEOM/Ql , Q2 , Q3

C Variables in common block KBKA

C VB = K-beta/K-alpha ratios (Kb/Ka)

C

COMMON/KBKA/VB(30)

C Variables in common block KFAC

C W = integrated peak intensity for each element

C XM = relative intensity (k-ratio) for each element

C

C0MM0N/KFAC/W(15) ,XM(15)

C Variables in common block LINEDG

C LED = edge number for each of the 17 x-ray lines included

C in the program.

C

C0MM0N/LINEDG/LED(17)

DATA LED/1 ,4,9,1,4,4,4,3,3,3,2,2,2,9,8,7,6/

C

C The x-ray lines are in the following order:

C Ka,Lal,Ma,Kb,La2,Ll,Lb2,Lbl,Lgl,Ln,Lb3,Lg3,Lb4,Mz,Mb,Mg ,M2N4

C

38
C Variables in common block ROIC

C CNTS = integrated counts in a peak window

C EHI = high energy side of a window

C ELOW = low energy side of a window

C NB = number of background regions (currently = 2)

C NR = total number of regions on a spectrum (background+peaks)

C

COMMON/ROIC/CNTS(20) , EHI (20) ,ELOW(20) ,NB,NR

C Variables in common block SPEC

C SPEC = number of counts in each channel of a spectrum

C

INTEGER*4 SPEC

COMMON/SPECTM/SPEC(2048)

C H = mass absorption coefficients

C S = x-ray stopping powers

C V = R from x-ray loss due to backscatter (1-R)

C

COMMON/ZAFF/H(30,15) ,S(15,15) ,V(15,15)

39

NBS.n4A (REV. 2-eo) U.S. DEPT. OF COMM.

BIBLIOGRAPHIC DATA

SHEET (See instructions)

1. PUBLICATION OR

REPORT NO.

NBS TNI 200

2. Performing Organ. Report No. 3. Publication Date July 1984

4. TITLE AND SUBTITLE

A Fortran Version of the Quantitative

Energy-Dispersive Electron Beam X-ray Analysis Program FRAME C

5. AUTHOR(S)

R. L. Myklebust, B. B. Thorne

6. PERFORMING ORGANIZATION (/f joint or other than NBS, see instructions)

National Bureau of Standards

Department of Commerce

Gaithersburg, Maryland 20899

7. Contract/Grant No.

t. Type of Report & Period Covered

Final

9. SPONSORING ORGANIZATION NAME AND COMPLETE ADDRESS (Street. City. State. ZIP)

Same as item 6.

10. SUPPLEMENTARY NOTES

I I Document describes a computer program; SF-185, PIPS Software Summary, is attached.

11. ABSTRACT (A 200-word or less factual summary of most significant information. If document includes a significant

bibliography or literature survey, mention it here)

A Fortran listing of the quantitative electron microprobe analysis routine,

FRAME C, is presented. The source code is extensively documented and there

are short summaries of the various parts of the program. Examples are also

presented to demonstrate the versatility of the program.

12. KEY WORDS (Six to twelve entries; alphabetical order; capitalize only proper names; and separate key words by semicolons)

computer prograni, electron microprobe; energy-dispersive detector;

quantitative analysis; x-ray spectra

13. AVAILABILITY

fXl Unlimited

I I For Official Distribution. Do Not Release to NTIS

rXl Order From Superintendent of Documents, U.S. Government Printing Office, Washington, D.C.

20402. Q] Order From National Technical Information Service (NTIS), Springfield, VA. 22161

14. NO. OF

PRINTED PAGES

42

15. Price

USCOMM-OC eO49-P80

NBS TECHNICAL PUBLICATIONS

PERIODICALS

JOURNAL OF RESEARCH—The Journal of Research of the National Bureau of Standards reports NBS research and develop- ment in those disciplines of the physical and engineering sciences in which the Bureau 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 Bureau's technical and scientific programs. As a special service to subscribers each issue contains complete

citations to all recent Bureau publications in both NBS and non- NBS media. Issued six times a year. Annual subscription; domestic

$18; foreign $22.50. Single copy, $5.50 domestic; $6.90 foreign.

NONPERIODICALS

Monographs—Major contributions to the technical literature on

various subjects related to the Bureau's scientific and technical activities. Handbooks—Recommended codes of engineering and industrial practice (including safety codes) developed in cooperation with in- terested industries, professional organizations, and regulatory bodies

Special Publications—include proceedings of conferences sponsored by NBS, NBS 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 under a worldwide program coordinated by NBS under

the authority of the National Standard Data Act (Public Law

90-3%)

NOTE; The principal publication outlet for the foregoing data is the Journal of Physical and Chemical Reference Data (JPCRD)

published quarterly for NBS by the American Chemical Society

(ACS) and the American institute of Physics (AiP). Subscriptions,

reprints, and supplements available from ACS, 1 155 Sixteenth St., NW, Washington, DC 20056.

Building Science Series—Disseminates technical information developed at the Bureau 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 treatment 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 NBS 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. NBS administers this program as a supplement to the activities of the private sector standardizing

organizations. Consumer Information Series—Practical information, based on NBS research and experience, covering areas of interest to the con- sumer. Easily understandable language and illustrations provide

useful background knowledge for shopping in today's tech- nological marketplace. Order ihe above NBS publications from: Superiniendeni of Documenls. Government Printing Office. Washington. DC 20402. Order the following NBS publications— Fl PS and NBSIRs—from

the National Technical Information Service . Springfield, VA 22161

.

Federal Information Processing Standards Publications (FIPS

PL'B)—Publications in this series collectively constitute the Federal Information Processing Standards Register. The Register

serves as the official source of information in the Federal Government regarding standards issued by NBS 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 II, 1973) and Part 6

of Title 15 CFR (Code of Federal Regulations).

NBS Interagency Reports (NBSIR)—A special series of interim or

final reports on work performed by NBS for outside sponsors

(both government and non-government), in general, initial dis- tribution 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 Bureau of Standards

Washington, DC. 20234

Official Business

Penally lor Private Use S300