Skip to content

Commit ef756ba

Browse files
committed
YAML: Reaction comparison can do irreversible reactions
Previously was failing functional test.
1 parent b99c811 commit ef756ba

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

test/rmgpy/yaml_writer/compare_yaml_outputs.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,19 @@ def process_side(side):
119119
normalized_components.append(normalized_component)
120120
return ' + '.join(sorted(set(normalized_components)))
121121

122-
reactants, products = equation.split('<=>')
122+
# Handle both reversible (<=>) and irreversible (=>) reactions
123+
if '<=>' in equation:
124+
reactants, products = equation.split('<=>')
125+
separator = '<=>'
126+
elif '=>' in equation:
127+
reactants, products = equation.split('=>')
128+
separator = '=>'
129+
else:
130+
raise ValueError(f"Unknown reaction format: {equation}")
131+
123132
normalized_reactants = process_side(reactants)
124133
normalized_products = process_side(products)
125-
return f"{normalized_reactants} <=> {normalized_products}"
134+
return f"{normalized_reactants} {separator} {normalized_products}"
126135

127136
def compare_reactions(self):
128137
reactions1 = self.yaml1.get_reaction_df()

0 commit comments

Comments
 (0)