Skip to content

Sorting and comparison of SpinOrbitals seems broken #99

Description

@jagot
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions