# Simulation of Nuclear Quantum Effects in Condensed Matter Systems via Quantum Baths
## Appendix A Colored Noise Generation
The increase of the random force step \(h\) modifies its effective correlation spectrum, which should be taken into account by replacing filter (A1) with  
\[\hat{H}_{c}(\omega)=\frac{\hat{H}(\omega)}{C(\omega)},\ \ C(\omega)=\frac{\sin(h \,\omega/2)}{h\,\omega/2} \tag{10}\]  
that is, correcting with the Fourier transform of the appropriate square function, since the random force is kept constant on \(M\) consecutive timesteps. (iii) _Segmented_ noise generation  
In the adQTB method, the spectra \(C_{\alpha R}(\omega)\) and \(C_{\alpha V}(\omega)\) appearing in Equation (34) have to be evaluated periodically during the course of the simulation, in order to adapt the bath coefficients \(\gamma_{T}(\omega)\) or \(\gamma_{f}(\omega)\). The adaptation also implies that the colored noise correlation spectrum is modified periodically. Generating the noise a priori for the whole duration of the simulation is thus not possible. It would in principle be possible to divide the trajectory in segments of length \(T_{seg}=n\delta t\) and use the a priori method (i) to generate the colored noise at the beginning of each segment for the duration \(T_{seg}\) only. However, this would imply a rupture of the noise memory kernel, since the random force at the beginning of a new segment would be entirely uncorrelated with the force at the end of the former one. The associated error is small if \(T_{seg}\) is much longer than the random force typical correlation time, but this might not be the case, particularly when using short segments to accelerate the adaptation process. On the other hand, the _on-the-fly_ method (ii) is compatible with the adQTB--with a periodical adaptation of the filter \(\hat{H}(\omega)\)--but it requires the introduction of a large random force time step \(h=M\delta t\) in order to be computationally efficient. A workaround can be found with the _segmented_ noise generation, that combines ideas from both previous methods in order to alleviate their respective drawbacks. This method relies on the filtering Formula (A3), but the latter is applied at the beginning of each segment only, in order to generate the random force for the whole duration \(T_{seg}\), taking advantage of the computational efficiency of Fast Fourier Transform (FFT) algorithms in order to avoid the introduction of a larger step than \(\delta t\). In practice, one initializes the procedure by generating the normal white noise \(r_{i}\) for \(3n\) steps and store it in an array \(r(t)\). The convolution with the filter is then performed in the frequency domain at the beginning of each segment and the colored random force \(R(t)\) is finally obtained by backward FFT. The whole procedure can be summed up in the expressions:  
\[ \begin{split} r(t)&\leftrightarrow[r_{1},\dots,r _{3n}]\qquad\text{with }r_{i}\sim\mathcal{N}(0,\delta t)\\ R(t)&\leftrightarrow\text{FFT}^{-1}\Big{[}f_{\omega_ {max}}(\omega)\sqrt{2n\gamma_{T}(\omega)\theta(\omega,T)}\times\text{FFT}[r]( \omega)\Big{]}\\ &\qquad\text{for }t=i\delta t,i=n+1,\dots,2n\end{split}  \tag{11}\]  
where \(f_{\omega_{max}}(\omega)\) is a function implementing an explicit cutoff at frequency \(\omega_{max}\) (for instance a Fermi function centered at a well-chosen \(\omega_{max}<\pi/\delta t\) in order to avoid kinetic energy overestimation, as indicated in Section 4.1). Note that \(\hat{R}(\omega)\) should retain Hermitian symmetry in order for the resulting colored force in the time domain to be real. The random force used for the coming segment is then given by the middle part of \(R(t)\) (from index \(n+1\) to \(2n\)), even though the white noise \(r(t)\) is considered also for the preceding (\(i=1,\dots,n\)) and for the ulterior (\(i=2n+1,\dots,3n\)) ones, which avoids any rupture of the memory kernel at the transition between segments.