Commit 0e3efbca authored by Mathieu Hemery's avatar Mathieu Hemery

Allow the use of input in the initial concentration

parent b550ab6d
......@@ -1137,7 +1137,13 @@ set_new_iv([],_IV,1) :- !.
set_new_iv([Exp|TailE],[Value|TailV],NewValue) :-
set_new_iv(TailE,TailV,NewValueTempo),
NewValue is NewValueTempo * (Value ** Exp).
(
Exp = 0
->
NewValue = NewValueTempo
;
NewValue = NewValueTempo * (Value ^ Exp)
).
%! highest_exponant(+Multivar,-ExponantSet)
......@@ -1362,9 +1368,10 @@ g_to_c_PIVP([D, PV, IV], [Dc, PVc, IVc], X) :-
displace_multivar_vector(PV, 0, 1, PVd),
displace_exponent([1], D, 0, Egamma),
multiply_multivar_vector(PVd, [[1,Egamma]], PVm),
set_parameter(input, X),
append([ PVm, [[[-1,Egamma]]] ], PVc),
append([IV, [X]], IVc).
append([IV, [input]], IVc).
:- devcom('\\begin{todo}compilation option for not splitting the variables, assumed positive.\\end{todo}').
......
......@@ -134,17 +134,24 @@ get_initial_state(Object, State) :-
;
Item = present(Canonical, Concentration)
->
( % replace input by its value if necessary
parameter_value(input, Input_Value)
->
substitute([input], [Input_Value], Concentration, ConcentrationUpd)
;
ConcentrationUpd = Concentration
),
(
% if we have a parameter, keep it as present(param)
parameter_value(Concentration, _Value)
parameter_value(ConcentrationUpd, _Value)
->
State = present(Concentration)
State = present(ConcentrationUpd)
;
Concentration =:= 0
ConcentrationUpd =:= 0
->
State = absent
;
State = present(Concentration)
State = present(ConcentrationUpd)
)
;
Item = absent(Canonical)
......
......@@ -17,6 +17,8 @@ where reactions_s1 is a list of lists of the form
rewrite_PIVP/3
]).
:- use_module(util).
%! rewrite_PIVP(+PIVP_list, -PIVP_rewrited, -VarNeg)
%
% rewrite the ode set with variables negated is needed
......@@ -46,7 +48,8 @@ negative_initial_concentration([],[],_N).
negative_initial_concentration([Conc|ConcTail],NVL,N):-
(
Conc < 0
substitute([input], [1.0], Conc, ConcA),
ConcA < 0
->
NVL = [N|NVL_tempo]
;
......
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