Implement observables API and autocorrelation time computation#28
Draft
RadiatedMonkey wants to merge 3 commits into
Draft
Implement observables API and autocorrelation time computation#28RadiatedMonkey wants to merge 3 commits into
RadiatedMonkey wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the new observables API and automatically computes autocorrelation times for observables.
An observable can be created by implementing the
Observabletrait for a struct. This struct can then be added to the system using theSystemBuilder::with\_observablefunction. The code makes use of a compile time HList to store the observables which means there is no runtime dynamic dispatch involved.After the system has thermalised, the system will measure all observables on every sweep. This information is then used to compute the autocorrelation time for each observables using the FFT method. This method works as follows:
Collect all observables into a time series and then subtract the mean of the *entire* series from each entry to normalise it. We then double the list in size, filling the remainder with zeroes. After this we take the Fast Fourier Transform of this list and multiply the last by its conjugate. We then take the inverse FFT of this list to obtain the autocorrelation.
To get the (integrated) autocorrelation time we finally divide the whole list by the first element and compute
This autocorrelation time tells us how many sweeps to discard between measurements.
To determine
Nwe use the Madras-Sokal window method. This method reduces the noise that is introduced by higher frequencies. For this we choose someWsuch thatfor
capproximately 5. ThisWis found by starting withW = 1and incrementing until the condition is satisfied. Once the autocorrelation times are established, measurements will only be taken every 2 autocorrelation times for each observable.While the simulation is running, we then recompute the autocorrelation times periodically.
Closes #9
Closes #8