From c40dd9d0f7cae08e4c3fa37a4238bf9097f8ec5c Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Thu, 30 Oct 2025 15:30:55 -0400 Subject: [PATCH] fix(network-construction): added check to reject reaclib weak reactions reaclib provides a small number of weak reactions which allow for things like closing the CNO cycle. Howevever, they are not of the same quality as the WRL reactions. Therefore we ignore them during network construction through a simple heuristic (is the mass number the same on both sides and is there exactly 1 product and reactant (ignoring the beta +/- particle). This is one of the final steps before actually enabling weak reactions since withouty turning these off we would be double counting weak reactions. --- src/lib/engine/procedures/construction.cpp | 25 ++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/lib/engine/procedures/construction.cpp b/src/lib/engine/procedures/construction.cpp index 194ed57f..6aae513b 100644 --- a/src/lib/engine/procedures/construction.cpp +++ b/src/lib/engine/procedures/construction.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "gridfire/reaction/reaction.h" #include "gridfire/reaction/reaclib.h" @@ -16,6 +17,26 @@ #include "quill/Logger.h" #include "quill/LogMacros.h" +namespace { + bool reaclib_reaction_is_weak(const gridfire::reaction::Reaction& reaction) { + std::vector reactants = reaction.reactants(); + std::vector products = reaction.products(); + + if (reactants.size() != products.size()) { + return false; + } + + if (reactants.size() != 1 || products.size() != 1) { + return false; + } + + if (std::floor(reactants[0].a()) != std::floor(products[0].a())) { + return false; + } + + return true; + } +} namespace gridfire { using reaction::ReactionSet; @@ -48,7 +69,7 @@ namespace gridfire { // Clone all relevant REACLIB reactions into the master pool const auto& allReaclibReactions = reaclib::get_all_reaclib_reactions(); for (const auto& reaction : allReaclibReactions) { - if (reaction->is_reverse() == reverse) { + if (reaction->is_reverse() == reverse) { // Only add reactions of the correct direction and which are not weak. Weak reactions are handled from the WRL separately which provides much higher quality weak reactions than reaclib does master_reaction_pool.add_reaction(reaction->clone()); } } @@ -95,7 +116,7 @@ namespace gridfire { // ) // ); // } - // } TODO: Remove comments, weak reactions have been disabled for testing + // } // TODO: Remove comments, weak reactions have been disabled for testing // --- Step 2: Use non-owning raw pointers for the fast build algorithm --- std::vector remainingReactions;