Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
biocham
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
21
Issues
21
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Lifeware
biocham
Commits
30a0329e
Commit
30a0329e
authored
Oct 16, 2015
by
SOLIMAN Sylvain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
checking conservations from kinetics too, fixes stuff in kinetics on the way
parent
50805643
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
7 deletions
+57
-7
conservation_laws.pl
conservation_laws.pl
+15
-3
conservation_laws.plt
conservation_laws.plt
+14
-0
kinetics.pl
kinetics.pl
+3
-1
ode.pl
ode.pl
+3
-3
simplify_arithmetic.pl
simplify_arithmetic.pl
+22
-0
No files found.
conservation_laws.pl
View file @
30a0329e
...
...
@@ -65,6 +65,7 @@ check_conservations :-
'checks all conservation laws against reactions, and if necessary kinetics
(see also \\command{add_conservation/1}).'
),
compute_ode
,
forall
(
(
item
([
model
:
current_model
,
kind
:
conservation
,
id
:
Id
]),
...
...
@@ -106,11 +107,12 @@ check_conservation(C) :-
->
message
(
'~w checked from reactions'
,
[
C
])
;
message
(
'~w not checked from reactions'
,
[
C
]),
check_conserv_num
(
C
)
->
message
(
'~w checked from kinetics'
,
[
C
])
;
message
(
'~w
trusted but not checked
'
,
[
C
]),
message
(
'~w
not checked from kinetics either, but trusted anyway
'
,
[
C
]),
throw
(
error
(
unchecked_conservation_law
(
C
)))
).
...
...
@@ -128,8 +130,18 @@ check_conserv_reactions(C) :-
).
check_conserv_num
(
_
)
:-
fail
.
check_conserv_num
(
C
)
:-
get_weighted_ode
(
C
,
WeightedSum
),
simplify
(
WeightedSum
,
Sum
),
write
(
Sum
),
nl
,
Sum
==
0
.
get_weighted_ode
([],
0
).
get_weighted_ode
([
K
*
M
|
L
],
K
*
O
+
S
)
:-
ode
(
M
,
O
),
get_weighted_ode
(
L
,
S
).
scalar_conservation
([],
_
,
0
).
...
...
conservation_laws.plt
View file @
30a0329e
...
...
@@ -69,6 +69,20 @@ test(
with_output_to(atom(_), command(check_conservations)).
test(
'check_conservations is ok with kinetically conserved moieties',
[
setup(models:clear_model),
cleanup(models:clear_model)
]
) :-
% writing with 'command' produces a parsing error on k…
add_reaction('for'(k*[a], '=>'(a, b))),
add_reaction('for'(k*[a], '=>'(a, 2*a))),
command(add_conservation(a)),
with_output_to(atom(_), command(check_conservations)).
test(
'check_conservations is unhappy with non-conserved moieties',
[
...
...
kinetics.pl
View file @
30a0329e
...
...
@@ -10,6 +10,8 @@ kinetics(Kinetics, Reactants, Expression) :-
Kinetics
=
'MA'
(
Coefficient
)
->
mass_action
(
Coefficient
,
Reactants
,
Expression
)
;
Expression
=
Kinetics
).
...
...
@@ -21,5 +23,5 @@ mass_action(Coefficient, Reactants, Expression) :-
concentration_product
([],
1
).
concentration_product
([
Coefficient
*
Reactant
|
Reactants
],
Product
)
:-
Product
=
Coefficient
*
[
Reactant
]
*
ProductTail
,
Product
=
[
Reactant
]
^
Coefficient
*
ProductTail
,
concentration_product
(
Reactants
,
ProductTail
).
ode.pl
View file @
30a0329e
...
...
@@ -20,8 +20,8 @@ list_ODE :-
compute_ode
:-
retractall
(
ode
(
_
,
_
)),
\
+
(
item
([
model
:
current_model
,
kind
:
r
ule
,
item
:
Item
]),
r
ule
(
Item
,
Kinetics
,
Reactants
,
Products
),
item
([
model
:
current_model
,
kind
:
r
eaction
,
item
:
Item
]),
r
eaction
(
Item
,
Kinetics
,
Reactants
,
Products
),
\
+
(
kinetics
(
Kinetics
,
Reactants
,
KineticsExpression
),
add_molecules
(
Reactants
,
-
KineticsExpression
),
...
...
@@ -58,7 +58,7 @@ add_molecule(Coefficient * Molecule, Kinetics) :-
;
Expression
=
0
),
asserta
(
ode
(
Molecule
,
Expression
+
Kinetics
/
Coefficient
)).
asserta
(
ode
(
Molecule
,
Expression
+
Coefficient
*
Kinetics
)).
print_ode
:-
...
...
simplify_arithmetic.pl
View file @
30a0329e
...
...
@@ -118,6 +118,17 @@ simplify_addition(A, Value * B, Result) :-
ValueOpp
is
-
Value
,
Result
=
A
-
ValueOpp
*
B
.
simplify_addition
(
-
A
,
B
,
C
)
:-
!,
simplify_difference
(
B
,
A
,
C
).
simplify_addition
(
A
,
-
B
,
C
)
:-
!,
simplify_difference
(
A
,
B
,
C
).
simplify_addition
(
A
,
A
,
2
*
A
)
:-
!.
simplify_addition
(
A
,
B
,
A
+
B
).
...
...
@@ -148,6 +159,17 @@ simplify_difference(A, Value * B, Result) :-
ValueOpp
is
-
Value
,
Result
=
A
+
ValueOpp
*
B
.
simplify_difference
(
A
,
A
,
0
)
:-
!.
simplify_difference
(
A
,
-
B
,
C
)
:-
!,
simplify_addition
(
A
,
B
,
C
).
simplify_difference
(
-
A
,
B
,
-
C
)
:-
!,
simplify_addition
(
A
,
B
,
C
).
simplify_difference
(
A
,
B
,
A
-
B
).
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment