Skip to content

Kinetics

Chemical kinetics: reactions, oscillating reactors, and excitable media.

BrusselatorODESystem(u=1.0, v=1.0, *, a=1.0, b=3.0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

The well-mixed Brusselator.

It oscillates on a limit cycle when b > 1 + a**2.

The reactions A -> U, B + U -> V + D, 2U + V -> 3U, and U -> E with the buffered reactants A and B give du/dt = a - (b + 1) u + u^2 v and dv/dt = b u - u^2 v, with the fixed point (a, b / a). The concentrations are reactor.u and reactor.v.

Parameters:

Name Type Description Default
u float

The initial concentration of the autocatalytic intermediate.

1.0
v float

The initial concentration of the second intermediate.

1.0
a float

The constant supply of the first reactant.

1.0
b float

The constant supply of the second reactant.

3.0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.chemistry.kinetics import BrusselatorODESystem
>>> BrusselatorODESystem(b=1.5).prepare().system_.elements[0].b
1.5
Source code in src/skcomplex/systems/chemistry/kinetics/_oscillators.py
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
def __init__(
    self,
    u: float = 1.0,
    v: float = 1.0,
    *,
    a: float = 1.0,
    b: float = 3.0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.u = u
    self.v = v
    self.a = a
    self.b = b

CatalystPelletElement(label, *, c=1.0, h=0.1, k=10.0, K=20.0)

Bases: Element

Catalyst pellet, the concentration c of the reactant at its surface.

The concentration is relative to the bulk.

The mass transfer and the surface reaction of CatalystPelletSystem change the concentration and read their constants from the pellet.

Parameters:

Name Type Description Default
label str

The label of the pellet.

required
c Annotated[float, closed_open(0, oo)]

The initial surface concentration.

1.0
h Annotated[float, open(0, oo)]

The coefficient of mass transfer from the bulk.

0.1
k Annotated[float, closed_open(0, oo)]

The rate constant of the surface reaction.

10.0
K Annotated[float, closed_open(0, oo)]

The adsorption constant, which sets the inhibition.

20.0

Examples:

>>> from skcomplex.systems.chemistry.kinetics import CatalystPelletElement
>>> CatalystPelletElement('pellet').K
20.0
Source code in src/skcomplex/systems/chemistry/kinetics/_reactors.py
56
57
58
59
60
61
62
63
64
65
66
67
68
69
def __init__(
    self,
    label: str,
    *,
    c: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    h: Annotated[float, RealSet.open(0, oo)] = 0.1,
    k: Annotated[float, RealSet.closed_open(0, oo)] = 10.0,
    K: Annotated[float, RealSet.closed_open(0, oo)] = 20.0,
) -> None:
    super().__init__(label)
    self.c = c
    self.h = h
    self.k = k
    self.K = K

CatalystPelletSystem(c=1.0, *, h=0.1, k=10.0, K=20.0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

The surface concentration of a catalyst pellet.

It is bistable through Langmuir-Hinshelwood kinetics.

The concentration at the surface, relative to the bulk, follows dc/dt = h (1 - c) - k c / (1 + K c)^2, where mass transfer from the bulk balances a reaction that the adsorbed reactant inhibits. For the default parameters a reacting state of low concentration and an inhibited state of high concentration are both stable. The concentration is pellet.c.

Parameters:

Name Type Description Default
c float

The initial surface concentration.

1.0
h float

The coefficient of mass transfer from the bulk.

0.1
k float

The rate constant of the surface reaction.

10.0
K float

The adsorption constant, which sets the inhibition.

20.0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.chemistry.kinetics import CatalystPelletSystem
>>> CatalystPelletSystem(k=5.0).prepare().system_.elements[0].k
5.0
Source code in src/skcomplex/systems/chemistry/kinetics/_reactors.py
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
def __init__(
    self,
    c: float = 1.0,
    *,
    h: float = 0.1,
    k: float = 10.0,
    K: float = 20.0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.c = c
    self.h = h
    self.k = k
    self.K = K

ChemicalLangevinEquationSystem(x=50.0, *, c1=1.5e-06, c2=0.0025, c3=0.0002, c4=3.5, A=100000.0, B=200000.0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

The chemical Langevin equation of Schlögl's bistable reaction.

Its noise switches between two states.

The channels A + 2X -> 3X, 3X -> A + 2X, B -> X, and X -> B have the propensities c1 A x (x - 1) / 2, c2 x (x - 1) (x - 2) / 6, c3 B, and c4 x. Every channel adds its propensity times its change of x to the drift and drives x with its own Wiener process of amplitude the square root of its propensity. The default rate constants are those of Gillespie 2000 scaled to a volume five times smaller, so the stable states lie near 17 and 113 molecules and the noise switches between them within 200 time units. The number of molecules is reactor.x.

Parameters:

Name Type Description Default
x float

The initial number of molecules of X.

50.0
c1 float

The rate constant of the autocatalytic production.

1.5e-06
c2 float

The rate constant of the reverse of the autocatalytic production.

0.0025
c3 float

The rate constant of the production from B.

0.0002
c4 float

The rate constant of the conversion into B.

3.5
A float

The constant number of molecules of A.

100000.0
B float

The constant number of molecules of B.

200000.0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.chemistry.kinetics import ChemicalLangevinEquationSystem
>>> ChemicalLangevinEquationSystem(c4=3.0).prepare().system_.elements[0].c4
3.0
Source code in src/skcomplex/systems/chemistry/kinetics/_reactions.py
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
def __init__(
    self,
    x: float = 50.0,
    *,
    c1: float = 1.5e-6,
    c2: float = 2.5e-3,
    c3: float = 2e-4,
    c4: float = 3.5,
    A: float = 1e5,
    B: float = 2e5,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.x = x
    self.c1 = c1
    self.c2 = c2
    self.c3 = c3
    self.c4 = c4
    self.A = A
    self.B = B

ChemicalLangevinNetworkSystem(enzyme=100.0, substrate=300.0, *, k_binding=0.01, k_unbinding=0.1, k_catalysis=0.1, label='system', solver='auto', backend='auto')

Bases: ReactionNetworkSystem

The chemical Langevin equation of the enzyme reaction E + S <-> C -> E + P.

Every reaction adds its rate times its change of every species to the drift, and one Wiener process with the amplitude the square root of its rate drives every species it changes. Since one increment changes all of them, the total enzyme E + C and the total substrate S + C + P stay constant under the noise, as in the jump process. The amounts are E.x, S.x, C.x, and P.x.

Parameters:

Name Type Description Default
enzyme float

The initial amount of free enzyme.

100.0
substrate float

The initial amount of substrate.

300.0
k_binding float

The rate constant of the binding of enzyme and substrate.

0.01
k_unbinding float

The rate constant of the unbinding of the complex.

0.1
k_catalysis float

The rate constant of the conversion of the complex into enzyme and product.

0.1
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.chemistry.kinetics import ChemicalLangevinNetworkSystem
>>> [reaction.mode for reaction in ChemicalLangevinNetworkSystem().prepare().system_.interactions]
['langevin', 'langevin', 'langevin']
Source code in src/skcomplex/systems/chemistry/kinetics/_reactions.py
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
def __init__(
    self,
    enzyme: float = 100.0,
    substrate: float = 300.0,
    *,
    k_binding: float = 0.01,
    k_unbinding: float = 0.1,
    k_catalysis: float = 0.1,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label=label, solver=solver, backend=backend)
    self.enzyme = enzyme
    self.substrate = substrate
    self.k_binding = k_binding
    self.k_unbinding = k_unbinding
    self.k_catalysis = k_catalysis

CubicAutocatalysisElement(label, *, a=1.0, b=0.0, F=0.04, k=0.05)

Bases: Element

Continuously fed reactor of cubic autocatalysis.

It holds the concentrations of the reactant a and the autocatalyst b.

The reactions and the flows of CubicAutocatalysisSystem change the concentrations and read the feed rate F and the decay rate k from the reactor.

Parameters:

Name Type Description Default
label str

The label of the reactor.

required
a Annotated[float, closed_open(0, oo)]

The initial concentration of the reactant.

1.0
b Annotated[float, closed_open(0, oo)]

The initial concentration of the autocatalyst.

0.0
F Annotated[float, open(0, oo)]

The feed rate, the inverse residence time.

0.04
k Annotated[float, closed_open(0, oo)]

The decay rate of the autocatalyst.

0.05

Examples:

>>> from skcomplex.systems.chemistry.kinetics import CubicAutocatalysisElement
>>> CubicAutocatalysisElement('reactor').F
0.04
Source code in src/skcomplex/systems/chemistry/kinetics/_oscillators.py
53
54
55
56
57
58
59
60
61
62
63
64
65
66
def __init__(
    self,
    label: str,
    *,
    a: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    b: Annotated[float, RealSet.closed_open(0, oo)] = 0.0,
    F: Annotated[float, RealSet.open(0, oo)] = 0.04,
    k: Annotated[float, RealSet.closed_open(0, oo)] = 0.05,
) -> None:
    super().__init__(label)
    self.a = a
    self.b = b
    self.F = F
    self.k = k

CubicAutocatalysisSystem(a=0.5, b=0.5, *, F=0.04, k=0.05, label='system', solver='auto', backend='auto')

Bases: BaseSystem

Cubic autocatalysis A + 2B -> 3B with the decay B -> C.

It runs in a continuously fed reactor.

The flow through the reactor relaxes the reactant to its feed concentration 1 and washes out the autocatalyst at the rate F, so the dimensionless concentrations follow da/dt = -a b^2 + F (1 - a) and db/dt = a b^2 - (F + k) b. The washout state (1, 0) is always stable, and a reacting state coexists with it when F + k < sqrt(F) / 2. The concentrations are reactor.a and reactor.b.

Parameters:

Name Type Description Default
a float

The initial concentration of the reactant.

0.5
b float

The initial concentration of the autocatalyst.

0.5
F float

The feed rate, the inverse residence time.

0.04
k float

The decay rate of the autocatalyst.

0.05
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.chemistry.kinetics import CubicAutocatalysisSystem
>>> CubicAutocatalysisSystem(k=0.06).prepare().system_.elements[0].k
0.06
Source code in src/skcomplex/systems/chemistry/kinetics/_oscillators.py
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
def __init__(
    self,
    a: float = 0.5,
    b: float = 0.5,
    *,
    F: float = 0.04,
    k: float = 0.05,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.a = a
    self.b = b
    self.F = F
    self.k = k

CyclicAdvanceInteraction(label, *, target='cells')

Bases: Interaction

Advance of the cells of Griffeath's cyclic automaton around their cycle of levels.

A cell moves from level k to level k + 1 modulo n when at least threshold of its von Neumann neighbours hold that level, with n and threshold the parameters of its cell.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The cells whose state level the rule updates.

'cells'

Examples:

>>> from skcomplex.systems.chemistry.kinetics import CyclicAdvanceInteraction
>>> CyclicAdvanceInteraction('advance', target='cells').target
'cells'
Source code in src/skcomplex/systems/chemistry/kinetics/_cyclic.py
94
95
96
def __init__(self, label: str, *, target: Role = 'cells') -> None:
    super().__init__(label)
    self.target = target

CyclicCellElement(label, *, level=0, n=14.0, threshold=1.0, space=None)

Bases: Element

Cell of Griffeath's cyclic cellular automaton, with n levels.

The levels follow each other in a cycle.

A cell moves from level k to level k + 1 modulo n when at least threshold of its neighbours hold that level, by the local rule of CyclicCellularAutomatonSystem, so every level eats its predecessor and random initial levels organize into spiral waves.

Parameters:

Name Type Description Default
label str

The label of the cell or the lattice group.

required
level Annotated[object, NN]

The initial level, from 0 to n - 1.

0
n Annotated[float, open(0, oo)]

The number of levels.

14.0
threshold Annotated[float, open(0, oo)]

The number of neighbours at the following level that advance a cell.

1.0
space BaseSpace | None

The lattice of the cells, or None for one cell.

None

Examples:

>>> from skcomplex.systems.chemistry.kinetics import CyclicCellElement
>>> CyclicCellElement('cell').n
14.0
Source code in src/skcomplex/systems/chemistry/kinetics/_cyclic.py
58
59
60
61
62
63
64
65
66
67
68
69
70
def __init__(
    self,
    label: str,
    *,
    level: Annotated[object, NN] = 0,
    n: Annotated[float, RealSet.open(0, oo)] = 14.0,
    threshold: Annotated[float, RealSet.open(0, oo)] = 1.0,
    space: BaseSpace | None = None,
) -> None:
    super().__init__(label, space=space)
    self.level = level
    self.n = n
    self.threshold = threshold

CyclicCellularAutomatonSystem(shape=(64, 64), *, n=14, threshold=1, random_state=0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

Griffeath's cyclic cellular automaton.

Its random levels organize into spiral waves.

Every cell of a lattice holds one of n levels, which follow each other in a cycle, and moves to the following level when at least threshold of its von Neumann neighbours hold it. The levels are cells.level.

Parameters:

Name Type Description Default
shape Sequence[int]

The number of rows and columns.

(64, 64)
n int

The number of levels.

14
threshold int

The number of von Neumann neighbours at the following level that advance a cell.

1
random_state int | Generator | None

The seed or generator of the initial levels.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.chemistry.kinetics import CyclicCellularAutomatonSystem
>>> CyclicCellularAutomatonSystem((10, 10), n=8).prepare().system_.elements[0].n
8
Source code in src/skcomplex/systems/chemistry/kinetics/_cyclic.py
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
def __init__(
    self,
    shape: Sequence[int] = (64, 64),
    *,
    n: int = 14,
    threshold: int = 1,
    random_state: int | np.random.Generator | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.shape = shape
    self.n = n
    self.threshold = threshold
    self.random_state = random_state

ElectrodeKineticsInteraction(label, *, target, C=1.0, alpha=0.5, tau=10.0, kappa=0.05, current=5.0, period=10.0, width=2.0)

Bases: Interaction

Kinetics of an electrode that a train of current pulses charges.

In units of the exchange current and of the thermal voltage, the overpotential follows C deta/dt = i(t) - i_F, with the Butler-Volmer current i_F = c exp(alpha eta) - exp(-(1 - alpha) eta), and the reactant concentration follows dc/dt = (1 - c) / tau - kappa i_F.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the electrode.

required
C Annotated[float, open(0, oo)]

The capacitance of the double layer.

1.0
alpha Annotated[float, open(0, oo)]

The transfer coefficient.

0.5
tau Annotated[float, open(0, oo)]

The residence time of the reactor.

10.0
kappa Annotated[float, closed_open(0, oo)]

The consumption of reactant per unit of Faradaic current.

0.05
current float

The current of a pulse.

5.0
period float

The time between the starts of pulses.

10.0
width float

The duration of a pulse.

2.0

Examples:

>>> from skcomplex.systems.chemistry.kinetics import ElectrodeKineticsInteraction
>>> ElectrodeKineticsInteraction('kinetics', target='electrode').period
10.0
Source code in src/skcomplex/systems/chemistry/kinetics/_reactors.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
def __init__(
    self,
    label: str,
    *,
    target: Role,
    C: Annotated[float, RealSet.open(0, oo)] = 1.0,
    alpha: Annotated[float, RealSet.open(0, oo)] = 0.5,
    tau: Annotated[float, RealSet.open(0, oo)] = 10.0,
    kappa: Annotated[float, RealSet.closed_open(0, oo)] = 0.05,
    current: float = 5.0,
    period: float = 10.0,
    width: float = 2.0,
) -> None:
    super().__init__(label)
    self.target = target
    self.C = C
    self.alpha = alpha
    self.tau = tau
    self.kappa = kappa
    self.current = current
    self.period = period
    self.width = width

HodgepodgeCellElement(label, *, level=0, n=100.0, k1=2.0, k2=3.0, g=34.0, space=None)

Bases: Element

Cell of the hodgepodge machine of Gerhardt and Schuster.

It is healthy at 0, infected below n, and ill at n.

Healthy cells catch the infection from their infected and ill neighbours, infected cells worsen by the mean of their neighbourhood plus g, and ill cells heal, by the local rule of HodgepodgeSystem.

Parameters:

Name Type Description Default
label str

The label of the cell or the lattice group.

required
level Annotated[object, NN]

The initial level of infection from 0 to n.

0
n Annotated[float, open(0, oo)]

The level of illness.

100.0
k1 Annotated[float, open(0, oo)]

The weight of infected neighbours for healthy cells.

2.0
k2 Annotated[float, open(0, oo)]

The weight of ill neighbours for healthy cells.

3.0
g Annotated[float, closed_open(0, oo)]

The speed of the infection.

34.0
space BaseSpace | None

The lattice of the cells, or None for one cell.

None

Examples:

>>> from skcomplex.systems.chemistry.kinetics import HodgepodgeCellElement
>>> HodgepodgeCellElement('cell').n
100.0
Source code in src/skcomplex/systems/chemistry/kinetics/_hodgepodge.py
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
def __init__(
    self,
    label: str,
    *,
    level: Annotated[object, NN] = 0,
    n: Annotated[float, RealSet.open(0, oo)] = 100.0,
    k1: Annotated[float, RealSet.open(0, oo)] = 2.0,
    k2: Annotated[float, RealSet.open(0, oo)] = 3.0,
    g: Annotated[float, RealSet.closed_open(0, oo)] = 34.0,
    space: BaseSpace | None = None,
) -> None:
    super().__init__(label, space=space)
    self.level = level
    self.n = n
    self.k1 = k1
    self.k2 = k2
    self.g = g

HodgepodgeInteraction(label, *, target='cells')

Bases: Interaction

Infection, worsening, and healing of the cells of the hodgepodge machine.

A healthy cell catches the infection from its infected and ill neighbours, an infected cell worsens by the mean of its Moore neighbourhood plus g, and an ill cell heals, with n, k1, k2, and g the parameters of its cell.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The cells whose state level the rule updates.

'cells'

Examples:

>>> from skcomplex.systems.chemistry.kinetics import HodgepodgeInteraction
>>> HodgepodgeInteraction('infection', target='cells').target
'cells'
Source code in src/skcomplex/systems/chemistry/kinetics/_hodgepodge.py
103
104
105
def __init__(self, label: str, *, target: Role = 'cells') -> None:
    super().__init__(label)
    self.target = target

HodgepodgeSystem(shape=(100, 100), *, n=100.0, k1=2.0, k2=3.0, g=34.0, random_state=0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

The hodgepodge machine, a chemical reaction whose waves form spirals.

Every cell of a lattice holds a level of infection from 0 to n. Healthy cells catch the infection from their infected and ill Moore neighbours, infected cells worsen by the mean of their neighbourhood plus g, and ill cells heal. The levels are cells.level.

Parameters:

Name Type Description Default
shape Sequence[int]

The number of rows and columns.

(100, 100)
n float

The level of illness.

100.0
k1 float

The weight of infected neighbours for healthy cells.

2.0
k2 float

The weight of ill neighbours for healthy cells.

3.0
g float

The speed of the infection.

34.0
random_state int | Generator | None

The seed or generator of the initial levels.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.chemistry.kinetics import HodgepodgeSystem
>>> HodgepodgeSystem((10, 10)).prepare().system_.elements[0].g
34.0
Source code in src/skcomplex/systems/chemistry/kinetics/_hodgepodge.py
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
def __init__(
    self,
    shape: Sequence[int] = (100, 100),
    *,
    n: float = 100.0,
    k1: float = 2.0,
    k2: float = 3.0,
    g: float = 34.0,
    random_state: int | np.random.Generator | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.shape = shape
    self.n = n
    self.k1 = k1
    self.k2 = k2
    self.g = g
    self.random_state = random_state

MassExchangeInteraction(label, *, target, state='x', goal=0.0, time=1.0, noise=None)

Bases: Interaction

Mass exchange of a concentration towards a feed over a residence or transfer time.

Chemical engineering names it the exchange of a reactor with its feed, or a mass transfer to a surface. The rate is (goal(ns) - x) / time(ns) of a state x of a target, with optional noise. With a constant goal and time and an additive noise of amplitude sigma, the state follows the Ornstein-Uhlenbeck process dx = (goal - x) / time dt + sigma dW, whose stationary variance is sigma**2 time / 2. A goal, a time, or a noise function takes the namespace of the interaction, with the target as target and the time as t, and a number stands for a constant. A goal that is a number applies to every component of a vector state.

Parameters:

Name Type Description Default
label str

The label of the interaction, unique among the components of its system.

required
target Role

The path of the element or group whose state relaxes.

required
state str

The name of the state of the target that relaxes.

'x'
goal Callable[[SimpleNamespace], object] | float

A function of the namespace that returns the goal, or a number.

0.0
time Callable[[SimpleNamespace], object] | float

A function of the namespace that returns the relaxation time, or a positive number.

1.0
noise Callable[[SimpleNamespace], object] | float | None

A function of the namespace that returns the amplitude of the noise, a number, or None for no noise.

None

Raises:

Type Description
ValidationError

The state is not a name, or a function is neither callable nor a number.

Examples:

>>> from skcomplex.core.components.elements import Element
>>> from skcomplex.core.systems import System
>>> from skcomplex.systems.chemistry.kinetics import MassExchangeInteraction
>>> relaxation = MassExchangeInteraction('relaxation', target='stock', goal=10.0, time=0.5)
>>> system = System(elements=[Element('stock', values={'x': 0.0})], interactions=[relaxation]).prepare()
>>> round(float(system.simulate(until=5.0, dt=0.01).get_values('stock.x')[-1]), 3)
10.0
Source code in src/skcomplex/systems/chemistry/kinetics/_mass_exchange.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
def __init__(
    self,
    label: str,
    *,
    target: Role,
    state: str = 'x',
    goal: Callable[[SimpleNamespace], object] | float = 0.0,
    time: Callable[[SimpleNamespace], object] | float = 1.0,
    noise: Callable[[SimpleNamespace], object] | float | None = None,
) -> None:
    super().__init__(label)
    self.target = target
    self.state = state
    self.goal = goal
    self.time = time
    self.noise = noise

MichaelisMentenSystem(enzyme=100.0, substrate=300.0, *, k_binding=0.01, k_unbinding=0.1, k_catalysis=0.1, stochastic=False, label='system', solver='auto', backend='auto')

Bases: ReactionNetworkSystem

The enzyme reaction E + S <-> C -> E + P of Michaelis and Menten.

It runs as rate equations or as jumps.

The total enzyme E + C and the total substrate S + C + P are conserved. In stochastic mode the amounts are numbers of molecules and the reactions are the random events of Gillespie's algorithm. The amounts are E.x, S.x, C.x, and P.x.

Parameters:

Name Type Description Default
enzyme float

The initial amount of free enzyme.

100.0
substrate float

The initial amount of substrate.

300.0
k_binding float

The rate constant of the binding of enzyme and substrate.

0.01
k_unbinding float

The rate constant of the unbinding of the complex.

0.1
k_catalysis float

The rate constant of the conversion of the complex into enzyme and product.

0.1
stochastic bool

Whether the reactions are random events.

False
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.chemistry.kinetics import MichaelisMentenSystem
>>> [element.label for element in MichaelisMentenSystem().prepare().system_.elements]
['E', 'S', 'C', 'P']
>>> sorted(MichaelisMentenSystem(stochastic=True).get_tags().laws)
['jump']
Source code in src/skcomplex/systems/chemistry/kinetics/_reactions.py
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
def __init__(
    self,
    enzyme: float = 100.0,
    substrate: float = 300.0,
    *,
    k_binding: float = 0.01,
    k_unbinding: float = 0.1,
    k_catalysis: float = 0.1,
    stochastic: bool = False,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label=label, solver=solver, backend=backend)
    self.enzyme = enzyme
    self.substrate = substrate
    self.k_binding = k_binding
    self.k_unbinding = k_unbinding
    self.k_catalysis = k_catalysis
    self.stochastic = stochastic

NanoparticleCoronaSystem(nanoparticle=18.0, *, radius=35.0, proteins=(600000.0, 15000.0, 8800.0), corona=(14.0, 4.0, 0.0), protein_radii=(5.0, 4.0, 8.3), association=(2400.0, 30000.0, 2000.0), dissociation=(0.002, 3e-05, 0.002), label='system', solver='auto', backend='auto')

Bases: BaseSystem

The corona that plasma proteins form on a nanoparticle.

The proteins are albumin, high-density lipoprotein, and fibrinogen.

Each protein i binds a free nanoparticle at the rate n_i alpha_i U P_i and leaves it at the rate delta_i B_i, where n_i = 4 (R + r_i)^2 / r_i^2 is the number of its sites on a nanoparticle of radius R. The book gives only the balance of the complexes, and the system takes the free nanoparticles and the free proteins from mass action, so U + sum B_i and every P_i + B_i are conserved. The parameters and initial concentrations are the book's, without the binding to a target. Concentrations are in nM, association rates in 1/(M s), and time is in seconds. Albumin, the most abundant, covers the nanoparticles first, and lipoprotein, which binds more tightly, replaces it within hours, which is the Vroman effect. The free nanoparticles are nanoparticle.x, the free proteins albumin.x, lipoprotein.x, and fibrinogen.x, and the complexes albumin_corona.x, lipoprotein_corona.x, and fibrinogen_corona.x.

Parameters:

Name Type Description Default
nanoparticle float

The initial concentration of free nanoparticles.

18.0
radius float

The radius of a nanoparticle, in nm.

35.0
proteins Sequence[float]

The initial concentrations of free albumin, lipoprotein, and fibrinogen.

(600000.0, 15000.0, 8800.0)
corona Sequence[float]

The initial concentrations of nanoparticles bound to each protein.

(14.0, 4.0, 0.0)
protein_radii Sequence[float]

The radii of the proteins, in nm.

(5.0, 4.0, 8.3)
association Sequence[float]

The association rates of the proteins.

(2400.0, 30000.0, 2000.0)
dissociation Sequence[float]

The dissociation rates of the proteins, per second.

(0.002, 3e-05, 0.002)
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.chemistry.kinetics import NanoparticleCoronaSystem
>>> round(NanoparticleCoronaSystem().prepare().system_.interactions[0].k, 7)
0.0006144
Source code in src/skcomplex/systems/chemistry/kinetics/_nanoparticles.py
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
def __init__(
    self,
    nanoparticle: float = 18.0,
    *,
    radius: float = 35.0,
    proteins: Sequence[float] = (6e5, 1.5e4, 8.8e3),
    corona: Sequence[float] = (14.0, 4.0, 0.0),
    protein_radii: Sequence[float] = (5.0, 4.0, 8.3),
    association: Sequence[float] = (2.4e3, 3e4, 2e3),
    dissociation: Sequence[float] = (2e-3, 3e-5, 2e-3),
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.nanoparticle = nanoparticle
    self.radius = radius
    self.proteins = proteins
    self.corona = corona
    self.protein_radii = protein_radii
    self.association = association
    self.dissociation = dissociation

OregonatorElement(label, *, x=0.1, y=0.1, z=0.1, epsilon=0.04, delta=0.0004, q=0.0008, f=1.0)

Bases: Element

Reactor of the scaled Oregonator.

It holds the scaled concentrations of bromous acid, bromide, and the oxidized catalyst.

The scaled concentrations follow epsilon dx/dt = q y - x y + x (1 - x), delta dy/dt = -q y - x y + f z, and dz/dt = x - z. The reactions of OregonatorSystem change the concentrations, with the time scales epsilon and delta dividing the stoichiometric coefficients of x and y, and read the parameters from the reactor.

Parameters:

Name Type Description Default
label str

The label of the reactor.

required
x Annotated[float, closed_open(0, oo)]

The initial scaled concentration of bromous acid.

0.1
y Annotated[float, closed_open(0, oo)]

The initial scaled concentration of bromide.

0.1
z Annotated[float, closed_open(0, oo)]

The initial scaled concentration of the oxidized catalyst.

0.1
epsilon Annotated[float, open(0, oo)]

The ratio of the time scales of bromous acid and the catalyst.

0.04
delta Annotated[float, open(0, oo)]

The ratio of the time scales of bromide and the catalyst.

0.0004
q Annotated[float, closed_open(0, oo)]

The ratio of rate constants that sets the lowest bromous acid concentration.

0.0008
f Annotated[float, closed_open(0, oo)]

The stoichiometric factor of bromide production from the catalyst.

1.0

Examples:

>>> from skcomplex.systems.chemistry.kinetics import OregonatorElement
>>> OregonatorElement('reactor').epsilon
0.04
Source code in src/skcomplex/systems/chemistry/kinetics/_oscillators.py
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
def __init__(
    self,
    label: str,
    *,
    x: Annotated[float, RealSet.closed_open(0, oo)] = 0.1,
    y: Annotated[float, RealSet.closed_open(0, oo)] = 0.1,
    z: Annotated[float, RealSet.closed_open(0, oo)] = 0.1,
    epsilon: Annotated[float, RealSet.open(0, oo)] = 0.04,
    delta: Annotated[float, RealSet.open(0, oo)] = 0.0004,
    q: Annotated[float, RealSet.closed_open(0, oo)] = 0.0008,
    f: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
) -> None:
    super().__init__(label)
    self.x = x
    self.y = y
    self.z = z
    self.epsilon = epsilon
    self.delta = delta
    self.q = q
    self.f = f

OregonatorSystem(x=0.1, y=0.1, z=0.1, *, epsilon=0.04, delta=0.0004, q=0.0008, f=1.0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

The scaled Oregonator of the Belousov-Zhabotinsky reaction.

It is the reduction of the FKN mechanism of the reaction.

The scaled concentrations of bromous acid x, bromide y, and the oxidized catalyst z follow epsilon dx/dt = q y - x y + x (1 - x), delta dy/dt = -q y - x y + f z, and dz/dt = x - z. The five reactions of the mechanism, bromate with bromide Y -> X at q y, bromous acid with bromide X + Y -> 0 at x y, the autocatalysis X -> 2X + Z at x, the disproportionation 2X -> 0 at x^2, and the reduction of the catalyst Z -> f Y at z, change x and y by stoichiometric coefficients scaled by 1 / epsilon and 1 / delta. With the standard parameters the reaction settles on a relaxation limit cycle, and the small epsilon and delta make it stiff. The concentrations are reactor.x, reactor.y, and reactor.z.

Parameters:

Name Type Description Default
x float

The initial scaled concentration of bromous acid.

0.1
y float

The initial scaled concentration of bromide.

0.1
z float

The initial scaled concentration of the oxidized catalyst.

0.1
epsilon float

The ratio of the time scales of bromous acid and the catalyst.

0.04
delta float

The ratio of the time scales of bromide and the catalyst.

0.0004
q float

The ratio of rate constants that sets the lowest bromous acid concentration.

0.0008
f float

The stoichiometric factor of bromide production from the catalyst.

1.0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.chemistry.kinetics import OregonatorSystem
>>> OregonatorSystem(f=0.8).prepare().system_.elements[0].f
0.8
Source code in src/skcomplex/systems/chemistry/kinetics/_oscillators.py
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
def __init__(
    self,
    x: float = 0.1,
    y: float = 0.1,
    z: float = 0.1,
    *,
    epsilon: float = 0.04,
    delta: float = 4e-4,
    q: float = 8e-4,
    f: float = 1.0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.x = x
    self.y = y
    self.z = z
    self.epsilon = epsilon
    self.delta = delta
    self.q = q
    self.f = f

PulsedElectrochemicalReactorSystem(eta=0.0, c=1.0, *, C=1.0, alpha=0.5, tau=10.0, kappa=0.05, current=5.0, period=10.0, width=2.0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

A stirred electrochemical reactor driven by current pulses.

A train of current pulses drives its electrode.

Every pulse charges the double layer, the overpotential drives a Butler-Volmer current that consumes the reactant, and the feed restores it between pulses. The overpotential is electrode.eta and the concentration electrode.c.

Parameters:

Name Type Description Default
eta float

The initial overpotential.

0.0
c float

The initial reactant concentration, relative to the feed.

1.0
C float

The capacitance of the double layer.

1.0
alpha float

The transfer coefficient.

0.5
tau float

The residence time of the reactor.

10.0
kappa float

The consumption of reactant per unit of Faradaic current.

0.05
current float

The current of a pulse.

5.0
period float

The time between the starts of pulses.

10.0
width float

The duration of a pulse.

2.0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.chemistry.kinetics import PulsedElectrochemicalReactorSystem
>>> PulsedElectrochemicalReactorSystem(width=1.0).prepare().system_.interactions[0].width
1.0
>>> sorted(PulsedElectrochemicalReactorSystem().get_tags().laws)
['rate']
Source code in src/skcomplex/systems/chemistry/kinetics/_reactors.py
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
def __init__(
    self,
    eta: float = 0.0,
    c: float = 1.0,
    *,
    C: float = 1.0,
    alpha: float = 0.5,
    tau: float = 10.0,
    kappa: float = 0.05,
    current: float = 5.0,
    period: float = 10.0,
    width: float = 2.0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.eta = eta
    self.c = c
    self.C = C
    self.alpha = alpha
    self.tau = tau
    self.kappa = kappa
    self.current = current
    self.period = period
    self.width = width

PulsedElectrodeElement(label, *, eta=0.0, c=1.0)

Bases: Element

Electrode of a stirred electrochemical reactor, with its overpotential eta and reactant concentration c.

The electrode kinetics of PulsedElectrochemicalReactorSystem change both.

Parameters:

Name Type Description Default
label str

The label of the electrode.

required
eta float

The initial overpotential.

0.0
c Annotated[float, closed_open(0, oo)]

The initial reactant concentration, relative to the feed.

1.0

Examples:

>>> from skcomplex.systems.chemistry.kinetics import PulsedElectrodeElement
>>> PulsedElectrodeElement('electrode', c=0.5).c
0.5
Source code in src/skcomplex/systems/chemistry/kinetics/_reactors.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
def __init__(
    self,
    label: str,
    *,
    eta: float = 0.0,
    c: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
) -> None:
    super().__init__(label)
    self.eta = eta
    self.c = c

SchloglElement(label, *, x=50.0, c1=1.5e-06, c2=0.0025, c3=0.0002, c4=3.5, A=100000.0, B=200000.0)

Bases: Element

Reactor of Schlögl's reaction, the number of molecules of X.

The buffered species are A and B.

The reactions of ChemicalLangevinEquationSystem change x and read the rate constants and the constant numbers of molecules of A and B from the reactor.

Parameters:

Name Type Description Default
label str

The label of the reactor.

required
x Annotated[float, closed_open(0, oo)]

The initial number of molecules of X.

50.0
c1 Annotated[float, closed_open(0, oo)]

The rate constant of the autocatalytic production.

1.5e-06
c2 Annotated[float, closed_open(0, oo)]

The rate constant of the reverse of the autocatalytic production.

0.0025
c3 Annotated[float, closed_open(0, oo)]

The rate constant of the production from B.

0.0002
c4 Annotated[float, closed_open(0, oo)]

The rate constant of the conversion into B.

3.5
A Annotated[float, closed_open(0, oo)]

The constant number of molecules of A.

100000.0
B Annotated[float, closed_open(0, oo)]

The constant number of molecules of B.

200000.0

Examples:

>>> from skcomplex.systems.chemistry.kinetics import SchloglElement
>>> SchloglElement('reactor').x
50.0
Source code in src/skcomplex/systems/chemistry/kinetics/_reactions.py
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
def __init__(
    self,
    label: str,
    *,
    x: Annotated[float, RealSet.closed_open(0, oo)] = 50.0,
    c1: Annotated[float, RealSet.closed_open(0, oo)] = 1.5e-06,
    c2: Annotated[float, RealSet.closed_open(0, oo)] = 0.0025,
    c3: Annotated[float, RealSet.closed_open(0, oo)] = 0.0002,
    c4: Annotated[float, RealSet.closed_open(0, oo)] = 3.5,
    A: Annotated[float, RealSet.closed_open(0, oo)] = 100000.0,
    B: Annotated[float, RealSet.closed_open(0, oo)] = 200000.0,
) -> None:
    super().__init__(label)
    self.x = x
    self.c1 = c1
    self.c2 = c2
    self.c3 = c3
    self.c4 = c4
    self.A = A
    self.B = B

SpeciesElement(label, *, x=0.0, size=None, space=None)

Bases: NonnegativeElement

Chemical species with a nonnegative concentration x.

It is a free nanoparticle, a free protein, or a complex of the two. A species has no laws of its own, and the binding and unbinding reactions move its amount.

Parameters:

Name Type Description Default
label str

The label of the species.

required
x Annotated[object, closed_open(0, oo)]

The initial concentration.

0.0
size int | None

The number of members, or None for one.

None
space BaseSpace | None

The space with one member per site, such as a lattice of classes, or None for none.

None

Examples:

>>> from skcomplex.systems.chemistry.kinetics import SpeciesElement
>>> SpeciesElement('albumin', x=600.0).x
600.0
Source code in src/skcomplex/systems/chemistry/kinetics/_nanoparticles.py
49
50
51
52
53
54
55
56
57
def __init__(
    self,
    label: str,
    *,
    x: Annotated[object, RealSet.closed_open(0, oo)] = 0.0,
    size: int | None = None,
    space: BaseSpace | None = None,
) -> None:
    super().__init__(label, x=x, size=size, space=space)