Allow photolysis reactions with no reactants - #312
Merged
Conversation
Make Photolysis.reactants a vector (at most one element) so a reactant-less photolysis is kept instead of dropped. Music Box Interactive encodes emissions as reactant-less photolysis (to carry an irr product); the v0 parser previously discarded them. The reaction stays a PHOTOLYSIS (keeping its PHOTO. rate-parameter label), so downstream configs that reference it by that label continue to work. - types::Photolysis::reactants: ReactionComponent -> vector (0 or 1) - v0 parser: keep the reaction with its (possibly empty) reactants - v1 parser: parse reactants as a list (schema already allowed 0-or-1) - validate + tests updated; v1 accepts an empty reactants list Addresses NCAR/musica#986. Pairs with a musica update to handle the list-valued photolysis reactants in the Python layer. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #312 +/- ##
==========================================
+ Coverage 88.08% 88.39% +0.31%
==========================================
Files 44 44
Lines 2442 2655 +213
==========================================
+ Hits 2151 2347 +196
- Misses 291 308 +17
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The v0 photolysis parser silently drops
PHOTOLYSISreactions whosereactantsis empty. Music Box Interactive encodes emissions as reactant-less photolysis so they can carry anirr__product; in the CB05 config, 14 of 39 photolysis reactions are reactant-less, so they (and their irr accumulators) vanished. A converted config then fails to run: the conditions CSV supplies rates for the dropped reactions (PHOTO.EMIS_NO not found).Fix
Make
Photolysis::reactantsa vector holding at most one component, and keep reactant-less reactions instead of dropping them. The reaction stays a PHOTOLYSIS (keeping itsPHOTO.<name>rate-parameter label), so downstream conditions that reference it by that label keep working with no remapping.types::Photolysis::reactants:ReactionComponent→std::vector<ReactionComponent>validate.cppand the v0/v1 photolysis tests updated (a reactant-less v0 reaction is asserted to stay a photolysis with an empty reactants list)All 34 tests pass.
Addresses NCAR/musica#986. Pairs with a musica change to handle the now list-valued photolysis reactants in the Python layer (getter/setter/serialize), plus a mechanism_configuration tag bump; they must be released together.
Supersedes #311 (which routed these to
Emission; keeping them as photolysis avoids changing the rate-parameter label, so no converter remap is needed).🤖 Generated with Claude Code