[CHNOSZ-commits] r94 - in pkg/CHNOSZ: . R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Oct 19 20:37:21 CEST 2015


Author: jedick
Date: 2015-10-19 20:37:20 +0200 (Mon, 19 Oct 2015)
New Revision: 94

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/swap.basis.R
   pkg/CHNOSZ/R/util.list.R
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/man/swap.basis.Rd
Log:
prepare version 1.0.6 for submission to CRAN


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2015-10-09 12:03:09 UTC (rev 93)
+++ pkg/CHNOSZ/DESCRIPTION	2015-10-19 18:37:20 UTC (rev 94)
@@ -1,6 +1,6 @@
-Date: 2015-10-09
+Date: 2015-10-19
 Package: CHNOSZ
-Version: 1.0.5-6
+Version: 1.0.6
 Title: Chemical Thermodynamics and Activity Diagrams
 Author: Jeffrey Dick
 Maintainer: Jeffrey Dick <j3ffdick at gmail.com>

Modified: pkg/CHNOSZ/R/swap.basis.R
===================================================================
--- pkg/CHNOSZ/R/swap.basis.R	2015-10-09 12:03:09 UTC (rev 93)
+++ pkg/CHNOSZ/R/swap.basis.R	2015-10-19 18:37:20 UTC (rev 94)
@@ -16,7 +16,7 @@
   if(T==25) G <- get("thermo")$obigt$G[basis$ispecies]
   else G <- unlist(subcrt(basis$ispecies, T=T, property="G")$out)
   # chemical potentials of the basis species
-  species.mu <- G - convert(basis$logact, "G")
+  species.mu <- G - convert(basis$logact, "G", T=convert(T, "K"))
   # chemical potentials of the elements
   element.mu <- solve(basis.mat, species.mu)
   # give them useful names
@@ -41,14 +41,14 @@
   # with the chemical potentials of the elements
   basis.mu <- colSums((t(basis.mat)*emu)) - G
   # convert chemical potentials to logarithms of activity
-  basis.logact <- -convert(basis.mu, "logK")
+  basis.logact <- -convert(basis.mu, "logK", T=convert(T, "K"))
   # give them useful names
   names(basis.logact) <- rownames(basis.mat)
   return(basis.logact)
 }
 
 # swap in one basis species for another
-swap.basis <- function(species, species2) {
+swap.basis <- function(species, species2, T = 25) {
   # before we do anything, remember the old basis definition
   oldbasis <- get("thermo")$basis
   # and the species definition
@@ -77,9 +77,9 @@
   newbasis <- put.basis(ispecies)
   # if put.basis didn't stop with an error, we're good to go!
   # what were the original chemical potentials of the elements?
-  emu <- element.mu(oldbasis)
+  emu <- element.mu(oldbasis, T=T)
   # the corresponding logarithms of activities of the new basis species
-  bl <- basis.logact(emu, newbasis)
+  bl <- basis.logact(emu, newbasis, T=T)
   # update the basis with these logacts
   mb <- mod.basis(ispecies, logact=bl)
   # restore species if they were defined

Modified: pkg/CHNOSZ/R/util.list.R
===================================================================
--- pkg/CHNOSZ/R/util.list.R	2015-10-09 12:03:09 UTC (rev 93)
+++ pkg/CHNOSZ/R/util.list.R	2015-10-19 18:37:20 UTC (rev 94)
@@ -4,6 +4,7 @@
 which.pmax <- function (elts, na.rm = FALSE, pmin=FALSE) {
   # adapted from R's pmax. elts is a list of numeric vectors
   keepattr <- attributes(elts[[1]])
+  keepdim <- dim(elts[[1]])
   if(!is.numeric(elts[[1]])[1]) {
     if(is.data.frame(elts[[1]])) elts[[1]] <- as.matrix(elts[[1]])
     if(is.list(elts[[1]])) elts[[1]] <- elts[[1]][[1]]
@@ -36,6 +37,10 @@
       mmm <- work[, 1]
     }
   }
+  if(identical(keepattr$class, "data.frame")) {
+    dim(which.mmm) <- keepdim
+    which.mmm <- as.data.frame(which.mmm)
+  }
   mostattributes(which.mmm) <- keepattr
   which.mmm
 }

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2015-10-09 12:03:09 UTC (rev 93)
+++ pkg/CHNOSZ/inst/NEWS	2015-10-19 18:37:20 UTC (rev 94)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.0.5-6 (2015-10-09)
+CHANGES IN CHNOSZ 1.0.6 (2015-10-19)
 --------------------------------------
 
 - Rewrite rho.IAPWS95() to be able to invert density from IAPWS-95
@@ -37,8 +37,8 @@
 - Fix incorrect entry for entropy of aqueous methionine and [Met] in
   OBIGT.csv. Thanks to Apar Prasad for spotting this.
 
-- Some fixes to tests for compatibility with new version of testthat
-  (increase tolerance for one test in test-eos.R because of swapping
+- Some fixes for compatibility with new version of testthat (increase
+  tolerance for one test in test-eos.R because of corrected alignment
   actual/expected values in equals(); move inst/tests to
   inst/test/testthat; use test_check instead of test_package in
   test-all.R (for R CMD check)).

Modified: pkg/CHNOSZ/man/swap.basis.Rd
===================================================================
--- pkg/CHNOSZ/man/swap.basis.Rd	2015-10-09 12:03:09 UTC (rev 93)
+++ pkg/CHNOSZ/man/swap.basis.Rd	2015-10-19 18:37:20 UTC (rev 94)
@@ -13,7 +13,7 @@
   basis.matrix(basis = get("thermo")$basis)
   element.mu(basis = get("thermo")$basis, T = 25)
   basis.logact(emu, basis = get("thermo")$basis, T = 25)
-  swap.basis(species, species2)
+  swap.basis(species, species2, T = 25)
 }
 
 \arguments{



More information about the CHNOSZ-commits mailing list