  X-ray photon correlation spectroscopy (XPCS) allows for the resolution of
dynamic processes within a material across a wide range of length and time
scales. X-ray speckle visibility spectroscopy (XSVS) is a related method that
uses a single diffraction pattern to probe ultrafast dynamics. Interpretation
of the XPCS and XSVS data in terms of underlying physical processes is
necessary to establish the connection between the macroscopic responses and the
microstructural dynamics. To aid the interpretation of the XPCS and XSVS data,
we present a computational framework to model these experiments by computing
the X-ray scattering intensity directly from the atomic positions obtained from
molecular dynamics (MD) simulations. We compare the efficiency and accuracy of
two alternative computational methods: the direct method computing the
intensity at each diffraction vector separately, and a method based on fast
Fourier transform that computes the intensities at all diffraction vectors at
once. The computed X-ray speckle patterns capture the density fluctuations over
a range of length and time scales and are shown to reproduce the known
properties and relations of experimental XPCS and XSVS for liquids.
