Commit 568ac870 authored by Mathieu Hemery's avatar Mathieu Hemery
Browse files

Add the comment ;)

parent ec0f1677
......@@ -1047,11 +1047,17 @@ chemical_conversion(Names, PODE, Epsilon) :-
%! gather_reactions(+PODE, +Epsilon, -Reaction_list)
%
%
% Goes from the PODE format to the Reaction list used by write_reaction
gather_reactions(PODE, _Epsilon, Reaction_list) :-
convert_to_list(PODE, Reaction_list, 1).
%! convert_to_list(+PODE, +List, +N)
%
% deconstruct the PODE into a list, N is the offset for the current reaction
% it groups together the reaction that have exactly the same monomial
convert_to_list([], [], _N).
convert_to_list([[]|Tail], List, N) :-
......@@ -1062,7 +1068,7 @@ convert_to_list([[[R,E]|Tail1]|Tail2], List, N) :-
RR is float(abs(R)),
forge_products(R, E, N, Prod),
convert_to_list([Tail1|Tail2], List_tempo, N),
(
( % group similar monomials together
member([RR,E,OldProd],List_tempo)
->
add_list(OldProd, Prod, Prod_tempo),
......@@ -1070,11 +1076,16 @@ convert_to_list([[[R,E]|Tail1]|Tail2], List, N) :-
add_list(Prod_tempo,Em,NewProd),
delete(List_tempo, [RR,E,OldProd], List_temp2),
List = [[RR,E,NewProd]|List_temp2]
;
; % case where no same monomial exists
List = [[RR,E,Prod]|List_tempo]
).
%! forge_products(+Rate, +Exponent, +N_sp, -Product)
%
% Determine the product set of the reaction correspoding to the momomial [rate, exponent]
% in the derivative of the N_sp' species
forge_products(Rate, Exponent, N_sp, Product) :-
length(Exponent, Len),
Left is N_sp-1,
......@@ -1101,7 +1112,7 @@ write_reaction(Names, [Rate, Reactants, Products]) :-
%! write_species(+Names, +Species, -String)
%
% write the products/reactants associated to a given monomial
% write the name of products/reactants associated to a given integer set
write_species(Names, Species, String) :-
(
......@@ -1140,30 +1151,6 @@ write_species_sr([Head|TailNm], [N|TailSp], String) :-
).
%! exponant_to_solution(+Exponant,+Name_list,-Enzyme,-Reaction_rate)
%
% Forge the expression that correspond to a monomial in the all separated case
exponant_to_solution([], _, '_', 1) :- !.
exponant_to_solution([Exp|Tail_exp], [Name|Tail_name], Sol, Kin) :-
exponant_to_solution(Tail_exp, Tail_name, Sol_Tempo, Kin_Tempo),
(
Exp =:= 0
->
Sol = Sol_Tempo,
Kin = Kin_Tempo
;
Sol_Tempo = '_'
->
Sol = Exp*Name,
Kin = Name^Exp
;
Sol = Exp*Name + Sol_Tempo,
Kin = Name^Exp * Kin_Tempo
).
%! negate_name(+Name_list_raw, +Varneg, -Name_list)
%
% Add _p and _m to the name of variables if necessary
......
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