+ All Categories
Home > Documents > ReactionKinetics—A Mathematica package with applications

ReactionKinetics—A Mathematica package with applications

Date post: 14-May-2023
Category:
Upload: independent
View: 0 times
Download: 0 times
Share this document with a friend
12
ReactionKineticsA Mathematica package with applications A.L. Nagy a,1,3 , D. Papp c , J. To ´ th a,b,n,1,2 a Department of Analysis, Budapest University of Technology and Economics, Egry J.u.1., H-1111 Budapest, Hungary b Laboratory for Chemical Kinetics of the Institute of Chemistry, E¨ otv¨ os Lora ´nd University, Pa ´zma ´ny P. Se ´ta ´ny 1/A, H-1117 Budapest, Hungary c Department of Industrial Engineering and Management Sciences, Northwestern University, 2145 Sheridan Road, Room C210, Evanston, IL 60208, United States article info Article history: Received 18 July 2011 Received in revised form 6 December 2011 Accepted 17 January 2012 Available online 2 February 2012 Keywords: Kinetics Computational chemistry Graphs of reactions Stochastic models Parameter identification Decomposition of overall reactions abstract Requirements are formulated for a reaction kinetics program package to be useful for an as wide as possible circle of users and they are illustrated with examples using ReactionKinetics, a Mathematica based package currently being developed by the authors. Treating a realistic problem in any field of reaction kinetics raises a series of problems, both mathematical and computational: we illustrate a number of these also with examples using our package. & 2012 Elsevier Ltd. All rights reserved. 1. Introduction In Section 3.4 of our paper we formulate the requirements for a reaction kinetics program package to be useful for an as wide as possible circle of users. We try to answer the question: for what goals should we aim while designing and implementing such a program? In Section 3 we enumerate some of the major mathematical and computational problems arising when writing and using such a package. Throughout we try to illustrate everything with the present version of our package ReactionKinetics and the kinetic exam- ples are mainly taken so as to join to the lectures presented at the workshop MaCKiE 2011 (http://www.mackie2011.uni-hd.de/). In many cases the examples will not show all the fine details necessary to be given when actually using our program: a detailed program documentation will be given later (To ´ th et al., in preparation). Furthermore, simple examples are chosen in some cases to transparently illustrate the functioning of the package. Also, the present limitations of space do not allow to explain the theoretical background, we refer to the literature, and also to our future, more detailed work mentioned above. 2. Requirements for a reaction kinetics package 2.1. History In the late sixties, early seventies of the last century, at the time when the computer became accessible to the scientific community at large, kineticists immediately wrote (numeric) codes for at least three different problems: for parsing large sets of reaction steps, solving induced kinetic differential equations and simulating the stochastic model of chemical reactions, see an early review by Garfinkel et al. (1970). Nowadays a few existing widely used programs with multiple capabilities are e.g. CHEMKIN www.sandia.gov/chemkin/index.html, XPPAUT www.math.pitt.edu/~bard/xpp/xpp.html, KINALC garfield.chem.elte.hu/Combustion/kinalc.htm, but there exists a considerable number of them (which we are going to review later; see also Tomlin et al., 1997; Barnett et al., 2004), usually with much less capabilities. Contents lists available at SciVerse ScienceDirect journal homepage: www.elsevier.com/locate/ces Chemical Engineering Science 0009-2509/$ - see front matter & 2012 Elsevier Ltd. All rights reserved. doi:10.1016/j.ces.2012.01.039 n Corresponding author at: Department of Analysis, Budapest University of Technology and Economics, Egry J.u.1., H-1111 Budapest, Hungary. Tel.: þ36 705091398; fax: þ36 14633172. E-mail addresses: [email protected] (A.L. Nagy), [email protected] (D. Papp), [email protected], [email protected] (J. To ´ th). 1 Partially supported by the Hungarian National Scientific Foundation, No. 84060. 2 This work is connected to the scientific program of the ‘‘Development of quality-oriented and harmonized R þDþI strategy and functional model at BME’’ project. This project is supported by the New Sze ´ chenyi Plan (Project ID: TA ´ MOP- 4.2.1/B-09/1/KMR-2010-0002). 3 Partially supported by the COST Action CM901: Detailed Chemical Kinetic Models for Cleaner Combustion. Chemical Engineering Science 83 (2012) 12–23
Transcript

Chemical Engineering Science 83 (2012) 12–23

Contents lists available at SciVerse ScienceDirect

Chemical Engineering Science

0009-25

doi:10.1

n Corr

Technol

Tel.: þ3

E-m

dpapp@

janosto1 Pa

84060.2 Th

quality-

project.

4.2.1/B-3 Pa

Models

journal homepage: www.elsevier.com/locate/ces

ReactionKinetics—A Mathematica package with applications

A.L. Nagy a,1,3, D. Papp c, J. Toth a,b,n,1,2

a Department of Analysis, Budapest University of Technology and Economics, Egry J.u.1., H-1111 Budapest, Hungaryb Laboratory for Chemical Kinetics of the Institute of Chemistry, Eotvos Lorand University, Pazmany P. Setany 1/A, H-1117 Budapest, Hungaryc Department of Industrial Engineering and Management Sciences, Northwestern University, 2145 Sheridan Road, Room C210, Evanston, IL 60208, United States

a r t i c l e i n f o

Article history:

Received 18 July 2011

Received in revised form

6 December 2011

Accepted 17 January 2012Available online 2 February 2012

Keywords:

Kinetics

Computational chemistry

Graphs of reactions

Stochastic models

Parameter identification

Decomposition of overall reactions

09/$ - see front matter & 2012 Elsevier Ltd. A

016/j.ces.2012.01.039

esponding author at: Department of Analy

ogy and Economics, Egry J.u.1., H-1111 Buda

6 705091398; fax: þ36 14633172.

ail addresses: [email protected] (A.L. Nag

iems.northwestern.edu (D. Papp), jtoth@mat

[email protected] (J. Toth).

rtially supported by the Hungarian Nationa

is work is connected to the scientific progr

oriented and harmonized RþDþ I strategy an

This project is supported by the New Szeche

09/1/KMR-2010-0002).

rtially supported by the COST Action CM90

for Cleaner Combustion.

a b s t r a c t

Requirements are formulated for a reaction kinetics program package to be useful for an as wide as

possible circle of users and they are illustrated with examples using ReactionKinetics,

a Mathematica based package currently being developed by the authors. Treating a realistic problem

in any field of reaction kinetics raises a series of problems, both mathematical and computational:

we illustrate a number of these also with examples using our package.

& 2012 Elsevier Ltd. All rights reserved.

1. Introduction

In Section 3.4 of our paper we formulate the requirements fora reaction kinetics program package to be useful for an as wide aspossible circle of users. We try to answer the question: for whatgoals should we aim while designing and implementing such aprogram?

In Section 3 we enumerate some of the major mathematicaland computational problems arising when writing and using sucha package.

Throughout we try to illustrate everything with the presentversion of our package ReactionKinetics and the kinetic exam-ples are mainly taken so as to join to the lectures presented at theworkshop MaCKiE 2011 (http://www.mackie2011.uni-hd.de/).In many cases the examples will not show all the fine details

ll rights reserved.

sis, Budapest University of

pest, Hungary.

y),

h.bme.hu,

l Scientific Foundation, No.

am of the ‘‘Development of

d functional model at BME’’

nyi Plan (Project ID: TAMOP-

1: Detailed Chemical Kinetic

necessary to be given when actually using our program: a detailedprogram documentation will be given later (Toth et al., inpreparation). Furthermore, simple examples are chosen in somecases to transparently illustrate the functioning of the package.

Also, the present limitations of space do not allow to explainthe theoretical background, we refer to the literature, and also toour future, more detailed work mentioned above.

2. Requirements for a reaction kinetics package

2.1. History

In the late sixties, early seventies of the last century, at thetime when the computer became accessible to the scientificcommunity at large, kineticists immediately wrote (numeric)codes for at least three different problems: for parsing large setsof reaction steps, solving induced kinetic differential equationsand simulating the stochastic model of chemical reactions, see anearly review by Garfinkel et al. (1970).

Nowadays a few existing widely used programs with multiplecapabilities are e.g.

CHEMKIN

www.sandia.gov/chemkin/index.html, XPPAUT www.math.pitt.edu/~bard/xpp/xpp.html, KINALC garfield.chem.elte.hu/Combustion/kinalc.htm,

but there exists a considerable number of them (which we aregoing to review later; see also Tomlin et al., 1997; Barnett et al.,2004), usually with much less capabilities.

A.L. Nagy et al. / Chemical Engineering Science 83 (2012) 12–23 13

2.2. Coverage

Our major governing principle is that the program shouldcontinuously be updated with recent methods developed in mostareas of reaction kinetics modeling. A conference like MaCKiE2011 is an excellent occasion, a great help to learn newermethods.

We show a few examples from the recent literature which arenot directly solvable with the programs mentioned above.

2.2.1. Testing detailed balance

Preliminaries and definitions. The history, which dates back forover a century, starts most probably with Wegscheider (1901/2)but the first explicit formulation (without any formula) of theprinciple of detailed balance has been given by Fowler and Milne(1925): in real thermodynamic equilibrium all the subprocesses(whatever they mean) should be in dynamic equilibrium sepa-rately in such a way that they do not stop but they proceed withthe same velocity in both directions.

One can say that this principle means that time is reversible atequilibrium, that is why the expression microscopic reversibility isusually used as a synonym.

The modern formulation of the principle accepted by IUPACGold et al. (1997) essentially means the same: ‘‘The principle ofmicroscopic reversibility at equilibrium states that, in a system atequilibrium, any molecular process and the reverse of thatprocess occur, on the average, at the same rate’’.

Neither the above document nor the present authors assertthat the principle should hold without any further assumptions;for us it is an important hypothesis the fulfilment of which shouldbe checked individually in different models.

Now let us consider a reaction consisting only of reversiblesteps

XMm ¼ 1

aðm,pÞXðmÞ"kp

k�p

XMm ¼ 1

bðm,pÞXðmÞ ðp¼ 1;2, . . . ,PÞ ð1Þ

where we have P pairs of reaction steps, a,b are the matrices withmolecularities as elements, their difference is the stoichiometric

matrix, and kq ðq¼�P, . . . ,�2,�1;1,2, . . . ,PÞ are the coefficients.Now, the induced kinetic differential equation of the abovereaction is as follows:

_cðtÞ ¼XP

p ¼ 1

ðbð�,pÞ�að�,pÞÞðkpcðtÞað�,pÞ�k�pcðtÞbð�,pÞÞ ð2Þ

where cðtÞARM describes the concentrations of the species attime t.

Definition 1. Assume that cnAðRþ ÞM and

kpðcnÞað�,pÞ¼ k�pðc

nÞbð�,pÞ

ð3Þ

is fulfilled for every p¼1, 2, y, P. (Then, cn makes the right-handside of (2) equal to zero.) In this case we say that reaction (1) isdetailed balanced at the stationary point cn. If the reaction isdetailed balanced at all of its positive stationary points, then itis detailed balanced.

Methods to test detailed balance. A simplistic way to checkconditions (3) is the direct one: having found one (or all of) thepositive stationary points substitute it (them) into (3) and see ifEq. (3) holds or not. Or, it may be enough to solve Eqs. (3) forpositive cn’s to get all the candidates in which reaction (1) isdetailed balanced. However, to get the stationary points a non-linear system of equations is to be solved, which renders theproblem difficult.

Fortunately, there is a more elegant way to look at theproblem, namely Feinberg (1989) has proved that the following

two conditions are necessary and sufficient for the reaction (1) tobe detailed balanced.

Condition 1 (Circuit conditions). Suppose that we have chosen anarbitrary spanning forest for the Feinberg–Horn–Jackson graph ofreaction (1). It is possible to find a set of P�NþL independentcircuits, where N denotes the number of vertices (complexes)

N:¼ 9fað:; rÞ; r¼ 1;2, . . . ,Rg [ fbð:; rÞ; r¼ 1;2, . . . ,Rg9

whereas L is the number of connected components (linkage

classes) of the Feinberg–Horn–Jackson graph (in which all thecomplexes are written down exactly once and they are connectedwith reaction arrows). For each of these circuits we write anequation which asserts that the product of the reaction ratecoefficients in the clockwise direction and counterclockwisedirection is equal. Thus we have P�NþL equations for thereaction rate coefficients.

Before formulating Condition 2 we need another importantdefinition.

Definition 2. The deficiency is the number of complexes N minusthe number L of connected components of the Feinberg–Horn–Jackson graph and the number S of independent reaction steps(or, the rank of the stoichiometric matrix).

Condition 2 (Spanning forest conditions). Assume that reaction(1) shows deficiency d. Furthermore, assume that the edges of anarbitrarily selected spanning forest F have been given an orienta-tion. Then there exist d independent nontrivial solutions to thevector equationXði,jÞA F

ðbð�,jÞ�að�,iÞÞaði,jÞ ¼ 0

for the aði,jÞ numbers. With each of these solutions one canconstruct a spanning forest conditionYði,jÞA F

~kaði,jÞ

ij ¼Yði,jÞAF

~kaði,jÞ

ji

where ~kði,jÞ are the corresponding reaction rate coefficients(associated to the edge (i,j)).

Applications. Here we present only one example. Now thecommand

DetailedBalanced½fA2B,2A2AþBg,fk1,k�1,k2,k�2g�

in ReactionKinetics yields the output.DetailedBalanced::nocycle: The FHJ graph of the given formal

mechanism has no cycle, so we are given only the spanning forestcondition(s).

fk�1nk2 ¼ ¼ k�2nk1g

providing the condition for the reaction to be detailed balanced.(Here and below we add a sentence to warn the reader when aMathematica outcome follows.)

We are pursuing several applications that include chirality,models of ion channels and combustion theory, as well.

2.2.2. Absolute concentration robustness

One might look for sufficient conditions to ensure the inde-pendence of a stationary concentration coordinate from outerconditions: does it only depend on the reaction rate coefficientsand not on the initial concentrations? (Shinar and Feinberg,2010).

Motivation. A simple example follows. Let us consider thereaction

r1 :¼ fAþB�!k1

2B,B�!k2

Ag

A.L. Nagy et al. / Chemical Engineering Science 83 (2012) 12–2314

where A may be interpreted as the inactive form of a proteinand B as its active form, e.g. trypsinogen and trypsin, respec-tively. (Let us remark in passing that this model is anirreversible version of the model in Section 2.2.1.) The inducedkinetic differential equation of this reaction is given byDeterministicModel½r1; fk1;k2g� as

a0ðtÞ ¼�k1aðtÞbðtÞþk2bðtÞ, b0ðtÞ ¼ k1aðtÞbðtÞ�k2bðtÞ

Calculation of the stationary points (under the condition thatað0Þ ¼ a0,bð0Þ ¼ b0) proceeds quite naturally with Reaction

Kinetics

FSD

StationaryPoints½r1; fk1;k2g,fa0;b0g,Conditions� 4fa0þb04k2=k1g;Positivity� 4True�

The stationary concentration an of A, being k2=k1, is alwayspositive (together with bn

¼ a0þb0�k2=k1, at least if a0þb0

4k2=k1), and does not depend on total mass: the reaction showsabsolute concentration robustness with respect to A.

However, in the reaction A"k1

k�1

B neither A nor B has this property,

both coordinates of the stationary concentration vector do depend

on a0þb0 (as one can easily find it without any program): an ¼

k1ðða0þb0Þ=ðk�1þk1ÞÞ, bn¼ k�1ðða0þb0Þ=ðk�1þk1ÞÞ.

The question is what kind of general conditions can be given toassure absolute concentration robustness. A set of easily verifiableconditions has been formulated by Shinar and Feinberg (2010).

Conditions.

Theorem 1. Suppose that a reaction endowed with mass action

kinetics has a positive stationary point, and its deficiency is one.

Then, if there exist two complexes lying in nonterminal strong

components of the Feinberg–Horn–Jackson graph so that they only

differ in a single species, then the reaction shows absolute concen-

tration robustness with respect to this species.

The notions in the theorem are widely used and can be foundin the paper cited above. In the case of the simple example aboveReactionsData[r1][‘‘deficiency’’] gives d¼ 4�2�1¼ 1.

We have shown earlier that there exists a positive stationarypoint.

To see that there exist two nonterminal complexes onlydiffering in a single species we draw the Feinberg–Horn–Jacksongraph of the reaction (see Fig. 1), and gladly observe thatðAþBÞ�A¼ B. (To make it clear, complex Aþ2B and B differs inboth A and B.) The last condition is also checked by our program,it would be really hard to test this property in a large reaction setby hand.

Here is how to learn which species of the given reaction areabsolutely robust: AbsoluteRobustness[r1] gives {A}.

Let us remark that the program is also capable to calculate thestationary concentrations both numerically and symbolically inmore complicated cases. Nevertheless one should be cautious.

Remark 1. The theoretical and computational problem lies inshowing that a positive stationary point exists. Why? Because if

k1

k2

A B2B

BA

ig. 1. The Feinberg–Horn–Jackson graph of the reaction r1 is obtained by

howFHJGraph½r1;Style½;Red;14�&=@fk1;k2g;VertexLabeling� 4True;irectedEdges� 4True�:

the initial value problem describing a reaction is c0 ¼ fJc,cð0Þ ¼ c0

then the chemically meaningful stationary point cn

1.

X

Yp

FigGra

com

com

the

should obey fðcnÞ ¼ 0,

2. should be nonnegative, 3. should be on the level sets of the linear first integrals, and 4. should be on the level sets of the nonlinear first integrals.

The situation is that one cannot in general find (global) nonlinearfirst integrals.

Let us consider reaction r1 in detail.

1.

The solutions to fðcnÞ ¼ 0 in this case are ðan

0 ÞðanARÞ and

k2k1bn

� �ðbnARÞ.

2.

These solutions are nonnegative if anZ0 and bn

Z0, res-pectively.

3.

They are on the level curves of the linear first integral cðp,qÞ :¼ pþq if and only if 0ra0þb0�k2=k1.

4.

No nonlinear global first integral – independent from c –exists.

Let us return to detailed balancing. Certainly, the conditions werenot found to treat the simple examples above. Their role will beclearer if we cite another – this time more complicated – examplefrom the paper.

Let us consider a model where ATP is the cofactor in theosmoregulation system of Escherichia coli: EnvZ-OmpR

r5¼ fX2XT-Xp,XpþY2XpY-XþYp,XTþYp2XTYp2XTþYg

The existence of a positive stationary point can be proved eithernumerically or symbolically using StationaryPoints½r5;

Positivity� 4True� and—waiting for dozens of minutes(whereas the usual run times are seconds or even less). The resultgiven by ReactionsData½r5�½‘‘deficiency’’� is

d¼ n�l�s¼ 9�3�5¼ 1

To see that there exist two nonterminal complexes onlydiffering in a single species we draw the Feinberg–Horn–Jacksongraph of the reaction (Fig. 2) and find that ðXTþYpÞ�XT¼ Yp,therefore the reaction is absolutely robust with respect to Yp, thephosphorylated form of the response-regulator, a species ofcrucial importance in the reaction.

The conditions are only sufficient but not necessary. The fact thatthe conditions are only sufficient but not necessary can also beseen on the examples given by Shinar and Feinberg (2010), seealso their Supplementary material. Here we give another exam-ple, the one shown by Prof. Ross in his lecture (see also Ross,2008, p. 2136)

jr¼ 0-X12X22X32X42X52X62X72X8-0 ð4Þ

X XT Xp

p Y XpY Yp X

XT XTYp XT Y

. 2. The Feinberg–Horn–Jackson graph of reaction r5 obtained by ShowFHJ

ph½r5;VertexLabeling� 4True;DirectedEdges� 4True� with proper

plex colorings (purple ones in the electronic version are the terminal

plexes). (For interpretation of the references to color in this figure legend,

reader is referred to the web version of this article.)

A.L. Nagy et al. / Chemical Engineering Science 83 (2012) 12–23 15

The result given by ReactionsData[jr][‘‘deficiency’’] is

d¼ n�l�s¼ 9�1�8¼ 0

(no wonder, jr is a compartmental system, see e.g. Erdi and Toth,1989; Jacquez, 1999; Cobelli and Carson, 2008), the theoremcannot be applied, although all the stationary concentrations areonly dependent on the reaction rate coefficients. Expression

StationaryPoint[jr,

fk0;k1;k�1;k2;k�2;k3;k�3;k4;k�4,k5;k�5;k6;k�6;k7;k�7;k8g,c1½0�;c2½0�;c3½0�;c4½0�;c5½0�;c6½0�;c7½0�;c8½0�g�

gives the result symbolically, what we do not reproduce hereverbatim, because of the length of the formulae. Here is anequivalent symbolic form:

ci ¼k0P9�i

j ¼ 1ðQ8

l ¼ 10�j klÞðQ8�j

l ¼ i k�lÞQ8l ¼ i kl

ði¼ 1;2, . . . ,8Þ

the proof and generalization of which is left to the reader.Once here, we can also qualitatively reproduce Fig. 3 of the

paper by Ross (2008). Let us use the following set of reaction ratecoefficients:

rrc¼ f0:1;2;0:1;8;5;3;0:4;1;1;6;0:5;4;2;10;1;1g ð5Þ

and let the initial concentrations be the same as the stationaryconcentrations except that we add 100 to the initial value of theinitial concentration of X1. Then the return of the perturbedconcentrations to the (asymptotically stable) original stationarystate is as seen in our Fig. 3. This has been calculated by

Concentrations[jr, rrc, iniþ100UnitVector[8,1],

{0,4}].

More examples and many further interesting details can befound in the Supporting online material for the mentioned Science

paper: the sufficient conditions are generalized, the statementsare proved, etc.

2.2.3. Improved methods of stochastic simulation

As we shall expose in Section 3 of our paper, we have built inall the relevant direct and approximate methods as well asexplicit and implicit ones into our program package. Several fancyimprovements have long been known, here we intend to mentiononly two.

The first one is more theoretical and relies on numericaltechniques which have already been applied successfully when

0 1 2 3 4time

10

20

30

40

conc

.

Subsequent maxima

Fig. 3. Return to the stationary state after a perturbation of the first species in

reaction (4) with the reaction rate coefficient s (5).

solving ordinary differential equations. We shall mention a few ofthem in Section 3.7 but further ideas can and will improve theapproximation methods of stochastic simulation of chemicalreactions.

The other approach is based on recent theoretical develop-ments and programming shortcuts. The latest versions of Math-

ematica enable us to use compiled functions in a more efficientand delicate way which may result in thousands of times moreeffective function evaluation compared to the ‘‘usual’’ evaluations(see the function Compile). Another direction of recent develop-ments concerns parallel computing (see the functions Paralle-lize, ParallelMap, etc.), and the use of GPUs (see the functionsCUDALink and OpenCLLink, etc.).

Here stands an example: the Lotka–Volterra model is

X�!k1

2X, XþY�!k2

2Y, Y�!k3

0

and see Fig. 4 for the simulation results.

2.2.4. Methods of reaction generation and decomposition

A fundamental problem of stoichiometry is the decompositionof overall reactions into elementary steps. The definition of‘‘elementary’’ (or ‘‘simple’’) reactions varies; we call here a stepelementary if it is of order two, at most. Ideally, a reaction kineticspackage should not only provide the user with the list of possibledecompositions (or at least a large number of decompositions, astheir number may be huge, or even infinite), but it should alsoassist the user in the identification of elementary steps them-selves, or even in the generation of possible intermediate speciesthat may take part in an elementary step. Clearly, the completeautomation of this three-step process is a formidable task, as alarge amount of domain specific expertise and data must beincorporated into each step. A more reasonable goal is to providethe user with an abundant list of solutions, all of which adhere tothe basic conservation laws (e.g. all elementary steps mustconserve the number of atoms of each element and total charge)and other combinatorial constraints imposed by the problem; andleave all further processing to the user. At this abstract level thegeneration of elementary steps with given reactants and thegeneration of decompositions of a given overall reaction areessentially equivalent, as we shall see immediately.

Suppose that the M species are made of D different elements,and assign a (Dþ1)-dimensional vector am to species X(m) wherethe first D components are the quantities of each constituent, andthe last component is electric charge. A similar vector can be

0 5 10 15 20 25time

500

1000

1500

num

ber

of s

peci

es

Species: X, Y

Fig. 4. Stochastic Lotka–Volterra model with reaction rate coefficients k1 ¼ 1,

k2 ¼ 1=1000, k3 ¼ 1 and initial conditions x0 ¼ 600, y0 ¼ 400, using t-leaping

methods and compiled functions, where 2.157 CPU time units elapsed.

A.L. Nagy et al. / Chemical Engineering Science 83 (2012) 12–2316

assigned analogously to every complex as well. Now, a reaction

XMm ¼ 1

amXðmÞ�!XM

m ¼ 1

bmXðmÞ

obeys the laws of atomic and charge balance if and only if thevectors am describing the atomic structure of the species satisfythe linear system of equations

XMm ¼ 1

amam ¼XM

m ¼ 1

bmam

All combinatorially feasible elementary reactions can be gener-ated by expressing each possible reactant complex (correspond-ing to a vector

PMm ¼ 1 amam satisfying 1r

Pmamr2) as a linear

combination of the vectors am, with nonnegative integer coeffi-cients. Hence, we are looking for the nonnegative integer solu-tions x of a system of linear equations

Ax¼ b

where A is the atomic matrix, with columns a1 to aM , and b is avector corresponding to the reactants. Such equations are calledlinear Diophantine equations. With M species the elementaryreactions are obtained by solving 2MþðM2 such systems.

Similarly, if M is the number of species, an M-dimensionalvector is associated to every reaction involving these species. Themth component of the vector shows the change in the quantity ofspecies X(m) in the reaction; if a species is only a reactant, itscomponent is negative, if it is only a product, the coefficient ispositive, if it occurs on both sides, the coefficient might be eitherpositive or negative, or even zero. The matrix c with columnvectors corresponding to the elementary reactions is the stoichio-metric matrix of the mechanism. A combination of elementarysteps with coefficients x is a decomposition of the overall reactionif and only if

cx¼w

where w is the vector associated with the overall reaction. Again,we are primarily interested in nonnegative integer solutions x,though nonnegative rational solutions also can be interpreted asdecompositions of the overall reaction.

While the complexity of this problem is very high (indeed,deciding whether there exists even a single solution is NP-hard, forthe definition and treatment of the concept see e.g. Graham et al.,1995), research in multiple fields where such equations arise inmathematical models has yielded several relatively practical algo-rithms and heuristics for its solution. Further cross-fertilizationbetween fields in this problem is essential, but one must also keepin mind that different applications produce problem instances withstrikingly different characteristics, which in turn call for differentmethods. Indeed, in our investigations in Kovacs et al. (2004) andPapp and Vizvari (2006) we have found that entirely differentalgorithms are the most effective in elementary step generationand in the generation of the decompositions. In particular, note thefollowing obvious differences:

in elementary step generation multiple relatively small systemsneed to be solved, all of which share the coefficient matrix,whereas in decomposition a single large-scale system is solved; �

Table 1Species of the oxalate–persulphate–silver oscillator.

in elementary step generation all but one row consists ofnonnegative numbers only, in decomposition every rows andcolumns may contain entries of different sign;

Agþ Ag2þ Hþ SO4�

SO2�4 S2O2�

8 C2O2�4

AgðC2O4Þ

OH� H2O CO�2 O2

HO2 H2O2 O2CO�2 CO2

in elementary step generation the number of solutions isalways finite, in decomposition it is often infinite.

Elaborating on the last point, if a sequence of steps forms acycle in which no species are generated or consumed, it can be

added to any decomposition in an arbitrary number of times. Astraightforward application of Dickson’s lemma (Dickson, 1913)shows that the converse is also true.

Lemma 1. The number of decompositions is finite if and only if the

elementary reactions cannot form a cycle. Furthermore, the number

of decompositions that do not contain a cycle is always finite.

The lemma motivates two further problems related to decom-positions: first, one needs to be able to decide whether theelementary reactions can form cycles or not, which amounts tothe solution of a linear programming problem. Second, if cycles doexist, the goal changes from generating all decompositions togenerating all minimal (that is, cycle-free) decompositions, and allminimal cycles (that is, cycles that cannot be expressed as a sum oftwo cycles). The latter is equivalent to the problem of generatingall minimal P-invariants of a Petri net (Martınez and Silva, 1982).

Another approach to handle the explosion in the number ofsolutions is to restrict the attention to the simplest decomposi-tions and cycles, those that consist of a small number of steps.

Returning to our discussion of basic requirements for a generalpurpose reaction kinetics package, it has become clear to us thatour package must implement a number of methods for theproblems of reaction generation and decomposition, along withan algorithm selection heuristic to choose the one most suited forthe problem at hand.

Currently three algorithms are implemented for the solution ofthese problems, including one of our own developed with verylarge-scale problems in mind. Additionally, we provide twopreprocessing methods to identify the steps that must take partin every decomposition, and the ones that cannot take part in any.(This greatly reduces the computation time for some of thedecomposition algorithms.) We also provide a heuristic thatgenerates a typically large number of decompositions much fasterthan the rigorous algorithms, but without any guarantee that itfinds all minimal decompositions.

Example. We conclude this section with an example for elemen-tary step generation. The oxalate–persulphate–silver oscillator(Clarke, 1992) involves 16 species, shown in Table 1; these canform 2 � 16þ 16

2

� �¼ 152 complexes that may be the reactants of an

elementary step. The species consist of five atomic constituents,and have charge, hence they can be represented by a 6�16 atomicmatrix, generated by the AtomMatrix command of our package.From this matrix the ElementaryReactions command generatesall elementary steps involving them. In this tiny example eachalgorithm currently implemented proved to be rather efficient; thenumber of combinatorially possible elementary steps is 95.

In Section 3 of our paper we shall revisit this problem, andprovide a detailed example of obtaining a decomposition for acomplex overall reaction.

2.3. Applications

Although there are big differences between the different fieldsof chemical kinetics, e.g. the role of thermodynamic data is moreimportant in combustion, much less important in inorganicchemistry, still we hope the package will be used for more and

k

A.L. Nagy et al. / Chemical Engineering Science 83 (2012) 12–23 17

more realistic applications in many fields. Here we only mentiona few of our previous applications with the ancestors of thepresent package.

Intersecting concentration time curves

Reactions on a surface, reactions in plasma: Sipos et al.(1974b).

conc–s

� Enzyme kinetics: Toth (2002). 1.0 � Signal transduction: Toth and Rospars (2005).

Out[17]=

0.5 1.0 1.5 2.0 2.5 3.0time

0.2

0.4

0.6

0.8

Fig. 5. Concentration time curves of the consecutive reaction obtained by

Manipulate½Plot½Evaluate½ReplaceAll@@Concentrations½fA� 4B� 4Cg;

Ion channels: Nagy et al. (2009).

2.4. Formats

A useful program should be compatible with usual formatssuch as CHEMKIN, PrIme, SBML, etc. What we can do at themoment is that we can read in data of different formats but not inan automatic way. The main method to transform data indifferent forms is to use pattern matching, including if necessaryor useful such tools as RegularExpression. Suppose we havethe file hydrox.dat from the website http://www.math.bme.hu/�nagyal describing a model of hydrogen oxidation. Then, we canimport and transform it like this

k; f1;0;0g,f0;3g��; ft;0;3g�; fk; f0:1;0:1g,f1;1gg�:

Import½‘‘hydrox:dat’’�=:fx ,f‘‘SPECIES’’g;

Shortest½y �; f‘‘END’’g;zg: 4y

The problem is obviously similar to, or may be considered to bepart of parsing. The papers by Ratkiewicz at the present con-ference and earlier by Ratkiewicz and Truong (2003) are alsoaimed at uniquely identifying mechanisms based on graphtheoretic methods.

2.5. Speed and accuracy

It is important to be able to handle a reaction in a reasonabletime interval even if it consists of a large number of reaction stepsand species. Similarly, the accuracy should also be enough forcomparisons with measurements.

Let us mention a few more specific problems where thenumber of species and of reaction steps can be reallyhigh—beyond the well known areas of atmospheric chemistry,metabolism and combustion.

1.

One might wish to treat reaction chromatography in such away that one divides a column into thousands of plates,assumes the same reaction on each of the plates and alsoassumes (linear) diffusion between the plates. This is theproblem mentioned by Prof. Trapp in his lecture at theconference. Let us also mention here the less known paperby Shapiro and Horn (1979a,b) which gives a qualitativetreatment of such systems using the tools of Chemical Reac-tion Network Theory.

2.

Or, one might describe the transformation taking place amongthousands of polymers with different molecular weights, asmentioned in the poster by van Steenberge et al. (2011).

3.

Another problem might be the treatment of molecules sittingat different energy levels of which one might have severalmillions. A possible first step to treat such a system might beto measure the time needed to solve the induced kineticdifferential equation of a model as a function of size as follows:

lendvay½n_� :¼ Table½Xi2XÞiþ1,fi,1,n�1g�

Concentrations½lendvay½1000�;Array½N½�&;1998�;Array½0:1N½�&;1000�; f0;1g�==Timing

It turned out that such a model can be solved in 30 s usingMathematica, without our package, without Parallelize and

without using GPU and similar tools, i.e. one can say, onlyapplying Low Performance Computing. This is quite a promisingstart in this direction.

2.6. Language: Mathematica, what else?

The trade-offs in using different mathematical programpackages have been discussed extensively, let us only mentionthe web page mentioning more than one hundred systems(Barnett et al., 2004; WRI).

From our viewpoint the most important arguments for creat-ing our package in Mathematica are as follows. It is capable ofsymbolic and numeric calculations, creating graphics (in fact,even whole presentations and publications) within the sameframework. In numerical computations it is not worse than anyother program (Weisstein; WRI). It uses as many cores/processorsas are available in parallel, it implements OpenCL and CUDA touse GPUs, one can obtain the C form of a compiled function ifneeded, etc. Using a symbolic-numeric mathematical program-ming language such as Mathematica is extremely helpful increating very transparent programs; code that can even be readas ‘‘pseudo-code’’ for those readers who are most reluctant to getacquainted with the software.

In a meticulous analysis of the consecutive reaction Yablonskyet al. (2010) have found a symbolically expressed necessary andsufficient condition for the three concentration time curves tohave a single point of intersection (see also Toth and Simon, 2005,2009, p. 341). As a final application of our package we show inFig. 5 how to solve this (and also similar, symbolically untractableproblems) numerically.

The two-dimensional slider can be used to vary by hand thereaction rate coefficients, and compute and plot instantly thethree concentration–time curves.

3. Computational problems when building a reactionkinetics package

3.1. Introduction

In Section 2 of our paper we formulated the requirements for areaction kinetics package to be useful for a wide circle of users.

A.L. Nagy et al. / Chemical Engineering Science 83 (2012) 12–2318

In the present section we enumerate the major problemsarising when writing and using such a package. It turns out thatthe solution of some problems is far from being simple.

3.2. Parsing

As we mentioned in the previous section of our paper, at thevery beginning of application of computers to chemical kineticsthe problem arose how to construct the induced kinetic differ-ential equation of a reaction without making too many errors. Thebest solution is when the chemist provides the reaction steps, andthe program creates the induced kinetic differential equationsautomatically, if the kinetics is supposed to be of the mass actiontype. If it is not so, then reaction rates should also be provided bythe user.

As our program is based on a modern mathematical programpackage (that for historical reasons is often called computer

algebra system) there is no software limitation as to the size ofthe reaction to be handled, see the Lendvay example above.(Naturally, the size of your hard disk and the time you are willingor capable to wait is a limitation.) Compare this with the quitetypical restriction ‘‘y has the capabilities for handling up to 590differential equations’’.

It may be instructive to cite the code of the construction of theright hand side of the induced kinetic differential equation of thereaction (note that reversibility is not assumed)

XMm ¼ 1

aðm,rÞXðmÞ�!kr

XMm ¼ 1

bðm,rÞXðmÞ ðr¼ 1;2, . . . ,RÞ

given the matrices (a,b) of molecularities, the vector of reactionrate coefficients (k¼ ðkrÞ

Rr ¼ 1) and the concentration vector (c)

ðb�aÞ � ðk Times@@ caÞ

Notice that here both dot product and componentwise productare used. (By componentwise product of the vectors k and x wemean the vector with the components krxr , i.e. the vectorðk1x1,k2x2, . . . ,kRxRÞ.) The reaction step vector cð�,rÞ, wherec¼ b�a expresses the effect of the rth reaction step.

3.3. Combinatorics

In reaction kinetics graphs of many types are useful andused, though it is not quite obvious how to visualize them to bethe most informative for users, especially concerning largemechanisms. Hence we accept the representations offered byMathematica.

The Volpert graph is one of the widely applied graphs inreaction kinetics which proved to be a good tool to investigateproblems emerging e.g. in the theory of kinetic ordinary differ-ential equations. It is a directed bipartite graph with species andreaction steps as its vertices and with aðm,rÞ edges from thevertex representing species X(m) into the vertex representingreaction step r and with bðm,rÞ edges from the vertex representingreaction step r, into the vertex representing species X(m) (Erdi andToth, 1989). At the same time this is the graph one can see intextbooks on biochemistry, in metabolic maps or at MaCKiEWorkshops. Some researchers describe the same graphical struc-ture in terms of Petri nets (Martınez and Silva, 1982). A model ofglycolysis is a built-in reaction of our program package thereforehaving got it we can easily draw its Volpert graph which is closeto the one used in textbooks on biochemistry (see Fig. 6).

3.4. Linear (Diophantine) equations

Complex reactions occur via pathways of simple ‘‘elementary’’reaction steps. It is a common problem that the overall (or global)

reaction is measured, and one would like to reconstruct theunderlying network of simple reaction steps. By simple here onemay mean reaction steps of order not higher than two. Let usconsider an example (Kovacs et al., 2004). We start from theoverall description of the permanganate/oxalate reaction

2MnO�4 þ6Hþ þ5C2H2O4"2Mn2þþ8H2Oþ10CO2

The following steps lead to its decompositions to elementarysteps:

1.

determine the combinatorially possible species and selectfrom those the chemically acceptable ones,

2.

determine the combinatorially possible reaction steps that aresimple in the above sense and select from those the chemicallyacceptable ones,

3.

find those representations of the given overall reaction that arechemically acceptable.

As shown in Section 2 of our paper, the second and third stepsreduce to the solution of linear Diophantine equations. The authorsof Kovacs et al. (2004) worked with 19 species, including fourhypothetical transient species, made up of four atomic constituents(and charge); these are listed in Table 2. The corresponding atomicmatrix is a 5�19 matrix. To generate all combinatorially feasibleelementary reactions, 2 � 19þ 19

2

� �¼ 209 systems need to be solved.

The results give 1022 combinatorially feasible elementary steps.Based on chemical evidence a large number of them were elimi-nated, leaving 673 elementary reactions.

The same computational results were reproduced in Papp andVizvari (2006), where further combinatorial analysis revealed thatonly 297 of the previously generated elementary reactions may bepart of decompositions, and that three of the species cannot begenerated during the reaction. This analysis takes into account whichfive species are present initially in the reaction (based on experi-ments), and is an adaptation of the indexing process by Volpert(1972). It is perhaps worth mentioning that the result (in this specificexample) is not sensitive to the assumption on the initial species; thesame elementary steps and species remain if every noncomplexspecies is assumed to be present initially in the vessel.

Decompositions of the overall reaction can be obtained via thesolution of another linear Diophantine system of equations. Withthe above analysis the dimensions of this system are reduced to16�297. The generation of decompositions can be further accel-erated by preprocessing: simple analysis, using linear program-ming, shows that every decomposition consists of at least 15steps, and that two elementary steps take part in every decom-position, one of them with a coefficient of at least four. After thispreprocessing, it is possible to find all decompositions of 15–17steps, and thousands of more complex decompositions, fromwhich chemically acceptable ones can be selected.

We refer the reader to the two papers cited above for thedetails of these computations, and a review of a number ofalgorithms for the solution of linear Diophantine equations. Allof these algorithms and the various methods of combinatorialanalysis mentioned above are now built in to our program.

3.5. Numerics

3.5.1. Stiffness

One of the major problems when solving initial value pro-blems describing chemical reactions is – as in general – stiffness:the situation when the reaction proceeds along more than onetime scales, reaction rates of different steps are of differentmagnitude. Then the codes meet the dilemma: if they choose asmall step size, then the numerical solution will need much time,if they take a too long step size, then interesting phenomena

1,3BPG GADP

GADP

1,3BPG

DHAP GADP

DHAP

GADP DHAP

F1,6BP DHAP GADP

F1,6BP

DHAP GADP F1,6BP

2PG H2O PEP

H2O PEP

2PG

2PG 3PG

3PG

3PG 2PG

PEP 2PG

Volpert graph or Petri net

ATP Glc ADP G6P H

ADP

G6P

H

ATP

Glc

G6P F6P

F6P

F6P G6P

ATP F6P ADP F1,6BP

F1,6BP

GADP NAD Pi 1,3BPG H NADH

1,3BPGNADH

GADP NAD Pi

1,3BPG ADP 3PG ATP

3PG

ATPADP PEP Pyr

Pyr

PEP

Fig. 6. The Volpert graph or Petri net of a glycolysis model.

Table 2Species of the permanganate/oxalic acid reaction according to Kovacs et al. (2004).

Species with initially positive concentration are typeset bold.

H2C2O4 HC2O�4 Hþ C2O2�4 Mn2þ MnC2O4 MnO�4 MnO2

Mn3þ CO2 H2O CO�2 ½MnO2 ,H2C2O4� ½MnðC2O4Þ�þ

½MnðC2O4Þ2�� ½MnC2O4 ,MnO�4 ,Hþ � ½MnC2O2þ

4 ,MnO�3 �þ

½MnC2O2þ4 ,MnO�3 ,Hþ �2þ ½Hþ ,MnO2 ,H2C2O4�

þ

A.L. Nagy et al. / Chemical Engineering Science 83 (2012) 12–23 19

occurring in the time evolution of the fast species (e.g. oscillation)will be lost. Starting with Gear (1992) and Butcher and Cash(1990) many methods fulfilling the requirements of the chemist

have been elaborated and built in into program packages. Thefollowing example shows that such an insertion has been carriedout especially successfully in the case of Mathematica.

The Robertson problem (Robertson, 1966)

A�!0:04

B, 2B �!3�107

BþC, BþC�!104

AþC

is a popular benchmark problem of stiff type because there is anine orders of magnitude difference between the reaction ratecoefficients (if the unit of concentration used is mol/dm3). Tomake matters worse, the solution is required on the time interval

12

1 1

1

1

11

1

A BB

A

2 B B C

C B C A C

Fig. 7. The Volpert graph of the Robertson model.

0 200 000 400 000 600 000 800 000 1×106

time

0.999995

1.000000

1.000010

1.000010

tota

l con

c.

Mass conserved

Fig. 8. The total mass in the Robertson model. –5 0 5 10log (time)

0.2

0.4

0.6

0.8

1.0

conc.a decreasing, c increasing

Fig. 9. Species A and C in the Robertson model.

The quantity of the intermedier b is so smallthat we were unable to see it in the previous figures.

A.L. Nagy et al. / Chemical Engineering Science 83 (2012) 12–2320

[0,1011]. Fig. 7 shows its Volpert graph. No matter what the valuesof the reaction rate coefficients are, the derivatives of theconcentrations sum up to zero, meaning that total mass isconserved. One way to verify this fact is to execute the following:

conc.

Total½RightHandSide½f‘‘Robertson’’g,fk1;k2;k3g��

0.00003

0.000035

which gives 0, c.f. Yildirim and Bayram (2000). The concentrationsare calculated numerically as simply as usual (with our built-infunction Concentrations)

0.00002

0.000025

Concentrations½f‘‘Robertson’’g,f0:04,3� 107,104g,

f1;0;0g,f0;1011g�

–5 0 5 10log (time)

5.×10–6

0.00001

0.000015

Fig. 10. Species B in the Robertson model.

Also the numerical method is good enough to conserve mass(Fig. 8). Let us see the individual concentrations of species A and Cusing logarithmic time scale (Fig. 9). But what about the speciesB? See Fig. 10.

One of our colleagues, R. Horvath, was so kind as to solve thesame problem using MATLAB; the same results were obtainedwithin the same CPU time, but not without human intervention.

Finally, we remark that a symbolic approach to unveil stiffnesswhen it does not manifest itself on the surface has been given byProf. Goldshtein at the conference, and see also Bykov et al.(2008).

3.5.2. Bifurcations

A usual method to show that oscillatory solutions exist in theinduced kinetic differential equation of a reaction is to apply thewell-known Andronov–Hopf bifurcation theorem. Visualizing theeffect of the change of the parameters is really simple using theManipulate command of Mathematica, see also the last example

of Section 3. For a simple implementation see the demonstrationby Vardai and Toth (2009). In fact the method used there is basedon particular ideas and has not as yet been built into our programpackage handling general models.

3.6. Symbolic methods

Symbolic solutions to differential equations are easier to findnowadays, still it is a hard problem even to find stationary points,see Remark 1. The most interesting developments are expected in

0 2 4 6 8time

500

1000

1500

conc

.

Species: X, Y

Fig. 11. Stochastic Brusselator model is considered with reaction rate coefficients:

k1 ¼ 1:92, k2 ¼ 5:76, k3 ¼ 5:6, k4 ¼ 4:8 and initial conditions x0 ¼ 500, y0 ¼ 720. The

‘‘noisy’’ curve describes the evolution of the stochastic model, where the volume is

10�21 dm3.

A.L. Nagy et al. / Chemical Engineering Science 83 (2012) 12–23 21

these fields, e.g. how to find automatically the equivalence(of some kind) of different kinetic models (Mendez and Femat,under review), how to show the possibility or impossibility oftransforming one dynamics into another by (say, orthogonal)transformations (Toth and Hars, 1986a) using perhaps the theoryof algebraic invariants of differential equations (Halmschlageret al., 2004), how to find a minimal model with given propertieswithin a class of reactions (Wilhelm, 2009; Toth and Hars, 1986b),given an induced kinetic differential equation, how to find areaction with a given structure (Szederkenyi, 2010; Szederkenyiand Hangos, 2011), etc.

3.7. Stochastic simulation

In reaction kinetics, it has always been obvious from thetheoretical point of view that small systems (see e.g. Aranyi andToth, 1977), and systems operating around an unstable stationarystate (e.g. models of chirality, see e.g. Barabas et al., 2010) arebetter described with the standard continuous time discrete statestochastic model of chemical reactions, see e.g. Erdi and Toth(1989, Chapter 5). However, it turned out to be much morerelevant only recently, as with the development of analyticaltechniques it became possible to measure individual molecules,see e.g. Lee et al. (2010). That is the reason why simulation of thestochastic model forms a relevant part of our program package.

Here we are considering only the usual continuous timediscrete state model which is a Markovian jump process. Denoteby XðtÞ the number of species presents in the system at time t.Now, our investigated process is defined to evolve in time so thatthe law

PðRr takes place in ½t,tþhÞ9XðtÞÞ ¼ krðXðtÞÞhþeðhÞh ð6Þ

is fulfilled where eðhÞ-0 if h-0 and kj’s (r¼1, 2, y, R) are a kindof combinatorial functions of the vector of numbers of speciessimilar to but slightly different from the product of powers (Kurtz

kinetics) involving also the reaction rate coefficients. From thisassumption one can easily determine the infinitesimal generator ofthis Markov process from which the Kolmogorov forward andbackward equations as well as the master equation are obtained.However, our formulation is equivalent to the following explicitrepresentation:

XðtÞ ¼Xð0ÞþXR

r ¼ 1

Zr

Z t

0krðXðsÞÞ ds

� �cð�,rÞ ð7Þ

where the Zr ’s are independent, unit-rate Poisson processes. Notethat there are many known stochastic simulation algorithms forthe presented problem but we intend to summarize only a few ofthem. The first one is the direct method (cf. Sipos et al., 1974a,b):let kðxÞ :¼

PRr ¼ 1 krðxÞ and suppose T40 is given, then the

initialization step is: xð0Þ :¼ x0ARM , t :¼ 0; then the algorithmworks as follows:

While½toT ,c :¼ RandomChoice½fkrðxðtÞÞ=kðxðtÞÞ; r¼ 1;2, . . . ,Rg-fRr; r¼ 1;2, . . . ,Rg�;s :¼ RandomVariate½ExponentialDistribution½kðxðtÞÞ��;xðtþsÞ :¼ xðtÞþc; t¼ tþs�

Notice that the idea of the direct method relies on definition(6). Also there exist several variants (e.g. first reaction method) andimprovements of this early method (see e.g. Gibson and Bruck,2000). In what follows we briefly present the approximation

methods, which have their roots in formula (7). At the heart ofthese kinds of methods is the leap condition, that is choose t to besmall enough so that the change in the state in ½t,tþtÞ causes no

relevant change for the kr ’s. Again, the initialization step isxð0Þ :¼ x0ARM , t :¼ 0; then the algorithm works as follows:

While½toT ,

Choose t so as to satisfy the leap condition;Do½pr :¼ RandomVariate½PoissonDistribution½krðxðtÞÞt�,fr,1,Rg�;

xðtþtÞ :¼ xðtÞþPR

r ¼ 1 PrðxðtÞ,xðtþtÞ,prÞ;

t¼ tþt�

If we take PrðxðtÞ,xðtþtÞ,prÞ :¼ pr , then we get the explicit

t-leaping method.

� If PrðxðtÞ,xðtþtÞ,prÞ :¼ pr�tkrðxðtÞÞþkrðxðtþtÞÞ, we are led to

the implicit t-leaping method.

� If we set PrðxðtÞ,xðtþtÞ,prÞ :¼ pr�ðt=2ÞkrðxðtÞÞþðt=2ÞkrðxðtþtÞÞ

then what we get is the trapezoidal t-leaping method (Cao andPetzold, 2005; Rathinam et al., 2003).

However, these methods may also be considered as the stochasticanalogues of certain numerical schemes applied to ordinarydifferential equations. Choosing the appropriate t has not turnedout to be a simple task. It is also a challenging problem to avoidnegative population for xðtÞ in the simulation process, see Cao et al.(2005). Especially these last methods are used to handle stiff

problems, where typically implicit approaches give the mostappropriate results. These and several other algorithms have alsobeen implemented into our program package. We also included theconversion of units functions, which provide an elegant way tocompare the solution of the induced kinetic differential equationwith the results of the stochastic simulation process, which isconsidered to be taking place in a certain volume. In Fig. 11 we cansee this comparison on the example of Brusselator model

A�!k1

X, X�!k2

Y, 2XþY�!k3

3X, X�!k4

P

where A and P are external species.In Fig. 12 one can see the behaviour of the Autocatalator model

A�!k1

X, X�!k2

Y, Xþ2Y�!k3

3Y, Y�!k4

P

where again A and P are external species.

0 10 20 30 40 50 60 70time

10

20

30

40

50

num

ber

of s

peci

es

Species: X, Y

Fig. 12. Stochastic Autocatalator model with reaction rate coefficients: k1 ¼ 110:2,

k2 ¼ 0:094, k3 ¼ 0:011, k4 ¼ 90:34, where the initial conditions x0 ¼ 15, y0 ¼ 80

were considered.

1 2 3 4 5 6

2.05

2.10

2.15

No worse fitting ever!

Fig. 13. Fitted model and data.

Fig. 14. The deterministic Brusselator model plotted in 2D using Manipulate in

which one can change the initial conditions in real time (using the ‘‘locator’’

object).

A.L. Nagy et al. / Chemical Engineering Science 83 (2012) 12–2322

3.8. Estimation methods

3.8.1. Based on the deterministic model

Estimating the reaction rate coefficients (and, if necessary, theArrhenius parameters k0,n and A in the formula

kðTÞ ¼ k0Tn expð�A=ðRTÞÞ

see Nagy and Turanyi, 2011) based on measurements is a kind ofart. Here we only make a few remarks.

First of all, Mathematica gives the possibility to obtain esti-mates (seemingly) without any kind of iteration: it is capableusing the numerical solution of a differential equation in the sameway as an explicitly given function. Let us start from thedeterministic model of the reaction

2X"k1

k2

X

where k1 ¼ 0:33 and k2 ¼ 0:72 with the following initial concen-tration of X: x(0)¼2. Let us generate experimental data from thenumerical solution and add a small amount of error.

end¼ 7:0;

sol¼ First½x=:NDSolve½fx’½t� ¼ ¼ � 0:33x½t�2þ0:72x½t�,x½0� ¼ ¼ 2g;x; ft;endg��;times¼ Range½0;5end�=5;data¼ Transpose½ftimes;sol½times�

þRandomReal½:01;5endþ1�g�;

Then, the model needed by the function FindFit

FindFit½data;model½a;b�½x�; ffa;0:7g,fb;0:2gg;x�

is defined in the following way.

model½a;b� :¼ ðmodel½a;b� ¼ First½x=:NDSolve½fx’½t�

¼ ¼ bx½t� � ax½t�2;x½0� ¼ ¼ 2g;x; ft;endg��Þ

As a result we get (0.344129, 0.75174) instead of (0.33, 0.72),not a bad result, but certainly this is only a toy example. Theagreement between the ‘‘measurements’’ and the fitted model isquite good, see Fig. 13. A systematic investigation of similar (andfurther) estimation procedures for more complicated models is inprogress. We also mention that a method similar to simulatedannealing applied to the determination of Arrhenius parametersof reaction rate coefficients has also been elaborated (Nagy et al.,in preparation).

3.8.2. Based on the stochastic model

Based on the stochastic model one can obtain estimates indifferent ways. If we are able to collect data on the individualchanges of the molecules which is not impossible these days (seee.g. Lee et al., 2010), then we can have maximum likelihoodestimates. What is more even equilibrium fluctuations might beenough to estimate the parameters (Erdi and Toth, 1989, Section5.8.7). Another approach is to use a kind of implicit linearregression: Hangos and Toth (1988). Methods elaborated toestimate parameters of mass communication can also be adaptedto the goals of reaction kinetics, see Kovacs (submitted forpublication).

3.9. Visualization

No external package is needed to provide camera ready figuresfor papers in any of the following formats: eps, jpg, pdf, bmp, gif,wmf, etc. (see a delicate example on Fig. 14).

3.10. Discussion, further plans

Kinetics different from the mass action type is also allowedeven now, therefore it does not seem to be a hard task to includetemperature dependence, so important in the case of modelinge.g. atmospheric chemistry and combustion. Surely, reaction–diffusion equations should also be treated in full generalityincluding symbolic treatment, as well. The reduction of thenumber of variables is also a very important topic, see Toth

A.L. Nagy et al. / Chemical Engineering Science 83 (2012) 12–23 23

et al. (1997) on lumping and Gorban and Karlin (2003) andRoussel and Fraser (2001) on the method of invariant manifolds.Let us mention that both of these topics are especially welltreated with modern computational tools where symbolic andnumeric methods can strongly cooperate.

Acknowledgments

The help of Prof. M. Barnett in collecting the literature is highlyappreciated. The authors thank the cooperation with R. Horvath.Our anonymous referees and also our colleagues Mr. T. Ladics andMs. A. Busai were so kind as to closely read earlier versions of themanuscript. We are grateful to all of them. Many of the partici-pants of MaCKiE 2011 contributed with stimulating ideas. Furtherrequirements, criticism and problems to be solved are wanted.

References

Aranyi, P., Toth, J., 1977. A full stochastic description of the Michaelis–Mentenreaction for small systems. Acta Biochim. Biophys. Hung. 12 (4), 375–388.

Barabas, B., Toth, J., Palyi, G., 2010. Stochastic aspects of asymmetric autocatalysisand absolute asymmetric synthesis. J. Math. Chem. 48 (2), 457–489.

Barnett, M.P., Capitani, J.F., von zur Gathen, J., Gerhard, J., 2004. Symboliccalculation in chemistry: selected examples. Int. J. Quant. Chem. 100 (2),80–104.

Butcher, J.C., Cash, J.R., 1990. Towards efficient Runge–Kutta methods for stiffsystems. SIAM J. Numer. Anal. 27 (3), 753–761.

Bykov, V.I., Goldshtein, V., Maas, U., 2008. Simple global reduction technique basedon decomposition approach. Combust. Theory Model. 12 (2), 389–405.

Cao, Y., Petzold, L., 2005. Trapezoidal t-leaping formula for the stochasticsimulation of biochemical systems. In: Proceedings of the Foundations ofSystems Biology in Engineering, pp. 149–152.

Cao, Y., Gillespie, D.T., Petzold, L., 2005. Avoiding negative populations in explicitPoisson t-leaping. J. Chem. Phys. 123 (5), 054104., p. 8.

Clarke, B.L., 1992. Stoichiometric network analysis of the oxalate–persulphate–silver oscillator. J. Chem. Phys. 97 (4), 2459–2472.

Cobelli, C., Carson, R.E., 2008. Introduction to Modeling in Physiology andMedicine. Academic Press Series in Biomedical Engineering. Elsevier Inc.,Oxford, London.

Dickson, L.E., 1913. Finiteness of the odd perfect and primitive abundant numberswith ndistinct prime factors. Am. J. Math. 35 (4). URL /http://www.jstor.org/stable/2370405S.

Erdi, P., Toth, J., 1989. Mathematical Models of Chemical Reactions. Theory andApplications of Deterministic and Stochastic Models. Princeton UniversityPress.

Feinberg, M., 1989. Necessary and sufficient conditions for detailed balancing inmass action systems of arbitrary complexity. Chem. Eng. Sci. 44 (9),1819–1827.

Fowler, R.H., Milne, E.A., 1925. A note on the principle of detailed balancing. Proc.Natl. Acad. Sci. USA 11, 400–402.

Garfinkel, D., Garfinkel, L., Pring, M., Green, S.B., Chance, B., 1970. Computerapplications to biochemical kinetics. Annu. Rev. Biochem. 39, 473–498.

Gear, C.W., 1992. Invariants and numerical methods for ODEs. Physica D (60),303–310.

Gibson, M.A., Bruck, J., 2000. Efficient exact stochastic simulation of chemicalsystems with many species and many channels. J. Phys. Chem. A 104 (9),1876–1889.

Gold, V., Loening, K.L., McNaught, A.D., Shemi, P., 1997. IUPAC Compendium ofChemical Terminology, second ed. Blackwell Science, Oxford.

Gorban, A.N., Karlin, I.V., 2003. Method of invariant manifold for chemical kinetics.Chem. Eng. Sci. 58 (21), 4751–4768.

Graham, R.L., Grotschel, M., Lovasz, L., 1995. Handbook of Combinatorics. ElsevierScience B.V..

Halmschlager, A., Szenthe, L., Toth, J., 2008. Invariants of kinetic differentialequations. In: Proceedings of the 7th Colloquium on the Qualitative Theoryof Differential Equations, Electron. J. Qual. Theory Differ. Equ. 1, 1–4. URL/http://www.emis.de/journals/EJQTDE/7/714.htmlS.

Hangos, K.M., Toth, J., 1988. Maximum likelihood estimation of reaction-rateconstants. Comput. Chem. Eng. 12 (2/3), 135–139.

Jacquez, J.A., 1999. Modeling with Compartments. BioMedware, Ann Arbor, MI.Kovacs, B. An intensity estimation method for inhomogeneous point processes and

its application in reaction kinetics and telecommunications, submitted forpublication.

Kovacs, K., Vizvari, B., Riedel, M., Toth, J., 2004. Computer assisted study of themechanism of the permanganate/oxalic acid reaction. Phys. Chem. Chem.Phys. 6 (6), 1236–1242.

Lee, N.K., Koh, H.R., Han, K.Y., Lee, J., Kim, S.K., 2010. Single-molecule, real-timemeasurement of enzyme kinetics by alternating-laser excitation fluorescenceresonance energy transfer. Chem. Commun. 46 (26), 4683–4685.

Martınez, J., Silva, M., 1982. A simple and fast algorithm to obtain all invariants ofa generalized Petri net. In: Girault, C., Reisig, W. (Eds.), Selected Papers fromthe First and the Second European Workshop on Application and Theory ofPetri Nets. Springer-Verlag, London, UK, pp. 301–310.

Mendez, J.M., Femat, R., 2012. Dynamic equivalence in tangent spaces from vectorfields of chemical reaction networks. Chem. Eng. Sci. 83, 50–55.

Nagy, A.L., Nagy, T., Szabo, B., Turanyi, T., Toth, J., in preparation.Nagy, I., Kovacs, B., Toth, J., 2009. Detailed balance in ion channels: applications of

Feinberg’s theorem. React. Kinet. Catal. Lett. 96 (2), 263–267.Nagy, T., Turanyi, T., 2011. Uncertainty of Arrhenius parameters. Int. J. Chem.

Kinet. 43 (7), 359–378.Papp, D., Vizvari, B., 2006. Effective solution of linear Diophantine equation

systems with an application in chemistry. J. Math. Chem. 39 (1), 15–31.Rathinam, M., Petzold, L.R., Cao, Y., Gillespie, D.T., 2003. Stiffness in stochastic

chemically reacting systems: the implicit t-leaping method. J. Phys. Chem. A119 (24), 12784–12794.

Ratkiewicz, A., Truong, T.N., 2003. Application of chemical graph theory forautomated mechanism generation. J. Chem. Inf. Comput. Sci. 43 (1), 36–44.

Robertson, H.H., 1966. The Solution of a Set of Reaction Rate Equations. ThompsonBook Co.., pp. 178–182.

Ross, J., 2008. Determination of complex reaction mechanisms. Analysis ofchemical, biological and genetic networks. J. Phys. Chem. A 112, 2134–2143.

Roussel, M.R., Fraser, S.J., 2001. Invariant manifold methods for metabolic modelreduction. Chaos 11 (1), 196–206.

Shapiro, A., Horn, F., 1979a. On the possibility of sustained oscillations, multiplesteady states, and asymmetric steady states. Math. Biosci. 44 (1–2), 19–39.

Shapiro, A., Horn, F., 1979b. Math. Biosci. 46 (1–2), 157. (Erratum).Shinar, G., Feinberg, M., 2010. Structural sources of robustness in biochemical

reaction networks. Science 327 (5971), 1389–1391.Sipos, T., Toth, J., Erdi, P., 1974a. Stochastic simulation of complex chemical

reactions by digital computer, I. The model. React. Kinet. Catal. Lett. 1 (1),113–117.

Sipos, T., Toth, J., Erdi, P., 1974b. Stochastic simulation of complex chemicalreactions by digital computer, II. Applications. React. Kinet. Catal. Lett. 1 (2),209–213.

Szederkenyi, G., 2010. Computing sparse and dense realizations of reaction kineticsystems. J. Math. Chem. 47, 551–568.

Szederkenyi, G., Hangos, K.M., 2011. Finding complex balanced and detailedbalanced realizations of chemical reaction networks. J. Math. Chem. 49,1163–1179.

Tomlin, A.S., Turanyi, T., Pilling, M.J., 1997. Mathematical tools for the construc-tion, investigation and reduction of combustion mechanisms. In: Pilling, M.J.,Hancock, G. (Eds.), Low Temperature Combustion and Autoignition. Elsevier,pp. 293–437.

Toth, J., 2002. Formal kinetics with applications, computer science II. In: 6th WorldMulticonference on Systemics, Cybernetics and Informatics, vol. XI, Orlando,Florida, USA, pp. 573–576, July 14–18.

Toth, J., Hars, V., 1986a. Orthogonal transforms of the Lorenz- and Rossler-equations. Physica D 19, 135–144.

Toth, J., Hars, V., 1986b. Specification of oscillating chemical models starting froma given linearized form. Theor. Chim. Acta 70, 143–150.

Toth, J., Rospars, J.P., 2005. Dynamic modelling of biochemical reactions withapplications to signal transduction: principles and tools using Mathematica.Biosystems 11 (79), 33–52.

Toth, J., Simon, L.P., 2005 and 2009. Differential Equations (Differencialegyenle-tek). Typotex, Budapest.

Toth, J., Li, G., Rabitz, H., Tomlin, A.S., 1997. The effect of lumping and expandingon kinetic differential equations. SIAM J. Appl. Math. 57, 1531–1556.

Toth, J., Nagy, A.L., Papp, D. Reaction Kinetics Exercises Programs and TheoremsMathematical and Computational Chemistry. Springer-Verlag, New York, inpreparation.

van Steenberge, P.H.M., D’Hooge, D.R., Reyniers, M.-F., Marin, G.B., 2011. KineticMonte Carlo modeling of precursor route synthesis for conjugated polymers.In: MaCKiE, Papers, Heidelberg.

Vardai, J., Toth, J., 2009. Hopf Bifurcation in the Brusselator. From The WolframDemonstrations Project. URL /http://demonstrations.wolfram.com/HopfBifurcationInTheBrusselator/S.

Volpert, A.I., 1972. Differential equations on graphs. Mat. Sb. 88 (130), 578–588.Wegscheider, R., 1901. Uber simultane Gleichgewichte und die Beziehungen

zwischen Thermodynamik und Reaktionskinetik homogener Systeme. Zsch.Phys. Chem. 39, 257–303.

Weisstein, E.W. Hundred-dollar, Hundred-digit Challenge Problems. FromMathWorld—A Wolfram Web Resource. URL / http://mathworld.wolfram.-com/Hundred-DollarHundred-DigitChallengeProblems.html S.

Wilhelm, T., 2009. The smallest chemical reaction system with bistability. BMCSyst. Biol. 3 (90), 9.

WRI. Comparative Analyses. URL /http://www.wolfram.com/products/mathematica/analysis/S.

Yablonsky, G.S., Constales, D., Marin, G.B., 2010. Coincidence in chemical kinetics.Chem. Eng. Sci. 65, 6065–6076.

Yildirim, N., Bayram, M., 2000. Derivation of conservation relationships formetabolic networks using MAPLE. Appl. Math. Comput. 112 (June (2–3)),255–263. ISSN: 0096-3003, doi:10.1016/S0096-3003(99)00053-3. URL/http://portal.acm.org/citation.cfm?id=348205.348242S.


Recommended