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.
I have written these in *.xls format, which is Office 2003. One of the great stupid things that Microsoft did was changing this program; there is no question that Excel 2003 is much better than what follows. Anyway, you have to do two things to use some of these programs. First is you have to change the security settings in Excel to allow macros to run; if you are concerned about something in the future messing up your Excel etc. then just turn it back when you are done with these programs. Once you change this setting, it will stay at this setting until you change it back for all files (i.e. you only have to do this once). The second thing you have to do is the following
1) In Excel hit Alt-F11. This opens up
the VBA programming environment.
2) Under "Tools-References" check the box that says "Solver".
Unfortunately, you have to do this everytime you open a new file with one of
these programs in it, if you are getting that error message. Also, you have
to do it before you run the program once; in some cases if you run the program
with this error in it and then change the setting, it still won't run that file
the way it should.
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 1-D Correlation Function (used for lamellar phases; cos(qr) in integration) 1-D Correlation Function (used for spherical dispersed phases; sin(qr)/qr in integration)
|
Polyethylene |
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 also need to have installed Solver in your version of Excel; in 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,
then see above. 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 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. I don't think you have to run the program with the original file however.
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 30 seconds
on a fast PC; while the correlation function program takes about 5 minutes on
a reasonable PC. For the latter, I would definitely run this on the fastest
PC that I can find. I could have put a progress meter in, but that would just
slow the program down more.
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 worksheets (you can change the filename, just
not the worksheet names); 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).
You may then ask "why do a Porod fit at all then". The reason is that
the high q behavior of the data must be fit in order to integrate the data for
the invariant reasonably; and I gave you some choices so you could see the difference.
I think the invariant is a much better way to characterize interfacial thicknesses
for a semi-crystalline material; of course you do need to know the percent crystallinity
which you can determine from some other method (e.g. WAXS or DSC) as well as
the electron density difference between the amorphous and crystalline phases.
The procedure that uses the invariant to calculate the interfacial thickness
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. some crystallites are not part of spherulites). 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. This is what
I used in developing my programs.
10) Sometimes you will get negative values for interfacial thicknesses. 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.
11) The sigmoidal fit to the high-q background is used for the 1-D correlation
function program; there is really no scientific reason for this. As I said before,
I wouldn't trust this interfacial thickness anyway; it is just a convenient
way to fit the data so as to have a proper extrapolation to high q. I have done
some testing, and I don't think it matters what interfacial thickness profile
that you use; even sharp interfaces is fine.