Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pablosanjose committed Oct 9, 2024
1 parent 6885550 commit 0839501
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/test_hamiltonian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -439,18 +439,18 @@ end
h = combine(hb, h0, ht; coupling = hopping((r,dr) -> exp(-norm(dr)), range = 2))
@test !iszero(h((0,0))[1:2, 5:6])
# Parametric combine
h1 = LP.linear(dim = 2) |> hopping(1)
h1 = LP.linear(dim = 2) |> translate(SA[0,1]) |> hopping(1)
h2 = LP.linear(dim = 2) |> hamiltonian(@hopping((; p = 1) -> p*I), orbitals = 2)
coupling = @hopping((; p = 1) -> im*p*SA[1 0], range = 3, sublats = :B => :A) |> plusadjoint
@test_throws ArgumentError combine(h1, h2)
@test_throws ArgumentError combine(h1, h2) # non-unique names not allowed with parametric
@test_throws ArgumentError combine(h1, h2(); coupling)
@test combine(h1, h2()) isa Hamiltonian
@test combine(h1, h2()) isa Hamiltonian # non-unique names allowed with hamiltonian
h2 = LP.linear(dim = 2, names = :B) |> hamiltonian(@hopping((; p = 1) -> p*I), orbitals = 2)
@test combine(h1, h2) isa ParametricHamiltonian{Float64,2,1,Quantica.SMatrixView{2,2,ComplexF64,4}}
h = combine(h1, h2; coupling)
@test h isa ParametricHamiltonian{Float64,2,1,Quantica.SMatrixView{2,2,ComplexF64,4}}
# plustadjoint broken for ParametricModels
@test_broken h((p = 10))
@test ishermitian(h((p = 10)))
@test h(0; p = 10) == SA[2 50im 0; -50im 20 0; 0 0 20]
# block filtering
l1 = LP.linear(dim = 2, names = :A) |> supercell(2) |> supercell
l2 = translate(lattice(l1, names = :B), SA[0,1])
Expand Down

0 comments on commit 0839501

Please sign in to comment.