Skip to content

Commit 25b8472

Browse files
committed
Tests: SimpleReactor get_const_spc_indices()
1 parent 54c6495 commit 25b8472

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/rmgpy/solver/simpleTest.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,3 +759,29 @@ def test_specific_collider_model(self):
759759
# order: Ar, N2, O2, H, CH3, CH4
760760
for i in range(len(simulated_mole_fracs)):
761761
assert round(abs(simulated_mole_fracs[i] - expected_mole_fracs[i]), 6) == 0
762+
763+
def test_get_const_spc_indices(self):
764+
"""
765+
Test that const_spc_names are correctly mapped to core species indices.
766+
"""
767+
# Dummy species with labels that should match const_spc_names
768+
a = Species(smiles='C', label="CH4")
769+
b = Species(smiles='[OH]', label="OH")
770+
core_species = [a, b]
771+
772+
T = 1000.0 # K
773+
P = 1.0e5 # Pa
774+
775+
rxn_system = SimpleReactor(
776+
T,
777+
P,
778+
initial_mole_fractions={a: 0.5, b: 0.5},
779+
n_sims=1,
780+
termination=[],
781+
const_spc_names=["CH4"])
782+
783+
# Populate const_spc_indices from labels
784+
rxn_system.get_const_spc_indices(core_species)
785+
786+
# Only "CH4" should be marked constant
787+
assert rxn_system.const_spc_indices == [core_species.index(a)]

0 commit comments

Comments
 (0)