CHAPTER
11

This chapter provides several utilities widely used in crystallography. Although these utilities involve crystallographic concepts, they are not so much tangled with others. Therefore, they are isolated in this chapter and cpl.ccl.utility module for easy access. These utilities may depend on MAC library, but not any other parts of CCL.

**11.1**** ****Resolution**** ****Range**

Resolution is perhaps the most cited crystallographic quantity. It measures a spatial detail that an experimental data point reveals or to which the quality of a structure reaches. A range of resolution often refers to that of an ensemble of diffraction data set. The classes ccl::resolution and cpl.ccl.utility.resolution implement this range. It also contains a binning method that provides equal reflection bins, and resolution extension that guarantees specified number of reflections.

11.1.1 Class ccl::resolution

**resolution(const
std::complex<double> =**

**
std::complex<double>(5, 1000));**

The default constructor returns a resolution range from 5 to 1000 Å, or constructs a resolution range from the specified boundaries as the real and imaginary parts. The order of the boundaries is arbitrary.

**resolution(const
double, const double = 1000);**

Constructs a resolution range from the specified boundaries. The order of the boundaries is arbitrary. If only one value is given, constructs a range from that to 1000 Å.

**resolution(const
resolution&);**

Copy
constructor.

**~resolution();**

Destructor.

**const resolution&
operator=(const resolution&);**

Assignment operator.

**operator
std::complex<double>() const;**

Converts to a complex with minimum resolution as the real part and maximum resolution as the imaginary part.

**operator
double() const;**

Converts minimum resolution to a double.

**bool
operator==(const resolution&) const;**

**bool
operator&=(const resolution&) const;**

**bool
operator!=(const resolution&) const;**

Return true if two ranges are equal, approximately equal, or not equal to each other, respectively.

**std::complex<double> getResolution()
const;**

**double dMin() const;**

**double dMax() const;**

Return resolution range, minimum, and maximum resolution, respectively.

**std::vector<double>
bins(const int = 8) const;**

Divides the resolution range to the specified number of bins, returns the boundaries in a vector of length 1 greater than the number of bins. It is guaranteed that each resolution bin has equal volume of its spherical shell in reciprocal space, so that each shall contain approximately equal number of reflections.

**static std::vector<double>
bins(const double,**

**
const double = 0,**

** const
int = 8);**

Same as above, except that the initial resolution range is
given as two doubles. If the second
double is missing, 1000 Å is assumed.

**double extend(const double = 1)
const;**

Extends the resolution range to a higher resolution so that
the volume of the newly extended spherical shell and that of the original has a
ratio as the given value. This
method can be used, for example, in phase extension. The extended resolution will increase
the number of reflection by, say, 25%.

**static double extend(const
double,**

**
const double,**

**
const double = 1);**

Same as above, except that the initial resolution range is
given as two doubles.

**friend ostream
&operator<<(ostream&,**

**
const resolution&);**

Returns an ostream for printing.

11.1.2 Class cpl.ccl.utility.resolution

If d1 and d2 are two floats, c is a complex, an object of resolution range res has the following methods:

**resolution(c
= complex(5, 1000))**

The default constructor returns a resolution range from 5 to 1000 Å, or constructs a resolution range from the specified boundaries.

**resolution(d1,
d2 = 1000)**

Constructs a resolution range from the specified boundaries.

**resolution(res)**

Copy
constructor.

**res
== r**

**res
!= r**

Return true if two ranges are equal, or not equal to each other, respectively.

**res.ap_eq(r)**

Return true if two ranges are approximately equal to each other.

**res.getResolution()**

**res.dMin()**

**res.dMax()**

Return resolution range, minimum, and maximum resolution, respectively.

**res.bins(n = 8)**

Divides the resolution range to n bins, returns the boundaries in a vector of length n + 1. It is guaranteed that each resolution bin has equal volume of its spherical shell in reciprocal space, so that each shall contain approximately equal number of reflections.

**res.extend(f = 1)**

Extends the resolution range to a higher resolution so that
the volume of the newly extended spherical shell and that of the original has a
ratio f.

**res.__str__()**

Special method for printing.

**11.2 ****Wavelength**** ****Range**