From 6db570e2d3b71cd668c1d33c38e5b9666bebe830 Mon Sep 17 00:00:00 2001 From: johannes-moegerle Date: Wed, 7 Jan 2026 19:57:46 +0100 Subject: [PATCH 01/10] [submodule] update MQDT --- MQDT.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MQDT.jl b/MQDT.jl index df4e47d..9cb11fd 160000 --- a/MQDT.jl +++ b/MQDT.jl @@ -1 +1 @@ -Subproject commit df4e47dc2f4df56f0a42260e921ce56389b36657 +Subproject commit 9cb11fd5f2a930c8ee13ae388d9a7acbc228c43a From 21008f03914345f42bf70e10120547100b31b096 Mon Sep 17 00:00:00 2001 From: johannes-moegerle Date: Wed, 21 Jan 2026 18:00:15 +0100 Subject: [PATCH 02/10] [submodule] update rydstate --- rydstate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rydstate b/rydstate index b2d5597..2095748 160000 --- a/rydstate +++ b/rydstate @@ -1 +1 @@ -Subproject commit b2d559760779cfb2ff0158b9a05a00b9d3b53937 +Subproject commit 2095748c6faa61a9221f375a24d52a14901c9630 From 0def16b453d425900681404154a998e7c5fbc073 Mon Sep 17 00:00:00 2001 From: johannes-moegerle Date: Thu, 25 Dec 2025 21:57:32 +0100 Subject: [PATCH 03/10] get models of interest dynamically --- generate_database.jl | 48 +++++++++++++++-------- tables.jl | 92 -------------------------------------------- 2 files changed, 31 insertions(+), 109 deletions(-) delete mode 100644 tables.jl diff --git a/generate_database.jl b/generate_database.jl index a497187..c9465b8 100644 --- a/generate_database.jl +++ b/generate_database.jl @@ -10,7 +10,7 @@ using LRUCache include("utils.jl") -include("tables.jl") + version = "v1.1" function parse_commandline() @@ -78,34 +78,48 @@ function main() # initialize Wigner symbol calculation if args["skip-high-l"] - CGcoefficient.wigner_init_float(max(FMODEL_MAX_L[species], 5), "Jmax", 9) + CGcoefficient.wigner_init_float(10, "Jmax", 9) else CGcoefficient.wigner_init_float(n_max - 1, "Jmax", 9) end - parameters = PARA_TABLE[species] - models = MODELS_TABLE[species] - if args["skip-high-l"] - @info "Skipping high ℓ SQDT models." - high_l_models = [] - else - @info "Generating high ℓ SQDT models..." - l_max = n_max - 1 - l_start = FMODEL_MAX_L[species] + 1 - high_l_models = MQDT.single_channel_models(species, l_start:l_max) - models = vcat(models, high_l_models) + parameters = MQDT.get_species_parameters(species) + all_models = Vector{MQDT.fModel}() + + s_r = 1 / 2 + j_c = 1 / 2 + i_c = parameters.spin + for l_r = 0:(n_max-1) + for j_r = abs(l_r-s_r):1:(l_r+s_r) + for f_c = abs(j_c-i_c):1:(j_c+i_c) + for f_tot = abs(f_c-j_r):1:(f_c+j_r) + models = MQDT.get_fmodels(species, l_r, j_r, f_c, f_tot, parameters) + for model in models + if !any(m -> m.name == model.name, all_models) + push!(all_models, model) + end + end + end + end + end end @info "Calculating MQDT states..." - states = Vector{MQDT.EigenStates}(undef, length(models)) - for (i, M) in enumerate(models) - n_min = M in high_l_models ? n_min_high_l : NaN + states = Vector{MQDT.EigenStates}(undef, length(all_models)) + for (i, M) in enumerate(all_models) + n_min = NaN + if startswith(M.name, "SQDT") + if args["skip-high-l"] + continue + end + n_min = n_min_high_l + end @info "$(M.name)" states[i] = MQDT.eigenstates(n_min, n_max, M, parameters) @info " found nu_min=$(minimum(states[i].n)), nu_max=$(maximum(states[i].n)), total states=$(length(states[i].n))" end - basis = MQDT.basisarray(states, models) + basis = MQDT.basisarray(states, all_models) @info "Generated state table with $(length(basis.states)) states" @info "Converting states to database table..." diff --git a/tables.jl b/tables.jl deleted file mode 100644 index a1c8eec..0000000 --- a/tables.jl +++ /dev/null @@ -1,92 +0,0 @@ -using MQDT - -const MODELS_TABLE = Dict( - :Sr87 => [ - MQDT.Sr87.FMODEL_LOWN_P45, - MQDT.Sr87.FMODEL_HIGHN_S35, - MQDT.Sr87.FMODEL_HIGHN_S45, - MQDT.Sr87.FMODEL_HIGHN_S55, - MQDT.Sr87.FMODEL_HIGHN_P25, - MQDT.Sr87.FMODEL_HIGHN_P35, - MQDT.Sr87.FMODEL_HIGHN_P45, - MQDT.Sr87.FMODEL_HIGHN_P55, - MQDT.Sr87.FMODEL_HIGHN_P65, - MQDT.Sr87.FMODEL_HIGHN_D15, - MQDT.Sr87.FMODEL_HIGHN_D25, - MQDT.Sr87.FMODEL_HIGHN_D35, - MQDT.Sr87.FMODEL_HIGHN_D45, - MQDT.Sr87.FMODEL_HIGHN_D55, - MQDT.Sr87.FMODEL_HIGHN_D65, - MQDT.Sr87.FMODEL_HIGHN_D75, - MQDT.Sr87.FMODEL_HIGHN_F45, - ], - :Sr88 => [ - MQDT.Sr88.FMODEL_LOWN_P1, - MQDT.Sr88.FMODEL_HIGHN_S0, - MQDT.Sr88.FMODEL_HIGHN_S1, - MQDT.Sr88.FMODEL_HIGHN_P0, - MQDT.Sr88.FMODEL_HIGHN_P1, - MQDT.Sr88.FMODEL_HIGHN_P2, - MQDT.Sr88.FMODEL_HIGHN_D1, - MQDT.Sr88.FMODEL_HIGHN_D2, - MQDT.Sr88.FMODEL_HIGHN_D3, - MQDT.Sr88.FMODEL_HIGHN_F2, - MQDT.Sr88.FMODEL_HIGHN_F3, - MQDT.Sr88.FMODEL_HIGHN_F4, - ], - :Yb171 => [ - MQDT.Yb171.FMODEL_HIGHN_S05, - MQDT.Yb171.FMODEL_HIGHN_S15, - MQDT.Yb171.FMODEL_HIGHN_P05, - MQDT.Yb171.FMODEL_HIGHN_P15, - MQDT.Yb171.FMODEL_HIGHN_D05, - MQDT.Yb171.FMODEL_HIGHN_D15, - MQDT.Yb171.FMODEL_HIGHN_D25, - MQDT.Yb171.FMODEL_HIGHN_D35, - MQDT.Yb171.FMODEL_HIGHN_F25, - MQDT.Yb171.FMODEL_HIGHN_F35, - MQDT.Yb171.FMODEL_HIGHN_F45, - MQDT.Yb171.FMODEL_HIGHN_G25, - MQDT.Yb171.FMODEL_HIGHN_G35, - MQDT.Yb171.FMODEL_HIGHN_G45, - MQDT.Yb171.FMODEL_HIGHN_G55, - ], - :Yb173 => [ - MQDT.Yb173.FMODEL_HIGHN_S15, - MQDT.Yb173.FMODEL_HIGHN_S25, - MQDT.Yb173.FMODEL_HIGHN_S35, - MQDT.Yb173.FMODEL_HIGHN_P05, - MQDT.Yb173.FMODEL_HIGHN_P15, - MQDT.Yb173.FMODEL_HIGHN_P25, - MQDT.Yb173.FMODEL_HIGHN_P35, - MQDT.Yb173.FMODEL_HIGHN_P45, - ], - :Yb174 => [ - MQDT.Yb174.FMODEL_LOWN_P1, - MQDT.Yb174.FMODEL_HIGHN_S0, - MQDT.Yb174.FMODEL_HIGHN_S1, - MQDT.Yb174.FMODEL_HIGHN_P0, - MQDT.Yb174.FMODEL_HIGHN_P1, - MQDT.Yb174.FMODEL_HIGHN_P2, - MQDT.Yb174.FMODEL_HIGHN_D1, - MQDT.Yb174.FMODEL_HIGHN_D2, - MQDT.Yb174.FMODEL_HIGHN_D3, - MQDT.Yb174.FMODEL_HIGHN_F2, - MQDT.Yb174.FMODEL_HIGHN_F3, - MQDT.Yb174.FMODEL_HIGHN_F4, - MQDT.Yb174.FMODEL_HIGHN_G3, - MQDT.Yb174.FMODEL_HIGHN_G4, - MQDT.Yb174.FMODEL_HIGHN_G5, - ], -) - -const FMODEL_MAX_L = Dict(:Sr87 => 3, :Sr88 => 3, :Yb171 => 4, :Yb173 => 1, :Yb174 => 4) - - -const PARA_TABLE = Dict( - :Sr87 => MQDT.Sr87.PARA, - :Sr88 => MQDT.Sr88.PARA, - :Yb171 => MQDT.Yb171.PARA, - :Yb173 => MQDT.Yb173.PARA, - :Yb174 => MQDT.Yb174.PARA, -) From 083512743e82d32b50daa6c6788e83d48573ca7a Mon Sep 17 00:00:00 2001 From: johannes-moegerle Date: Thu, 22 Jan 2026 09:28:22 +0100 Subject: [PATCH 04/10] improve logging --- generate_database.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/generate_database.jl b/generate_database.jl index c9465b8..ad9ae8f 100644 --- a/generate_database.jl +++ b/generate_database.jl @@ -123,13 +123,14 @@ function main() @info "Generated state table with $(length(basis.states)) states" @info "Converting states to database table..." - states_df = basis_to_df(basis, parameters) + @timelog states_df = basis_to_df(basis, parameters) @info "Calculating matrix elements..." @timelog row_col_value_dict = all_matrix_element(basis, parameters) @info "Converting matrix elements to database table..." - matrix_elements_df_dict = Dict(k => rcv_to_df(v) for (k, v) in row_col_value_dict) + @timelog matrix_elements_df_dict = + Dict(k => rcv_to_df(v) for (k, v) in row_col_value_dict) @info "Storing database tables as parquet files..." tables = merge(Dict("states" => states_df), matrix_elements_df_dict) From aa869112e973573246789f9fef5add3d503a51a5 Mon Sep 17 00:00:00 2001 From: johannes-moegerle Date: Thu, 22 Jan 2026 12:18:35 +0100 Subject: [PATCH 05/10] improve performance --- utils.jl | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/utils.jl b/utils.jl index 50145f8..d98848d 100644 --- a/utils.jl +++ b/utils.jl @@ -39,7 +39,10 @@ function all_matrix_element(B::MQDT.BasisArray, parameters::MQDT.Parameters) "matrix_elements_q0" => Tuple{Int64,Int64,Float64}[], ) - states_indexed = [(ids - 1 + START_ID, state) for (ids, state) in enumerate(B.states)] + states_indexed = [(ids, state) for (ids, state) in enumerate(B.states)] + states_lr = [get_relevant_lr(s) for (_, s) in states_indexed] + states_nu = [get_relevant_nu(s) for (_, s) in states_indexed] + states_sorted = sort( states_indexed, by = x -> @@ -47,17 +50,16 @@ function all_matrix_element(B::MQDT.BasisArray, parameters::MQDT.Parameters) ) for (i1, (id1, s1)) in enumerate(states_sorted) - lr1 = get_relevant_lr(s1) - nus1 = get_relevant_nu(s1) + lr1 = states_lr[id1] + nus1 = states_nu[id1] for (id2, s2) in states_sorted[i1:end] - lr2 = get_relevant_lr(s2) - nus2 = get_relevant_nu(s2) - + lr2 = states_lr[id2] # Skip if all contributions of the two states are far apart in angular momentum if minimum(lr2) - maximum(lr1) > k_angular_max continue end + nus2 = states_nu[id2] # Skip if all contributions of the two states are far apart in n and None of them is low-n if all(abs(nu1-nu2) >= 11 for nu1 in nus1 for nu2 in nus2) && all(nu1 > 25 for nu1 in nus1) && @@ -78,9 +80,12 @@ function all_matrix_element(B::MQDT.BasisArray, parameters::MQDT.Parameters) for (i, key) in enumerate(table_keys) if m[i] != 0 - push!(row_col_value[key], (id1, id2, m[i])) + # start IDs from 0 for consistency with python + _id1 = id1 - 1 + START_ID + _id2 = id2 - 1 + START_ID + push!(row_col_value[key], (_id1, _id2, m[i])) if id1 != id2 - push!(row_col_value[key], (id2, id1, m[i] * prefactor_transposed)) + push!(row_col_value[key], (_id2, _id1, m[i] * prefactor_transposed)) end end end From 6a20e9d31ad130e36651490346448c7616cdc8c5 Mon Sep 17 00:00:00 2001 From: johannes-moegerle Date: Fri, 30 Jan 2026 10:19:22 +0100 Subject: [PATCH 06/10] skip high l states for high n --- generate_database.jl | 47 ++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/generate_database.jl b/generate_database.jl index ad9ae8f..0c0a863 100644 --- a/generate_database.jl +++ b/generate_database.jl @@ -10,6 +10,7 @@ using LRUCache include("utils.jl") +HIGH_L = 10 version = "v1.1" @@ -24,13 +25,17 @@ function parse_commandline() help = "The species to generate the database for" required = true arg_type = String - "--n-min-high-l" - help = "The minimal principal quantum number n for the high angular momentum (l) states to be included in the database." + "--n-min-sqdt" + help = "The minimal principal quantum number n for the SQDT models to be included in the database." default = 25 arg_type = Int + "--n-max-high-l" + help = "The maximal principal quantum number n for high angular momentum states (l > $HIGH_L) to be included in the database." + default = Inf + arg_type = Float64 "--n-max" help = "The maximum principal quantum number n for the states to be included in the database." - default = 90 + default = 110 arg_type = Int "--directory" help = "The directory where the database will be saved" @@ -39,9 +44,6 @@ function parse_commandline() "--overwrite" help = "Delete the species folder if it exists and create a new one" action = :store_true - "--skip-high-l" - help = "Include high angular momentum (l) states in the calculation" - action = :store_true end return parse_args(s) @@ -51,8 +53,9 @@ end function main() # Parse command line arguments args = parse_commandline() - n_min_high_l = args["n-min-high-l"] n_max = args["n-max"] + n_min_sqdt = args["n-min-sqdt"] + n_max_high_l = args["n-max-high-l"] directory = args["directory"] overwrite = args["overwrite"] species = Symbol(args["species"]) @@ -73,15 +76,11 @@ function main() global_logger(combined_logger) @info "Starting database generation for $species with version $version" - @info "Parameters: n_min_high_l=$n_min_high_l, n_max=$n_max" + @info "Parameters: $args" start_time = time() # initialize Wigner symbol calculation - if args["skip-high-l"] - CGcoefficient.wigner_init_float(10, "Jmax", 9) - else - CGcoefficient.wigner_init_float(n_max - 1, "Jmax", 9) - end + CGcoefficient.wigner_init_float(n_max - 1, "Jmax", 9) parameters = MQDT.get_species_parameters(species) all_models = Vector{MQDT.fModel}() @@ -107,16 +106,26 @@ function main() @info "Calculating MQDT states..." states = Vector{MQDT.EigenStates}(undef, length(all_models)) for (i, M) in enumerate(all_models) - n_min = NaN + _n_min = NaN + _n_max = n_max if startswith(M.name, "SQDT") - if args["skip-high-l"] - continue + _n_min = n_min_sqdt + if parameters.spin > 0 + l_ryd = MQDT.get_lr(M)[1] + if l_ryd >= n_max_high_l + _n_max = 0 + elseif l_ryd > HIGH_L + _n_max = min(n_max_high_l, n_max) + end end - n_min = n_min_high_l end @info "$(M.name)" - states[i] = MQDT.eigenstates(n_min, n_max, M, parameters) - @info " found nu_min=$(minimum(states[i].n)), nu_max=$(maximum(states[i].n)), total states=$(length(states[i].n))" + states[i] = MQDT.eigenstates(_n_min, _n_max, M, parameters) + if length(states[i].n) > 0 + @info " found nu_min=$(minimum(states[i].n)), nu_max=$(maximum(states[i].n)), total states=$(length(states[i].n))" + else + @info " found no states" + end end basis = MQDT.basisarray(states, all_models) From f3da0f5470ed825b63a596a6169ebeb2b3b16da1 Mon Sep 17 00:00:00 2001 From: johannes-moegerle Date: Fri, 30 Jan 2026 11:26:31 +0100 Subject: [PATCH 07/10] fix ci on main --- .github/workflows/generate_database.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/generate_database.yml b/.github/workflows/generate_database.yml index d8b19d7..5ee45ca 100644 --- a/.github/workflows/generate_database.yml +++ b/.github/workflows/generate_database.yml @@ -14,8 +14,8 @@ jobs: matrix: species: [Sr87, Sr88, Yb171, Yb173, Yb174] include: - # use n_max=220 for tags and master, but only n_max=100 for PRs, etc. - - n_max: ${{ (startsWith(github.ref, 'refs/tags/') || contains(github.ref, 'master')) && 220 || 100 }} + # use n_max=220 for tags and main, but only n_max=110 for PRs, etc. + - n_max: ${{ (startsWith(github.ref, 'refs/tags/') || contains(github.ref, 'main')) && 220 || 110 }} # FIXME: the following species do not yet support high \ell states - species: Sr87 extra_args: "--skip-high-l" @@ -23,7 +23,7 @@ jobs: extra_args: "--skip-high-l" - species: Yb173 extra_args: "--skip-high-l" # FIXME: Yb173 fails for n > 115 - n_max: ${{ (startsWith(github.ref, 'refs/tags/') || contains(github.ref, 'master')) && 115 || 100 }} + n_max: ${{ (startsWith(github.ref, 'refs/tags/') || contains(github.ref, 'main')) && 115 || 110 }} name: ${{ matrix.species }} runs-on: ubuntu-latest timeout-minutes: 300 From 0340657fd84254c3ebc95c20ea3130f0907de8a3 Mon Sep 17 00:00:00 2001 From: johannes-moegerle Date: Wed, 7 Jan 2026 19:59:48 +0100 Subject: [PATCH 08/10] [ci] calc high l for all species --- .github/workflows/generate_database.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/generate_database.yml b/.github/workflows/generate_database.yml index 5ee45ca..648591e 100644 --- a/.github/workflows/generate_database.yml +++ b/.github/workflows/generate_database.yml @@ -16,14 +16,13 @@ jobs: include: # use n_max=220 for tags and main, but only n_max=110 for PRs, etc. - n_max: ${{ (startsWith(github.ref, 'refs/tags/') || contains(github.ref, 'main')) && 220 || 110 }} - # FIXME: the following species do not yet support high \ell states + # for isotopes with hyperfine structure, we only include high-l states up to n=110 (otherwise the database size gets too large) - species: Sr87 - extra_args: "--skip-high-l" + extra_args: "--n-max-high-l 110" - species: Yb171 - extra_args: "--skip-high-l" + extra_args: "--n-max-high-l 110" - species: Yb173 - extra_args: "--skip-high-l" # FIXME: Yb173 fails for n > 115 - n_max: ${{ (startsWith(github.ref, 'refs/tags/') || contains(github.ref, 'main')) && 115 || 110 }} + extra_args: "--n-max-high-l 110" name: ${{ matrix.species }} runs-on: ubuntu-latest timeout-minutes: 300 @@ -37,7 +36,7 @@ jobs: - uses: julia-actions/setup-julia@v2 with: - version: 1.11 + version: 1.12 arch: x64 - uses: julia-actions/cache@v2 From ca7195751d43f85d79241ba1709aaa17890ef68f Mon Sep 17 00:00:00 2001 From: johannes-moegerle Date: Mon, 2 Feb 2026 09:17:54 +0100 Subject: [PATCH 09/10] small improvement --- generate_database.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/generate_database.jl b/generate_database.jl index 0c0a863..8f44d9f 100644 --- a/generate_database.jl +++ b/generate_database.jl @@ -88,13 +88,15 @@ function main() s_r = 1 / 2 j_c = 1 / 2 i_c = parameters.spin + seen_models = Set{String}() for l_r = 0:(n_max-1) for j_r = abs(l_r-s_r):1:(l_r+s_r) for f_c = abs(j_c-i_c):1:(j_c+i_c) for f_tot = abs(f_c-j_r):1:(f_c+j_r) models = MQDT.get_fmodels(species, l_r, j_r, f_c, f_tot, parameters) for model in models - if !any(m -> m.name == model.name, all_models) + if !(model.name in seen_models) + push!(seen_models, model.name) push!(all_models, model) end end From 42cd1837bc4707983a50239e14ecbf2fb82029b9 Mon Sep 17 00:00:00 2001 From: johannes-moegerle Date: Thu, 5 Feb 2026 10:20:56 +0100 Subject: [PATCH 10/10] bump version v1.2 --- generate_database.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate_database.jl b/generate_database.jl index 8f44d9f..d38fd1e 100644 --- a/generate_database.jl +++ b/generate_database.jl @@ -12,7 +12,7 @@ using LRUCache include("utils.jl") HIGH_L = 10 -version = "v1.1" +version = "v1.2" function parse_commandline() s = ArgParseSettings(