CHAPTER
3
Once the orientation of crystal lattice is found by indexing, a set of Miller indices can be assigned to each diffraction spot, so that resolution and wavelength of each spot become known subsequently. Cell parameters of the crystal and other parameters of the experimental setup can be put together in order to negotiate the responsibility of apparent errors. This process is called geometric refinement since all parameters to be adjusted are geometric. The purpose of this process is to model the observed diffraction pattern as precise as possible, since it is crucial to the next process, integration of each spot. The assignment and refinement of these geometric parameters are not only local to a single image, but also global to a set of them with known relative geometric relationship.
3.1
Estimates of Soft Limits and Source Spectrum
Knowing of source spectrum and diffraction limit of a pattern makes the rest of the refinement process much better guided. It is also likely that estimates from one pattern in a set can be transferred to others in the same set. Some soft limits can be recognized before a pattern is indexed and as soon as spot recognition. Others can be analyzed after a pattern is indexed and refined successfully.
Strictly speaking, the topics of soft limits exceed the scope of Chapters 2 and 3, but it is so important to get these right as early as possible. I find it necessary to discuss soft limits before we have gone too far into a whole set of diffraction patterns.
3.1.1 Before indexing
Before indexing of a pattern, it is possible to estimate the best sigma cut level, the maximum Bragg angle, and therefore the highest diffraction limit by knowing a reference wavelength. The following script uses a new command Limits to perform this task.
diagnostic off
Input
Distance 180
Center 1704 1711
Pixel 0.1 0.1
Format Mar345
Image
l29w_25a_001.mar3450
Wavelength 0.7 1.5 1.1
Quit
Spot
12 6 2.3
Limits
Stop
Yes
Listing 3.1.1.0.1 Command script that estimates soft limits before indexing.
Notice that this task does not require any crystal information. Only detector information are necessary. Wavelength range is required, but this procedure can tolerate large errors in these value. In fact, lmin and lmax are only place holders here. Only lref is the functional value. Error in lref can be corrected after next session of soft limit recognition. See below for more. Parameters controlling spot recognition are discussed in 2.2.1 and 2.2.3. Slightly over-picked spots are recommended such as those shown in Figure 2.2.1.0.2.
______
| )_
| Report |
| ------ |
| ------ |
| ------ |
| ----
|
|________|
Best
sigma cut estimated at 2.42.
Sigma
cut results in 10% noise is 2.32.
Maximum
spot density
16.1/mrad
at Bragg angle of
12.6
degree.
Diffraction
limit estimated at Bragg angle of
19.5
degree or
1.65
A resolution.
Suggested
resolution for indexing and geometry refinement is 2.08 A.
Listing 3.1.1.0.2 Results from the command Limits before indexing.
Results of this procedure are listed above. The sigma cut that would result in 10% noise is recommended for the purpose of this procedure. The best sigma cut is for indexing and geometry refinement. If the input sigma cut is much higher than the result, a warning message will suggest lowering of the input and retry. If the input is much lower than the best value, all results may appear slightly more optimistic. You may choose to rerun the procedure using the recommended sigma cut.
Running this procedure before indexing (2.2.2) may help you select a better sigma cut and resolution limit. As suggested, indexing and geometry refinement require an underestimated resolution range. It should also be noted that sigma cut aught to be lowered from the suggested value for smaller unit cell cases, and elevated somewhat for larger unit cells. Especially for ellipse recognition on large unit cell patterns, it is only necessary to find far fewer spots than a normal sigma cut would find. Ellipse recognition would be prolonged significantly under the suggested, normal sigma cut.
Any report on l-curve before indexing is arbitrary. Please discard the message and see below.
3.1.2 After indexing
If the command Limits is placed after indexing, that is, the command Pattern in Listing 2.2.0.0.1, it performs differently. Alternatively, a frame-specific parameter file can be loaded before the command Limits. A rough l-curve can be estimated quickly when an indexed and refined pattern is available. Better reference wavelength can be read from the curve.
Input
бн
Wavelength 0.7 1.3 1.1
Quit
бн
Pattern pre.spt
Limits 1 1.5 estimate.lam
бн
Listing 3.1.2.0.1 Command script that estimates soft limits after indexing command Pattern.
This command script is same as the one for indexing listed in Listing 2.2.0.0.1 except the additional command Limits after Pattern. This command will not work fully if the pattern is mis-indexed. If this command is followed by a string argument as a filename, a rough l-curve can be saved into this file from 0.25 to 2 Å. This l-curve is a Chebyshev approximation of some automatically chosen degree. Users have no control of the degree at this point. This simple ASCII file has .lam format as described later in 4.1, essentially with wavelength in Å in the first column and relative intensity in the second column. The command Limits can also accept one or two numerical arguments, but these numerical arguments must work with a string argument. If one number is given, it specifies lmax of the saved wavelength range. If two numbers are given, the range is defined by these two values.
diagnostic off
@
l29w_25a_001.mar3450.inp
Input
Format Mar345
Image
l29w_25a_001.mar3450
Wavelength 0.7 1.5 1.1
Quit
Spot
12 6 2.3
Limits 1 1.5 estimate.lam
Stop
Yes
Listing 3.1.2.0.2 Command script that estimates soft limits after loading a frame-specific parameter file.
A command script independent of indexing is also possible. The Image command in Input section is necessary, since the parameter file does not really load the image file, while the image must be loaded for spot recognition. If a non-frame-specific parameter file is loaded, please also specify goniometer setting and image format before loading an image.
The resulted l-curve in Figure 3.1.2.0.1 is already quite good except that it seems to include an incorrect baseline. It takes seconds to obtain the curve from data on a single frame. This curve may serve as very good starting point in later wavelength normalization. This procedure also suggests a reference wavelength.

Figure 3.1.2.0.1 An estimated l-curve in black solid line and final l-curve from wavelength normalization in red dash line.
This procedure could fail if unit cell is too small or resolution is too low, since it requires a certain number of observed reflections to estimate a l-curve.
3.2
Goniometer Setting
Before we can process a set of images, we need a means to specify their spatial arrangement. A virtual goniometer is simulated in Precognition in order to achieve this. More precisely, such simulation is carried out by a class of CCL, ccl::goniometer. Please note that the simulated goniometer may differ from the one you use in your lab or synchrotron, but the virtual goniometer must be universal enough to simulate all possible motion of a real goniometer by changing its setting.
Precognition
chooses its coordinate system as the following: X- and Y-axes are horizontal to
the right and vertical down, respectively.
They are the same as those in an image file and a computer display. Z-axis is along the X-ray beam, if
detector surface is normal to the X-ray beam (Figure 3.2.0.0.1 and 3.2.0.0.2).
The virtual goniometer has three circles w, c, and f. The orientation of w-axis is given by polar angles Y and F. Note that the polar angle F differs from the goniometer circle f, and they shall not replace each other. See Box 3.2.0.0.1 and CCL/CPL reference for definition of polar angles. w-axis is therefore along Y-axis, vertical down, when both polar angles are 0. c-circle is riding on w-circle, c-axis is always normal to w-axis. c-axis is along Z-axis, the X-ray beam, when w-circle is at its home position, w = 0. c-axis turns in a horizontal plane when w is other than 0. f-circle is riding on c-circle, f-axis is always normal to c-axis. f-circle is coaxial with w-circle, when c-circle is at its home position, c = 0 (Figure 3.2.0.0.1).

Figure 3.2.0.0.1 Three circles of the virtual goniometer at their home position. The orientation of w-axis is Y = F = 0.
If Y = p/2, and F = 0, w-axis is along X-axis. c-axis turns in a vertical plane parallel to X-ray beam (Figure 3.2.0.0.2). Under this definition, the goniometers of BioCARS stations at the APS 14-ID-B, 14-BM-C, and 14-BM-D have w-circle set at Y = p/2, and F = 0. If the k-block is set at 0, both w or f can be used to specify crystal orientation. If the k-block is not 0, use w-circle only.
Two commands Omega and Goniometer at Input level are available for input of these angular values. Omega takes two numerical arguments Y and F in degree. The default values are 90 and 0. Goniometer takes one to three numerical arguments w, c, and f in degree. The latter angles are assumed to be 0, if they are missing.

Figure 3.2.0.0.2 w-axis of the virtual goniometer is set at Y = p/2 and F = 0, that is, the X-axis. This is the setting of the goniometers at BioCARS beamlines.
With these two commands added to Input section, the command script for indexing looks like this:
diagnostic
off
Input
бн
Omega 90 0
Goniometer 3 0 0
бн
Quit
Spot re.spt
Pattern pre.spt
Stop
Yes
Listing 3.2.0.0.1 Indexing of the first pattern with goniometer setting.
3.3 Indexing and Refinement of a Set of
Patterns
Once the first or any pattern in a set is indexed and refined with the correct goniometer setting, you are ready to refine all patterns in the set. A small file is necessary to tell the program goniometer setting of each and every pattern in the set.
бн
m37v3b_8us_056.mar3450 165
m37v3b_8us_058.mar3450 171 0
m37v3b_8us_060.mar3450 177 0 0
бн
Listing 3.3.0.0.1 Goniometer settings in a file.
The first string of each record is the filename. One to three numbers follow. They are w, c, and f angles in degree, respectively. The missing values are assumed to be 0. All images listed in a goniometer file must be from a same type of detector. Goniometer file is loaded by the same command Image as an image file is loaded, thus it must use .gon as its file extension in order to distinguish from a diffraction image. It is not possible to change orientation of w-axis from image to image, it can only be set by the command Omega.
diagnostic off
@
pre.spt.inp
Input
Format MAR3450Packed
Image m37v3a_8us.gon
Resolution 2.1 100
Wavelength 1 1.4
Spot 20 6 0.7
Quit
Dataset
In /mnt/jaz/m37v3_8us
Out
first_try/
Quit
Stop
Yes
Listing 3.3.0.0.2 Command script refines a dataset.
The command script above performs geometric refinement of a set defined by the .gon file. This script first loads an input file generated by previous run of indexing. This input file can be any non-frame-specific one, like the one listed in Listing 2.2.6.0.2. That is to say, crystal and detector parameters from one frame can be transferred to another. The Input section specifies image type, loads goniometer setting file, limits resolution and wavelength ranges, and gives spot size and s-cut.
A new top level command Dataset enters a submenu of several optional choices. The program starts to process all images in the .gon file by exiting from the submenu. The subcommand In takes a string argument as a directory where image files are located. Out specifies a directory where results can be saved. This directory must exist already. It is not going to be created by the program. Obviously, Quit exits from the submenu. If no In nor Out commands are given, the current directory is the default. In this case, the command Quit is still needed.
Previous releases require four subcommands following Dataset: Path-OK-Path-OK. The first Path specifies a directory where results can be saved. The second gives where image files are located. This release has backward compatibility, but it is recommended to stop using the old convention.
This process generates a set of .inp files similar to, but not exactly the same as that listed in Listing 2.2.6.0.2. The newly-generated input file includes some additional parameters that are specific to a frame, such as the goniometer setting and filename. Therefore, this type is called frame-specific. The filename of this new parameter file is chosen automatically as the image filename appended by .inp. If this type of frame-specific parameter file is loaded at the beginning of the command script in Listing 3.3.0.0.2, this particular frame is added to all other frames in the .gon file.
Input
Crystal 91.870 91.870 45.983 90.000
90.000 120.000 168
Matrix 0.615638 -0.057006
-0.785965 -0.758598 -0.312911 -0.571505 -0.213356 0.948069 -0.235885
Goniometer 0.000 0.000 0.000
Omega 90.000 0.000
Distance 180.053 0.250
Center 1704.59 1711.25 1.00
1.00
Pixel 0.099995 0.100000
0.001000 0.000000
Swing 0.000 0.000
0.000 0.000
Tilt 0.103947
0.026568 0.100000 0.100000
Bulge 0.000000598502
0.000000000226 0.000001000000 0.000000001000
Format MAR3450Packed
Image 0 ./l29w_25a_001.mar3450
Resolution 2.10 100.00
Wavelength 1.00 1.30
Quit
Listing 3.3.0.0.3 A frame-specific parameter file.
An alternative way of listing all goniometer settings is shown in Listing 3.3.0.0.4. Instead of using a .gon file, one may list them in the input script directly by repeatedly using the command Goniometer. Additional string arguments are necessary here to specify image filenames. Please note that the string argument should always be the last in the command. This way removes the need of .gon file, and some frames can be easily commented out as needed, which is not allowed in a .gon file. However, the downside is a long input script.
Once again, if the .inp file at the beginning is a frame-specific one, this frame is included regardless whether it is in the list of the commands of Goniometer.
diagnostic off
@
pre.spt.inp
Input
Format MAR3450Packed
Goniometer 0 0 0 m37v3a_8us_002.mar3450
Goniometer 0 0 3 m37v3a_8us_004.mar3450
# Goniometer 0 0 6 m37v3a_8us_006.mar3450
бн
Goniometer 0 0 180 m37v3a_8us_062.mar3450
Resolution 2.1 100
Wavelength 1 1.4
Spot 20 6 0.7
Quit
Dataset
Path ./
OK
Path
/mnt/jaz/m37v3_8us
OK
Stop
Yes
Listing 3.3.0.0.4 Command script refines a dataset.
3.4 Crystal Slipping
When working with protein crystals, especially when working on time-resolved projects, there are a number of matters often bothersome. A protein crystal may quickly turn mosaic in white beam. Its diffraction may decay significantly after a few exposures. Laser shots for pumping the reaction in crystal may also contribute to these phenomenon. One of the worst is crystal slippage in a room temperature capillary mounting. For whatever reason, excessive mother liquid around the crystal and/or high power laser illumination causing temperature jump or sound wave, it is quite common that the recorded Laue patterns do not always fit predicted ones very well. They may be off by degrees. Losing orientation in middle of a run may happen, if your crystal experiences these problems. One option to the command Dataset helps greatly in this situation: progressive.
By default, the command Dataset will run under normal mode. The initial geometric parameters will be taken from the first pattern, that is, the user supplied .inp file. progressive mode forces the initial parameters be inherited from the last refined pattern, instead of the first. Therefore, the crystal orientation may slowly drift away from the original one. If you dataset requires using of progressive mode, the user supplied .inp file at the beginning of the script should be from the first frame, or the one that is very close to the first in the set.
In addition, if the program is able to detect losing grip on crystal orientation, it first launches a small walk-around search in order to get the orientation back. If this effort fails, the program will re-index the pattern using some newly recognized nodal spots. These spots will be found near the predicted low-indices reflections, since we assume that we are not off too much at this point. Finally, if none of these efforts work, we desperately restart the pattern recognition sequence from very beginning. Obviously, progressive mode runs slower than normal mode, but it saves a lot of your trouble.
progressive mode is good only for occasional slippage. It starts random search after detection of losing orientation. In some cases, crystal jumping is so frequent that the input goniometer settings do not predict the crystal orientations very well throughout the dataset. Another refinement mode named drunk is available. In drunk mode, random orientation search is performed before refinement of each frame. The number of steps and radius of the random walk depends on whether and how soon a better fit is found. The best fit resulted in the random walk serves the initial orientation for the refinement. Same as progressive mode, the other initial parameters come from the last refined pattern. This mode runs even slower.
The refinement modes normal, progressive and drunk are either-or. They are not usually combined.
diagnostic off
@
pre.spt.inp
Input
Format MAR3450Packed
Image m37v3a_8us.gon
Resolution 2.1 100
Wavelength 1 1.4
Spot 20 6 0.7
Quit
Dataset progressive
Quit
Stop
Yes
Listing 3.4.0.0.1 Command script for progressive mode.
3.5 Repairing an Individual Frame
Sometimes all frames in a data set are refined well except one or two. The refinement mode drunk has a special usage that can repair the bad frames.
diagnostic off
@
m37v3b_8us_004.mar3450.inp
Input
Resolution 2.1 100
Wavelength 1 1.4
Spot 20 6 0.7
Quit
Dataset drunk
Quit
Stop
Yes
Listing 3.5.0.0.1 Command script to repair a bad frame by using drunk mode.
This example loads an input file with some errors in its parameters, and refines them by drunk mode. This mode is more powerful than any other modes when a frame is mis-steered previously. However, it is not a good idea to load several input files and refine them by drunk mode in one job hoping that all of them will be repaired. The program may not work as desired, instead some parameters of a earlier frame will be transferred to a latter one. This usage is meant to repair one frame at a time. See 3.4 for details.
3.6 Fixing Parameters and Limited Refinement
You may sometimes find that certain parameters are changed too much by the refinement. You may fix a parameter by reset its uncertainty to 0 before refinement. This can be done by editing either a non-frame-specific or a frame-specific input file.
Input
бн
Distance 180.053 0
бн
Quit
Listing 3.6.0.0.1 Uncertainty of distance reset to 0.
It is highly recommended that you use this feature to fix crystal-to-detector distance during geometric refinement for all data sets except some special-purpose small molecule work. A variable distance within a data set will introduce systematic error to wavelength assignment.
You may also set an uncertainty to a small value in order to limit its freedom of change. Attempt changes greater than twice as large as the given uncertainty will be suppressed to a smaller change.
However, editing an entire set of .inp files can be tedious. It is good that the uncertainty values in the first input file before refinement of a whole set will be transferred to other frames when the refinement is done. For example, in Listing 3.3.0.0.2, uncertainties in file pre.spt.inp will be copied into other .inp files created during the refinement. Therefore, it is a good idea to set your desired uncertainty values by editing the first input file.
Two
string arguments free and fix can be used with these commands in
Input section:
Center, Pixel,
and Tilt may take two
uncertainty values for both directions, when argument free follows.
If only one is given, the second value is assumed to be the same as the
first. Bulge may take two uncertainties too, but if one is
given, the second is assumed to be 0.
Matrix cannot take free and fix options. This may be added in later releases.
3.7 Calibration of
Wavelength of each Laue reflection is assigned after crystal-to-detector distance and cell constants are refined. These parameters are highly inter-dependent on, but not very orthogonal to, each other. For example, distance and cell lengths may be refined to greater values at the same time and still keep nice prediction pattern. These parameters may easily run away during refinement. Due to this possibility of systematic bias in refined values of distance and cell constants, wavelength assignment may also be biased. Such bias is hard to be corrected, since in Laue diffraction, there is seldom a precisely known characteristic wavelength in the source spectrum. A new refinement mode calibration may be used to calibrate distance and cell constants to known values. In order to calibrate a parameter, one must first fix it so that no more refinement is allowed, and specify a known, accurate value to which calibration will be done (see the last section).
diagnostic off
@
m37v3b_8us_002.mar3450.inp
@
m37v3b_8us_004.mar3450.inp
бн
@
m37v3b_8us_060.mar3450.inp
Input
Crystal 93.22 44.00 83.56 90.00
121.95 90.00 fix
Distance 180 fix
Resolution 2.1 100
Wavelength 1 1.4
Spot 20 6 0.7
Quit
Dataset calibration
Quit
Stop
Yes
Listing 3.7.0.0.1 Command script performs calibration.
One may calibrate cell lengths but not cell angles by combined use of fix and free arguments. The next example sets a nonzero uncertainty for cell angle b so that it will not be calibrated.
Input
бн
Crystal 56.2 29.7 40.9
90.0 114.7 90.0 fix
# set cell
constants and reset all uncertainties to 0
Crystal 0 0 0 0 0.2 0 free
# free beta only
бн
Quit
Listing 3.7.0.0.2 Combined use of fix and free arguments.
Other parameters such as orientation matrix, direct-beam center, detector tilt angles and bulge corrections do not need calibration, since they cannot run away in refinement. The only other parameters may run away are pixel sizes. No calibration is provided because the vertical pixel size is never allowed to be refined.
This calibration can be avoided, if distance and cell were never refined.
3.8 Re-index
If none of the refinement modes can carry geometry refinement to the end, or due to whatever reason, you must re-index a pattern in middle of a set, a common concern is consistency of indexing. For example, consistent indexing is demanded when anomalous scattering signal from a heavy element is under investigation (See 5.1 and 5.4). Due to symmetry of a space group, an orientation matrix usually has a set of equivalent matrices. The first indexing carried out by command script in Listing 2.2.0.0.1 chooses one of the equivalent matrix with least missetting angles. To ensure a consistent re-indexing with a previous indexing, the previous missetting matrix shall be given. A report of discrepancy between the new and old indexing will be printed. Precognition automatically selects the least discrepancy. This angular value shall be small enough, say less than a few degrees, to safely believe indexing consistency. The following script shows how a previous missetting matrix can be given to the indexing program. The numbers are arranged by row, such as
Matrix r11
r12 r13 r21
r22 r23 r31
r32 r33
if
the matrix is
. The given
matrix must be orthogonal.
diagnostic off
Input
Crystal
/home/renz/xtal_info/pypwt.xtl
Matrix -0.6630 -0.7483 0.0177
0.0794 -0.0468 0.9957 -0.7443 0.6616 0.0905
Distance 250
Center 1704.5 1711.0
Pixel 0.1 0.1
Goniometer 16
Format Mar345
Image
/mnt/cdrom/w1nd_2a_05.mar3450