CEMS

Simple SAXS and WAXS Software written in Excel


Be sure to read the overall notes on the programs, as well as the notes for the Porod (high q-fit)/invariant program and 1-D correlation function program.

Introduction
For SAXS there are two programs: one to do a Porod fit (high q fit)/calculate the invariant and one to calculate a 1-d correlation function. There are three versions of the Porod fit, one that assumes sharp interfaces (e.g. Porod's law), one that assumes that the electron density across the interface varies in a sigmoidal fashion, and one that assumes the electron density across the interface varies in a linear fashion.

For WAXS, I have one program; this program fits a baseline followed by Gaussian curves to WAXS data in order to determine fractional crystallinity. As of now, the program is only concerned with peaks that go as high as 35-40 degrees in 2*theta; my belief is that a more complete method such as that described in Alexander (X-ray Diffraction Methods in Polymer Science, p. 146) based on a procedure given by Ruland might not be worth the effort (both in terms of the requirements of collecting to very high angles, as well as the inherent assumptions involved in using WAXS to calculate fractional crystallinity. In other words: is the effort worth the slight change in number given the number is relative, i.e. not directly comparable to crystallinity from DSC etc.). Each polymer has its own program, this approach requires much less user input. Finally, I could have used a Voigt curve (Lorentzian+Gaussian, which is much more correct for crystalline peaks) instead of a Gaussian for the crystalline peaks, the problem is that I am worried that the programs won't converge, and I just don't see the advantage of adding 2 more parameters to the fit. Also, the amorphous halo is clearly asymmetric for most samples; I started to add some skewness; never could get it to work correctly and gave up. The area under the curve certainly looks correct in all the cases I have looked at.

If you use these programs in a publication, please reference this website. If you have any questions/comments, feel free to e-mail me at bpgrady@ou.edu

SAXS Software WAXS Software

Porod Fit-Sharp
Porod Fit-Linear
Porod Fit-Sigmoidal
Porod Fit-All

1-D Correlation Function
1-D Correlation Function (no smooth)

Polyethylene
Polypropylene (does NOT include polymorph calculation, I will add at some point)
Polyamide 6 (also includes % gamma phase calculation)
Polyethylene oxide (polyethylene glycol)

Some important tips for the all programs
1) The programs use Visual Basic for Excel. To make a long story short, the advantages of using this environment are it is very easy to program in and everyone knows how to use Excel. Many people will tell you that the capabilities in Excel are limited; I have found that not to be true. The disadvantages are that programs run slower than molasses (and that you have to buy Excel!). You will need to allow macros to run (Tools-Options-Security-Macro Security; I suggest Medium). You will need to have installed Solver in your version of Excel, inside excel goto “Tools-Addins” and click the box for solver (I also suggest adding in the Analysis Tool-Paks at the same time). If the program still crashes,
   a. Close the program and reopen it
   b. Run solver (hit “Tools-Solver”; let it default to whatever it is and crash)
   c. Hit “Alt-F11”, and in this screen goto “Tools-References” and select “Solver”.
I am not 100% sure this will work for all computers, so if you do this and your program still crashes, let me know.

2) I strongly suggest that you run the program, then save the program with a different name, i.e. always use the same starting program that you downloaded directly from the internet.

Some Important tips for Porod program and 1-D Correlation Function Program
1 ) To run the program, just put your data starting with cell a3 as indicated, and push the button. The porodfitall program takes on the order of a minute on a fast PC; while the correlation function program takes about 10 minutes (or even longer). You have to just wait. I could have put a progress meter in, but that would just slow the program down more. I also strongly recommend that you not try to do anything else why the program is running, I have tried that and it causes more trouble than its worth.

2 ) Note you must use the given units for the program to work correctly; if you are working in scattering length density the conversion is 1.26 x 10^5 cm/nm3 (thanks to Rick Register for providing this conversion). If there is overwhelming need to use cm^-1, then I will write a few lines of code to change this and take data that way.

3 ) Do not change the name of any spreadsheets; also the black columns contain important values so don’t delete them (I thought about hiding them entirely, but I thought you might want to examine them).

4 ) It is a simple matter for me to write the program so that it handles multiple files automatically; in other words you could start the program, select a bunch of files (or use names like file1.dat, file2.dat etc.) and the program would automatically process each of these files. However, I would need to know where your data is located (i.e. first and second columns etc.) and hence I didn’t write this into the routine. For a fee (for a commercial unit) I will be happy to do that, for academic users we can talk about it (bpgrady@ou.edu)

5 ) You can run the programs over and over (i.e. change a value and hit the “run” button), they are written to do that. There are two things you should pay attention to in order to find the optimal values to use; I recommend that you use one of the individual programs to determine the optimal values because of time issues.

a. The higher q you collect data to, the better the fit will be. Further, it is not necessary to truncate data at high q if you start getting into the amorphous halo; the variable “Q-value to make switch..” is the highest q where the actual data is used, after that the Porod fit is used to calculate I(q).
b. You do need to pay special attention to the variables that set the range where the Porod fit is made. A good rule of thumb is that you are at least 2*q where any peak might be in any semicrystalline sample. The program also behaves much better if you have data that goes to high q where the profile clearly is flat (although be sure you don't start seeing the upturn due to the amorphous halo or any low angle crystalline peaks!). Be sure to visually examine the quality of fits.

6) At low q, the program draws a line between the lowest q point of q^2I(q) vs. q and (0,0) for the necessary extrapolation. You can look at the cell “Percentage….” to determine how important this might be.

7 ) I do not recommend that you use interfacial thicknesses from the Porod fits because the error in the fit parameters can be quite large (i.e. fairly substantial changes in the interfacial thickness has little effect on the shape of the curve). Rather, I think the invariant is a much better way to characterize interfacial thicknesses for a semi-crystalline material. The procedure that is used comes from the book by the chapter in Vonk which is found in Svergun and Feigin (“Structure Analysis by Small-Angle X-Ray and Neutron Scattering”) and assumes a linear interface (the electron density varies linearly between the crystalline and amorphous phases). However, there are other reasons for the calculated electron density difference to be reduced as opposed to interfacial effects (probably the most common is where the sample is not 100% spherulitic; i.e. all crystallites are part of a spherulite). You should be aware of the other reasons why the invariant can be reduced.

8 ) There are a number of different constants that appear in the expression for the invariant depending on what book you use; that is why what I use is given. I am 95% sure that what I am doing is correct, but if someone wants to tell me why I am wrong, I will listen.

9) In my opinion, the best reference for the Porod (i.e. high q) analysis is Koberstein, J.; Stein R. J. Polym. Sci. Phys. Ed. 1983, 21, 2181-2200. The webpage http://www.ill.fr/ccp13/software/program/corfunc.html gives a decent description of their software; however the correlation function analysis stuff is misleading in places, specifically in the value of A (look at the original paper referred to in Ref 1 on that webpage to see what I mean).

10) Sometimes you will get negative values for interfacial thicknesses etc. I have found this only when you don’t need an interfacial thickness to fit the data; i.e. a two term Porod law (sharp interface) works fine.

Some tips for the 1-D correlation function program
1) The sigmoidal fit to the high-q background is used; there is really no scientific reason for this. I haven’t really tested whether it makes a difference or not with respect to the correlation function about which one you use, but can easily make the change. I may look at this at some point.

2) With some data sets, I get very high frequency oscillations in the correlation function. I think this is because the way in which Excel calculates cosine, but I honestly have no idea. Obviously, these oscillations are an artifact (possibly a problem with the number precision); the easiest way to fix this is to run a simple smoothing program. I wrote a simple program and made it part of the actual program. However, Sigma Plot has a much better smoothing routine than what I wrote, and I suggest you use that if you are really concerned with it (this is why I left the unsmoothed version).


Return to main page.