ComPWA / qrules

Rule-based particle reaction problem solver on a quantum number level
https://qrules.rtfd.io
Apache License 2.0
9 stars 5 forks source link

`StateTransitionManager.find_solutions()` crashes on certain allowed intermediate particles #33

Closed redeboer closed 1 year ago

redeboer commented 3 years ago

Bug description

StateTransitionManager.find_solutions crashes on certain allowed_intermediate_particles.

How to reproduce?

from expertsystem.reaction import StateTransitionManager, InteractionTypes
stm = StateTransitionManager(
    initial_state=[("Y(4260)", [-1, +1])],
    final_state=["D0", "D~0", "pi0", "pi0"],
    allowed_intermediate_particles=["D"],  # <--- HERE
    number_of_threads=1,
)
stm.set_allowed_interaction_types([InteractionTypes.Strong])
stm.add_final_state_grouping([["D0", "pi0"], ["D~0", "pi0"]])
problem_sets = stm.create_problem_sets()
result = stm.find_solutions(problem_sets)  # exception

Note: same behaviour if you use: ["D(0)", "D(2)", "D*"]

Expected behavior

The weird thing is that this does not happen if you select "D*" (D star):

stm = StateTransitionManager(
    initial_state=[("Y(4260)", [-1, +1])],
    final_state=["D0", "D~0", "pi0", "pi0"],
    allowed_intermediate_particles=["D*"],  # <--- HERE
    number_of_threads=1,
)
stm.set_allowed_interaction_types([InteractionTypes.Strong])
stm.add_final_state_grouping([["D0", "pi0"], ["D~0", "pi0"]])
problem_sets = stm.create_problem_sets()
result = stm.find_solutions(problem_sets)
len(result.transitions)  # 14

but neither if you take any particle:

stm = StateTransitionManager(
    initial_state=[("Y(4260)", [-1, +1])],
    final_state=["D0", "D~0", "pi0", "pi0"],
    # <--- NOTHING HERE
    number_of_threads=1,
)
stm.set_allowed_interaction_types([InteractionTypes.Strong])
stm.add_final_state_grouping([["D0", "pi0"], ["D~0", "pi0"]])
problem_sets = stm.create_problem_sets()
result = stm.find_solutions(problem_sets) 
len(result.transitions)  # 76

I would say the latter should give the expected result.

System info

Should happen on any system. Tried it on both 0.6.9 (ed932d7) and master (1caa526).

spflueger commented 3 years ago

And whats the precise error message?