SAXS CORRELATION FUNCTION ANALYSIS:
NOTES ON THE SOFTWARE AT DARESBURY

1. Introduction

A set of programs for performing correlation function analysis of one dimensional SAXS patterns has recently been written. The programs are based on the SUN network at Daresbury, but have also been copied across to UMIST. From a given SAXS image they calculate the one and three dimensional correlation functions, and analyse the one dimensional function in terms of an ideal lamellar morphology1. The two correlation functions (called Γ1 and Γ3 respectively) are essentially Fourier transforms of the given one dimensional SAXS curve2. They are often interpreted in terms of an imaginary rod moving through the structure of the material from which the SAXS curve was obtained. Γ1(R) is the probability that a rod of length R moving through the material has equal electron densities at either end. Hence a frequently occurring spacing within a structure shows up as a peak in the one dimensional correlation function. The difference between Γ1 and G3 lies in the assumptions made about the experimental material. The interpretation of Γ1 assumes that, within the SAXS length scale, spacings occur along one fixed axis, but that the axis assumes all possible directions throughout the material. Similarly, Γ3 assumes that spacings can occur in all three dimensions within the SAXS length scale.

The task of calculating and interpreting the correlation functions can be broken down into three logical parts:

  1. Extrapolation of the experimental SAXS curve to q=infinity and q=0.
    This is a mathematical requirement for the Fourier transform to be performed. Any SAXS experiment gives a finite number of intensity values at finite values of q necessitating this extrapolation and a numerical integration to calculate the transforms. Two programs perform this extrapolation: tailfit and tailjoin. It should be stressed right from the start that extrapolation to q=infinity (tail fitting) is the most problematic task of correlation function analysis, and can greatly influence results obtained.

  2. Fourier transformation of the extrapolated data.
    Γ1 is based on a cosine Fourier transform, while Γ3 is based on a sine transform. The two functions are related by a simple expression2. The program transform performs the Fourier transformations, and is relatively simple. It can also re-transform Γ1 back into a smoothed copy of the extrapolated data.

  3. Interpretation of Γ1 based on an ideal lamellar morphology.
    A model is required for the interpretation of features of Γ1 to be possible. The program extract performs this analysis. Note that no interpretation of Γ3 is performed.

Correlation functions are extremely valuable tools in the interpretation of one dimensional SAXS patterns, particularly those for which features are either weak or obscured (for example shoulders). However, as with any involved method of analysis, care should be taken to ensure results are genuine and meaningful.

2. Program structure.

The programs were written in a modular form to enable other programmers to adapt the code to their own needs. The programs also had to be transportable between systems. Each program is run from a UNIX shell script corfunc.sh that can be invoked from any directory by typing corfunc. The shell script runs each of the programs in turn, and also controls graphics output. The first program run is tailinput. This prompts the user for all the information required for the analysis. No user input is required once tailinput has finished. Tailinput is not given its own section in these notes, but each input will be discussed in the context of the analysis program that uses it. The programs invoked by corfunc have to communicate with each other. They do this via a system of dummy files. For example tailfit passes fit information to tailjoin in the file tailinfo.dat. If everything is running smoothly, the user should be unaware of the creation of these files. In general, deletion of a dummy file is not important, providing it does not occur during an analysis session. The most important dummy file is corfunc.dat, the file containing all the information provided by the user in tailinput.

Graphical output of results is catered for, and is one of the options controlled by tailinput. The programming behind this is complicated, but was written to ease transport of the programs. To plot a graph, a program creates otoko format files containing the data, and a set of shell scripts. The shell scripts run otoko and force it to plot the data contained in the files just created. The name used for dummy otoko files is O99000.TMP, or something similar. The shell scripts created by the programs are invoked by corfunc, and delete themselves once plotting is over. They use the otoko ".pnt" command that requires the user to click with the middle mouse button to clear the graph - any of the standard plotting commands would leave no delay between plotting the graph and clearing it, when run from a shell script. This may seem an unnecessarily complicated way of producing plots, but it can be used on any system that supports the Xwindows version of otoko, and in general works seemlessly. Note however that should any changes be made to otoko, the programs might not be able to produce graphics. In this case, the graphics option can either be toggled off, or some minor alterations made to the Fortran code to enable the programs to use some other graph plotting program.

Before discussing each of the analysis programs in turn, we will consider the first few inputs made to tailinput. The user is prompted for the name of the directory containing the otoko files to be analysed. This can be any UNIX path name such as /img8/ajr/aug94, or ../jul94, or you can simply press return if the current directory contains your data. The user is the prompted for a file name. All file names should be in the form X??000.!!!, where ?? is a file number and !!! a file extension. Using any other name format will result in error messages like

Software error with subroutine changeotok: fatal...

or

Error in subroutine swapexten: fatal...

at some point in the analysis. Whenever a fatal error occurs all the programs stop. The user is also prompted for a Q axis filename, before tailinput checks all the data. If the file supplied contains realtime data, the user is then prompted for the number of the first frame to be analysed, the last frame to be analysed, and the increment between frames. If the user, when prompted, chooses the absolute intensities option, the programs assume the intensities are in reciprocal centimetres. Using absolute units is recommended, as more information will be available when interpreting the correlation functions. Note that pressing the return key when prompted by tailinput selects the default for that input. Tailinput keeps a record of defaults, speeding up user input. Tailinput is case sensitive!

3. Program tailfit.

4. Program tailjoin.

5. Program transform.

6. Program extract.

7. Conclusion and recommendations.

References.

  1. Strobl, G. R.; Schneider, M. J. Polym. Sci. 1980, 18, 1343-1359.
  2. Balt Calleja, F. J.; Vonk, C. G. X-ray Scattering of Synthetic Poylmers; Elsevier:Amsterdam, 1989; pp.247-251.
  3. Balt Calleja, F. J.; Vonk, C. G. X-ray Scattering of Synthetic Poylmers; Elsevier:Amsterdam, 1989; pp.257-261.
  4. Koberstein, J.; Stein R. J. Polym. Sci. Phys. Ed. 1983, 21, 2181-2200.
  5. Press, W. H. et al. Numerical Recipes: the Art of Scientific Computing; Cambridge University Press, 1986.
  6. Balt Calleja, F. J.; Vonk, C. G. X-ray Scattering of Synthetic Poylmers; Elsevier: Amsterdam, 1989; pp.260-270.