Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convenience methods to obtain correlations in direct space #267

Open
kbarros opened this issue May 23, 2024 · 1 comment
Open

Convenience methods to obtain correlations in direct space #267

kbarros opened this issue May 23, 2024 · 1 comment

Comments

@kbarros
Copy link
Member

kbarros commented May 23, 2024

Sunny currently returns all intensities in Fourier space (momentum $\mathbf{q}$ and energy $\omega$). There should be convenience functions get Fourier transformed intensities in real-space $\mathbf{r}$ and time $t$. This might need to wait until our next big interface refactor.

@Lazersmoke
Copy link
Contributor

I want to flag that this issue is the main blocking feature for the "paramagnetic fitting" workflow (i.e. fitting S(Q) at high temperatures where things are short-range correlated) which is the thing that Joe's Spinteract code and some of Sakib's codes are built around. Here's an old explainer about this.

I want to highlight that this is a true missing feature and not a missing convenience function. Specifically this line:

https://github.com/SunnySuite/SunnyContributed/blob/8c82b7b69cc98ce39bccd1d1a9a4f76939baf281/initiatives/Sam-GT/realspace/classical.jl#L70

# Sunny 0.6 code
# sc :: SampledCorrelations
real_corr = real.(ifft(sc.data,(4,5,6)))

uses a Sunny-internal feature (accessing .data of a SampledCorrelations). It has to be done like this (by manipulating sc.data instead of some returned intensities) because it needs sublattice-resolved information to do the computation. So the straightforward fix is to add

struct SublatResolvedIntensities{T, Q <: AbstractQPoints, D} <: AbstractIntensities
    # Original chemical cell with na atoms
    crystal :: Crystal
    # Wavevectors in RLU
    qpts :: Q
    # Regular grid of energies
    energies :: Vector{Float64}
    # Sublattice-resolved intensity data as continuum density
    data :: Array{T, D} # (na x na x nω × nq...)
end

and output this from intensities(...) somehow (but NOT by default, since na can be large in some cases and then you explicitly don't want to deal with a big na x na x etc thing). Then, the "direct space convenience method" is something that can be implemented by the user! (so that base sunny doesn't pick up any complexity from having to deal with maintaining/documenting that conversion. The sublattice-resolved structure factor is in fact already documented in the structure factor doc!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants