I am trying to understand the implementation of dynasor. I have a question regarding the computation of the dynamic structure factor F(q,t).
Why a “windowed” algorithm is used ? Like for \text{MSD} computation, I was thinking a method based on Fast Fourier Transform (according to the definition : \left< n({\bf q}, t)n({\bf -q}, 0) \right>) would be used in place.
Maybe I lack some physical/mathematical/numerical background, but I can’t understand the choice of windowing. Or I did not understand the code.
Hi,
Yes autocorrelation functions could be computed with FFTs, but in dynasor for F(q, t) this is done by computing the ACF directly in the time domain.
The FFT approach is likely faster, but requires holding the entire time signal n(q, t) in memory which can be prohibitive, whereas calculating the ACF in the time domain allows one to only hold a part (a window) of the full signal in memory, see here for a schematic representation of this.
This allows you to compute the F(q, t) for trajectories with millions of snapshots and thousands of q-points for which using FFT could be difficult due to memory limitations.
To continue the discussion, according to the documentation, how does dynasor do the averages if there are multiple windows generated from the setting? Is it first calculating the ISF on each window, and then do averages on those separate windows?
Im not sure what you mean by multiple windows, since almost always there will be multiple windows unless you set window size equal to trajectory length.
But yes ACF is computed in each window separately, and then in the end the ACF is an averaged over all these.