Skip to content

Commit

Permalink
Fix the error of the commutation relation of canonical bosons.
Browse files Browse the repository at this point in the history
  • Loading branch information
waltergu committed Sep 15, 2023
1 parent 0afaeba commit 35264d2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/QuantumSystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function permute(id₁::FID{:f}, id₂::FID{:f})
end
function permute(id₁::FID{:b}, id₂::FID{:b})
if id₁'==id₂
return (Operator(id₁.nambu==creation ? 1 : -1), Operator(1, id₂, id₁))
return (Operator(iscreation(id₁) ? -1 : +1), Operator(1, id₂, id₁))
else
return (Operator(1, id₂, id₁),)
end
Expand Down
4 changes: 2 additions & 2 deletions test/QuantumSystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ end
opt = Operator(1.0, id₁, id₂)
@test latexstring(opt) == "b^{\\dagger}_{2, 1, ↓}b^{}_{2, 1, ↓}"

@test permute(id₁, id₂) == (Operator(+1), Operator(1, id₂, id₁))
@test permute(id₂, id₁) == (Operator(-1), Operator(1, id₁, id₂))
@test permute(id₁, id₂) == (Operator(-1), Operator(1, id₂, id₁))
@test permute(id₂, id₁) == (Operator(+1), Operator(1, id₁, id₂))
@test permute(id₁, id₄) == (Operator(1, id₄, id₁),)
@test permute(id₄, id₁) == (Operator(1, id₁, id₄),)
end
Expand Down

0 comments on commit 35264d2

Please sign in to comment.