[Kinetics] Fix indexing error in Kinetics::checkDuplicates

This commit is contained in:
Ray Speth 2017-08-01 17:14:53 -04:00
parent 45891a2118
commit 513b43200c
2 changed files with 5 additions and 3 deletions

View file

@ -104,12 +104,12 @@ std::pair<size_t, size_t> Kinetics::checkDuplicates(bool throw_err) const
// Compare this reaction to others with similar participants
vector<size_t>& 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

View file

@ -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')