JuliaAtoms / AtomicLevels.jl

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

Invalid Array dimensions when constructing CSFs from open-core configurations #22

Closed jagot closed 4 years ago

jagot commented 5 years ago
julia> c=c"[Kr]* 5s2 5p6"
1s² 2s² 2p⁶ 3s² 3p⁶ 3d¹⁰ 4s² 4p⁶ 5s² 5p⁶

julia> csfs(c)
ERROR: invalid Array dimensions
Stacktrace:
 [1] Type at ./boot.jl:394 [inlined]
 [2] similar at ./array.jl:331 [inlined]
 [3] repeat(::Array{IntermediateTerm,1}, ::Int64) at ./abstractarraymath.jl:292
 [4] (::getfield(AtomicLevels, Symbol("##98#99")){Orbital{Int64},Int64})(::Term) at /home/jagot/.julia/dev/AtomicLevels/src/terms.jl:169
 [5] iterate at ./generator.jl:47 [inlined]
 [6] _collect(::Array{Term,1}, ::Base.Generator{Array{Term,1},getfield(AtomicLevels, Symbol("##98#99")){Orbital{Int64},Int64}}, ::Base.EltypeUnknown, ::Base.HasShape{1}) at ./array.jl:632
 [7] collect_similar(::Array{Term,1}, ::Base.Generator{Array{Term,1},getfield(AtomicLevels, Symbol("##98#99")){Orbital{Int64},Int64}}) at ./array.jl:561
 [8] map(::Function, ::Array{Term,1}) at ./abstractarray.jl:1987
 [9] intermediate_terms(::Orbital{Int64}, ::Int64) at /home/jagot/.julia/dev/AtomicLevels/src/terms.jl:155
 [10] iterate at /home/jagot/.julia/dev/AtomicLevels/src/terms.jl:178 [inlined]
 [11] collect_to!(::Array{Array{IntermediateTerm,1},1}, ::Base.Generator{Configuration{Orbital{Int64}},getfield(AtomicLevels, Symbol("##100#101"))}, ::Int64, ::Tuple{Tuple{Orbital{Int64},Int64,Symbol},Int64}) at ./array.jl:656
 [12] collect_to_with_first!(::Array{Array{IntermediateTerm,1},1}, ::Array{IntermediateTerm,1}, ::Base.Generator{Configuration{Orbital{Int64}},getfield(AtomicLevels, Symbol("##100#101"))}, ::Tuple{Tuple{Orbital{Int64},Int64,Symbol},Int64}) at ./array.jl:643
 [13] collect(::Base.Generator{Configuration{Orbital{Int64}},getfield(AtomicLevels, Symbol("##100#101"))}) at ./array.jl:624
 [14] map at ./abstractarray.jl:2013 [inlined]
 [15] intermediate_terms at /home/jagot/.julia/dev/AtomicLevels/src/terms.jl:177 [inlined]
 [16] csfs(::Configuration{Orbital{Int64}}) at /home/jagot/.julia/dev/AtomicLevels/src/csfs.jl:41
 [17] top-level scope at none:0
 [18] eval_user_input(::Any, ::REPL.REPLBackend) at /build/julia/src/julia-1.0.3/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:85
 [19] run_backend(::REPL.REPLBackend) at /home/jagot/.julia/packages/Revise/yp5KG/src/Revise.jl:769
 [20] (::getfield(Revise, Symbol("##58#60")){REPL.REPLBackend})() at ./task.jl:259

julia> csfs(c"[Kr] 5s2 5p6")
1-element Array{CSF{Orbital,IntermediateTerm,Term},1}:
 [Kr]ᶜ 5s²(₀¹S|¹S) 5p⁶(₀¹S|¹S)+
jagot commented 4 years ago

Seems to work now

julia> c=c"[Kr]* 5s2 5p6"
1s² 2s² 2p⁶ 3s² 3p⁶ 3d¹⁰ 4s² 4p⁶ 5s² 5p⁶

julia> csfs(c)
1-element Array{CSF{Orbital{Int64},Term,Seniority},1}:
 1s²(₀¹S|¹S) 2s²(₀¹S|¹S) 2p⁶(₀¹S|¹S) 3s²(₀¹S|¹S) 3p⁶(₀¹S|¹S) 3d¹⁰(₀¹S|¹S) 4s²(₀¹S|¹S) 4p⁶(₀¹S|¹S) 5s²(₀¹S|¹S) 5p⁶(₀¹S|¹S)+