Commit 40a15283 authored by SOLIMAN Sylvain's avatar SOLIMAN Sylvain
Browse files

better species ignore list for equilibration

parent b99347a0
...@@ -215,6 +215,11 @@ subst_deg_and_vars(A ^ N, Vars, Ai, NN * AA) :- ...@@ -215,6 +215,11 @@ subst_deg_and_vars(A ^ N, Vars, Ai, NN * AA) :-
!, !,
subst_deg_and_vars(A, Vars, Ai, AA). subst_deg_and_vars(A, Vars, Ai, AA).
subst_deg_and_vars(N, _Vars, _Ai, D) :-
number(N),
!,
get_degree(N, D).
subst_deg_and_vars(K, _Vars, _Ai, D) :- subst_deg_and_vars(K, _Vars, _Ai, D) :-
degree(K, D), degree(K, D),
!. !.
...@@ -425,7 +430,7 @@ ignore_unbalanced([H | T], [H | TT]) :- ...@@ -425,7 +430,7 @@ ignore_unbalanced([H | T], [H | TT]) :-
:- initial(option(tropical_epsilon: 0.1)). :- initial(option(tropical_epsilon: 0.1)).
:- initial(option(tropical_max_degree: 3)). :- initial(option(tropical_max_degree: 3)).
:- initial(option(tropical_partial: 0)). :- initial(option(tropical_ignore: {})).
:- initial(option(tropical_denominator: 0)). :- initial(option(tropical_denominator: 0)).
:- biocham_silent(clear_model). :- biocham_silent(clear_model).
...@@ -456,12 +461,11 @@ tropicalize :- ...@@ -456,12 +461,11 @@ tropicalize :-
'Max absolute value of the degree in epsilon as a power of 2' 'Max absolute value of the degree in epsilon as a power of 2'
), ),
option( option(
tropical_partial, tropical_ignore,
number, {object},
Partial, Partial,
'Number of a variable (as displayed by \\command{list_molecules/0} plus 1) 'set of species to ignore for equilibration ({} to ignore none, {-1} to
to ignore for equilibration (0 to ignore none, -1 to ignore all ignore all unbalanced)'
unbalanced)'
), ),
option( option(
tropical_denominator, tropical_denominator,
...@@ -501,18 +505,26 @@ tropicalize :- ...@@ -501,18 +505,26 @@ tropicalize :-
get_equilibrations(Vars, Ai, E, _DE), get_equilibrations(Vars, Ai, E, _DE),
debug(tropical, "equilibrations: ~w", [E]), debug(tropical, "equilibrations: ~w", [E]),
( (
Partial == 0 Partial == [{}]
-> ->
Equils = E Equils = E
; ;
Partial == -1 Partial == [-1]
-> ->
ignore_unbalanced(E, Equils), ignore_unbalanced(E, Equils),
write(E),nl, write(E),nl,
write(Equils),nl write(Equils),nl
; ;
format("Ignoring equilibration for ~wth variable\n", [Partial]), format("Ignoring equilibration for ~w\n", [Partial]),
nth1(Partial, E, _, Equils) findall(
Eq,
(
nth0(N, E, Eq),
nth0(N, Vars, V),
\+ member(V, Partial)
),
Equils
)
), ),
debug(tropical, "equilibrations: ~w~n", [Equils]), debug(tropical, "equilibrations: ~w~n", [Equils]),
equilibrate_rec(Equils), equilibrate_rec(Equils),
......
Supports Markdown
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