Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
kbarros committed Jan 6, 2025
1 parent d04ece1 commit fb8f20d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/KPM/Lanczos.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function lanczos_ref(A, S, v; niters)

Q = reduce(hcat, vs)
T = SymTridiagonal(αs, βs)
return Q, T
return (; Q, T)
end


Expand Down
5 changes: 4 additions & 1 deletion src/KPM/SpinWaveTheoryKPM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,12 @@ function intensities2!(data, swt_kpm::SpinWaveTheoryKPM, qpts; energies, kernel:
resolution = (kernel.fwhm/2) / max(-log10(tol), 0)

for ξ in 1:Nobs
# Don't accumulate observables that are zero
iszero(view(u, :, ξ)) && continue

mulA!(v, view(u, :, ξ))
mulS!(Sv, v)
c = sqrt(Sv' * v)
c = sqrt(real(Sv' * v))
v ./= c
tridiag, lhs_adj_Q = try
lanczos(mulA!, mulS!, v; lhs=u, min_iters=lanczos_iters, resolution, verbose)
Expand Down
2 changes: 1 addition & 1 deletion src/SpinWaveTheory/HamiltonianDipole.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function swt_hamiltonian_dipole!(H::Matrix{ComplexF64}, swt::SpinWaveTheory, q_r
(; local_rotations, stevens_coefs, sqrtS) = data
(; extfield, gs) = sys

L = nbands(swt)
L = nbands(swt)
@assert size(H) == (2L, 2L)

# Initialize Hamiltonian buffer
Expand Down
2 changes: 1 addition & 1 deletion test/test_kpm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
lhs = randn(N, 2)
v = randn(N)
v /= sqrt(dot(v, S, v))
Q, T = Sunny.lanczos_ref(A, S, v; niters=10)
(; Q, T) = Sunny.lanczos_ref(A, S, v; niters=10)
ev1 = eigvals(T)

mulA!(w, v) = mul!(w, A, v)
Expand Down

0 comments on commit fb8f20d

Please sign in to comment.