Keep reactant-less v0 photolysis as an emission - #311
Closed
K20shores wants to merge 1 commit into
Closed
Conversation
The v0 photolysis parser silently dropped PHOTOLYSIS reactions with no reactants. Music Box Interactive encodes emissions this way (as a photolysis so they can carry an irr product), so those reactions -- and their irr accumulators -- were lost. A reactant-less photolysis is a pure production term, so parse it into the Emission list (which has no reactant) instead of dropping it. Adds a v0 photolysis test case. Relates to NCAR/musica#986. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #311 +/- ##
==========================================
+ Coverage 88.08% 88.42% +0.34%
==========================================
Files 44 44
Lines 2442 2661 +219
==========================================
+ Hits 2151 2353 +202
- Misses 291 308 +17
🚀 New features to boost your workflow:
|
Collaborator
Author
|
Superseded by #312: keep reactant-less reactions as photolysis (vector reactants) instead of routing to emission, so the PHOTO. rate-parameter label is preserved and no converter remap is needed. |
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, e.g.:{ "type": "PHOTOLYSIS", "__music_box_type": "EMISSION", "MUSICA name": "EMIS_NO", "reactants": {}, "products": {"NO": {"yield": 1}, "irr__...": {"yield": 1}} }In the CB05 MBI config, 14 of 39 photolysis reactions are reactant-less;
parse()returned only the 25 with reactants, so those emissions (and their irr accumulators) vanished. Downstream this breaks a music_box run: the conditions CSV still supplies their rates →User-defined rate parameter PHOTO.EMIS_NO not found in the mechanism.Fix
A reactant-less photolysis is a pure production term, so parse it into the
Emissionlist (which has no reactant) instead of dropping it. This keeps the reaction and itsirr__product. Reactions with a reactant are unchanged. Adds a v0 photolysis test case (a reactant-less reaction is now asserted to appear as an emission). All 12 v0 tests pass.Addresses NCAR/musica#986.
Follow-ups for the full pipeline
These reactions become emissions, so their MICM rate-parameter label changes from
PHOTO.<name>toEMIS.<name>. To run a converted MBI config (e.g. CB05) end-to-end, two more pieces are needed:PHOTO.<name>rate-parameter CSV columns toEMIS.<name>for reactions that are emissions.(An alternative design — making
Photolysis.reactantsa vector to allow zero reactants while keeping thePHOTO.label — was rejected here because it changes thePhotolysistype and would break musica's bindings, requiring an atomic cross-repo release. Routing toEmissionis self-contained.)🤖 Generated with Claude Code