User’s Manual PDFgetX Version 1.1 Ilkyoung Jeong Jeroen Thompson Thomas Proffen Simon Billinge Department for Physics and Astronomy Michigan State University East Lansing, MI, 48824-1116 USA Contact: billinge@pa.msu.edu Document created January 3, 2001

Disclaimer
By downloading the program PDFgetX, you agree to the terms and conditions concerning its use specified in the license agreement that is provided as part of the distribution. End users wishing to make commercial use of the software must contact Libraries, Computing & Technology, Michigan State University, East Lansing, MI 48824; (517)353-0722 prior to any commercial distribution to discuss terms. The Software is provided to End User by MSU on an as is basis. No user support is provided or implied. MSU makes no warranty, express or implied to end user or to any other person or entity. Specifically, MSU makes no warranty of merchantability or fitness for a particular purpose of the software.  MSU will not be liable for special, incidental, consequential, indirect or other similar damages, even if MSU or its employees have been advised of the possibility of such damages, regardless of the form of the claim.
Using PDFgetX
Publications of results totally or partially obtained using the program PDFgetX should state that PDFgetX was used and contain the following reference: JEONG, I.-K., THOMPSON, J.,PROFFEN, TH., PEREZ, A. AND BILLINGE, S. J. L. "PDFgetX, a program for obtaining the atomic Pair Distribution Function from X-ray powder diffraction data"
Acknowledgments
The PDFgetX is coded using Yorick language [1]. The atomic scattering factors are calculated using the analytic formula and coefficients developed by D. Waasmaier and A. Kirfel [2].  The mass attenuation coefficient data of elements are obtained from the web at: http://physics.nist.gov/PhysRefData/FFast/html/form.html [3]. Financial support from the National Science Foundation through the grants DMR-9700966, DMR-0075149, CHE-9633798 and CHE-9903706 as well as the Center for Fundamental Materi- als Research (CFMR) is gratefully acknowledged.
3
C.1 45
2.1
3.1

1.1
What is PDFgetX
PDFgetX is a program to be used to obtain the atomic Pair Distribution Function (PDF) from a measured X-ray powder diffraction data.  PDFgetX is written using the Yorick, an interpreted language.  This will require users to obtain the Yorick distribution and install it yourself.  See Chapter 2 for help in installation. PDF is the instantaneous atomic number density-density correlation function which describes the atomic arrangement in materials. A useful characteristic of PDF method is that it gives both local and average structure information because both Bragg peaks and diffuse scattering are used in the analysis. And from the PDF peak width, it's possible to obtain the information about bond- length distribution (static, thermal) [4] and correlated atomic thermal motion [5]. By contrast, an analysis of the Bragg scattered intensities alone, by a Rietveld type analysis for instance, yields the average crystal structure only and the extended x-ray absorption fine structure(EXAFS) gives nearest-neighbor and next nearest-neighbor distance information.  PDF analysis method has long been used to characterize glasses, liquids and amorphous materials.  Recently, however, it has found more application in the study of local structural disorder in crystalline materials, where some deviation from the average structure is expected to take place. Obtaining total scattering structure function (and PDF) from raw diffraction data requires many corrections for experimental effects such as absorption, polarization corrections and remov- ing of Compton and multiple scattering contribution to the elastic scattering. Also it needs proper error propagation to be used in modeling of PDF using either PDFFIT (real-space Rietveld) [6] or a Reverse Monte Carlo approach [7] using e.g.  DISCUS [8] to yield structural parameters. PDFgetX allows users to do all these data corrections and error propagation in convenient ways. During the refinement, PDFgetX displays each correction effect to the raw data and saves all the parameters used for refinement. This makes the refinement processes easy to understand and al- lows reproducible results. PDFgetX supports the following data formats: multi-column ascii file, SPEC and multi-channel analyzer(MCA) files. To find out about recent updates of PDFgetX or to get further information visit the PDFgetX homepage at the following site: http://www.pa.msu.edu/cmp/billinge-group/programs/PDFgetX

2.1
System Requirements
PDFgetX should run on any UNIX/Linux platform supported by Yorick. This includes PC/Unix and SGI. It also run on Windows NT and 95.  For a list of systems on which PDFgetX is known to work, see Table 2.1. If you successfully install PDFgetX on a system not included in this list, please contact us and let us know.  If you cannot install PDFgetX on a system, and have studied the documentation thoroughly, please contact us and ask for help. Without access to a similarly configured system, we may not be able to help you with the installation, but see Section 2.2.4 for instructions on how to report your trouble.
Table 2.1: Known Platforms Supporting PDFgetX
What You Need
2.2
Yorick
2.2.1
Before you can run PDFgetX, you will need to install Yorick. PDFgetX is written in the Yorick language, which is an interpreted C-like language (and it's free). The distribution of PDFgetX contains only the source code files for PDFgetX; it does not come with Yorick. The latest version of Yorick can be downloaded from the official site: ftp://wuarchive.wustl.edu/languages/yorick/yorick-ad.html This document provides no information about installing Yorick; see the Yorick readme files for help with the installation and checking that the installation was successful.  Before installing PDFgetX, be sure that your installation of Yorick works.
2.2.2  PDFgetX
You may obtain the latest version of PDFgetX from the PDFgetX website: http://www.pa.msu.edu/cmp/billinge-group/programs/PDFgetX PDFgetX is provided as a compressed file. Use the command tar -xzvf pdfgetx1.1.tar.gz which will extract the files into a new directory called "PDFgetX/".  And you can find the following program files under the directory PDFgetX/. pdfgetx.i, pdfgetxdistribution.i, pdfgetx_custom.i ASF.DAT, PERIODIC_TABLE.DAT, MASS_ABS_COEFF.DAT, LICENSE.TXT If the -z flag does not work on your system, then use the commands gzip -d pdfgetx1.1.tar.gz, tar -xvf pdfgetx1.1.tar to extract the files.
2.2.3
Installing and Configuring PDFgetX
To customize the PDFgetX installation, you need to modify two files, "custom.i" and "pdfgetxdis- tribution.i".  If you are new user of "Yorick", you can simply rename "pdfgetx_custom.i" (included in compressed file) to "custom.i" and give the proper path for the "Actual PATH" in the following two lines in “pdfgetx_custom.i” file. #include "Actual_PATH/pdfgetx.i" #include "Actual_PATH/pdfgetxdistribution.i" And then create a directory "/Yorick" under your home directory and place your own version of "custom.i" there. If you already have your own version of "custom.i", simply add the above two lines in the “custom.i” file. For Windows OS, you need to beware of a few things.  First, the path should look like the following: "/c/pdfgetx/.".  Second, in windows OS, users can set the size of font and graphic window in "custom.i" file.  Therefore it is better to copy the "custom.i" file coming with the Yorick Window version and add the above two lines there than just rename "pdfgetx_custom.i" to "custom.i". Finally, remember that if the directory name has a space (" ") as in "My Directory", the Yorick couldn't find the directory. After configuring the "pdfgetx_custom.i" file, if you open the file "pdfgetxdistribution.i" using a text editor, you will find the following code: asf_file="Actual_PATH/ASF.DAT" periodic_table="Actual_PATH/PERIODIC_TABLE.DAT" mabscoeff_file ="Actual_PATH/MASS_ABS_COEFF.DAT" again, give the proper path for the "Actual PATH". These code set paths for three important data files: Atomic scattering factor, Periodic table, and Mass absorption coefficient. Also, the variable name, e.g. asf file, should not be changed, otherwise PDFgetX couldn't find these data files. If you want to print graphs directly from PDFgetX, you need to edit the file "pdfgetxdistribu- tion.i” and change the following line: printer_string="lpr -h -Prm31 __temp.ps" Modify the printer string to reflect your system.  When printing, PDFgetX creates a temporary postscript file called "__temp.ps" and makes a system call to print the file. Do not change the name of the file in the printer string or printing will not work. For windows OS, "lpr" command doesn't work, instead use "print" command. This is a DOS command and it seems it sends the graph to a printer connected via "LPT1" port. If this setting is not working, we would recommend windows OS users to use another method to print graphs. First, save the graph as a postscript (PS) file or window meta file (WMF) using [S] option in the main menu, and open it using ghostview (PS file) or using MS word (WMF file). Then print the graph using print command in the program.
Report problems and suggestions
2.2.4
If you have any problems in installing & running PDFgetX and have any suggestions about the PDFgetX, please send email to the following address: billinge@pa.msu.edu http://www.pa.msu.edu/cmp/billinge-group/programs/PDFgetX.html
Now you might have installed PDFgetX and can start it simply by typing pdfgetx at Yorick prompt. In this tutorial, you'll get a chance to analyze In 0.33 Ga 0.67 As semiconductor alloy data collected at Cornell High Energy Synchrotron source (CHESS) using intense x-rays of 60 KeV (λ = 0.206 Å). The tutorial files can be downloaded from the PDFgetX homepage. In this experiment, the incident x-ray energy was selected using a Si(111) double-bounce monochromator. The data were collected at 10 K to minimize thermal atomic motion in the sample, and hence increase the sensitivity to static displacement of atoms due to alloying using a closed cycle helium refrigerator mounted on the Huber 6 circle diffractormeter.  All the signal measured was saved to a file using the system controlling software, SPEC. The signal measured using the intrinsic Ge solid state detector was processed in two ways. Using single-channel pulse-height analyzer (SCA), the elastic scattering, Compton scattering, and elastic + Compton scattering were collected separately.  In the measurements using SCA, the proper energy window setting for the elastic scattering is very important because any error in the window setting could cause an unknown contamination to the elastic scattering thus make data corrections very difficult. At the same time, the signal was fed to multi-channel analyzer (MCA) to record the complete energy spectrum of each value of Q. The elastic and Compton scattered radiation could then be separated using software after measurement. Collecting data using MCA has advantages and disadvantages.  In the MCA method, since the entire energy spectrum of the scattered radiation is measured at each value of Q, the error caused by the mis-set of energy window is negligible. The main disadvantage of the MCA method is that it has a larger dead-time, although this can be reliably corrected [9]. This tutorial is composed of two subsections, "Preliminary Data Analysis" and "Refine struc- ture function". The "Preliminary Data Analysis" section is mainly concentrated on how to reduce SPEC and MCA file to build PDFgetX input file for structure refinement.  In "Refine structure function" section, the step by step procedure of structure function refinement is presented. Users can build the input file using tutorial SPEC file in "Preliminary Data Analysis" section or use a tutorial input file coming with the program. In this manual, SPEC file refers to the data collected using SCA and MCA file for the data collected using MCA.
10
3.1
Preliminary Data Analysis
3.1.1
Reduction of SPEC file
The raw data from x-ray powder diffraction measurements using either a sealed x-ray tube or syn- chrotron source could have many different file formats and could contain multiple scans that ought to be averaged together.  Therefore it is very difficult to use the raw data directly in the structure function refinement.  With these things in mind, we limited the "Preliminary Data Analysis" to support only the SPEC file format and N-column ascii file format.  For details about SPEC file format, please refer to Appendix A. This section will show you how to reduce the raw SPEC data into the input file from which to start analysis. This process includes extracting scans from SPEC file, comparison of different scans, applying dead-time correction and combining different scans. In general, one SPEC file contains many scans. The following shows a scan header of SPEC file collected at CHESS. #L pmQ ereal elive Epoch Seconds IC1 IC3 I_CESR PULSER TOTAL COMPTON IC2 ELASTIC During the SPEC file reduction process, we will use column number to refer to a specific variable such as ELASTIC, IC2, PULSER, etc , so you need to remember which column corresponds to which variable. Follow along with this example terminal output. It will guide users to learn about how the "Reduction of SPEC file" works.  The comments in /* …  */ mark are added just for explanation purpose and will not be shown in the real analysis. current directory> yorick Copyright (c) 1996.  The Regents of the University of California. All rights reserved.  Yorick 1.4 ready.  For help type 'help' > pdfgetx Pair Distribution Function from the X-ray powder diffraction (PDFgetX 1.1) 0) Preliminary data reduction 1) Build a setup file 2) Background Substraction 3) Reduction of Structure Function: S(Q) Input file format: (Q, I, dQ, dI) 4) PDF calculation: G(r) Input file format: (Q, S(Q), dQ, dS) P) Print, S) Save, U) Unzoom, L) Limits windows Q) Quit [0-4 qsulp] 0 /* Enter to the Preliminary data reduction level */ 1) Extract Scan(s) from SPEC file 2) Compare N-column(N>=2) ascii files
3) Combine N-column(N>=2) ascii files 4) Build PDFgetX input format: (Q, I, dQ, dI) 5) Convert MCA file to N-column ascii file Q) Return to Main [1-5Q] 1 The Input should be SPEC file format : Continue (y/n)? y ENTER SPEC FILE NAME TO READ: in33_tutorial.spec - The following shows scan information in in33_tutorial.spec
EXTRACT SCANS FROM SPEC FILE: - Each scan will be saved as an ascii file - Enter all scans to be read: [Ex: 2 4 5] 1 2 3 4 5 /* Extract good scans by entering the scan number */ SAVE SCANS TO ASCII FILE: - Output file name will be 'samplename_scannumber.asc' - Enter your 'samplename' [Ex. InAs] : in33 Return to Preliminary data reduction --- Now each scan is saved as ascii file. As it is mentioned during extracting process, the file name will be "in33_1.asc", "in33_2.asc", and so on. Now we can compare these different scans. [1-5Q] 2 /* Compare N-column (N>=2) ascii files */ The Input should be N-column ascii file format : Plot y(=data/norm) vs. x(=q). Continue (y/n)? y ENTER FILE NAMES TO COMPARE, TO QUIT READING, ENTER 'Q': - File name to compare : in33_1.asc #L pmQ ereal elive Epoch Seconds ICl IC3 I_CESR PULSER TOTAL COMPTON IC2 ELASTIC ASSIGN COLUMN NUMBER TO VARIABLES:
- Column # corresponding to X-axis : 1 - Column # corresponding to DATA   : 13 - Normalization of data : for constant normalization, enter '0' - Column # corresponding to NORM.  : 12 ENTER FILE NAMES TO COMPARE, TO QUIT READING, ENTER 'Q': - File name to compare : in33_2.asc ENTER FILE NAMES TO COMPARE, TO QUIT READING, ENTER 'Q': - File name to compare : in33_5.asc ENTER FILE NAMES TO COMPARE, TO QUIT READING, ENTER 'Q': - File name to compare : q --- /* Dead-time correction setting */ READ FILE : in33_1.asc APPLY DEAD-TIME CORRECTION FOR DATA (y/n)? y 1) Dead-time correction using detector dead-time 2) Dead-time correction using pulser measurement Q) Exit Dead-time correction [1-2Q] 2 Enter column # containing pulser : 9 APPLY DEAD-TIME CORRECTION FOR MONITOR (y/n)? n /* For details, refer to CH. 4 Using PDFgetX */ CHECK VARIABLE AND ASSIGNED COLUMN #
- Normalization
Detector dead-time Correction using pulser
- Pulser column : 9 No Monitor dead-time Correction CHANNEL SETTINGS ARE CORRECT (y/n)? y READ file: in33_2.asc . . READ file: in33_5.asc Colors in order of reading: magenta, cyan, blue, green, red, and blacks COMPARE OTHER VARIABLE (y/n)? n EXIT COMPARING FILES: Return to Preliminary data reduction --- Fig. 3.1 shows dead-time corrected elastic scattering after normalization by monitor. It shows that these scans overlap with each other quite nicely.  Maybe it's good to check how the comparison looks like if the dead-time correction is not applied. Since the normalized elastic scattering from different scans overlap with each other, we can combine all of them. [1-5Q] 3 /* Combine N-column (N>2=2) ascii file */ The Input should have N-column ascii file format ! The X-axis column should have constant step(dX) -. Combine upto five variables: X-axis(Q, Two-theta)! DATA, NORM, and Aux1, Aux2 (auxiliary variables) ! Continue (y/n)? y ENTER FILE NAMES TO COMBINE, TO QUIT READING, ENTER 'Q': - File name to combine : in33_1.asc #L pmQ ereal elive Epoch Seconds IC1 IC3 I_CESR PULSER TOTAL COMPTON IC2 ELASTIC ASSIGN COLUMN NUMBER TO VARIABLES: - If the column # is set to '0', the corresponding variable - will not be propagated !! - Column # corresponding to X-axis : 1 : 13 - Column # corresponding to DATA - Column # corresponding to NORM. : 12 ： 0 - Column # corresponding to Auxl ： 0 - Column # corresponding to Aux2 ENTER FILE NAMES TO COMBINE, TO QUIT READING, ENTER 'Q': - File name to combine : in33_2.asc . ENTER FILE NAMES TO COMBINE, TO QUIT READING, ENTER 'Q': - File name to combine : in33_5.asc ENTER FILE NAMES TO COMBINE, TO QUIT READING, ENTER 'Q': - File name to combine : q ---
READ file : in33_1.asc Apply DEAD-TIME CORRECTION FOR DATA (y/n)? y 1) Dead-time correction using detector dead-time 2) Dead-time correction using pulser measurement Q) Exit Dead-time correction [1-2Q] 2 Enter column # containing pulser : 9 APPLY DEAD-TIME CORRECTION FOR MONITOR (y/n)? n CHECK VARIABLE AND ASSIGNED COLUMN #
Detector dead-time Correction using pulser : - Pulser column                    : 9 No Monitor dead-time Correction CHANNEL SETTINGS ARE CORRECT (y/n)? y READ file : in33_2.asc . . READ file : in33_5.asc Enter variable name corresponding to X-axis: Q Enter variable name corresponding to DATA  : Elastic Enter variable name corresponding to NORM. : Monitor SAVE COMBINED DATA: - Enter file name for combined data: in33_tutorial.comb
Make sure the X-column and combined variables have the correct value !! Return to Preliminary data reduction --- We just obtained combined N-column ascii file.  The next step is to convert it to the PDFgetX input format: (Q, I, dQ, dI). Here Q is the magnitude of scattering vector and defined as Q = 4 π sin(θ) /λ. I is the intensity of elastic scattering normalized by the monitor, dQ and dI are errors in Q and I. In this tutorial we'll not preprocess the background data. It'll be given as 4-column (Q, I, dQ, dI) format. [1-5Q] 4 /* Build PDFgetX input file */ The Input should be N-column(N>=2) ascii file All columns should have same number of lines Blanks and commas in columns are not permitted Continue (y/n)? y ENTER FILE NAME TO READ: in33_tutorial.comb - Enter number of comment(and blank) lines in the data header : 2 CHECK FILE FORMAT: 1) Column contains Q/Two-theta?       : 1 - Data in Q or Two-theta value?     : Q 2) Column contains Intensity?          : 2 3) Column contains Monitor/Time?      : 0 - Normalization by Monitor or Time?: No Normalization x) Exit.
[1-3X] 3
Column contains Monitor/Time? : 3 - Normalization by Monitor or Time(M/T)? m 1) Column contains Q/Two-theta?       : 1 - Data in Q or Two-theta value?     : Q 2) Column contains Intensity?          : 2
3) Column contains Monitor/Time?       : 3 - Normalization by Monitor or Time?: Monitor x) Exit. [1-3X] x SAVE PDFgetX INPUT FILE (Q, I, dQ, dI): - Enter file name to for input file: in33_tutorial.input Return to Preliminary data reduction --- Now, you obtained the input file for the structure function refinement. If the X-column is 2θ, then the program converts it to Q.
Reduction of Multi-Channel Analyzer(MCA) data
3.1.2
The MCA file format could be different depending on the instruments. Therefore here we assume an MCA file format which we used in the data reduction process.  The MCA file format we used is attached in Appendix B. In this file, the scattered intensity at every Q point is distributed to the whole MCA channels.  So each block which is separated by blank corresponds to each Q point.  In order to convert this file to the normal N-column ascii file, we need to know the following information:  Minimum Q or two-theta, number of data points, Q/two-theta step (this should be constant), total channel number of MCA. Many of these information can be obtained using "scan summary" function which is a part of PDFgetX. We will not provide whole MCA file to do the analysis but just one MCA file to show you how it works. However we can tell that the structure function obtained using SPEC and MCA data are basically same. [1-5Q] 5 /* Convert MCA file to N-column ascii file */ File should have MCA file format: Continue (y/n)? y ENTER MCA FILE NAME TO READ: in33_tutorial.mca - Build an X-axis column of corresponding MCA data - The X-axis should be either 'Q' or 'Two-theta' - The X-axis should have constant step (dX) - Enter variable name corresponding to X-axis, [Q/TT] : q - Enter minimum Q value : 36 - Enter number of data points            : 251 : 0.02 - Enter Q step - Total channel number of MCA         : 1024 READING MCA DATA, BE PATIENT!! SET UP THE INTEGRAING REGIONS OF MCA SPECTRUM: - Propagate upto four variables: Elastic, Elastic+Compton, Auxl and Aux2
- If the starting and ending channel number of a variable - is same, the corresponding variable will not be propagated - Start of elastic channel  : 639 : 657 - Stop of elastic channel - Start of elastic_compton channel    : 470 - Stop of elastic_compton channel     : 657 : 0 - Start of MCA auxiliary channel 1 - Stop  of MCA auxiliary channel 1    : 0 - Start of MCA auxiliary channel 2    : 0 : 0 - Stop  of MCA auxiliary channel 2 read-write binary stream: _mcachannel In directory: /home/jeong/analysis/gainas/data/in50/mcafile/ /* Open a binary file to save MCA channel setting */ CHECK SETTING OF MCA CHANNEL : 639 1) Start of elastic channel
   Stop of elastic channel : 657 2) Start of elastic_compton channel   : 470 Stop of elastic_compton channel   : 657 3) Start of MCA auxiliary channel 1   : 0 ： 0 Stop  of MCA auxiliary channel 1  ： 0 4) Start of MCA auxiliary channel 2  Stop  of MCA auxiliary channel 2  : 0 Q) Exit MCA channel setting Enter to reset channel setting [1-4Q] : q INTEGRATE REGIONS OF INTEREST!! SAVE MCA DATA TO ASCII FILE: - Enter file name for MCA-derived data: in33_mca.dat READ ANOTHER MCA FILE(y/n)?  n EXIT MCA FILE READING: Return to Preliminary data reduction --- Fig. 3.2 shows MCA spectrum of In 0.33Ga0.67As at Q=40Å-1 . The elastic and Compton scattering are well separated at this value of Q. It also shows some fluorescence peaks in low channel number side. If you check the output file, you'll find that it contains Q, MCA Elastic, MCA ElaCompt, and Figure 3.2: MCA spectrum of In 0.33Ga 0.67 As at Q=40 Â −1 .  It shows that the very sharp elastic scattering around channel number 640 is well separated from the broad Compton scattering. The fluorescence of the alloy are shown below channel number 300. MCA_Det_Tot. When the program generates X-column, it assumes constant X-step. The whole MCA files can be converted to N-column ascii files in this way and then as we did in "Reduction of SPEC file" these files can be compared and combined.  Also it's possible to apply dead-time correction for MCA file.
Refine structure function of In0.33Ga0.67As
3.2
Now we are almost ready to refine structure function of In 0.33Ga9.67As semiconductor alloy except two more things; building setup file and background subtraction. BUILD SETUP FILE: --- Note that the setup file is a text file written using Yorick syntax, and may be modified in emacs without going through this whole procedure of building a new one.
If PDFgetX crashes, check the (text) input file very closely! --- ENTER THE TYPE OF INCIDENT X-RAY RADIATION: - [S]ilver, [M]olybdenum, [C]opper or enter [E]nergy [smce]? e - Enter Energy of incident X-ray (KeV) : 59.67 SAMPLE INFORMATION: - Number of elements in the sample[Ex. InGaAs => 3]? 3 - Element #: 1 - Enter the element (ions not yet supported) : in - Enter fractional composition: 0.33 - Element #: 2 - Enter the element (ions not yet supported) : ga - Enter fractional composition: 0.67 - Element #: 3 - Enter the element (ions not yet supported) : as - Enter fractional composition: 1 - Enter absorption coefficient*thickness of sample, mu*t: 1.11 MONOCHROMATOR INFO.: 1) d-spacing of monochromator: 3.135 2) Position of monochromator : incident_beam 3) Type of monochromator     : perfect_cryst Q) Exit [123Q] Q SAVE SETUP FILE AS: in33_tutorial.setup --- You've finished creating a setup file which contains information about the sample composition and experimental setup.  You may take a look at the setup file using a text editor and check what you have there. Also you can add some more comment using Yorick syntax if you want. The final step before starting refinement is to subtract background. Because the sample itself affects magnitude of background, sometimes instrument background (background measured without sample) over estimate the real background. So in background correction, the program allows users can change the magnitude of background by multiplying correction constant in order to make it match data
more nicely in low Q. [0-4 qsulp] 2 /* Enter to Background substraction in Main */ The Input should be 4-column ascii file(Q, I, dQ, dI) Continue (y/n)? y ENTER DATA FILE NAME TO READ      : in33_tutorial.input ENTER BACKGROUND FILE NAME TO READ : in33_bkg.input BACKGROUND SUBTRACTION: - Multiply correction constant to background to make - it match data more nicely in low Q (y/n)? n - 30 negative intensities set to 0.000208106. /* negative value are set to minimum intensity */ ENTER FILE NAME FOR BACKGROUND CORRECTED DATA: in33_cfbg.input --- [0-4 qsulp] 3  /* start structure function refinement */ ENTER SETUP FILE NAME: in33_tutorial.setup READ INPUT FILE: It should be 4-column ascii file(Q, I, dQ, dI) - Enter data file name to read:  in33_cfbg.input DATA REDUCTION : read-write binary stream: _history.pdb In directory: /u24/jeong/PDFgetX/manual/ /* Open binary file to save refinement history. Refer to the Appendix C */ SMOOTH DATA USING SAVITZKY & GOLAY METHOD (y/n)? n Flat Symmetric [R]eflection or [T]ransmission geometry (r/t)? t /* Choose either symmetric flat reflection or transmission geometry  */ --- Flat Plate Symmetric Transmission Geometry Data Correction --- WINDOW 0: CORRECTION EFFETS ON RAW DATA !
APPLY MULTIPLE SCATTERING CORRECTION (y/n)? y - Does the data contain Compton scattering in high Q (y/n)? n - Multiple scattering calculation in transmission geometry WINDOW 3: MULTIPLE SCATTERING RATIO! APPLY POLARIZATION CORRECTION (y/n)? n => Polarization correction NOT applied! APPLY ABSORPTION CORRECTION (y/n)? y NORMALIZATION USING MID-HIGH Q PART OF DATA - Enter a mid-range Q value (roughly 26.4): 25 - 751 points are used for normalization - Approximate normalization constant: 1904.38 WINDOW 1: CORRECTED DATA VS. TIS! ENTER NORMALIZATION CONSTANT: 1920 APPLY COMPTON SCATTERING CORRECTION - Apply Compton correction in MID-LOW Q region using 'Ruland' method. - Enter integral width 'b' (try 0.008): 0.003 - For details, please refer to the MANUAL !! WINDOW 4: <f^2>, Compton, and Modified Compton by the Ruland function WINDOW 2: REDUCED STRUCTURE FUNCTION, Q*(S(Q)-1)! CHECK IF F(Q) = (S(Q)-1)*Q IS APPROXIMATELY 0 AT HIGH Q - Is F(Q) approximately 0 at high Q (y/n)? y SAVE STRUCTURE FUNCTION, S(Q), TO ASCII FILE: - Enter file name to save data: in33_tutorial.soq --- Now you've obtained structure function.  Before we move on, let's examine the corrections applied during data reduction. First, Fig. 3.3(a) shows all the correction effects on the raw data. It shows step by step changes of raw data after each correction. In high Q, the changes of slope is noticeable.   Fig. 3.3(b) shows comparison between normalized data after all correction and total independent scattering(TIS). We can see that TIS lines up with data in high Q region nicely. Finally Fig. 3.5(a) shows reduced structure function of In 0.33Ga 0.67As semiconductor.  The oscillating diffuse scattering is clear in high Q region. Table 3.1 shows all the inputs used in the refinement. Now let's calculate Pair Distribution Function(PDF) using the structure function just we obtained. [0-4 qsulp] 4 /* PDF calculation: G(r) */
CALCULATE PAIR DISTRIBUTION FUNCTION(PDF): G(r) - Read structure function: (Q, S(Q), dQ, dS) ENTER FILE NAME: in33_tutorial.soq - Enter Qmax at which to cut the data: 40 - Read structure function from Q = 1 to Q = 40 - Enter maxmimum range, r(Angstrom) for PDF calculation: 20 - Enter PDF step size(dr): 0.02
Calculating PDF up to rmax=20 with dr=0.02. - SAVE PDF: (r, G(r), dr, dG) (y/n)? y - Enter file name to save data: in33_tutorial.pdf - Recalculate PDF (y/n)? n --- Congratulations!  You've made a PDF. Fig. 3.5(b) shows pair distribution function of In0.33Ga0.67As semiconductor alloy.  The nearest-neighbor(NN) peak shows well resolved doublet which corre- sponds to shorter Ga-As and longer In-As bonds. This clearly shows the power of high real-space resolution PDF method to study the local structure of the alloy.  It could be instructive to obtain the PDF using different Q max to see how it affects the shape of NN peak. The dotted line shows ± one standard deviation(σ) of PDF; the error propagated to PDF from the raw data. The ripples around sharp peaks are known as the termination ripple. It is caused by the limited Q value in Sine Fourier transform. And the noise peaks near to r=0 are caused by noises in the data.
This chapter will teach you how to use PDFgetX. For this purpose, first we'll give you overview of PDFgetX. And then explain how the program works; we will explain the structure function refinement process.
Overview of PDFgetX
4.1
Before learning the specific commands and procedures to control PDFgetX, it is best to understand how PDFgetX works in a very general way.  This section documents the "broad overview" of PDFgetX while the following sections discuss the specifics at length. The function of PDFgetX is to produce PDFs from x-ray powder diffraction data, whether from an sealed tube x-ray source or from a synchrotron source.  Obviously, to begin the analysis one requires the raw data. The raw data, however, is in general too "raw" for analytical processing; not only does every facility has a different data file format, but the data file could contain multiple scans that ought to be averaged together.  PDFgetX can help reduce the raw data into a more convenient format from which to start the analysis, but ultimately the responsibility for doing so will lie with the end user. The input file from which PDFgetX can start the analysis contains the averaged intensities. Please be aware of the possible name confusion that can occur: the raw data file refers to the file that is directly output from the computer (like SPEC file) whereas the input file refers to a input data which will be used for the calculation of structure function, S(Q). Some information regard- ing the experiment (such as the wavelength used) and some information regarding the specimen characteristics (such as the stoichiometry) are required in order to apply proper correction. The experiment and specimen information are contained in a setup file that is required at every step of the analysis. With the setup file and the input file , the analysis can begin. The first stage of the analysis is to produce S(Q) which is saved as the S(Q) file. However, only the S(Q) file is used in the second stage of the analysis to produce the PDF. Note that each stage of the analysis is independent of the others, so long as the necessary input files are present. That is, to recalculate the PDF of a specimen, you do not have to start the analysis from input file; instead, you can specify the correct S(Q) file and the analysis will immediately create the PDF.
4.1.1
Launching PDFgetX
4.1.2
Exiting PDFgetX
4.1.3
The Main Menu
You can start Yorick from any directory by typing yorick at the prompt. At the Yorick prompt, type pdfgetx and Yorick should begin executing PDFgetX. current directory: > yorick Copyright (c) 1996.  The Regents of the University of California. All rights reserved.  Yorick 1.4 ready.  For help type 'help' > pdfgetx Then, this is what you should see: Pair Distribution Function from the X-ray powder diffraction (PDFgetX 1.1) 0) Preliminary data reduction 1) Build a setup file 2) Background Substraction 3) Reduction of Structure Function: S(Q) Input file format : (Q, I, dQ, dI) 4) PDF calculation : Input file format : (Q, S(Q), dQ, dS) P) Print, S) Save, U) Unzoom, L) Limits windows Q) Quit [0-4 hlqpu] This is the main menu, and Section 4.1.3 will explain the menu in detail. To quit PDFgetX, type "q" at the main menu prompt. This will exit PDFgetX but leave you still in Yorick. Type “quit” to exit Yorick. [0-4 hlqpu] q Exiting (PDFgetX 1.1): > quit current directory: > Pair Distribution Function from the X-ray powder diffraction (PDFgetX 1.1) 0) Preliminary data reduction 1) Build a setup file 2) Background Substraction 3) Reduction of Structure Function: S(Q) Input file format : (Q, I, dQ, dI) 4) PDF calculation : Input file format : (Q, S(Q), dQ, dS) P) Print, S) Save, U) Unzoom, L) Limits windows Q) Quit [0-4 hlqpu] The main menu provides you with several options.  Simply type the number or letter of the option you want and hit “Enter”. Option 0: This will access an interactive routine that can extract scan(s) from raw SPEC data and MCA data acquired from x-ray powder diffraction experiments.  Correction for detector and monitor dead-time correction can be applied. You can also compare variables(e.g. elastic) in each scan and combine scans to get average value. Option 1: This will access an interactive routine used to create a setup file describing the con- ditions of your experiment. The setup file is needed at several stages in the analysis; PDFgetX will prompt for the name of the setup file at the appropriate points. Option 2: This will access an interactive routine that can subtract a background from a PDFgetX input file. Option 3: This will access an interactive routine that applies most of the corrections to the data and produces S( Q ). Those corrections requiring feedback from the user will prompt for the necessary information. Option 4: This will access an interactive routine that calculates the PDF from S( Q ). Option P: When there is a Yorick window present on your screen, you may select this option to print the contents of the window. When prompted, specify the number of the window (this number should be visible in the title bar of the window. "Yorick 3" would indicate a window number of 3.). This option is only available from the main menu, which means that printing is not possible while doing the analysis. Option S: This option save the specified window as postscript (PS) file or windows meta file (WMF) in your directory instead of sending figure to printer. Option U: This UN-zooms a window.  Yorick permits zooming on a data window (left-button zooms, right-button UN-zooms, and middle-button drags. You may also click on one axis only to zoom or unzoom that axis.) but sometimes it is difficult to make the window look the way it did before the zooming. In that case, select this option and, when prompted, specify the window num- ber to unzoom the window. Unzooming only returns the window to the state it was in before the mouse-based zooms; manually-specified axis limits (option L) supersede the effects of this option. Option L: This allows you to manually specify the axis limits for a given window. Enter the window number when prompted.
Data Analysis Procedure in PDFgetX
4.2
The Fig. 4.1 shows flow chart of data analysis procedure in PDFgetX. As is shown, the analysis procedure is composed of four main blocks, "Preliminary Data Reduction", "Build PDFgetX input file", "Refine Structure Function", and "PDF Calculation".    Since most processes in the main blocks are already explained in the tutorial chapter, we will not repeat the explanation for the whole process. Instead, we'll give explanation for the refinement process in detail. In order to refine the structure function, we need to apply five major corrections; dead-time, multiple scattering, polarization, absorption, and Compton scattering corrections. In these correc- tions, dead-time correction will be applied in the preliminary data reduction. All other corrections will be applied during structure function refinement. The Fig. 4.2 shows flow chart of structure function refinement process. During the refinement process, the program asks input if it is neces- sary so please beware of the messages on the screen.
History File
4.3
During data reduction, PDFgetX records all the experimental information, parameters used for corrections, intermediate correction results to a binary file. The default file name is "_history.pdb". You can look at the content of this file using Yorick command. > o = openb("_history.pdb") > show, o
> For example, you can simply check your experimental geometry by typing > o.geometry "r" /* "r" means reflection geometry */ For a complete description of history file see Appendix C.
Some Yorick Information
4.4
This section describes some miscellaneous information regarding the operation of Yorick, within the context of PDFgetX. At any time, you may stop the execution of PDFgetX by entering control-C. You may restart PDFgetX at any time.  If PDFgetX, for some reason, crashes, you can simply restart PDFgetX from within Yorick. It will not usually be necessary to exit Yorick before restarting PDFgetX. You may zoom any Yorick window using a mouse. The left mouse button zooms in, the right mouse button zooms out, and the middle button can be used to drag (if you have a two-button mouse, use both the right and left buttons at the same time).  Click on an individual axis to affect only that axis.
The measured X-ray diffraction intensity may be expressed [10] by Imea (Q) = PA[N(Icoh + Imc + Imul )] (5.1) where P is the polarization factor, A the absorption factor, N normalization constant, and Icoh , Inc , Inc are the coherent, incoherent(Compton), and multiple scattering intensities, respectively, in electron units. We can define the structure function( S(Q) ) in the following form. (5.2) where 〈 f 〉 is the sample average scattering factor. Therefore to get a structure function, we have to do the following corrections [11] step by step on raw data. 0) Dead-time correction 1) Multiple scattering correction 2) Polarization correction 3) Absorption correction 4) Normalization 5) Compton scattering correction 6) Laue diffuse correction
5.1
Dead-Time Correction
In high-energy, high-intensity synchrotron x-ray diffraction experiments, the detector and monitor dead-time effect on the measured experimental data is rather lager. Therefore in these experiments, proper dead-time correction should be applied before applying standard corrections. In the PDFgetX, the dead-time effect can be corrected by measuring detector dead-time and using the following Eq.(5.3).
where τ is dead-time of detector or monitor, N dtc the dead time corrected counts, N m the measured counts, N tot the total counts of detector or monitor and t o the measuring time for each data point. Or dead-time effect can be corrected using the pulser method. [9] A pulser-train from an electronic pulser of known frequency can be fed into the detector preamp. The measured counts in the pulser signal in an SCA window set on the pulser signal is then recorded for each data point. The data dead-time correction is then obtained by scaling the raw data by the ratio of the known pulser frequency and the measured pulser counts.  The Fig.  (5.1) shows a comparison of dead-time correction using these two methods.
5.2
Multiple Scattering Correction
We'll consider here only the double scattering process since it represents the major part of the multiple scattering.  To calculate double scattering ratio, we followed the method suggested by Warren and Mozzi [12]. According to Warren and Mozzi, the double scattering ratio is given by Eq. (5.4)
where, B = ∑ i Z i and A i , μ i (m) are the atomic weights and mass absorption coefficients of the atoms.  And J (20) is an approximate representation for independent scattering, ∑ i f j 2 or ∑ i l f 2 + i(M)] i depending on whether the measurements include only the coherent scattering or both the coherent and incoherent scattering and given in Eq. (5.5).
where, a, b are parameters and can be obtained by fitting J(20) to either ∑ i f j 2 or ∑ i [ f 2 + i(M)] i . Q M is a complicated function depending on Q, μt , fitting parameters a and b and geometry.  For details, refer to the papers by Dwiggins Jr. [13, 14].  As you can see in Fig.  (5.2), the multiple scattering depends on absorption coefficient and geometry. In transmission geometry it becomes larger as Q increases.  In reflection geometry, however, it increases up to maximum point and decrease a little bit after that.  We can see that smaller the absorption coefficient, smaller double scattering ratio, in both cases [15]. 5.3
Polarization Correction
Polarization factor P is given by the following Eqs. [10]:
(B) Using a crystal monochromator
where 2θ is the scattering angle, x = cos 2 2α c for a mosaic monochromator crystal or x = cos 2α c for a perfect monochromator crystal where 2 α c is twice the Bragg angle of the monochromatic crystal. In Eq. (5.7) x = y when the monochromator is located in the incident beam, and y = 1 when the monochromator is set in the diffracted beam. In the case of the sealed tube X-ray diffractometer, incident beam is unpolarized, so the full po- larization correction should be applied. However, the Synchrotron X-ray radiation (e.g. CHESS) is almost perpendicularly polarized to the detector plane therefore only partial polarization correc- tion is necessary, usually less than 5%. 5.4
Absorption Correction
Absorption factor A is given by the following Eqs. : (A) Flat plate reflection geometry
(B) Flat plate transmission geometry
Fig.  (5.3) shows the absorption factor as function of angle and absorption coefficient.  In reflection geometry, if the absorption coefficient is large enough ( μt ≥ 4), there's almost no angle dependence of absorption factor. In transmission geometry, however, when absorption coefficient is around 1, the angle dependence is minimal.
5.5
Compton Scattering Correction
Compton scattering correction is very important and difficult in X-ray diffraction data analysis. Fig.  (5.4) shows elastic and Compton scattering.  We can see that Compton scattering becomes much larger than coherent scattering in high Q. So even the small error in Compton correction causes big error in determining coherent scattering. Therefore it's better to discriminate Comp- ton scattering from elastic scattering than to correct it theoretically.  Compton scattering can be removed experimentally, particularly at large scattering angles, using an analyzer crystal in the diffracted beam, or using a solid state detector with a very narrow energy widow setup. When the Compton scattering is not discriminated, we have to use theoretical Compton profiles to ap- ply correction. In this case we have to take into account the 'Breit-Dirac' recoil factor, R [16]. Formerly, R was usually set equal to unity, which is still an acceptable approximation for elements of high atomic number.  For light elements and for present-day high-precision diffractometric measurement, however, it is essential that R be numerically evaluated if the maximum amount of information inherent in the experimental data is to be extracted. According to Ergun [16], the following Eq. (5.10) should be applied when the number of photons per unit area per unit time is measured, as with counters.
where λ and λ ′ are the wavelength of incident and Compton scattered beam. In this program, we use analytical Compton scattering formula [18] to calculate Compton pro- file. One can compare this results with theoretical Compton scattering data from the 'International tables for crystallography C' [17] and find the difference between these two are very small. Even when the Compton scattering in high Q is discriminated, the data still contains Compton in mid- low Q region. In order to remove the Compton in mid-low Q region, we use the method suggested by Ruland [19].  In this method, the Compton intensity in the data is smoothly attenuated with increasing Q as is shown in Fig. 3.4(c).
5.6
Normalization
The measured x-ray intensity is arbitrary value. The intensity should be normalized properly to get physical meaning. To determine normalization constant, N , we use high Q part of data. In this method, the normalization constant, N is defined in the following way.
In Eq. 5.12, Icor corresponds to the data after corrections for background, multiple scattering, polarization, and absorption. The theoretical atomic scattering factor is calculated using the ana- lytical formula suggested by D. Waasmaier & A. Kirfel [2].
5.7
Laue Scattering Correction
Laue term is defined as 〈 f 2 〉 −〈 f 〉 2 . The Laue scattering occurs when there is no short-range order and the atoms are distributed randomly and it decreases monotonically with increasing scattering angle [12].
5.8
Pair Distribution Function
The atomic Pair Distribution Function(PDF), G(r), can be obtained from powder diffraction data through a sine Fourier transform:
where ρ( r ) is the microscopic pair density, ρ o is the average number density, and Q is the mag- nitude of the scattering vector.  The PDF is a measure of the probability of finding an atom at a distance r from another atom and gives information about both average and the local struc- ture of materials. For more about PDF analysis method, look up the papers by Egami, Toby and Billinge [20, 21, 22].
5.9
Error Propagation
In most diffraction experiments, the measured diffraction intensities are subject to statistical fluc- tuations. It is known that the detection process is well represented by the Poisson distribution. According to Poisson distribution, the standard deviation of statistical fluctuations is given by √ N for the measured N counts. This error in measured intensities will be propagated to the error in a function(e.g.  PDF) determined from these measured intensities.  The estimated error in PDF will be used to test the quality of modeling. In general, an error in function f ( x 1 , . . , , , , , , , , , ) can be calculated by the following Eq.
The error in the Structure function, S(Q), is estimated by propagating error in the measured in- tensities through each correction step.  For the calculation of error in G(r), the following Eq.  is used [21].
In this appendix, the SPEC file format used in the data analysis is presented. The following shows sample SPEC file. #F in33_tutorial.spec #S 1  ascan  pmQ 1 13 600 1 #D Fri Sep 18 16:13:55 1998 #T 1  (Seconds) #L pmQ ereal elive Epoch Seconds ICl IC3 I_CESR PULSER TOTAL COMPTON IC2 ELASTIC 1  2.07 1.967 75931 2.11758 556914 396634 394.395 416 2866 233 31718 606 1.02  2.07 1.968 75934 2.11849 558523 396548 394.159 432 3000 217 31791 610 1.04  2.06 1.962 75936 2.10892 555188 394768 392.324 414 3030 253 31569 591 1.06  2.07 1.969 75939 2.11886 558933 396616 394.023 417 3138 240 31776 647 1.08  2.07 1.977 75942 2.1189 559126 396636 393.919 419 2923 246 31839 639 #S 2  ascan  pmQ 1 13  600 1 #D Fri Sep 18 16:40:55 1998 #L pmQ ereal elive Epoch Seconds IC1 IC3 I_CESR PULSER TOTAL COMPTON IC2 ELASTIC 1  2.07 1.999 77606 2.11876 490517 396566 353.616 418 2397 186 27129 533 1.02  2.069 1.997 77609 2.11807 490872 396438 353.319 415 2486 194 27167 558 1.04  2.07 1.989 77612 2.11884 489377 396583 353.419 416 2672 177 27045 536 1.06  2.07 1.996 77614 2.11884 492200 396585 353.414 428 2551 195 27218 551 1.08  2.06 1.989 77617 2.10866 488500 394682 351.707 419 2458 199 26993 550 #S 3  ascan  pmQ 12 40  1400 1 #L pmQ ereal elive Epoch Seconds IC1 IC3 I_CESR PULSER TOTAL COMPTON IC2 ELASTIC 12  2.07 1.115 88417 2.11861 633382 399154 451.721 317 44519 7243 634757 29557 12.02  2.06 1.137 88419 2.1088 628412 397322 449.505 313 43218 7290 630504 28163 12.04  2.07 1.166 88422 2.11877 625842 399215 451.612 327 42631 7336 630216 27395 12.06  2.07 1.185 88425 2.11884 624286 399227 451.478 299 41732 7166 629057 26469
APPENDIX A.  SPEC FILE FORMAT
As is shown in the sample SPEC file, all the comments and characters start with # mark. To specify scan number #S is used and for the scan header, #L and so on.  To separate scans blank line is used. Except these things the SPEC file is the same as the multi-column ascii file.
In this appendix, the content of the history file (" history.pdb") is described. The history file contains all the experimental information, parameters used for corrections, intermediate correction results.

42

In this appendix, the MCA file format used in the data analysis is presented. The MCA file format used in this manual is two column ascii file as shown in the following Fig.  C.1. The correspond MCA spectrum is shown in Fig.  3.2. The first column corresponds to the MCA channel number which starts from 0 to 1023 in this case ( so total MCA channel # = 1024). And the second column is the intensity detected at each channel. Each 1024 lines corresponds to one Q value and separated by the blank line. Therefore to convert MCA file to N-column ascii file, the following information is needed; total MCA channel number and the corresponding "Q" column. You can get the "Q" column from the corresponding scan (saved in SPEC file) or you can generate "Q" column if it has constant step. In this case you need Q min of your scan, total number of points in your scan, and Q step.
[1] ftp://wuarchive.wustl.edu/languages/yorick/yorick-ad.html . [2]  D. Waasmaier and A. Kirfel, Acta Cryst. A 51, 413 (1995). [3]  C. T. Chantler, J. Phys. Chem. Ref. Data 24 , 71 (1995). [4] V. Petkov, I-K. Jeong, J. S. Chung, M. F. Thorpe, S. Kycia, and S. J. L. Billinge, Phys. Rev. Lett. 83, 4089 (1999). [5] I.-K. Jeong, Th. Proffen, F. Mohiuddin-Jacobs, and S. J. L. Billinge, J. Phys. Chem. A 103 , 921 (1999). [6] Th. Proffen and S. J. L. Billinge, J. Appl. Crystallogr. 32 , 572 (1999). [7]  R. L. McGreevy and L. Pusztai, Mol. Simul. 1, 357 (1988). [8]  T. Proffen and R. Neder, Jour. Appl. Cryst. 30, 171 (1997). [9] I.-K. Jeong, F. Mohiuddin-Jacobs, V. Petkov, and S. J. L. Billinge, arXive:cond-mat/0008079 (2000). [10] Y. Waseda, The structure of non-crystalline materials , McGraw-Hill, New York, 1980. [11] C. N. J. Wagner, J. Non-cryst. Solid 31, 1 (1978). [12] B. E. Warren, X-Ray Diffraction , Dover, New York, 1990. [13] C. W. Dwiggins, Jr. and D. A. Park, Acta Crystallogr. A 27, 264 (1971). [14] C. W. Dwiggins, Jr., Acta Crystallogr. A 28 , 155 (1972). [15] R. Serimaa, T. Pitkanen, S. Vahvaselka, and T. Paakkari, Jour. Appl. Cryst. 23, 11 (1990). [16] S. Ergun,  in Chemistry and Physics of Carbon, edited by J. P. L. Walker, chapter Vol. 3, pages 211–288, Marcel Dekker, New York, 1968. [17] A. J. C. Wilson, editor, International tables for crystallography, volume C, Kluwer Aca- demic Publishers, 1995. [18] B. J. Thijsse, Jour. Appl. Cryst. 17, 61 (1984). [19]  W. Ruland, Brit. J. Appl. Phys. 15 , 1301 (1964).
BIBLIOGRAPHY
[20]  T. Egami, Local Structure from Diffraction , pages 1–21, Plenum, New York, 1998. [21]  B. H. Toby,  Acta Cryst. A 48, 336 (1992). [22]  S. Billinge and M. F. Thorpe, editors, Local Structure from Diffraction , Plenum, New York, 1998.