SunnySuite / Sunny.jl

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

`intensities_bands` doesn't accept arbitrarily shaped arrays #252

Closed ddahlbom closed 2 months ago

ddahlbom commented 4 months ago

In contrast with the other intensities functions (e.g., intensities_interpolated, intensities_broadened), intensities_bands only accepts linear arrays of wave vectors. For example, the following,

qs = [(a, b, 0) for a in range(-1, 1, 100), b in range(-1, 1, 100)]
disp, is = intensities_bands(swt, qs, formula)

will throw a broadcast error, whereas the other intensities functions will return an array with dimensions consistent with the input array of wave vectors.

Just leaving this as a reminder. Changing this would be good for interface consistency and for being able to create 3D plots of dispersion relations.

Lazersmoke commented 2 months ago

Oops my bad! Just need to replace length(ks) -> size(ks)... on these lines I think:

https://github.com/SunnySuite/Sunny.jl/blob/4cebde92584accaf0be43f6e25a872ae8c442812/src/Intensities/LinearSpinWaveIntensities.jl#L68C38-L69

kbarros commented 2 months ago

This was fixed in https://github.com/SunnySuite/Sunny.jl/pull/265, which has become part of https://github.com/SunnySuite/Sunny.jl/pull/230.