Volume 2 Chapter 3 3D-Constrain Sub-menu VECTOR
SORT is used to reorder the values of 2 or more previously defined parameters into ascending order.
Example
Suppose that a search is to examine substituent positions around a 6-coordinate metal, and that six parameters, B1 to B6 had been defined to be the six bond lengths.
It is easy to determine the minimum and maximum values of the 6 parameters, using the TRANSFORM command's MIN and MAX operators. However, ordering the 4 intermediate values would be much more difficult.
Using the SORT command, however, the procedure is very easy.
SORT B1 B2 B3 B4 B5 B6
Select or type items for SORT. If necessary reselect SORT to end input.
Select CANCEL to cancel command.
The new SORT instruction is added to the scrolling summary area, in the colour used for TRANSFORM commands.
Note 1
If you wish to sort parameters into descending order, simply reverse the order in which the parameters are specified.
For example,
Select or type items for SORT. If necessary reselect SORT to end input. Select CANCEL to cancel command.
SORT B6 B5 B4 B3 B2 B1 Select or type items for SORT. If necessary reselect SORT to end input. Select CANCEL to cancel command.
Note 2
Parameters derived from numeric values stored in the database, such as space group number, R-factor, temperature etc (i.e. those with names beginning * - available in the *MASK sub-menu) may not be included in SORT commands. This is because it is assumed that these values are distinct and unrelated, so sorting them would not be meaningful.
However, if you would still like to sort a set of *MASK values, you may use the DEFINE command to make "copies" of the *MASK values, and then sort the copies.
For example,
COMMENT declare that the three stored densities should be tabulated: DEFINE *DENM DEFINE *DENX DEFINE *DENC COMMENT make copies of the density values: TRANSFORM DENM = *DENM TRANSFORM DENX = *DENX TRANSFORM DENC = *DENC COMMENT now sort these values into ascending order: SORT DENM DENX DENCNote 3
Note that it is perfectly valid to include hidden parameters (those with names beginning with the character "?") in SORT instructions, although now that the TRANSFORM syntax is much more flexible (allowing nested brackets, and multiple operators per line) it is anticipated that ?parameters will be needed much less frequently.
Note 4
It is helpful to understand the relationship between the commands DEFINE, TRANSFORM, SELECT and SORT.
DEFINE allows the creation of a named numeric parameter (or "variable") whose value is determined by some geometrical (or other) property of each 'hit' database entry.
TRANSFORM allows a mathematical operation on one or more parameters, to create a new parameter.
The SELECT command insists that only entries whose values for a specified parameter lie within a specified range should be accepted as 'hits'.
The SORT command allows the reordering of parameter values.
During a search, DEFINE, TRANSFORM and SORT commands are executed in the order in which they were entered in the instruction deck. Thus, if a particular parameter,B1, is defined, transformed, sorted, and then transformed again, the first transformation will use the original value of B1, whereas the second transformation will use the sorted value.
SELECT commands, however, are executed as soon as the original value of the associated parameter has been determined by its DEFINE command. This improves program speed, as there would be no point continuing with possibly many more definitions and transformations if we already know that, because of a single selection criterion, the fragment cannot possibly be a hit.
Thus, once a parameter name has been included in a SORT line, the program will no longer allow it to be included in a SELECT instruction. To allow this would create ambiguity - users might think that the SELECT would apply to the sorted value, whereas in fact it would apply to the UNsorted value.