Skip to content

Commit

Permalink
added dispersion function
Browse files Browse the repository at this point in the history
  • Loading branch information
abhirup-m committed Nov 7, 2024
1 parent 8d9e976 commit 21313d8
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/modelHamiltonians.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,13 @@ function KondoModel(
for indices in Iterators.product(1:numBathSites, 1:numBathSites)
if any((cavityIndices), indices)
kondoJ_indices = 0
continue
else
kondoJ_indices = kondoJ
end
if abs(kondoJ) < 1e-15
continue
end
up1, up2 = 2 .* indices .+ 1
down1, down2 = (up1, up2) .+ 1
push!(hamiltonian, ("n+-", [1, up1, up2], kondoJ_indices / 4)) # n_{d up, n_{0 up}
Expand Down Expand Up @@ -104,3 +108,53 @@ function KondoModel(
return hamiltonian
end
export KondoModel


function Dispersion(
numStates::Int64,
lowerCutOff::Float64,
upperCutoff::Float64,
discretisation::String;
phSymmetry::Bool=true,
)

@assert abs(lowerCutOff) abs(upperCutoff)
@assert discretisation == "log" || discretisation == "lin"
if discretisation == "log"
@assert lowerCutOff > 0
end

dispersion = zeros(numStates)
if discretisation == "log"
if phSymmetry
if numStates % 2 == 0
dispersion[1:2:end] .= 10. .^ range(log10(lowerCutOff), stop=log10(upperCutoff), length=div(numStates, 2))
dispersion[2:2:end] .= -1 .* dispersion[1:2:end]
else
dispersion[3:2:end] .= 10. .^ range(log10(lowerCutOff), stop=log10(upperCutoff), length=div(numStates - 1, 2))
dispersion[2:2:end] .= -1 .* dispersion[3:2:end]
end
else
if numStates % 2 == 0
dispersion .= 10. .^ range(log10(lowerCutOff), stop=log10(upperCutoff), length=numStates)
else
dispersion[2:end] .= 10. .^ range(log10(lowerCutOff), stop=log10(upperCutoff), length=numStates-1)
end
end
else
if phSymmetry
if numStates % 2 == 0
dispersion[1:2:end] = range(abs(lowerCutOff), stop=abs(upperCutoff), length=div(numStates, 2))
dispersion[2:2:end] .= -1 .* dispersion[1:2:end]
else
@assert dispersion[1] == 0
dispersion[1:2:end] = range(abs(lowerCutOff), stop=abs(upperCutoff), length=div(numStates+1, 2))
dispersion[2:2:end] .= -1 .* dispersion[3:2:end]
end
else
dispersion = collect(range(abs(lowerCutOff), stop=abs(upperCutoff), length=numStates))
end
end
return dispersion
end
export Dispersion

0 comments on commit 21313d8

Please sign in to comment.