aboutsummaryrefslogtreecommitdiff
path: root/R/mkinmod.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2014-07-02 18:38:39 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2014-07-02 18:38:39 +0200
commit9728f72ac3fde73051c85b124d14fdc6406e6cfb (patch)
tree83ba06976c2b144e96784eab7a9140468c95e90e /R/mkinmod.R
parenta75c5f01d346cd7e2bbb3f01a98bc16bdca972e5 (diff)
Do not introduce formation fractions for singular pathways
- As a consequence, we do not need implicit formation fractions in mkinfit
Diffstat (limited to 'R/mkinmod.R')
-rw-r--r--R/mkinmod.R17
1 files changed, 13 insertions, 4 deletions
diff --git a/R/mkinmod.R b/R/mkinmod.R
index fe5e8142..1ffd14d7 100644
--- a/R/mkinmod.R
+++ b/R/mkinmod.R
@@ -150,6 +150,9 @@ mkinmod <- function(..., use_of_ff = "min", speclist = NULL)
# Name of box from which transfer takes place
origin_box <- box_1
+ # Number of targets
+ n_targets = length(to)
+
# Add transfer terms to listed compartments
for (target in to) {
target_box <- switch(spec[[target]]$type,
@@ -164,10 +167,16 @@ mkinmod <- function(..., use_of_ff = "min", speclist = NULL)
diffs[[target_box]] <- paste(diffs[[target_box]], "+",
k_from_to, "*", origin_box)
} else {
- fraction_to_target = paste("f", origin_box, "to", target, sep="_")
- parms <- c(parms, fraction_to_target)
- diffs[[target_box]] <- paste(diffs[[target_box]], "+",
- fraction_to_target, "*", decline_term)
+ # Do not introduce a formation fraction if this is the only target
+ if (spec[[origin_box]]$sink == FALSE && n_targets == 1) {
+ diffs[[target_box]] <- paste(diffs[[target_box]], "+",
+ decline_term)
+ } else {
+ fraction_to_target = paste("f", origin_box, "to", target, sep="_")
+ parms <- c(parms, fraction_to_target)
+ diffs[[target_box]] <- paste(diffs[[target_box]], "+",
+ fraction_to_target, "*", decline_term)
+ }
}
}
} #}}}

Contact - Imprint