Models

The models created used the ‘|’ operator can be iterated through

[1]:
from mobspy import *

A, B, C, D = BaseSpecies()

iterator = A | B | C | D

for spe in iterator:
    print(spe)
A
B
C
D

Characteristics

One can loop through characteristics by keeping them in a list and using the .c operator. Futhermore, the method get_characteristics() returns the set of characteristics directly added to that species.

[2]:
from mobspy import *

A, B = BaseSpecies()

l_a = ['a1', 'a2', 'a3']
l_b = ['b1', 'b2', 'b3']

for a, b in zip(l_a, l_b):
    A.c(a) + B.c(l_b) >> Zero [1]

print(A.get_characteristics())
print(B.get_characteristics())

S = Simulation(A | B)
print(S.compile())

{'a3', 'a2', 'a1'}
{"['b1', 'b2', 'b3']"}

Species
A.a1,0
A.a2,0
A.a3,0
B.['b1', 'b2', 'b3'],0

Mappings
A :
A.a1
A.a2
A.a3
B :
B.['b1', 'b2', 'b3']

Parameters
volume,1

Reactions
reaction_0,{'re': [(1, 'A.a1'), (1, "B.['b1', 'b2', 'b3']")], 'pr': [], 'kin': "A.a1 * B.['b1', 'b2', 'b3'] * 1 * volume^-1"}
reaction_1,{'re': [(1, 'A.a2'), (1, "B.['b1', 'b2', 'b3']")], 'pr': [], 'kin': "A.a2 * B.['b1', 'b2', 'b3'] * 1 * volume^-1"}
reaction_2,{'re': [(1, 'A.a3'), (1, "B.['b1', 'b2', 'b3']")], 'pr': [], 'kin': "A.a3 * B.['b1', 'b2', 'b3'] * 1 * volume^-1"}

Compiling model

List Species

Futhermore, MobsPy provides a ListSpecies constructor. This constructor creates a list of meta-species automatically named with the variable used to construct the ListSpecies plus _ and the number of the species in the list.

[5]:
A = ListSpecies(5)

for a in A:
    print(a.get_name())
A_1
A_2
A_3
A_4
A_5