You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/catalyst_functionality/chemistry_related_functionality.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,12 +7,12 @@ While Catalyst has primarily been designed around the modelling of biological sy
7
7
## Modelling with compound species
8
8
9
9
#### Creating compound species programmatically
10
-
We will first show how to create compound species through [programmatic construction](@ref programmatic_CRN_construction), and then demonstrate using the DSL. To create a compound species, use the `@compound` macro, first designating the compound, followed by its components (and stoichiometries). In this example, we will create a CO₂ compound species, consisting of one C species and two O species. First, we create species corresponding to the components:
10
+
We will first show how to create compound species through [programmatic construction](@ref programmatic_CRN_construction), and then demonstrate using the DSL. To create a compound species, use the `@compound` macro, first designating the compound, followed by its components (and stoichiometries). In this example, we will create a CO₂ molecule, consisting of one C atom and two O atoms. First, we create species corresponding to the components:
11
11
```@example chem1
12
12
@variables t
13
13
@species C(t) O(t)
14
14
```
15
-
Next, we create the `CO2` compound:
15
+
Next, we create the `CO2` compound species:
16
16
```@example chem1
17
17
@compound CO2(t) = C + 2O
18
18
```
@@ -76,10 +76,10 @@ rn = @reaction_network begin
76
76
(k1,k2), H2O+ CO2 <--> H2CO3
77
77
end
78
78
```
79
-
as the components `C`, `H`, and `O` are not explicitly declared as a species anywhere. Please also note that only `@compounds` can be used as an option in the DSL, not `@compound`.
79
+
as the components `C`, `H`, and `O` are not declared as a species anywhere. Please also note that only `@compounds` can be used as an option in the DSL, not `@compound`.
80
80
81
81
## Balancing chemical reactions
82
-
One use of defining a species as a compound is that they can be used to balance reactions to that the number of compounds are the same on both sides. Catalyst provides the `balance_reaction` function, which takes a reaction, and returns a balanced version. E.g. let us consider a reaction when carbon dioxide is formed from carbon and oxide `C + O --> CO2`. Here, `balance_reaction` enables us to find coefficients creating a balanced reaction (in this case, where the number of carbon and oxygen atoms are the same on both sides). To demonstrate, we first created the unbalanced reactions:
82
+
One use of defining a species as a compound is that they can be used to balance reactions to that the number of components are the same on both sides. Catalyst provides the `balance_reaction` function, which takes a reaction, and returns a balanced version. E.g. let us consider a reaction when carbon dioxide is formed from carbon and oxide `C + O --> CO2`. Here, `balance_reaction` enables us to find coefficients creating a balanced reaction (in this case, where the number of carbon and oxygen atoms are the same on both sides). To demonstrate, we first created the unbalanced reactions:
Copy file name to clipboardExpand all lines: src/reaction_network.jl
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -468,11 +468,11 @@ end
468
468
469
469
# When compound species are declared using the "@compound begin ... end" option, get a list of the compound species, and also the expression that crates them.
470
470
functionread_compound_options(opts)
471
-
# If the compound option is used retrive a list of compound species, and the option that creeates them
471
+
# If the compound option is used retrive a list of compound species (need to be added to teh reaction system's species), and the option that creates them (used to declare them as compounds at the end).
472
472
ifhaskey(opts, :compounds)
473
473
compound_expr = opts[:compounds]
474
474
compound_species = [arg.args[1].args[1] for arg in compound_expr.args[3].args] # Loops through where in the "@compound begin ... end" the compound species names are.
475
-
else
475
+
else# If option is not used, return empty vectors and expressions.
0 commit comments