18. The FCA algorithm
Most of the quantities which can be extracted from MD simulations are time correlation functions. Correlation functions of discrete time series can be efficiently calculated by using the FFT [Ref44] . The FCA allows the number of multiplications (complexity) to be reduced from to . In MDANSE all time correlation functions are computed using the FCA method which will be outlined in the following. We will also briefly comment on spectral smoothing of Fourier transformed correlation functions.
We consider two time series
(18.1)
of length which are to be correlated. In the following the shorthands and will be used. The discrete correlation function of and is defined as
(18.2)
The prefactors in front of the sums ensure the proper normalization of the individual channels, . The asterisk denotes a complex conjugate. According to (18.2), has data points and obeys the symmetry relation
(18.3)
In case that and are identical, the corresponding correlation function is called an autocorrelation function. We define now the extended, periodic time series
(18.4)
which have the period ,
(18.5)
The discrete, cyclic correlation of and is defined as
(18.6)
It is easy to see that
(18.7)
Using the correlation theorem of discrete periodic functions [Ref44] , can be written as
(18.8)
where and are the discrete Fourier transforms of and , respectively:
(18.9)
If the Fourier transforms of the signals and as well as the inverse transform in (18.8) are computed by FFT, $S_{AB}(m)$ can be computed by $propto N_tlog_2(N_t)$ instead of $propto N_t^2$ multiplications. It is sometimes said that the FFT} method induces spurious correlations. We emphasize that this is only the case if the time series $a(k)$ and $b(k)$ are not properly extended, as indicated in Eqs. (18.4). The FFT method and the direct scheme (18.2) give, apart from round-off errors, identical results.
In many cases not only the computation of a correlation function is required, but also the computation of its Fourier spectrum. In principle one could use the product
(18.10)
which is already available as an intermediate step in the computation of according to (18.8). This would, however, not be a good estimate for the spectrum of [Ref45] . In MDANSE all spectra are smoothed by applying a window in the time domain [Ref45]
(18.11)
The time step in front of the sum yields the proper normalization of the spectrum. In MDANSE a Gaussian window [Ref46] is used:
(18.12)
Its widths in the time and frequency domain are and , respectively. We recall that is the length of the simulation. corresponds to the width of the resolution function of the Fourier spectrum.