JuliaAtoms / AtomicLevels.jl

https://juliaatoms.org/AtomicLevels.jl
Other
12 stars 3 forks source link

Sorting and comparison of SpinOrbitals seems broken #99

Open jagot opened 3 years ago

jagot commented 3 years ago
julia> using AtomicLevels, Random

julia> os = rsos"5[s-p]"
8-element Vector{SpinOrbital{RelativisticOrbital{Int64}, Tuple{HalfIntegers.Half{Int64}}}}:
 5s(-1/2)
 5s(1/2)
 5p-(-1/2)
 5p-(1/2)
 5p(-3/2)
 5p(-1/2)
 5p(1/2)
 5p(3/2)

julia> ros = Random.shuffle(os)
8-element Vector{SpinOrbital{RelativisticOrbital{Int64}, Tuple{HalfIntegers.Half{Int64}}}}:
 5p(3/2)
 5s(1/2)
 5p-(1/2)
 5p-(-1/2)
 5p(-1/2)
 5p(-3/2)
 5s(-1/2)
 5p(1/2)

Sorting this vector does not seem to have any effect:

julia> sort(ros)
8-element Vector{SpinOrbital{RelativisticOrbital{Int64}, Tuple{HalfIntegers.Half{Int64}}}}:
 5p(3/2)
 5s(1/2)
 5p-(1/2)
 5p-(-1/2)
 5p(-1/2)
 5p(-3/2)
 5s(-1/2)
 5p(1/2)

But comparing these vectors returns false...

julia> sort(ros) == os
false

julia> sort(ros) .== os
8-element BitVector:
 0
 1
 0
 0
 0
 0
 0
 0