SunnySuite / Sunny.jl

Spin dynamics and generalization to SU(N) coherent states
Other
79 stars 19 forks source link

Asymmetric correlations (continued from #174 ) #217

Closed Lazersmoke closed 2 weeks ago

Lazersmoke commented 8 months ago

This is #174 but fixed up and rebased onto modern Sunny

Lazersmoke commented 7 months ago

Here is a list of what this PR adds/changes (can be condensed into some versions.md lines):

  1. Adds negative_energies=true support to the binning interface. (Required to be able to evaluate the sum rule, which requires integrating over [-fs/2,fs/2], and make this test pass)
  2. Corrects the overall scale of intensities returned by intensities_binned to correctly incorporate the bin size. (Required for binned sum rule to be satisfied)
  3. Adds concept of "unilateral_to_bilateral transformation" to the Contractions interface. (Required for agreement between LSWT (=true) and SampledCorrelations (=false). See here for the important part. Amounts to a factor of x2 in intensities in some cases)
  4. Documents/corrects the internal handling of indices of correlations in the contractions interface to be self-consistent.
  5. Adds support function intensities_band_structure, which returns the LSWT intensities in a neat struct bs::BandStructure with bs.dispersion and bs.intensities fields. The idea is that the normalization of these "delta function" intensities requires some verbal explanation (currently located in a comment), which can be given in a docstring for BandStructure later. (also adds show instance for this previously internal type).
  6. Allows querying both (Sx,Sy) and (Sy,Sx) correlations, which are different in general. (Although in certain special cases, such as classical dynamics they coincide up to time reversal/some other symmetry). There is a well-documented test which compares this to a reference time-domain algorithm.
  7. Fixes up the classical intensities calculation by: a. fixing wraparound bug using zero padding, b. inserting a 1/natoms factor, c. replacing an extraneous 1/n_omega with the correct 1/(T - |t|), d. enabling an optional cosine-squared window function which may be useful for systems which do not naturally decorrelate. These changes (correctly) alter the normalization of the intensities, and this change is documented in the test suite. (Required to make the test from (6.) pass)
  8. Optimizes memory allocation when using LSWT-with-kernel
  9. Adds a well-documented test of the "polyatomic sum rule," which is more stringent than existing sum rule tests. The existing "monoatomic" tests still exist and are now better documented
Lazersmoke commented 7 months ago

237 includes points (1) (2) (7b) (7c, sort of) and (9) from the above list

kbarros commented 2 weeks ago

This feature is currently out of scope, but can be revisited if there is sufficient user demand.