A Small Angle X-Ray Scattering (SAXS) calculator from coordinate files such as XYZ in Julia.
This Julia package is built to compute the X-ray scattering response of atomic clusters at small angles (SAXS). To do so, the Debye formula is utilized:
where f are atomic form factors, q is the magnitude of transferred momentum and
Functions to parse xyz/extxyz files are provided, yet at its core the code only requires atomic coordinates and the corresponding chemical species - you can use any other code to obtain them and feed those to the desired functions.
For large systems, and statistical ensembles , it is more useful to evaluate Debye's formula starting from the Pair Distance Distribution Function (PDDF) which indicates , on average, how many atoms are at a certain distance. Debye's formula becomes:
where
The atomic form factors can be written as:
They contain :
- A part dependent on transferred momentum q , deriving from Thomson scattering
- A part dependent on the energy of the incoming X-ray , or resonant part
The momentum dependent contribution is written using the Cromer-Mann parametrization:
Where the a,b and c are empirical parameters.
saxyz.jl is now packaged as a Julia package. You can now run it by:
using Pkg
Pkg.activate("PATH/TO/SAXYZ-JL/saxyz.jl/saxyz")To import the calcolator as a regular package, you have to include the saxyz.jl folder to the JULIA_LOAD_PATH environment variable.
export JULIA_LOAD_PATH="/PATH/TO/saxyz.jl:$JULIA_LOAD_PATH"Then, in Julia scripts run
using saxyzsaxyz.jl can be multithreaded by splitting the calculations for the required
exchanged momenta in chunks.
Given an arrays
saxyz.parallel_I_q_1D(qs,atoms,types,f_res)It will use all threads available to the Julia session.
A python library to fit spectra is provided including Porod's and Guinier's laws.
This code is released under an MIT license. Please acknowledge nanoMLMS @ University of Milan if you use this code in your work.
Units used are : KeV for energies , Angstrom for distances , Angstrom -1 for momenta.
