CrystalDraw: A Computer Model to Model Crystal Structures, Axial and Planar Channelling Directions and Crystal Alignment For Channelling Experiments

J. England*1, A. Ellis, K. Piper

Radiate Report R002

ABSTRACT

To aid the understanding of crystallographic concepts, a C# computer programme “CrystalDraw” has been written to produce models of crystal structures and their associated axial and planar channelling directions in three-dimensions and to generate their corresponding two-dimensional projections. Visualisation of the models using specially written macros within Paraview illustrates how to orient and manipulate crystals for channelling measurements and guide interpretations of collected channelling data.

INTRODUCTION

This paper describes a programme, “CrystalDraw”, that generates and visualises crystal structures, their channelling directions and planes in three dimensions and relative to two dimensional projections and shows how to orient crystals on experimental goniometers. The source code is freely available by contacting the corresponding author and through the RADIATE program site [1] so that users can understand the concepts used to generate the visualisations and customise the program to describe experiments on a chosen crystal using the apparatus present in a specific laboratory.

Visualisation of Crystallography Concepts

This report is not intended to teach the concepts of crystallography as many excellent text books, such as Hammond [2], and on-line courses, such as Hoffmann & Sartor [3], already exist. However, the visualisation of crystallographic concepts for the novice can be difficult. Text books on crystallography, such as [2], repeatedly suggest the use of three dimensional models to aid the understanding of the reader. Making physical models can be a challenge and does not always easily illustrate a concept. The first motivation for producing the CrystalDraw programme was to produce a virtual 3D visualisation package in which a crystal structure can be generated and then inspected. Whilst there are many software packages and excellent websites already available that show crystal structures, the underlying assumptions used to produce the structures are not always accessible. By making the source code available, a second motivation was to allow the underlying mathematical methods and symmetry considerations used to generate the crystal structures to be understood. In this way concepts such as Bravais lattices, unit cells, equivalent positions (and perhaps in the future generation of the basis atoms from these) can be illustrated. Orientations of zone axes and planes as referenced by Miller indices (and in the future by Weber

*Corresponding author: [email protected], Surrey Ion Beam Centre, Advanced Technology Institute, University of Surrey, Guildford, Surrey GU2 7XH, UK 1 symbols and Miiler-Bravais indices) can be plotted relative to the crystal lattice and atoms.

Thirdly, and of importance for the ion beam community, CrystalDraw can be used as a 3D CAD tool to visualise real world problems applied to a generated crystal structure. Crystallographic information can be communicated through two dimensional methods such as stereographic projections. The authors initially had difficulty converting the information on a stereographic projection into instructions of how to manipulate a six- axis goniometer to align crystal samples to chosen axial and planar channelling directions. The literature also uses a variety of types of projection, so CrystalDraw can generate projections of stereographic, equiangular azimuthal and gnomic types. CrystalDraw allows alignment procedures to be visualised and hence experiments can be planned before committing accelerator time.

Application to Ion Beam Analysis

Channelling Rutherford Backscattering Spectroscopy (RBS/c) and related ion beam analysis (IBA) techniques such as channelling PIXE, NRA and ion transmission were first developed in the 1970s. An excellent review of the first 50 years of channelling IBA has been given by Vantomme [4]. In these techniques, the spectroscopic yield is measured as the direction of a primary ion beam towards a crystalline sample is varied around a channelling direction. To extract the information from channelling curves the experimenter must first be convinced that features in the channelling dip are due to material properties and not from experimental artefacts. This requires a thorough understanding of the experiment and confidence that the crystal is aligned as intended. Hence a fourth motivation for developing CrystalDraw was to understand scanning directions considered in experiments. The theory of ion channelling using the “string model” approach has been described by Feldman et al [5], amongst others. Whilst CrystalDraw calculates channel angular half widths and minimum yields to aid channel identification, we have used FLUX [6,7] to model measured dips in detail to extract material information or to investigate small experimental misalignments. It is our intention to evaluate other programs such as McChasy [8] and RBSADEC [9] in the future.

The RBS/c technique is complementary to other crystallography measurements such as those collected using transmission microscopy (TEM) and x-ray diffraction (XRD) [4]. RBS/c is particularly sensitive to crystal imperfections. The primary beam cross sectional dimensions, typically a few mm but possibly down to a few nm, limits the spatial resolution to those dimensions and measurements average the sample characteristics under the beam irradiation area. RBS/c can detect point defects (such as interstitial atoms) and extended defects (such as stacking faults and lattice strain). The flux focussing nature of channelling makes defect detection very sensitive. By measuring along different channels, defect positions within the crystal lattice can be determined and by analysing within specific ranges of the scattered ion energies, RBS/c is also capable of measuring crystal qualities for different component elements at different depths in the crystal. TEM on the other hand, using electron beams focussed to a few nm, has a much higher spatial resolution than RBS/c but can only probe a sample area within a lamella (for cross sections) which are typically a few microns wide and few nm thick or within a field of view of a few microns for top down techniques. Point defects are not usually visible by TEM. XRD is strongly influenced

2 by the order of the crystal lattice and is a reference technique to determine crystal lattice constants. X-ray beam sizes are similar to the RBS/c ion beam dimensions but the depth of penetration of the x-rays is deeper (many microns) than ions. Although XRD does not inherently have any depth resolution, when a characteristic peak can be assigned to a particular element, it may be assigned to having arisen from reflections from a particular compositional layer of a sample. The widths of refraction peaks can also give information about variations in atomic positions and hence lattice disorder. RBS/c is most informative when considered in combination with these complementary techniques and other sources of information about the sample [4].

Previous Work

In addition to those cited above, the following references were used extensively in preparing CrystalDraw:

Doyle and co-workers at Sandia National Laboratories built on earlier work (especially Gemmel [10]) to produce papers and an associated excel worksheet that calculates half widths and yield minima for planar and axial channels [11-13]. Some examples of stereographic (actually azimuthal equi-angular) projections are included in the worksheet but the code used to generate them was not available. The calculations used look up tables for cubic crystals; we wanted to generate this information from first principles so that CrystalDraw should work for any crystal system.

Much of the information used above is also included in Appendix 17 of the Handbook of Modern Ion Beam Materials Analysis [14] which also includes methods for aligning crystals on goniometers.

The “ Technology Conference School Book” [15] has a detailed chapter on channelling and stereographic projections but is slightly confusing in showing stereographic and gnomic projections.

This report describes the uses of CrystalDraw. Details of the C# code and python macros used within the Paraview visualisation programme are described in the appendix.

3

DESCRIPTIONS OF VISUALISATIONS

Step 1 – Crystal Structure

CrystalDraw creates crystal structures from crystal information files (CIF) that can be downloaded from the Crystallography Open Database [16]. Each CIF contains the symmetry information, lattice angles and dimensions as given in the International Tables for Crystallography which is available as a hypertext book on line [17] and the structures are well presented on another site [18].

This paper uses GaAs (case 9008845 in the database) as an example crystal. This form of GaAs (Space Group 216 “F-43m”) has the zinc blende structure, which is based on a face centred cubic structure. Si (case 9008565) has a similar structure, but the single type of atom moves Si into Space Group 227 “Fd3m”.

CrystalDraw takes the information from the CIF file to generate the Bravais Lattice and atoms at the equivalent symmetry points. From this, the atoms within the unit cell can be visualised (Fig 1). A large crystal formed from a set of unit cells can also be shown so that channels can be visualised when orienting the crystal (see Fig 2). In this paper, the large crystal is 5 unit cells wide in x and y directions and 10 unit cells deep in the z (beam) direction.

a) b) Fig 1 – a) the face centred cubic Bravais lattice (grey lines joining red boxes), and unit cell atoms for GaAs; b) the equivalent symmetry points for GaAs with its relationship to the Bravais lattice (light lines).

4

Step 2 – Miller Indices of Directions and Planes

CrystalDraw defines a reference sphere that is centred on the origin of the unit cell and intersects the far corner of the unit cell. The surface of the sphere is populated with spheres that represent the crystallographic axial directions defined by the Miller indices; the size and colour of the spheres can be scaled by the axial channel widths to emulate Doyle et al [13]. In a similar way, the surface of the reference sphere is populated by circles showing where the planes defined by Miller indices cut the sphere; the circle colours and line sizes are scaled by the planar half widths. Directions of the axial and planar channels in x,y, z coordinate space are defined by drawing imaginary lines that start at the centre of the reference sphere and pass through the surface spheres and circles. Directions that support strong channelling have large half widths, so the stronger axial and planar channelling directions are represented by large spheres and lines. In the future, it will be possible to choose the sphere size and colour from Xmin values (the signal strength at the minimum of the axial or planar channelling dip relative to the random direction). Directions that support strong channelling have small Xmin.

The axial directions and planes may all be labelled using Paraview’s select data function or those for a particular set of Miller indices can be highlighted using a macro (see appendix). Fig 2a shows a visualisation after choosing the [111] direction (surrounded by a large, transparent pink sphere) and associated (111) plane (surrounded by large blue transparent spheres). Combining views of the reference sphere and large crystal allows understanding of how the atomic positions of the atoms form the channels (Fig 2b and c).

The reader is reminded of the conventions for labelling specific directions or planes and families of directions or planes that share common miller indices and symmetry properties:

Single direction: [uvw] Set of equivalent directions: Plane member: (uvw) Set of equivalent planes: {uvw}

The use of Miller-Bravais indices and Weber symbols for describing planes and directions in trigonal and hexagonal crystal symbols has not yet been implemented.

5 a)

b) c)

Fig 2 – a) unit cell atoms, Bravais Lattice and the reference sphere showing axial directions and planes for GaAs. The magenta line is the beam direction (along the z- axis). The reference sphere and large crystal viewed together show b) axial direction [111]; c) planar channel (111).

Step 3 – Projections of Axial Directions and Planes

The three-dimensional representation of the reference sphere can be reduced into two dimensions by projection. There are a vast number of projection methods [19] but the stereographic projection is usually described in the context of crystallography [2]. In the coordinate system to be considered (Fig 3), the ion beam (magenta line) has been drawn to arrive through the “North Pole” (0, 0, R) to hit the centre of the reference sphere (0, 0, 0). For a stereographic projection (Fig 3 and 4a), a line is drawn starting from the “north pole”, through a point on the reference sphere and terminating on a point (x, y, -R) on the plane that includes the south pole (0, 0, -R). Fig 3 and 4 only

6 show points on the projection plane that correspond to points on the “southern hemisphere” of the reference sphere (axial directions of the form ). Points on the reference sphere’s equator (axial directions ) appear on projection plane on a circle of radius 2R. The same technique is used to project the planes from the reference sphere onto the projection plane.

Fig 3 – the GaAs reference sphere showing directions and planes in three-dimensions and its two-dimensional stereographic projection. Only points and planes up to second order (i.e. up to <222> and {222}) are shown.

CrystalDraw is able to generate three types of projection of interest: stereographic, equiangular equidistant and gnomic. The projections change depending on the orientation of the crystal (see Step 4). Figs 4 and 5 compare three types of projection for the crystal oriented in the [001] directions and compare important characteristics of each projection.

Due to the cubic symmetry of GaAs, it is only strictly necessary to show one quadrant of the projection. In Figs 3-5, directions [11-1], [1-1-1], [-11-1] or [-1-1-1] could be used to illustrate the orientation of the crystal for <111> axial channelling.

7 a)

b)

c)

Fig 4 – The red arrows illustrate the methods for projecting a position on the surface of the reference sphere down onto the projection plane for the a) stereographic, b) azimuthal equidistant and c) gnomic projections

8

Stereographic Projection

Projection using a straight line starting from the north pole, through a point on the surface of the sphere onto the projection plane. Only projections of points on the southern hemisphere of the reference sphere are shown here (within a circle of radius 2R on the projection plane). The angular scale in this projection is not linear, so care must be taken to interpret angular distances between two points.

Azimuthal Equidistant Projection

This projection also uses a line starting from the north pole directed, through a point on the surface of the reference sphere onto the projection plane. However, the scale on the projection plane is then adjusted so that the radial distance of a point from the centre is linearly dependent on its angle from the pole (convenient as angles can be measured using a ruler on the projection). Doyle et al [13] use this representation.

Gnomic Projection

Projection using a straight line starting from the centre of the reference sphere, not the north pole. It is unable to show all the points in the southern hemisphere. The IIT Schoolbook [15] sometimes uses this representation.

Fig 5 – a comparison of projections available within CrystalDraw (points and planes are shown up to 3rd order).

9

Step 4 – Visualising Rotating the Crystal on a Goniometer

CrystalDraw has been written to model the effect of rotating a crystal on the goniometer of the Surrey Ion Beam Centre but the code could be modified to describe any other type of goniometer. The goniometer has been described previously [20], including engineering drawings in [21], and is shown in Fig 6. In summary, the whole goniometer is mounted on a θ stage that can be rotated around a vertical (θ) axis. Mounted to, and rotating with, the θ stage, the Φ stage can also be rotated around a horizontal (Φ) axis. The ω stage, mounted to and rotating with the Φ stage, can also be rotated around an orthogonal (ω) axis. The three axes of rotation are also shown in Fig 6. The ω stage includes the sample plate which can be driven over large ranges in x and y to centre any sample of choice mounted on the sample plate under the ion beam. A hole in the centre of the sample plate allows the beam to travel through the goniometer and through the back of the vacuum chamber in which it is mounted. The z drive has a limited range of drive (4mm) and is adjusted so that the surface of a sample is at the eucentric point (i.e. at the origin of the rotation axes). If this is achieved, the same point on the sample is irradiated by the beam for all goniometer rotation settings. If this is not achieved, the beam spot moves over the sample as the axes are rotated; this has implications if the sample is not uniform and in extreme cases (sometimes met with large θ or Φ rotations around small samples) the beam can even wander off the sample.

The mechanical construction of this goniometer has the following consequences for how a rotation about each axis affects the orientations of the other rotation and translation axes:

1) Rotation around ω does not affect θ or Φ; z is unchanged but x and y translation directions rotate. 2) Rotation around Φ does not affect θ but moves the direction around which ω rotates; x (when not aligned with ω), y and z translation directions rotate. 3) Rotation around θ (whose axis is always vertical) affects Φ and ω; x, y (when not vertical) and z translation directions rotate.

10

Fig 6 - a photograph of the Surrey Ion Beam Centre goniometer showing its six axes of rotation and translation.

Fig 7 shows the goniometer rotation axes in relation to the beam and detector directions (with the goniometer in the [001] alignment). Use of this visualisation together with the large crystal view can show if a primary beam is channelled into the crystal (see Fig 11) or if any detector is in a blocking direction for scattered .

Detector D is positioned so that when the sample is vertically oriented, the path length for particles scattered out of the sample into this detector is as long as possible. This maximises the difference in energy lost for events that occur at different

11 sample depths and so gives the highest depth resolution possible for the energy resolution of the detector.

Fig 7– A diagram of Surrey Ion Beam Centre rotational axes ([001] alignment) relative to directions towards the detectors. The orientation of the axes is consistent with the photograph of Fig 6. The coloured lines represent the following items:

Line colour Item Represented magenta Incident beam (along the -z direction) red Detector A – Cornell geometry with a scattering angle of 173°. yellow Detector B – IBM geometry with scattering angle of 149°. not shown Detector C – IBM geometry for detection of forward recoils for Elastic Recoil Detection (scattering angle of 30°). turquoise Detector D – Cornell geometry with scattering angle of 97° (for highest depth resolution).

Fig 8 illustrates how the projected axial and planar channel directions vary with the goniometer rotations starting from the [100] alignment. It should be recognised that each rotation changes the projection and that the actions of a subsequent rotation may be different to those shown in Figure 8, in accordance with the descriptions above of how the rotational axes are changed by the earlier movement. Whilst a printed projection can act as a map to show how to move the goniometer to direct the primary

12 beam into the crystal along any chosen direction, the user has to imagine how the map and rotation axes will be altered after each rotation.

Fig 8 – Stereographic projections that show the directions of movements of θ (red), Φ (green) and ω (blue) from the [001] alignment and the new projections produced.

Examples of these changes are shown in Fig 9 which illustrates how the goniometer may be moved in three different ways so that the primary beam enters the crystal in a [1,1-1] direction, a member of the <111> family of axial directions. Fig 9a shows the starting goniometer position ([001]) with the required [11-1] direction highlighted by the large pink sphere.

A first approach to align to [11-1] could be to tilt (Φ) the goniometer back by 45° and then rotate (θ) the goniometer by 35°. A subsequent scan in θ will move along the (011) (or the equivalent (0-1-1)) planar channel. Scattered ions could be detected in all three detectors, but the depth resolution of detector D would be reduced.

A second alignment approach could be to rotate (ω) the sample by 45° followed by a goniometer rotation (θ) of 54.7°. A subsequent scan in θ would move along the (-110) (or the equivalent (1-10)) planar channel. This scan is equivalent to the first approach, but the projection shows the scan is in the opposite direction. The sample could be further rotated (ω) to allow a θ scan to move along any planar channel of choice that intercepts the [11-1] axis. Scattered ions could be detected in all three detectors. Since the sample retains its vertical attitude, the depth resolution of detector D would be preserved.

A third alignment approach could be to rotate (ω) the sample by 45° (in the opposite direction to that above) followed by a goniometer tilt (Φ) of 54.7°. A subsequent scan in θ will move along the (112) (or the equivalent (-1-1-2)) planar channel.

13

It is understood that scans in Φ could also be carried out for all the aligned examples above. a) Starting position b) 45° up in Φ c) 35° right in θ

d) 45° clockwise in ω e) 54.7° right in θ

f) Orientation for horizontal [100]

g) 45° anti-clockwise ω h) 54.7° up in Φ

Fig 9 – azimuthal equidistant projections illustrating three methods b)&c), d)&e) and g)&h) to rotate the sample from a starting [001] alignment a) to [11-1].

Fig 9f) illustrates a convenient way to mount samples if the crystal is to be oriented with the [100] axis horizontal and [010] vertical in accordance with the projection before the goniometer is moved. It should be noted that zinc blende and diamond structure wafers preferentially cleave along {110} planes.

14

Step 5 – Precise Alignment of Crystal on Goniometer

The alignment procedures described in the previous section assume that the crystal axes were perfectly aligned to the goniometer axes. This cannot be assumed because the crystal cut of a crystalline wafer can vary by up to 1° from the normal and further angular errors may be introduced during mounting of the sample. The scanning methods described in the next section require very close alignment of the crystal and goniometer axis if experimental artefacts are not to be introduced into the channelling dips.

It is normally relatively simple to align the crystal [100] axial channel to the ion beam by making successive scans in θ and Φ to locate the bottom of the channelling dip. Having completed θ and Φ alignments, Fig 10a shows the goniometer movements that can be used to calibrate ω accurately. The crystal is first moved away from the [100] axial channel by rotating θ by, say, 7°. If the crystal is oriented in the same way as shown in Fig 9f, a scan of around 90° in ω will exhibit the planar channelling dips shown in Fig 10b. It is interesting to note that the (310) planar channel dip is stronger than (210). It might be expected that planes associated with lower Miller indices would exhibit stronger planar channels than those with higher indices. Fig 11 illustrates the crystal orientations for the steps taken in Fig 10. Fig 11d clearly shows that the planar separation is, in fact, larger for (310) than (210) which leads to a larger channel FWHM and lower minimum channel yield [11]. The planar (320) separation (not shown) is so small that planar channelling for those indices is not observable.

ω can now be rotated to be aligned to the centre of the (100) planar channel (or other channel of choice). As this alignment was made with the goniometer misaligned in θ, it is prudent to check that ω is indeed set for the centre of the planar channel when θ is moved either side on the [100] axis.

15 a)

b)

Fig 10 – a) CrystalDraw generated projection of planar channels around the [001] axial channel (central circle) for GaAs; b) – the predicted RBS/c intensity calculated using FLUX for the ω scan represented by the green arc in a).

16

a) Aligned in θ, Φ. ω misaligned b) 7° rotation in θ

c) ω aligned to {100} d) ω aligned to {310}

e) ω aligned to {210} f) ω aligned to {110}

Fig 11 – large crystal atoms, Bravais lattice and unit cell atoms shown relative to the goniometer ( ) axes (grey tubes) for the orientations corresponding to positions in Fig 10.

17

Step 6 – Visualisation of Scanning across Channels

Very accurate alignment of the sample and goniometer is required when collecting channelled IBA data such as RBS/c. We tend to collect full energy range RBS spectra at a number of steps in angle across a channelling dip and then analyse how chosen energy sections vary in intensity with angle of the after the acquisition. This gives the greatest flexibility in allowing channelling at different depths and for different sample elements to be analysed. A faster method is to pre-select an energy range of interest within the RBS spectra and collect the integrated signal from this as the angle is changed. We often use this approach during the set-up procedures discussed in the previous sections.

Swanson and Shao (page 276 in [14]) state that there are three methods to scan across axial channels: 1) Taking a path along planar channels 2) Taking a path along a non-linear path that avoids any planar channel 3) Along a random path by rotating about an axis for each angular increment.

Our first approach was to use method 2) because the difference between the random signal outside of the channel and the minimum yield in an axial channel is larger than from within a planar channel (see Fig 41 of [14]). Although scanning from the random might give better statistics, this scan method is difficult to control because the true random level is difficult to achieve. Not only are there many channels, as shown by this report, but the steering effect of the channels can enhance the scattering rate above a true random direction (see for example the peaks around the [00-1] and [10- 1] axial channels in Fig 13). We tried to scan from random directions across axial channels (similar to the green paths in Fig 12) by either rotating ω away from a channel direction and scanning in θ or by using a combination of θ and Φ steps. However, Fig 12 shows the difficulty of doing this. Any misalignment between the scan direction and crystal axes can cause unintended interactions with planar channels, leading to the experimental artefacts in the acquired scan data.

We have therefore recently used method 1) - scanning along a planar channel - to try and avoid these problems. Fig 13 shows experimental and modelled data for such a long-range scan. In this case, we attribute the rise in background signal as θ increases to be due to a small misalignment has caused the beam to wander outwards away from the middle of the planar channel up the side towards the random signal. The misalignment could be totally mechanical or due to some distortion in the crystal lattice.

Method 3) exploits Lindhard’s Rule of Angular Averages (see section 2.4c of [14]) which states that the signal averaged over all angles should equal the signal from an non-crystalline (”random”) substrate. We have not yet investigated this method, mainly because of the extra time taken to acquire channelling data, although this approach would be possible using the ω rotation.

18 a)

b)

Fig 12 – examples generated by FLUX of artefacts introduced into channelling dips in which a random direction has been attempted by choice of ω orientation: a) misalignment in Φ causes leading slope on the dip as the beam travels out of an unintentional planar channel; b) Φ is well aligned but symmetric unintentional interaction with the large planar channel leads to the dips on both sides of the axial dip.

19

a)

b)

Fig 13 – a) experimental data for a θ scan nominally along the {100} planar channel. The azimuthal equiangular projection generated by CrystalDraw above the scan identifies the axial channels that have been crossed. b) a Flux model of the experiment that, by including a small ω misalignment, predicts the observed background rise with θ.

20

CONCLUSIONS

Understanding crystallographic concepts and their relationship to experimental channelling experiments can be challenging but is made easier by the ability to visualise and manipulate three dimensional models. CrystalDraw produces three dimensional virtual models to show how crystals are constructed from their space groups and, in combination with the reference sphere, allows axes and planes described by Miller indices to be recognised. By generating commonly used projections, CrystalDraw illustrates the connection between two dimensional projections, the crystal and the experimental goniometer. This can be used to plan experiments and recognise which channels have been measured.

The source code, described in the Appendix, can be accessed for a deeper knowledge and to customise the code to particular experimental apparatus.

ACKNOWLEDGEMENTS

JE and AE wish to thank Andre Vantomme of KU Leuven for useful discussions about channelling experiments. AE and KP were Surrey University Physics students participating in Professional Training Year internships funded by Surrey Ion Beam Centre, a UK National Facility funded by the Engineering and Physical Sciences Research Council.

REFERENCES

1. https://www.ionbeamcenters.eu/ 2. C. Hammond, “The Basics of Crystallography and Diffraction”, Fourth Edition published in 2015 by Oxford University Press 3. Frank Hoffmann & Michael Sartor, “Fascination of Crystals and Symmetry”, https://www.youtube.com/channel/UCts9FTFNInqTMvcFpdyap7w/featured 4. Vantomme, A. (2016). “50 Years of Ion Channeling in Materials Science”, Nuclear Instruments and Methods in Physics Research, Section B: Beam Interactions with Materials and Atoms, 371, 12–26 5. L. Feldman, J. Mayer, S. Picraux “Materials Analysis by Ion Channeling” published in1982 by Academic Press 6. Smulders, P. J. M., & Boerma, D. O. (1987) ”Computer simulation of channeling in single crystals”, Nuclear Inst. and Methods in Physics Research, B, 29(3), 471–489 7. http://www.pjms.nl/FLUXHTML/#FLUX7-and-related-programs 8. L. Nowicki, A. Turos, R. Ratajczak, A. Stonert, F. Garrido (2005) Nuclear Instruments and Methods in Physics Research, Section B: Beam Interactions with Materials and Atoms, 240, 277 9. Zhang, S., Nordlund, K., Djurabekova, F., Zhang, Y., Velisa, G., & Wang, T. S. (2016) ”Simulation of Rutherford backscattering spectrometry from arbitrary atom structures”, Physical Review E, 94(4), 1–12 10. Gemmell, D. S. (1974) “Channeling and related effects in the motion of charged particles through crystals”, Reviews of Modern Physics, 46(1), 129–227 11. Doyle, B. L. (2016). Parameterization of ion channeling half-angles and minimum yields. Nuclear Instruments and Methods in Physics Research, Section B: Beam Interactions with Materials and Atoms, 371, 63–68

21

12. Doyle, B. L., Corona, A., & Nguyen, A. Q. (2014). Ion channeling. Ion Beam Analysis: Fundamentals and Applications, 171–193 13. https://www.sandia.gov/research/facilities/technology_deployment_centers/ion_b eam_lab/_assets/documents/periodic%20table%20excel%20files/channeling.xls m 14. Y Wang, M. Nastasi (editors), “Handbook of Modern Ion Beam Materials Analysis”, 2nd Edition published in 2010 by Cambridge University Press 15. J. Ziegler, “Ion Implantation - Science and Technology” published by Ion Implantation Technology Co. 16. http://www.crystallography.net/cod/ 17. http://img.chem.ucl.ac.uk/sgp/mainmenu.htm 18. http://aflowlib.org/CrystalDatabase/space_groups.html 19. https://en.wikipedia.org/wiki/List_of_map_projections 20. Simon, A., Jeynes, C., Webb, R. P., Finnis, R., Tabatabaian, Z., Sellin, P. J., Breese, M.B.H., Fellows, D.F., van den Broek, R., Gwilliam, R. M. (2004) “The new Surrey ion beam analysis facility”, Nuclear Instruments and Methods in Physics Research, Section B:219–220(1–4), 405–409 21. [1] B. Holländer, H. Heer, M. Wagener, H. Hailing, and S. Mantl,(2000) “New high-precision 5-axes RBS/channeling goniometer for ion beam analysis of 150 mm Ø wafers,” Nucl. Instruments Methods Phys. Res. Sect. B Beam Interact. with Mater. Atoms, 161–163, 227–230 22. https://www.paraview.org/ 23. https://vtk.org/wp-content/uploads/2015/04/file-formats.pdf 24. https://en.wikipedia.org/wiki/Fractional_coordinates 25. Weisstein, Eric W. "Stereographic Projection." from MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/StereographicProjection.html 26. Weisstein, Eric W. "Azimuthal Equidistant Projection." from MathWorld--A Wolfram Web Resource http://mathworld.wolfram.com/AzimuthalEquidistantProjection.html 27. https://en.wikipedia.org/wiki/Rotation_matrix in section “Rotation matrix from axis and angle” 28. https://stackoverflow.com/questions/30809409/removing-duplicates-from-a-list-of- tuples 29. https://stackoverflow.com/questions/333737/evaluating-string-342-yield-int-18 30. https://www.codeproject.com/Articles/1070593/Point-Inside-D-Convex-Polygon- in-Csharp 31. https://github.com/shuhaowu/pvpyfilter

22

APPENDIX - DESCRIPTION OF PROGRAMS

PROGRAMMING PHILOSOPHY

Paraview [22] is a free to use 3D visualisation program that allows the viewing of structures (as discussed in the first part of this report) described using the vtk (visual tool kit) file format [23]. Paraview includes the ability to write macros in python for data and visualisation manipulations but, being non-compiled, calculation intensive macros can be slow to run. Hence the philosophy of this model is to carry out many of the calculations inside a compilable program (written in Microsoft C#) that generates a set of vtk files. Python macros have been written that then load the output set of vtk files into Paraview, generate standard views and select axial directions and their planes.

DESCRIPTION OF CRYSTALDRAW

CrystalDraw is a program written in Microsoft C# to calculate the vtk files for visualisation with Paraview. Whilst CrystalDraw can be compiled, it is most convenient to run the program from the Visual Studio IDE to allow debugging and changes to the input parameters. The CrystalDraw namespace contains the following classes:

Program Class

This is the entry point for the program. The following steps are carried out:

i. Set up parameters: The following parameters can be edited within the top lines of code: Filename (including full path) of CIF file to read Generate ASCII or Binary vtk files Maximum uvw (Miller index) values (large values take longer to calculate) Projection type (stereographic, azimuthal equidistant or gnomic) Goniometer rotations to be visualised Projectile Z, mass and energy, temperature, Debye temperature

This method of input has been chosen over input through a GUI (requiring tedious, repetitive manual typing) or editing of an input file (not implemented). The input values (and other generated variables and constants) are stored in the CrystalGlobalValues class which is a method to make them available throughout the other classes.

ii. Generate crystal Program first uses the crystal class to calculate the crystal parameters and generate its vtk visualisation files at the starting, [001], orientation.

iii. Calculate points and planes on the reference sphere Program next uses the pointAndPlanes class to calculate the axial and planar channelling parameters of the crystal before any rotation occurs for each value of uvw.

iv. Calculate points and planes on projection plane Program then uses its channelMain function to project the points and their associated planes from the reference sphere onto the projection plane.

23

v. Calculate effect of rotations Program calculates the effect of all the input rotations on the coordinates of the crystal, reference sphere and projection plane and generates the necessary vtk to allow the effect of the goniometer rotations to be visualised.

vi. Write the Paraview input file The following parameters are output to a text file so that they can be read in automatically by Paraview: CIF case number Name of crystal compound Elements in the crystal Radius of the reference sphere. crystal Class crystal first reads in the following data from the chosen CIF file: lattice constants a, b, c, alpha, beta, gamma, density, mass equivalent points atom positions

Whilst some effort has been made to make the file read robust, the format of some of the input files can vary subtly, causing the read to fail. If this occurs, the format of the local copy of the CIF file should be edited to make the read successful.

From this information crystal generates: Bravais lattice and points Unit cell atoms “Basis” (equivalent points) atoms Large crystal

These properties are initially constructed in the crystal coordinate system with orthogonal axes (a, b, c) (although in real space the axes may not be orthogonal). The crystal coordinates are then converted to “real” space cartesian coordinates (x, y, z) using the crystal metric tensor [24] which takes into account the true relationship of the a, b and c axes. Finally, the vtk files for each of these properties are generated.

The “basis” is derived from the equivalent symmetry points. For now, crystal populates the equivalent points and shows all of these; the algorithm to extract the basis from the equivalent points is still to be written. The crystal is generated using the relationship:

crystal = bravais lattice + basis

As the equivalent points includes more atoms than are in the basis, this process may produce more than one atom at a populated position. Duplicate atoms are removed from the list of unit cell and crystal atoms.

24 pointsAndPlanes Class

As in the crystal class, the pointsAndPlanes class first carries out the majority of its calculations in the crystal coordinate system and then later converts the results to real coordinates using the crystal metric tensor for visualisation. pointsAndPlanes converts the vector direction [uvw] in crystal coordinates into real coordinates of a “point” on the surface of the reference sphere (using the crystal metric tensor) that has a radius, R, that encloses the unit cell.

The axial channel half angle for the direction [uvw] is calculated using equations presented by Doyle [11-13] (using their updated pre-factor values). However, rather than using lookup tables (supplied by Doyle for cubic crystals) for atomic spacing along the axial direction the program searches for and counts atoms that lie along the direction [uvw]. The program searches along the length of the string in positive and negative directions (necessary because not all strings have the same occupancy and atom type). pointsAndPlanes then calculates the planar half angle for (uvw) using the equations from Doyle. As for the axial channel case, the separation of the planes is searched for rather than found using a look up table. The equations for channel half angles (and minimum yield) involve the mass of the crystal atoms. These calculations make a simplifying assumption that the atoms will appear in the ratio given by the stoichiometry of the crystal compound for all cases. Whilst this is an oversimplification (see section 4.4 in Gemmel [10] for a more complete discussion) it is used within the spirit of these calculations. More correct calculations should be carried out using programs such as FLUX.

The pointsAndPlanes class further includes the createSpherePlane function that calculates the circle on the surface of the reference sphere that represents the plane [uvw] which is orthogonal to a direction in the crystal coordinate system. Note that after conversion to real coordinates, the axial and planar directions may no longer be orthogonal.

Finally, pointsAndPlanes contains the projectPoint function to project coordinates on the reference sphere onto the projection plane. For stereographic and azimuthal equidistant projections the mathematics follows the equations explained by MathWorld--A Wolfram Web Resource [25, 26] using λ(0) = 90.0 and Φ(1) = -90.0. For gnomic projections it is simpler to consider similar triangles. channelMain Function

When called for the first time, channelMain calculates which values of uvw up to the maximum values should be considered in future calculations. This avoids duplicate calculations for cases such as [222] which are not necessary after having previously considered [111]).

The channelMain function calls projectPoint to project each point [uvw] on the reference sphere onto the projection plane, calls createSpherePlane to create the circles on the surface of the reference sphere that represent each [uvw] plane and then uses projectPoint to project those circles onto the projection plane. Upon completion, the values are stored for later calculations and then vtks created for

25 visualisations. All points and planes are shown on the reference sphere but only points on the lower half of the reference sphere (that fall within a radius 2R) are plotted onto the projection plane.

If called after the first time, channelMain considers the effect of a goniometer rotation. channelMain rotates the previous set of reference direction points and generates the planar channelling circles on the reference sphere, projection points and planes and crystal parameter coordinates so they can all be visualised together. The effects of rotation on the orientations of the goniometer rotation axes are also calculated so that further rotations can be correctly simulated.

CrystalGlobalValues Class

Stores global values that are used throughout the different classes.

CrystalDrawFunctions Namespace

This namespace includes a CrystalDrawFunctions class that contains functions used by other parts of the calculations. These include:

Matrix manipulation functions (to be replaced in future by Math.Net) to Multiply (3x1) and (3x3) Add Calculate size (|Determinant|) Apply a rotation matrix around an arbitrary axis using mathematics described on wikipedia [27]

TupleComparer [28] which is used when removing duplicate atom locations generated by the crystal calculations.

Evaluate which converts a string representing a fraction to a number [29] when reading the CIF files.

The namespace also includes a GeoPoint and other classes from [30] used to see if points lie within the polygon defined by the unit cell or large crystal.

26

DESCRIPTION OF PARAVIEW MACROS

The vtk files generated by CrystalDraw are visualised using Paraview [22]. A typical screen shot is shown in Fig 14. Paraview allows external macros to be written in python that can be imported (via the Macros -> Add new macro… menu) and then run by clicking the button now installed on the macro toolbar. Imported macros may be edited within a text window enabled via the Macros -> edit... menu. Macros can also be run more conveniently after enabling the Python Shell Window (via the View -> Python Shell menu) and from that window using the Run Script button which then asks for the path to the python script file. In this way a python script, in particular AllCrystalOutputs.py, may be edited more comfortably in an external IDE such as Microsoft Visual Studio. Once perfected, the macro can be imported. Note that outputs from the macros can appear in the Python Shell and Output Message windows.

The following python macros are available

AllCrystalOutputs.py

Plots out all the vtks associated with crystal, reference sphere and projection plane calculations of the chosen case together with the beam and detector directions and rotational axis positions. The case to show (normally the last case calculated by crystalDraw) is read in automatically from the Paraview_Inputs.txt file. A different case could be chosen by manually editing the Paraview_Inputs.txt file or the case names at the beginning of the AllCrystalOutputs.py.

Fig 14 – The Paraview window showing the items created in the Pipeline Browser window by AllCrystalOutputs. The ChooseChannels macro has been invoked on the render view. The Python Shell and Output Messages windows have been placed in the bottom right hand corner below the Pipeline Browser. The loaded macros are visible in the right-hand side of the second row.

27

It should be noted that visualisations involving atoms can use the “Points” representation to only show the atoms or “Surface” to also display bonds.

ChooseChannels

Convenient macro to enable just the pipeline browser items associated with channelling.

ChooseCrystal

Macro to enable just the pipeline browser items associated with the crystal.

Methods to identify points and plane values

In principle, it should be possible to select a cell in a Paraview render view by clicking on or hovering over it. Once selected, the uvw values associated with the cell could be read. In practice this appears to be very hard to achieve. There are two other ways to identify points and planes:

Using Paraview’s inbuilt “Find Data”

After clicking on a points or plane item in the pipeline browser, the Find Data can be selected from the Edit menu, typing or clicking on the top row icon (see Fig 15). Cells can be selected (choosing “ID is >= 0” selects all). Before clicking on “Run Selection Query”, clicking on the “Point Labels” button and selecting “UVW” will show labels on the chosen pipeline browser item.

Fig 15 – Paraview’s “Find Data” window used to label all axial or planar directions.

28

ChooseUVW

The ChooseUVW.py macro must be added. After the ChooseUVW button has been pressed, a text box appears that allows the positive or negative integer values of u,v and w to be entered. The input is split into three numbers, so separators such as commas can be typed (but will be ignored). After entering the values, enabling any of the four “Selected… Glyphs” visualisations places large spheres around the selected reference sphere or projection plane items.

To enable this input via a text box a plugin “uvwFilterCaller.xml” has to be installed. Accessing the Tools -> Manage Plugins… -> Load New… menu will allow one to see if this is already present or needs to be installed. Placing a copy of “uvwFilterCaller.xml” in the C:\Program Files\ParaView 5.7.0-Windows-Python3.7- msvc2015-64bit\bin\paraview-5.7\plugins directory will automatically load this plugin each time Paraview starts. This method has used the work of Shuhao Wu [31].

Because uvwFilterCaller.xml calls a python macro called uvwFilter.py, the full path to this file on must be contained in the uvwFilterCaller.xml. This can be manually edited in any text editor to match the path on the computer in use.

29