joomla templates

Wednesday, 29 Mar 2023

Synchrotron Software

E-mail Print

PyFAI : Fast Azimuthal Integration in Python:

PyFAI performs fast Azimuthal Integration on powder diffraction images. For online data analysis, where acquisition can reach up to 60 images per second, other azimuthal integration software is lacking. PyFAI is fast, since its performance demanding parts have been written in Cython and OpenCL. The code written in OpenCL can take advantage from hardware that contains multi/many cores or GPUs.


PyHST : High Speed Tomography in Python:

Since fast two-dimensional detectors are used in computed tomography, the data acquisition is much faster than the reconstruction. PyHST performs high speed tomography reconstruction by adopting a distributed and pipelined architecture. GPUs are used as compute co-processors to reconstruct slices, while the CPUs prepare the next ones. The code is written in C, Python and CUDA. Only NVidia GPUs supporting CUDA can be used for performance enhancement.

CoNBoVal-XAS : Coordination Number Bond Valence for X-Ray Absorption Spectroscopy:

Nowadays, experiments and simulation are complementary methods to achieve satisfying results. If the results obtained only from experiments are limited by different factors due to experimental set up, the simulations don’t have such restrictions. Thus, the user can extrapolate the results from the simulation, if the results from the simulations are matched 80 – 90% with the experimental results in the same region. Therefore, experiments and simulations go side by side. For the aforementioned reasons, the X-ray absorption Spectroscopy (XAS) technique is not only based on experiments, but also based on simulations using results from different modelling methods and codes such as Density Functional Theory (DFT), Molecular Dynamics (MD) or any structural modelling method. The idea is to use results from any structural simulation – model - as inputs for simulating X-ray Absorption Fine Structure (XAFS) experiment using a code called FEFF developed by Rehr’s group at University of Washington [6]. CoNBoValXAS is a program that calculates the Coordination Number, Bound Valence and generates input files for XAS simulation. Results from the structural model simulated using different simulation codes are used as input for the program. The idea is based on calculating the interatomic distances around a given type of atoms in the structure. Based on distances around the query atoms the Coordination number is calculated using two parameters: i) a flexible cut-off distance and ii) selection of type of the first neighbouring atom. Both parameters are defined by the user. Thereafter, the coordination number is used to calculate the bound valence values around the query atoms based on Brown & Altermatt [7] and Pauling [8] approaches. Both coordination number and bound valence are key results to validate the plausibility of the structure in simulated models. Moreover, input files generated in order to be used by FEFF code are widely known between XAS community for simulating XAFS.

Problem Statement
Solid is one of the four fundamental states of matter (the others being liquid, gas, and plasma). It is characterized by structural rigidity and resistance to changes of shape or volume. The atoms in a solid are tightly bound to each other, either in a regular geometric lattice (crystalline) or irregularly (amorphous). Generally, in theoretical simulations (DFT, Molecular Dynamics, …), one has to start looking at the simplest representation of the problem in order to enlarge the simulation to complex phenomena such as adsorption, radiation damage, erosions, etc. In solids, the crystalline structure offers an excellent start to enter the simulation parameters. Crystal structures may be conveniently specified by describing the arrangement within the solid of a small representative group of atoms or molecules, called the ‘unit cell.’ By multiplying identical unit cells in three directions, the location of all the particles in the crystal is determined. A solid structure in any theoretical simulation (MD, DFT …) is represented by spatial coordinates to define the position of each atom in the structure. Therefore, the user is provided with only the position of the atoms in the 3d space. Spectroscopy simulation by FEFF is interested in the radial distribution function (RDF) around a given atom called absorber. This means that from the structural simulation results a query atom (type of atom) is selected and then looks for all the atoms within the neighbourhood of certain radius for all the occurrences of the query atom. The objective is to repeat the process for all the atoms of the same type in the structure which come to a scenario when the queried atom is at the edge or the corner of the box of the crystal as shown in Figure 1. In this case, the neighbouring atoms may exist in adjacent crystals. In that case, atom position data of the crystal needs to be replicated after unit translation in that direction. The query atom can be adjacent to any of the edge or corner of the 3d box, therefore the position data for a crystal needs to be replicated in each 3d direction after unit translation as shown in Figure 2. After extrapolation, the number of atoms increases to 27 times the original, which also requires the same number in memory.

1Figure 1: Query atom in the corner of the box of the crystal


Figure 2: Query crystal along with the adjacent crystals


The naive implementation of finding all the atoms in a certain radius of the query atom, tries to find distance of every atom in the data set and then shows the atoms which are within a certain radius. Let n denote the total number of atoms in the extended data set and k the number of the query type atom. In this case the naive implementation requires O (kn) time.

Efficient solution to the problem
This problem is a very a well-known problem in computational geometry and it is known as the fixed radius neighbourhood problem. This can cause a serious problem for validating the structural simulated model as well as for generating input files for XAS simulation especially on the borders of the box. The problem has been skirted in two ways as follows:

The first method considers the symmetry of the starting crystalline model, with the size of the extrapolated atoms by 8 times instead of 27 times, by extrapolating only half of the total box on the edges and a quarter on the corners as shown in Figure 3.


Figure 3: Blue dotted line defines the new boundary


Installation guide for PyFAI, PyHST andCoNBoVal-XAS can be found as link below: