diff --git a/src/Intensities/LinearSpinWaveIntensities.jl b/src/Intensities/LinearSpinWaveIntensities.jl index 1953d4e53..491c468a3 100644 --- a/src/Intensities/LinearSpinWaveIntensities.jl +++ b/src/Intensities/LinearSpinWaveIntensities.jl @@ -65,8 +65,8 @@ function intensities_bands(swt::SpinWaveTheory, ks, formula::SpinWaveIntensityFo # Get the type parameter from the BandStructure return_type = typeof(formula).parameters[1].parameters[2] - band_dispersions = zeros(Float64,length(ks),2nmodes) - band_intensities = zeros(return_type,length(ks),2nmodes) + band_dispersions = zeros(Float64,length(ks), nmodes) + band_intensities = zeros(return_type,length(ks), nmodes) for kidx in CartesianIndices(ks) band_structure = formula.calc_intensity(swt, ks[kidx]) diff --git a/src/SpinWaveTheory/DispersionAndIntensities.jl b/src/SpinWaveTheory/DispersionAndIntensities.jl index f2c0aaca3..ee5deac33 100644 --- a/src/SpinWaveTheory/DispersionAndIntensities.jl +++ b/src/SpinWaveTheory/DispersionAndIntensities.jl @@ -42,8 +42,7 @@ function bogoliubov!(V::Matrix{ComplexF64}, H::Matrix{ComplexF64}) # Inverse of λ gives eigenvalues of Ĩ H. We only care about the first L # eigenvalues, which are positive. A factor of 2 is needed to get the # physical quasiparticle energies. - #disp = resize!(λ, L) - disp = λ + disp = resize!(λ, L) @. disp = 2 / disp # In the special case that H(q) = H(-q) (i.e., a magnetic ordering with @@ -104,7 +103,7 @@ function dispersion(swt::SpinWaveTheory, qs) H = zeros(ComplexF64, 2nmodes, 2nmodes) V = zeros(ComplexF64, 2nmodes, 2nmodes) - disp = zeros(Float64, 2nmodes, length(qs)) + disp = zeros(Float64, nmodes, length(qs)) for (iq, q) in enumerate(qs) q_reshaped = to_reshaped_rlu(swt.sys, q) @@ -154,8 +153,8 @@ function dssf(swt::SpinWaveTheory, qs) qs = Vec3.(qs) nmodes = num_bands(swt) - disp = zeros(Float64, 2nmodes, size(qs)...) - Sαβs = zeros(ComplexF64, 3, 3, 2nmodes, size(qs)...) + disp = zeros(Float64, nmodes, size(qs)...) + Sαβs = zeros(ComplexF64, 3, 3, nmodes, size(qs)...) # dssf(...) doesn't do any contraction, temperature correction, etc. # It simply returns the full Sαβ correlation matrix @@ -165,7 +164,7 @@ function dssf(swt::SpinWaveTheory, qs) for qidx in CartesianIndices(qs) q = qs[qidx] band_structure = formula.calc_intensity(swt,q) - for band = 1:(2nmodes) + for band = 1:nmodes disp[band,qidx] = band_structure.dispersion[band] Sαβs[:,:,band,qidx] .= band_structure.intensity[band] end @@ -248,7 +247,7 @@ function intensity_formula(f::Function,swt::SpinWaveTheory,corr_ix::AbstractVect H = zeros(ComplexF64, 2*nmodes, 2*nmodes) V = zeros(ComplexF64, 2*nmodes, 2*nmodes) Avec_pref = zeros(ComplexF64, Nm) - intensity = zeros(return_type, 2nmodes) + intensity = zeros(return_type, nmodes) # Expand formfactors for symmetry classes to formfactors for all atoms in # crystal @@ -364,7 +363,7 @@ function intensity_formula(f::Function,swt::SpinWaveTheory,corr_ix::AbstractVect # If there is no specified kernel, we are done: just return the # BandStructure - return BandStructure{2*nmodes,return_type}(disp, intensity) + return BandStructure{nmodes,return_type}(disp, intensity) else # Smooth kernel --> Intensity as a function of ω (or a list of ωs) return function(ω) diff --git a/src/Sunny.jl b/src/Sunny.jl index 568132a76..7305c216f 100644 --- a/src/Sunny.jl +++ b/src/Sunny.jl @@ -101,7 +101,7 @@ include("SpinWaveTheory/DispersionAndIntensities.jl") include("SpinWaveTheory/Lanczos.jl") include("SpinWaveTheory/Chebyshev.jl") include("SpinWaveTheory/KPM.jl") -export SpinWaveTheory, dispersion, dssf, kpm_dssf, kpm_intensities +export SpinWaveTheory, dispersion, dssf, kpm_dssf, kpm_intensities, delta_function_kernel include("SampledCorrelations/SampledCorrelations.jl") include("SampledCorrelations/CorrelationUtils.jl") diff --git a/test/test_lswt.jl b/test/test_lswt.jl index 6e8005fbe..ba4993cca 100644 --- a/test/test_lswt.jl +++ b/test/test_lswt.jl @@ -81,8 +81,6 @@ end -""" - @testitem "Lanczos Bounds" begin using LinearAlgebra n=10 @@ -644,4 +642,4 @@ end is_ref = [0.042551643530614226 0.05061618774203612 0.06118972834822155 0.07541981401191966 0.09518339306332815 0.12371078181463013 0.1669136576105103 0.23644634156679015 0.3574143016120729 0.589319004913063 1.0795750388213625 2.0570916947398903 2.6569442073245604 1.6749367428248116 0.8709898932656854 0.4927038808971025 0.30849624153704924 0.20903618563778026 0.1502266820186879 0.11286975075833217 0.08777050885259896 0.07013929292833648 0.057300827672198455 0.047672208009393216 0.04027090049655778 0.0344619791000266 0.02982086993597283 0.02605519995256082 0.022958441606058772 0.020381422739929135 0.01821426297223774 0.016374601990583864 0.014799738769001156 0.013441266708211906 0.01226133976759786 0.01123002734145714 0.010323410070056573 0.009522188815697288 0.008810654796662341 0.008175917662895354 0.007607320304517221 0.007095990541228231 0.006634494316422953 0.006216564975067639 0.005836890143659928 0.00549094262866035 0.005174845247781923 0.0048852620341421574 0.004619310095626147 0.004374487768740016 0.00414861571474443; 0.14853118271457438 0.19360218524421224 0.2621797495216911 0.3732135013522173 0.5678610986270936 0.944407657666259 1.7450675448755357 3.2945578443571577 3.9947874291087895 2.418790606759786 1.2612861617795654 0.7201697967624341 0.45442367736983386 0.30970051154679945 0.22353509755861065 0.1685055354270234 0.1313752454162916 0.10520387618639207 0.0860938574888819 0.0717287252840356 0.060665219355115055 0.05196772774655005 0.045008912709399315 0.03935576182418519 0.03470177881993486 0.030825189142763776 0.027562374631854493 0.024790523018178495 0.02241601889071837 0.020366506674885078 0.018585357752204528 0.017027745220739847 0.015657814448345492 0.014446613655329999 0.013370560099471452 0.01241028925551664 0.011549781566933818 0.010775692876605122 0.010076836041215703 0.009443775967574439 0.008868510590520351 0.008344217576743833 0.007865051732026552 0.007425981842385972 0.007022658419610481 0.006651305841367626 0.006308633878300496 0.005991764727412878 0.005698172523177506 0.0054256329470820505 0.005172181054614204; 0.042551643530614205 0.0506161877420361 0.06118972834822153 0.07541981401191963 0.0951833930633281 0.12371078181463005 0.16691365761051016 0.23644634156678992 0.3574143016120724 0.5893190049130621 1.0795750388213603 2.0570916947398867 2.656944207324563 1.6749367428248163 0.8709898932656877 0.4927038808971036 0.30849624153704985 0.20903618563778062 0.15022668201868813 0.1128697507583323 0.08777050885259907 0.07013929292833657 0.05730082767219852 0.04767220800939327 0.04027090049655782 0.03446197910002663 0.02982086993597286 0.026055199952560844 0.02295844160605879 0.020381422739929156 0.018214262972237757 0.016374601990583878 0.014799738769001168 0.013441266708211913 0.01226133976759787 0.011230027341457147 0.010323410070056582 0.009522188815697295 0.008810654796662348 0.00817591766289536 0.007607320304517226 0.007095990541228234 0.006634494316422957 0.006216564975067644 0.005836890143659932 0.005490942628660353 0.005174845247781927 0.00488526203414216 0.00461931009562615 0.0043744877687400185 0.0041486157147444325] @test is ≈ is_ref -end \ No newline at end of file +end