diff --git a/Hamiltonian.jl b/Hamiltonian.jl index a1b8f69..321c343 100644 --- a/Hamiltonian.jl +++ b/Hamiltonian.jl @@ -16,7 +16,7 @@ struct Hamiltonian{T} function Hamiltonian{T}(s::system{T}, V_twobody::Function, ϕ::Real, n_image::Int, mode::Hamiltonian_backend) where {T<:Float} @assert mode != gpu_cutensor || CUDA.functional() && CUDA.has_cuda() && CUDA.has_cuda_gpu() "CUDA not available" k = -s.N÷2:s.N÷2-1 - Vs = calculate_Vs(V_twobody, s, convert(T, ϕ), n_image) + Vs = calculate_Vs(s, V_twobody, convert(T, ϕ), n_image) hermitian = ϕ == 0.0 K_partial = (exp(-im * convert(T, ϕ)) * im / sqrt(2 * s.μ)) .* ∂_1DOF.(Ref(s), k, k') K_diag = nothing diff --git a/common.jl b/common.jl index 48be096..a81fb81 100644 --- a/common.jl +++ b/common.jl @@ -41,7 +41,7 @@ function get_Δk(s::system, i::CartesianIndex, dim::Int, p1::Int, p2::Int)::Int end "Calculate diagonal elements of the V matrix" -function calculate_Vs(V_twobody::Function, s::system{T}, ϕ::T, n_image::Int)::Array{Complex{T}} where {T<:Float} +function calculate_Vs(s::system{T}, V_twobody::Function, ϕ::T, n_image::Int)::Array{Complex{T}} where {T<:Float} coeff² = (exp(im * ϕ) * s.L / s.N)^2 images = collect.(Iterators.product(fill(-n_image:n_image, s.d)...)) # TODO: Learn how to use tuples instead of vectors Vs = zeros(Complex{T}, fill(s.N, s.d * (s.n - 1))...)