J. Appl. Cryst. (1999). 32, 362±364 MESO ± a program to convert X-ray diffraction data from angular to reciprocal space K. R. Locherer, a,b * A. Buckley a and E. K. H. Salje a,b at a Department of Earth Sciences, University of Cambridge, Cambridge CB2 3EQ, England, and b IRC in Superconductivity, University of Cambridge, Madingley Road, Cambridge CB3 0HE, England. E-mail: krl21@esc.cam.ac.uk (Received 10 October 1998; accepted 10 December 1998 ) Abstract A computer code has been developed to convert X-ray diffraction data generated by Siemens X-1000 and Siemens HISTAR area detectors and INEL CPS 120 linear detectors from angular to reciprocal space. Programs have been written to visualize and analyse the resulting data using AVS (Advanced Visual Systems Inc., MA, USA). Two examples of the application of MESO to problems in X-ray diffuse scattering are presented. Firstly, the `butter¯y' associated with tweed microstructure in the high-temperature superconductor YBa 2 (Cu 1±x M x ) 3 O 7± . Secondly, the `dog bone' generated by scattering off domain walls in the perovskite-like WO 3 . 1. Introduction Recent progress in computing and X-ray detector technology has led to systems that can sample large regions of reciprocal space on a fully automated scale. The traditional serial machines sample reciprocal space point by point; however, multichannel devices, such as gas position-sensitive detectors (PSDs), charge-coupled devices (CCDs) or image plates, record large volumes of reciprocal space. The particular systems in mind here are the one-dimensional INEL CPS 120 and the two-dimensional Siemens X-1000 and Siemens HI- STAR, in setups hereinafter referred to as X1, X2 and X3, respectively [as discussed by Salje (1995) and Locherer et al. (1996)]. Modern experimental setups can collect complete data sets within hours rather than what previously would have been weeks. The X2 system operates with a detector containing 512 512 pixels that subtend a solid angle of 20 at 24 cm detector-to-sample distance. The frame ®les generated are very large, of typical size between 256 and 512 kB. The X3 system has twice the resolution of X2 while keeping the area constant, hence quadrupling the amount of data generated. The administration, processing, analysis, visualization and storage of the data requires a combination of hardware and software. The front end to all diffractometers are PCs controlling the goniometer motors, the detector and the overall data collec- tion. The PCs are linked to a Hewlett-Packard 712/60 work- station on which the diffraction data is stored. The workstation then uses the program MESO described in xx2 and 3 to convert the data from angular to reciprocal space and visualize it using AVS (Advanced Visual Systems, 1989), respectively. Two examples of experimental data obtained using this setup are illustrated in x4. 2. Program description In its present setup the program is intended to be used such that when collecting diffraction data the detector is held at a constant angle and the sample is rocked through the angle of incidence ! (Fig. 1) through the Bragg peak, with all other goniometer angles equally held constant. 2.1. Processing three-dimensional data: MESO 3D MESO 3D reads series of X2 or X3 frame ®les and transforms a selected region of interest from each frame point by point to reciprocal space. The output generated is either of ASCII or binary format. A typical run on a series of 300 frames and a region of interest of 30 by 50 frame pixels takes about half an hour. An additional option is to subsample the input frames such that disk space can be saved when a trade-off in resolu- tion is acceptable. The code will then only read in every second, third etc. pixel, as desired. An initialization ®le contains the orientation matrix and other crystallographic data. Since converting complete frames is computationally and disk-space intensive, and in any case not ordinarily necessary, the user can determine a region of interest (ROI) in 2 and (for de®nition of angles see Fig. 1). The region of interest is a sector of an annulus. Transforming this geometry into reci- procal space would generate an output ®le with varying columns lengths, i.e. the dimensions of the output would not be constant, something not many visualization programs can cope with. The code thus extracts the maximum number of pixels in of the ROI for every 2 such that the ROI is bounded by two opposing arcs and two opposing parallel lines. The conversion is achieved by applying various rotation and orientation matrices to the diffraction vector (Fig. 1) and 362 COMPUTER PROGRAMS # 1999 International Union of Crystallography Journal of Applied Crystallography Printed in Great Britain ± all rights reserved ISSN 0021-8898 # 1999 Fig. 1. The X2 diffractometer system. The X3 diffractometer employs the same geometry with one notable exception: the sample holder can be shifted orthogonally with respect to the xy plane, i.e. along z. The left of the diagram depicts the diffractometer reference frame. The incoming X-ray beam s 0 is diffracted into s , with the diffraction vector X D . The angle of the detector is distinct from the goniometer angle gon .