Skip to content

Commit

Permalink
Sort SpinW reference in descending dispersion
Browse files Browse the repository at this point in the history
  • Loading branch information
kbarros committed Jun 6, 2024
1 parent 2b3b488 commit 9f62b99
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions test/test_spiral.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ end


@testitem "Langasite" begin
using LinearAlgebra
a = b = 8.539
c = 5.2414
latvecs = lattice_vectors(a, b, c, 90, 90, 120)
Expand Down Expand Up @@ -134,11 +133,15 @@ end
swt = SpinWaveTheory(sys)
formula = Sunny.intensity_formula_spiral(swt, :perp; k, axis, kernel=delta_function_kernel)
q = [0.41568,0.56382,0.76414]
disp, intensity = intensities_bands(swt, [q], formula);
SpinW_energies = [2.6267,3.8202,3.9422,2.8767,3.9095,4.4605,3.31724,4.0113,4.7564]
SpinW_intensities = [0.484724856017038, 0.962074686407910, 0.0932786148844105, 0.137966379056292, 0.0196590925454593, 2.37155695274281, 2.21507666401705, 0.118744173882554, 0.0547564956435423]
@test isapprox(disp[:], reverse(SpinW_energies); atol=1e-3)
@test isapprox(SpinW_intensities/Sunny.natoms(crystal), intensity[:]; atol=1e-3)
disp, intens = intensities_bands(swt, [q], formula)
# TODO: why reverse?
disp_spinw = reverse([2.6267,3.8202,3.9422,2.8767,3.9095,4.4605,3.31724,4.0113,4.7564])
intens_spinw = [0.484724856017038, 0.962074686407910, 0.0932786148844105, 0.137966379056292, 0.0196590925454593, 2.37155695274281, 2.21507666401705, 0.118744173882554, 0.0547564956435423]
# Sunny dispersion is given in descending. Sort SpinW calculation in the
# same way.
P = sortperm(disp_spinw; rev=true)
@test isapprox(disp[1,:], disp_spinw[P]; atol=1e-3)
@test isapprox(intens[1,:], intens_spinw[P]/Sunny.natoms(crystal); atol=1e-3)
end


Expand Down

0 comments on commit 9f62b99

Please sign in to comment.