17 Reaction forwardReaction(
const Reaction& rxn)
20 r.isReversible =
false;
25 Reaction reverseReaction(
const Reaction& rxn)
28 if (rxn.isReversible && (r.krev.A > 0.0)) {
29 r.isReversible =
false;
30 r.products = rxn.reactants;
31 r.reactants = rxn.products;
41 Reaction& Reaction::operator=(
const Reaction& b)
47 reactants = b.reactants;
48 fwdOrder = b.fwdOrder;
49 products = b.products;
50 thirdBody = b.thirdBody;
55 duplicate = b.duplicate;
56 falloffType = b.falloffType;
57 falloffParameters = b.falloffParameters;
58 otherAuxData = b.otherAuxData;
59 isFalloffRxn = b.isFalloffRxn;
60 isChemActRxn = b.isChemActRxn;
61 isThreeBodyRxn = b.isThreeBodyRxn;
62 isDuplicate = b.isDuplicate;
69 void Reaction::write(std::ostream& s)
const
71 int nl =
static_cast<int>(lines.size());
72 for (
int nn = 0; nn < nl; nn++) {
73 s << lines[nn] << std::endl;
116 double Reaction::stoichCoefficient(
const std::string& s)
const
119 int nr =
static_cast<int>(reactants.size());
120 for (k = 0; k < nr; k++)
121 if (reactants[k].name == s) {
122 return -reactants[k].number;
124 int np =
static_cast<int>(products.size());
125 for (k = 0; k < np; k++)
126 if (products[k].name == s) {
127 return products[k].number;
138 int nr =
static_cast<int>(reactants.size());
139 int np =
static_cast<int>(products.size());
146 std::map<std::string, double> coeffs;
147 for (
int ir = 0; ir < nr; ir++) {
148 coeffs[reactants[ir].name] = -reactants[ir].number;
150 for (
int ip = 0; ip < np; ip++) {
151 coeffs[products[ip].name] = products[ip].number;
153 for (
int jr = 0; jr < nr; jr++) {
155 if (coeffs[nm] == 0.0) {
160 for (
int jp = 0; jp < np; jp++) {
162 if (coeffs[nm] == 0.0) {
165 coeffs[nm] /= products[jp].number;
167 int nc =
static_cast<int>(coeffs.size());
168 std::vector<double> ratios;
171 if (!isReversible && ratios[0] < 0.0) {
175 for (
int ic = 0; ic < nc; ic++) {
176 if (ratios[ic] != ratios[0]) {