Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add omegamap option #247

Merged
merged 5 commits into from
Feb 28, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix bug, Schur unlinking
  • Loading branch information
pablosanjose committed Feb 28, 2024
commit c4643fa5d04256b42acfa2c6f7301508dd5093c5
4 changes: 3 additions & 1 deletion src/hamiltonian.jl
Original file line number Diff line number Diff line change
@@ -480,7 +480,9 @@ function nhoppings(h::AbstractHamiltonian)
return count
end

nonsites(h::AbstractHamiltonian) = nnzdiag(h[unflat()])
nonsites(h::Hamiltonian) = nnzdiag(h[unflat()])
# avoid call!, since params can have no default
nonsites(h::ParametricHamiltonian) = nonsites(hamiltonian(h))

coordination(h::AbstractHamiltonian) = iszero(nhoppings(h)) ? 0.0 : round(nhoppings(h) / nsites(lattice(h)), digits = 5)

4 changes: 2 additions & 2 deletions src/solvers/green/schur.jl
Original file line number Diff line number Diff line change
@@ -346,8 +346,8 @@ function apply(s::GS.Schur, h::AbstractHamiltonian1D, contacts::Contacts)
fsolver = SchurFactorsSolver(h´, s.shift)
h0 = unitcell_hamiltonian(h)
boundary = round(only(s.boundary))
rsites = stored_cols(h[unflat(1)])
lsites = stored_cols(h[unflat(-1)])
rsites = stored_cols(hamiltonian(h)[unflat(1)])
lsites = stored_cols(hamiltonian(h)[unflat(-1)])
orbslice_l = sites_to_orbs(lattice(h0)[cellsites((), lsites)], h)
orbslice_r = sites_to_orbs(lattice(h0)[cellsites((), rsites)], h)
ΣR_solver = SelfEnergySchurSolver(fsolver, h, :R)
2 changes: 1 addition & 1 deletion src/solvers/selfenergy/schur.jl
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ function SelfEnergy(hparent::AbstractHamiltonian, glead::GreenFunctionSchurEmpty
# convert lead site indices to lead orbital indices using lead's ContactOrbitals
leadorbs = reordered_site_orbitals(leadsites, cellsdict(contactorbitals(gunit)))
# translate glead unitcell by displacement, so it overlaps sel sites (modulo transform)
hlead = copy(parent(glead))
hlead = copy_lattice(parent(glead)) # don't copy, since you would break === link to fsolver
transform === missing || Quantica.transform!(hlead, transform)
translate!(hlead, displacement)
solver´ = SelfEnergySchurSolver(fsolver, hlead, reverse, leadorbs)
3 changes: 3 additions & 0 deletions test/test_greenfunction.jl
Original file line number Diff line number Diff line change
@@ -38,6 +38,9 @@ end
# This ensures that flat_sync! is called with multiorbitals when call!-ing ph upon calling g
g = LP.square() |> hamiltonian(@onsite(()->I), orbitals = 2) |> supercell |> greenfunction
@test g[](0.0 + 0im) ≈ SA[-1 0; 0 -1]
g = LP.linear() |> hopping(0) + @onsite((;ω=0) -> ω)|> greenfunction;
@test only(g[cellsites(SA[1],1)](1.0; ω = 0)) ≈ 1.0
@test only(g[cellsites(SA[1],1)](1.0; ω = -1)) ≈ 0.5
end

@testset "greenfunction with contacts" begin
Loading