Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting and comparison of SpinOrbitals seems broken #99

Open
jagot opened this issue May 6, 2021 · 0 comments
Open

Sorting and comparison of SpinOrbitals seems broken #99

jagot opened this issue May 6, 2021 · 0 comments

Comments

@jagot
Copy link
Member

jagot commented May 6, 2021

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant