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 733f785
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions src/modelHamiltonians.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,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 733f785

Please sign in to comment.