This repository contains code for the Python package mdxcs
, an acronym for m
olecular d
ynamics/x
-ray c
oherent s
cattering. The package provides code to compute coherent X-ray scattering intensities from molecular dynamics trajectories.
Please note this package is under active development.
We consider atomistic molecular dynamics trajectories (i.e., non-coarse-grained), which are typically treated as quasi-periodic systems under the minimum image convention. Most simply, such trajectories consist of a series of snapshots ('frames'), each of which is defined as a periodic cell (the 'unit cell', if you like) filled with
The total coherent (that is to say, elastic) scattering is given by the sum of the so-called self-scattering (which contains no structural information) and the distinct scattering (the interference term that provides two-body information),
where
Assuming we are considering an isotropic scatterer (e.g., a macroscopically-homogeneous system, such as a liquid),1 then the appropriate (atomistic) formalism is the Debye scattering equation (DSE),2
where
For isotropic systems, this equation is the most general formula to calculate coherent scattering intensities, under the independent atom approximation.4 As such, this code implements the DSE directly, making no approximations. The accuracy of the results is limited by (a) the size of the simulation cell (a source of finite-size errors), and (b) user-controlled parameters defining the quantization of the calculation.
Nevertheless, the code does not actually compute the DSE in the form given above. Rather, taking advantage of efficient codes to compute real-space radial distribution functions (RDFs) from MD simulation data, we essentially compute the Fourier transform of the DSE, as follows.
Assume we have a trajectory consisting of
where
Under construction...
Pending a full release on PyPI, one can simply clone this repository:
>> git clone https://github.com/niklasbt/mdxcs_dev.git
For ease of access, you can export the package to PYTHONPATH
:
>> export PYTHONPATH=<path>/mdxcs:$PYTHONPATH
Or, if you like:
>> echo 'export PYTHONPATH=<path>/mdxcs:$PYTHONPATH' >> ~/.<rc file>
>> source ~/.<rc file>
Try:
>> python mdxcs_dev/tests/test_all.py
As currently built, mdxcs
depends on:
itertools
(likely to change)json
mdtraj
numpy
periodictable
pytables
scipy
Footnotes
-
That is, homogeneous with respect to the coherence volume of the incident X-rays. Or: the characteristic coherence length of the material under illumination is much smaller than the characteristic length over which incident X-rays remain coherent. Otherwise we move towards 'Diffuse Coherent Diffraction Imaging', in analogy to BCDI. ↩
-
See: Guinier, A. (1994). X-ray Diffraction In Crystals, Imperfect Crystals, and Amorphous Bodies. New York: Dover Publications; https://doi.org/10.1088/0953-4075/48/24/244010. ↩
-
Note that the limit of the final factor is well defined when the distance shrinks to zero, so this expression is well-defined for the self-scattering contribution. ↩
-
Of course, really the most general formula would utilize the actual electron density, but the independent atom approximation is an efficient ansatz. ↩