Commit 391471d5 authored by Marco De Lucia's avatar Marco De Lucia
Browse files

fix RunPQC

parent daf983df
## Functions for dealing with simulations with kinetics
### Marco De Lucia, delucia@gfz-potsdam.de, 2009-2018
### Time-stamp: "Last modified 2018-05-24 18:01:01 delucia"
### Time-stamp: "Last modified 2018-08-15 00:16:25 delucia"
##' This function just runs the generated input buffer - or a list
##' thereof - through \code{phreeqc}. Obviously it requires the
......@@ -25,7 +25,7 @@
##' @export
RunPQC <- function(input, procs=1, second=TRUE) {
.runPQC <- function(input, second=TRUE) {
.runPQC <- function(input, onlysecond) {
require(phreeqc)
phreeqc::phrRunString(input)
out <- phreeqc::phrGetSelectedOutput()[[1]]
......@@ -43,7 +43,7 @@ RunPQC <- function(input, procs=1, second=TRUE) {
## is lin a list of inputs?
if (!is.list(input)) {
if(is.character(input)) { ## normal sequential run
res <- .runPQC(input, second=second)
res <- .runPQC(input, onlysecond=second)
} else {
stopmsg("something wrong with the input, dying!")
}
......@@ -53,7 +53,7 @@ RunPQC <- function(input, procs=1, second=TRUE) {
## old one
## res <- parallel::mclapply(input, .runPQC, mc.silent=TRUE, mc.cores=procs)
## res <- parallel::parLapply(ThisRunCluster, input, .runPQC)
res <- foreach(i=seq_along(input), .combine=rbind) %dopar% .runPQC(input[[i]], second=second)
res <- foreach(i=seq_along(input), .combine=rbind) %dopar% .runPQC(input[[i]], onlysecond=second)
## ## a is the string containing the rbind of each element of the list
## a <- paste("rbind(",paste("res[[",1:procs,"]]",sep="", collapse = ", "),")")
......
## Functions for dealing with surrogate simulations
### Marco De Lucia, delucia@gfz-potsdam.de, 2009-2018
### Time-stamp: "Last modified 2018-05-18 16:19:39 delucia"
### Time-stamp: "Last modified 2018-08-14 20:59:02 delucia"
##' Todo
......
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