Skip to content

Commit

Permalink
Merge pull request #211 from pablosanjose/allow_empty_sublats
Browse files Browse the repository at this point in the history
Allow empty sublats
  • Loading branch information
pablosanjose authored Oct 12, 2023
2 parents 5e085d8 + e238812 commit b06c4ad
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion docs/src/tutorial/observables.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ julia> f = Figure(); a = Axis(f[1,1], xlabel = "ω/t", ylabel = "T(ω)"); lines!
```@raw html
<img src="../../assets/four_terminal_T.png" alt="Total transmission from right contact" width="400" class="center"/>
```
So we indeed find that the 90-degree transmission `T₃₁` is indeed larger than the forward transmission `T₂₁` for all energies. The rapid oscillations are due to mesoscopic fluctuations.

!!! note "Total transmission vs transmission probability"
Note that `transmission` gives the total transmission, which is the sum of the transmission probability from each orbital in the source contact to any other orbital in the drain contact. As such it is not normalized to 1, but to the number of source orbitals. It also gives the local conductance from a given contact in units of $$e^2/h$$ according to the Landauer formula, $$G\_j = e^2/h \sum_i T_{ij}(eV)$$.
Note that `transmission` gives the total transmission, which is the sum of the transmission probability from each orbital in the source contact to any other orbital in the drain contact. As such it is not normalized to 1, but to the number of source orbitals. It also gives the local conductance from a given contact in units of $$e^2/h$$ according to the Landauer formula, $$G_j = e^2/h \sum_i T_{ij}(eV)$$.

## Conductance

Expand Down
1 change: 1 addition & 0 deletions src/docstrings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1726,6 +1726,7 @@ dω ∑ⱼ [fᵢ(ω) - fⱼ(ω)] Gᵢⱼ(ω)``, where ``fᵢ(ω)`` is the Fermi
Compute the conductance at the specified contacts.
# Examples
```jldoctest
julia> # A central system g0 with two 1D leads and transparent contacts
Expand Down
6 changes: 0 additions & 6 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
struct Sublat{T<:AbstractFloat,E}
sites::Vector{SVector{E,T}}
name::Symbol
function Sublat{T,E}(sites, name) where {T<:AbstractFloat,E}
isempty(sites) && argerror("Sublattices cannot be empty")
return new(sites, name)
end
end

struct Unitcell{T<:AbstractFloat,E}
Expand Down Expand Up @@ -41,8 +37,6 @@ end

#region ## Constructors ##

Sublat(sites::Vector{SVector{E,T}}, name::Symbol) where {T,E} = Sublat{T,E}(sites, name)

Bravais(::Type{T}, E, m) where {T} = Bravais(T, Val(E), m)
Bravais(::Type{T}, ::Val{E}, m::Tuple{}) where {T,E} =
Bravais{T,E,0}(sanitize_Matrix(T, E, ()))
Expand Down
5 changes: 4 additions & 1 deletion test/test_greenfunction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function testgreen(h, s; kw...)
return nothing
end

@testset "bare greenfunctions" begin
@testset "basic greenfunctions" begin
h0 = LP.honeycomb() |> hamiltonian(hopping(SA[0 1; 1 0]), orbitals = 2) |> supercell(region = RP.circle(10))
s0 = GS.SparseLU()
h1 = LP.square() |> hamiltonian(@onsite((; o = 1) -> o*I) + hopping(SA[0 1; 1 0]), orbitals = 2) |> supercell((1,0), region = r -> abs(r[2]) < 2)
Expand Down Expand Up @@ -66,6 +66,9 @@ end
testgreen(oh, s)
end
end
# contacts that don't include all sublattices
h = lattice(sublat(0, name = :L), sublat(1, name = :R)) |> hamiltonian
@test h |> attach(onsite->1), sublats = :L) |> greenfunction isa GreenFunction
end

@testset "greenfunction KPM" begin
Expand Down
2 changes: 1 addition & 1 deletion test/test_lattice.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ end
end
@test sublat((3,)) isa Sublat{Float64,1}
@test sublat(()) isa Sublat{Float64,0}
@test_throws ArgumentError sublat(SVector{3,Float64}[])
@test sublat(SVector{3,Float64}[]) isa Sublat{Float64,3}
end

@testset "lattice construction" begin
Expand Down
2 changes: 2 additions & 0 deletions test/test_plots.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@test_throws ArgumentError qplot(LP.linear()) # no backend loaded

using CairoMakie

@testset "plot lattice" begin
Expand Down

0 comments on commit b06c4ad

Please sign in to comment.