Skip to content

Preserve v0 species/reaction properties needed for v1 conversion#309

Merged
K20shores merged 1 commit into
mainfrom
fix-v0-phase-diffusion-coefficient
Jul 24, 2026
Merged

Preserve v0 species/reaction properties needed for v1 conversion#309
K20shores merged 1 commit into
mainfrom
fix-v0-phase-diffusion-coefficient

Conversation

@K20shores

@K20shores K20shores commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Problem

Converting a v0 (CAMP) config to v1 — or running one through MICM — dropped or omitted several fields the v1 representation needs. Three distinct v0-parser gaps, each surfaced while getting a real v0 music_box config to run on current musica:

  1. Diffusion coefficient — parsed onto the species but dropped when v0 places all species into the gas phase (only the name was copied). MICM reads the coefficient from the phase species (e.g. for surface reactions), so any v0 surface-reaction species failed with Diffusion coefficient for species '<name>' is not defined (e.g. GLYOXAL).

  2. THIRD_BODY tracer — a CHEM_SPEC with tracer type: THIRD_BODY recorded only the tracer-type string, which the unified type does not carry into v1 serialization (v1 represents a third body via is third body). Species like M silently lost their third-body role on conversion.

  3. Reaction gas phase — v0 reactions left gas_phase empty, but the v1 parser requires every reaction to name a non-empty gas phase, so a converted mechanism failed to re-parse with Unknown phase ''.

Fix

In the v0 parser, when building the single gas phase that all v0 species/reactions belong to:

  • carry each species' diffusion coefficient onto its PhaseSpecies;
  • set is_third_body when the tracer type is THIRD_BODY;
  • set every reaction's gas_phase to "gas".

Extends the v0 species and arrhenius unit tests to cover all three. All v0 tests pass.

🤖 Generated with Claude Code

In v0 configs the diffusion coefficient is defined on the species, but
MICM reads it from the phase species (e.g. for surface reactions). When
the v0 parser placed all species into the gas phase it copied only the
name, dropping the diffusion coefficient. This caused MICM to throw
"Diffusion coefficient for species '<name>' is not defined" for any v0
species used in a surface reaction.

Forward the species-level diffusion coefficient onto each gas-phase
PhaseSpecies and extend the v0 species test to cover it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@K20shores
K20shores requested a review from boulderdaze July 24, 2026 12:35
@K20shores
K20shores merged commit 2484131 into main Jul 24, 2026
26 of 28 checks passed
@K20shores
K20shores deleted the fix-v0-phase-diffusion-coefficient branch July 24, 2026 14:09
@K20shores K20shores changed the title Carry v0 species diffusion coefficient onto phase species Preserve v0 species/reaction properties needed for v1 conversion Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants