Commit 28ecdca7 authored by Mathieu Hemery's avatar Mathieu Hemery

Add commentary to the add_terms_as_reactions predicates

parent 7c03d43c
......@@ -749,6 +749,9 @@ non_decomposable_term_in_additive_normal_form(1, Term, Term).
:- dynamic(inhibitor/2).
% add_terms_as_reactions(+Id)
%
% Scan an ODE system to construct the equivalent Biocham model
add_terms_as_reactions(Id) :-
forall(
......@@ -757,10 +760,15 @@ add_terms_as_reactions(Id) :-
).
% add_terms_as_reactions(+Id, +Term, +Occurences)
%
% Add one term of an ODE to the Biocham model
add_term_as_reactions(Id, Term, Occurrences) :-
check_cleaned(ode:reactant/2),
check_cleaned(ode:product/2),
check_cleaned(ode:inhibitor/2),
% Dispatch molecules as products and reactants
forall(
member((X, Coefficient), Occurrences),
(
......@@ -772,6 +780,7 @@ add_term_as_reactions(Id, Term, Occurrences) :-
assertz(product(X, Coefficient))
)
),
% Recognize modifiers (catalysts and inhibitors)
forall(
ode_variables(Id, X),
(
......@@ -801,6 +810,7 @@ add_term_as_reactions(Id, Term, Occurrences) :-
)
)
),
% Build the Reactants part
findall(
Coefficient * Object,
reactant(Object, Coefficient),
......@@ -818,11 +828,13 @@ add_term_as_reactions(Id, Term, Occurrences) :-
;
Inhibitors = []
),
% Build the Products part
findall(
Coefficient * Object,
product(Object, Coefficient),
Products
),
% Build and add the reaction to the model
reaction(Reaction, [
kinetics: Term,
reactants: Reactants,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment