diff --git a/src/kinetics/Kinetics.cpp b/src/kinetics/Kinetics.cpp index 55c55ba16..644519146 100644 --- a/src/kinetics/Kinetics.cpp +++ b/src/kinetics/Kinetics.cpp @@ -104,12 +104,12 @@ std::pair Kinetics::checkDuplicates(bool throw_err) const // Compare this reaction to others with similar participants vector& related = participants[key]; - for (size_t m = 0; m < related.size(); m++) { - Reaction& other = *m_reactions[related[m]]; + for (size_t m : related) { + Reaction& other = *m_reactions[m]; if (R.duplicate && other.duplicate) { // marked duplicates unmatched_duplicates.erase(i); - unmatched_duplicates.erase(related[m]); + unmatched_duplicates.erase(m); continue; } else if (R.reaction_type != other.reaction_type) { continue; // different reaction types diff --git a/test/data/duplicate-reactions.cti b/test/data/duplicate-reactions.cti index 4774a74b2..34d00ab63 100644 --- a/test/data/duplicate-reactions.cti +++ b/test/data/duplicate-reactions.cti @@ -21,6 +21,7 @@ make_gas('J', ['C-1', 'F-1', 'I-1']) # unmatched duplicate kf = [1e10, 0, 100] # Forward multiple (not allowed) +reaction('O + 2 H <=> H2O', kf, id='A-0') # random other reaction reaction('O + H2 <=> H + OH', kf, id='A-1') reaction('2 O + 2 H2 <=> 2 H + 2 OH', kf, id='A-2') @@ -33,6 +34,7 @@ reaction('H + O2 + AR <=> HO2 + AR', kf, id='C-1') reaction('HO2 + AR <=> H + O2 + AR', kf, id='C-2') # Opposite direction #3 (not allowed) +reaction('O + 2 H <=> H2O', kf, id='D-0') # random other reaction reaction('H + O2 + AR <=> HO2 + AR', kf, id='D-1') reaction('HO2 + AR => H + O2 + AR', kf, id='D-2')