diff --git a/interfaces/cython/cantera/onedim.pyx b/interfaces/cython/cantera/onedim.pyx index 9fbcafb78..05b2d8b73 100644 --- a/interfaces/cython/cantera/onedim.pyx +++ b/interfaces/cython/cantera/onedim.pyx @@ -1063,9 +1063,11 @@ class CounterflowDiffusionFlame(FlameBase): if stoich is None: if oxidizer == 'O2': - nH = self.gas.nAtoms(fuel, 'H') - nC = self.gas.nAtoms(fuel, 'C') - stoich = 1.0 * nC + 0.25 * nH + stoich = 0.0 + if 'H' in self.gas.elementNames: + stoich += 0.25 * self.gas.nAtoms(fuel, 'H') + if 'C' in self.gas.elementNames: + stoich += self.gas.nAtoms(fuel, 'C') else: raise Exception('oxidizer/fuel stoichiometric ratio must be ' 'specified since the oxidizer is not O2')