Skip to content

Commit

Permalink
added gaussian broadening option to spec func
Browse files Browse the repository at this point in the history
  • Loading branch information
abhirup-m committed Dec 9, 2024
1 parent f22690f commit b6378b3
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/correlations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,14 @@ function SpecFunc(
degenTol::Float64=0.,
normalise::Bool=true,
silent::Bool=false,
broadFuncType::String="lorentz",
)

@assert length(eigVals) == length(eigVecs)

@assert broadFuncType ("lorentz", "gauss")
@assert issorted(freqValues)

broadeningFunc(x, standDev) = standDev ./ (x .^ 2 .+ standDev .^ 2)
broadeningFunc(x, standDev) = ifelse(broadFuncType=="lorentz", standDev ./ (x .^ 2 .+ standDev .^ 2), exp.(-0.5 .* ((x ./ standDev).^2)) ./ (standDev .* ((2π)^0.5)))

energyGs = minimum(eigVals)
specFunc = 0 .* freqValues
Expand Down Expand Up @@ -426,6 +427,7 @@ function SpecFunc(
degenTol::Float64=0.,
normalise::Bool=true,
silent::Bool=false,
broadFuncType::String="lorentz",
)
eigenStates = Vector{Float64}[]
for vector in eigVecs
Expand All @@ -437,7 +439,7 @@ function SpecFunc(
end

return SpecFunc(eigVals, eigenStates, probeMatrices, freqValues, standDev;
normalise=normalise, degenTol=degenTol, silent=silent)
normalise=normalise, degenTol=degenTol, silent=silent, broadFuncType=broadFuncType)
end
export SpecFunc

Expand All @@ -463,6 +465,7 @@ function SpecFunc(
degenTol::Float64=0.,
normalise::Bool=true,
silent::Bool=false,
broadFuncType::String="lorentz",
)
classifiedSpectrum, classifiedEnergies = ClassifyBasis(eigVecs, symmetries; energies=eigVals)
groundStateEnergy = minimum(eigVals)
Expand All @@ -487,7 +490,7 @@ function SpecFunc(
@assert groundStateEnergy == minimum(minimalEigVals)

return SpecFunc(minimalEigVals, minimalEigVecs, probes, freqValues, basisStates, standDev;
normalise=normalise, degenTol=degenTol, silent=silent)
normalise=normalise, degenTol=degenTol, silent=silent, broadFuncType=broadFuncType)
end
export SpecFunc

Expand Down Expand Up @@ -516,6 +519,7 @@ function SpecFunc(
degenTol::Float64=0.,
normalise::Bool=true,
silent::Bool=false,
broadFuncType::String="lorentz",
)
classifiedSpectrum, classifiedEnergies = ClassifyBasis(eigVecs, symmetries; energies=eigVals)
minimalEigVecs = Dict{BitVector,Float64}[]
Expand All @@ -542,7 +546,7 @@ function SpecFunc(
@assert groundStateEnergy == minimum(minimalEigVals)

return SpecFunc(minimalEigVals, minimalEigVecs, probes, freqValues, basisStates, standDev;
normalise=normalise, degenTol=degenTol, silent=silent)
normalise=normalise, degenTol=degenTol, silent=silent, broadFuncType=broadFuncType)
end
export SpecFunc

Expand All @@ -562,10 +566,11 @@ function SpecFunc(
degenTol::Float64=0.,
normalise::Bool=true,
silent::Bool=false,
broadFuncType::String="lorentz",
)

eigVecs = [collect(vec) for vec in eachcol(eigVecMatrix)]
return SpecFunc(eigVals, eigVecs, probes, freqValues, standDev;
normalise=normalise, degenTol=degenTol, silent=silent)
normalise=normalise, degenTol=degenTol, silent=silent, broadFuncType=broadFuncType)
end
export SpecFunc

0 comments on commit b6378b3

Please sign in to comment.