Commit 88d548c4 authored by David Rosenblueth's avatar David Rosenblueth

Fixed nusmv

parent 2e13a99b
......@@ -9,7 +9,7 @@ export_nusmv(OutputFile) :-
biocham_command,
type(OutputFile, output_file),
doc('
exports the current Biocham set of rules and initial state in an SMV
exports the current Biocham set of reactions and initial state in an SMV
\\texttt{.smv} file.
'),
automatic_suffix(OutputFile, '.smv', write, FilenameSmv),
......@@ -29,18 +29,18 @@ export_nusmv_stream(Stream) :-
findall(
(Reactants, Products),
(
item([kind: rule, item: Item]),
rule(Item, _, Reactants, Products)
item([kind: reaction, item: Item]),
reaction(Item, _, Reactants, Products)
),
Rules
Reactions
),
length(Rules, RuleCount),
length(Reactions, ReactionCount),
enumerate_molecules(Molecules),
export_initial_state(Stream, Molecules, RuleCount),
export_rules(Stream, Molecules, Rules).
export_initial_state(Stream, Molecules, ReactionCount),
export_reactions(Stream, Molecules, Reactions).
export_initial_state(Stream, Molecules, RuleCount) :-
export_initial_state(Stream, Molecules, ReactionCount) :-
write(Stream, 'VAR\n'),
(
no_false_initial_state
......@@ -49,7 +49,7 @@ export_initial_state(Stream, Molecules, RuleCount) :-
;
FirstState = 0
),
format(Stream, 'R: ~d..~d;\n', [FirstState, RuleCount]),
format(Stream, 'R: ~d..~d;\n', [FirstState, ReactionCount]),
\+ (
member(Molecule, Molecules),
\+ (
......@@ -58,11 +58,11 @@ export_initial_state(Stream, Molecules, RuleCount) :-
)
),
(
RuleCount < 2
ReactionCount < 2
->
NextStates = '1'
;
format(atom(NextStates), '1..~d', [RuleCount])
format(atom(NextStates), '1..~d', [ReactionCount])
),
format(Stream, '\c
ASSIGN
......@@ -71,16 +71,16 @@ next(R) := ~a;
', [FirstState, NextStates]).
export_rules(Stream, Molecules, Rules) :-
export_reactions(Stream, Molecules, Reactions) :-
\+ (
member(Molecule, Molecules),
\+ (
export_molecule_rules(Stream, Molecule, Rules)
export_molecule_reactions(Stream, Molecule, Reactions)
)
).
export_molecule_rules(Stream, Molecule, Rules) :-
export_molecule_reactions(Stream, Molecule, Reactions) :-
make_nusmv_name(Molecule, Name),
get_initial_state(Molecule, InitialState),
nusmv_initial_state(InitialState, NusmvInitialState),
......@@ -90,7 +90,7 @@ next(~a) := case
R = 0: ~a;
', [Name, Name, NusmvInitialState]),
\+ (
nth1(RuleIndex, Rules, (Reactants, Products)),
nth1(ReactionIndex, Reactions, (Reactants, Products)),
\+ (
(
(
......@@ -103,7 +103,7 @@ next(~a) := case
Result = '{FALSE, TRUE}'
)
->
format(Stream, ' R = ~d: case\n', [RuleIndex]),
format(Stream, ' R = ~d: case\n', [ReactionIndex]),
findall(
ReactantName,
(
......
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