Skip to content

Commit

Permalink
Merge pull request #344 from pablosanjose/spinless
Browse files Browse the repository at this point in the history
Bugfix: spinless nambu decoder
  • Loading branch information
pablosanjose authored Feb 27, 2025
2 parents 473efaf + 4c99870 commit 5091e05
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/meanfield.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ nambu_adjoint_significants(mat::SMatrix{N,N}, is_rotated) where {N} =
nambu_adjoint_significants(nambu_significants(mat), is_rotated)

function nambu_adjoint_significants(lmat::SVector{2}, _)
return -SA[0 1; 1 0] * conj(lmat)
return SA[0 1; -1 0] * conj(lmat)
end

function nambu_adjoint_significants(lmat::SMatrix{4,2}, is_rotated)
Expand Down
3 changes: 2 additions & 1 deletion test/test_greenfunction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -663,10 +663,11 @@ end
@test Φ[sites(1), sites(2)] -1.5 * Q * ρ12 * Q

# spinless nambu
oh = LP.linear() |> hamiltonian(hopping((r, dr) -> SA[1 sign(dr[1]); -sign(dr[1]) -1]) - onsite(SA[1 0; 0 -1]), orbitals = 2)
oh = LP.linear() |> hamiltonian(hopping((r, dr) -> SA[1 sign(dr[1]); -sign(dr[1]) -1]) - onsite(SA[1 0.1; 0.1 -1]), orbitals = 2)
g = oh |> greenfunction
Q = SA[1 0; 0 -1]
m = meanfield(g; selector = (; range = 1), nambu = true, hartree = r -> 1/(1+norm(r)), fock = 1.5, charge = Q)
@test !iszero(m()[sites(1)][1,2]) # decoder preserves pairing
@test_throws ArgumentError m(0.2, 0.3) # µ cannot be nonzero
Φ = m(0, 0.3)
ρ11 = m.rho(0, 0.3)[sites(1), sites(1)] - SA[0 0; 0 1]
Expand Down

0 comments on commit 5091e05

Please sign in to comment.