You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@set! rs.rxs = [get_balanced_reaction(rx) for rx inget_rxs(rs)]
360
371
return rs
361
-
end
372
+
end
373
+
374
+
# Selects a balanced version of an input reaction. Handles potential problems when there are no,
375
+
# or several, balanced alternatives.
376
+
functionget_balanced_reaction(rx::Reaction)
377
+
brxs =balance_reaction(rx)
378
+
379
+
# In case there are no, or multiple, solutions to the balancing problem.
380
+
ifisempty(brxs)
381
+
error("Could not balance reaction `$rx`, unable to create a balanced `ReactionSystem`.")
382
+
end
383
+
iflength(brxs) >1
384
+
error("Infinite number of balanced reactions possible for reaction ($rx) are possible. No method for automatically generating a valid reaction is currently implemented in `balance_system`.")
385
+
end
386
+
387
+
returnonly(brxs)
388
+
end
389
+
# For non-`Reaction` equations, returns the original equation.
0 commit comments