[CHNOSZ-commits] r101 - in pkg/CHNOSZ: . R inst man tests/testthat vignettes
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Nov 19 14:15:23 CET 2015
Author: jedick
Date: 2015-11-19 14:15:23 +0100 (Thu, 19 Nov 2015)
New Revision: 101
Modified:
pkg/CHNOSZ/DESCRIPTION
pkg/CHNOSZ/R/util.affinity.R
pkg/CHNOSZ/inst/NEWS
pkg/CHNOSZ/man/util.water.Rd
pkg/CHNOSZ/tests/testthat/test-affinity.R
pkg/CHNOSZ/tests/testthat/test-diagram.R
pkg/CHNOSZ/tests/testthat/test-util.affinity.R
pkg/CHNOSZ/vignettes/equilibrium.Rnw
pkg/CHNOSZ/vignettes/equilibrium.lyx
Log:
fixes for changed aperm() behavior in R-devel
Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION 2015-11-10 18:16:46 UTC (rev 100)
+++ pkg/CHNOSZ/DESCRIPTION 2015-11-19 13:15:23 UTC (rev 101)
@@ -1,6 +1,6 @@
-Date: 2015-11-10
+Date: 2015-11-19
Package: CHNOSZ
-Version: 1.0.6-5
+Version: 1.0.6-6
Title: Chemical Thermodynamics and Activity Diagrams
Author: Jeffrey Dick
Maintainer: Jeffrey Dick <j3ffdick at gmail.com>
Modified: pkg/CHNOSZ/R/util.affinity.R
===================================================================
--- pkg/CHNOSZ/R/util.affinity.R 2015-11-10 18:16:46 UTC (rev 100)
+++ pkg/CHNOSZ/R/util.affinity.R 2015-11-19 13:15:23 UTC (rev 101)
@@ -359,7 +359,12 @@
# take a slice of affinity along one dimension
a <- affinity
for(j in 1:length(a$values)) {
+ # preserve the dimensions (especially: names(mydim))
+ # - fix for change in behavior of aperm in R-devel 2015-11-17
+ mydim <- dim(a$values[[j]])
a$values[[j]] <- as.array(slice(a$values[[j]],d=d,i=i))
+ # the dimension from which we take the slice vanishes
+ dim(a$values[[j]]) <- mydim[-d]
}
return(a)
}
Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS 2015-11-10 18:16:46 UTC (rev 100)
+++ pkg/CHNOSZ/inst/NEWS 2015-11-19 13:15:23 UTC (rev 101)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.0.6-5 (2015-11-10)
+CHANGES IN CHNOSZ 1.0.6-6 (2015-11-19)
--------------------------------------
- Add functions usrfig() (get figure limits in user coordinates) and
@@ -8,7 +8,7 @@
mosaic()).
- Using new supporting function ibasis(), swap.basis() and mosaic()
- now allow basis species to be specified by name, not just formula.
+ now allow basis species to be specified by name, not only formula.
- diagram() now has '...' argument to pass additional options to
plot() (useful with diagram(tplot=FALSE, ...)).
@@ -31,8 +31,14 @@
nonideal() to set activity coefficients of proton and electron to
zero.
-- Add 'method' argument to equilibrate().
+- Add 'method' argument to equilibrate() (can be 'reaction' or
+ 'boltzmann').
+- For compatibility with a change in R-devel ("aperm(a, *) now preserves
+ names(dim(a))"), modify slice.affinity() to preserve names of
+ dimensions, and use check.attributes=FALSE or check.names=FALSE in
+ some tests.
+
CHANGES IN CHNOSZ 1.0.6 (2015-10-19)
------------------------------------
Modified: pkg/CHNOSZ/man/util.water.Rd
===================================================================
--- pkg/CHNOSZ/man/util.water.Rd 2015-11-10 18:16:46 UTC (rev 100)
+++ pkg/CHNOSZ/man/util.water.Rd 2015-11-19 13:15:23 UTC (rev 101)
@@ -4,7 +4,7 @@
\alias{WP02.auxiliary}
\alias{rho.IAPWS95}
\alias{water.AW90}
-\title{Functions to assist in calculating properties of water and steam}
+\title{Functions for Properties of Water and Steam}
\description{
Utility functions for properties of water and steam.
}
Modified: pkg/CHNOSZ/tests/testthat/test-affinity.R
===================================================================
--- pkg/CHNOSZ/tests/testthat/test-affinity.R 2015-11-10 18:16:46 UTC (rev 100)
+++ pkg/CHNOSZ/tests/testthat/test-affinity.R 2015-11-19 13:15:23 UTC (rev 101)
@@ -31,7 +31,8 @@
a.Eh <- affinity(Eh=Eh, T=100)
a.pe <- affinity(pe=pe, T=100)
# they should give the same result
- expect_equal(a.Eh$values, a.pe$values)
+ # ... except for names(dim(.)), so set check.attributes=FALSE
+ expect_equal(a.Eh$values, a.pe$values, check.attributes=FALSE)
# the variables should have the right names
expect_equal(c(a.Eh$vars, a.pe$vars), c("Eh", "pe"))
# now for an Eh-pH example
@@ -72,7 +73,7 @@
# log_a(O2) = -20, -15, -10, -5, 0
# first test: the dimensions are correct
a.logK <- affinity(T=c(0, 125, 6), H2=c(-20, 0, 5), O2=c(-20, 0, 5), property="logK")
- expect_equal(dim(a.logK$values[[1]]), c(6, 5, 5))
+ expect_equal(dim(a.logK$values[[1]]), c(6, 5, 5), check.names=FALSE)
# second and third tests: the logK values used by affinity() are correct
expect_equal(a.logK$values[[1]][2, 3, 3], logK.25)
expect_equal(a.logK$values[[1]][5, 4, 3], logK.100)
Modified: pkg/CHNOSZ/tests/testthat/test-diagram.R
===================================================================
--- pkg/CHNOSZ/tests/testthat/test-diagram.R 2015-11-10 18:16:46 UTC (rev 100)
+++ pkg/CHNOSZ/tests/testthat/test-diagram.R 2015-11-19 13:15:23 UTC (rev 101)
@@ -54,7 +54,7 @@
# ask for degrees of formation instead of logarithms of activities
d <- diagram(e, alpha=TRUE, plot.it=FALSE)
# we should find that the sum of alphas is one
- expect_equal(Reduce("+", d$plotvals), array(rep(1, 128)))
+ expect_equal(Reduce("+", d$plotvals), array(rep(1, 128)), check.attributes=FALSE)
})
test_that("'normalize' and 'as.residue' work as expected", {
Modified: pkg/CHNOSZ/tests/testthat/test-util.affinity.R
===================================================================
--- pkg/CHNOSZ/tests/testthat/test-util.affinity.R 2015-11-10 18:16:46 UTC (rev 100)
+++ pkg/CHNOSZ/tests/testthat/test-util.affinity.R 2015-11-19 13:15:23 UTC (rev 101)
@@ -8,7 +8,7 @@
# for two proteins, a list of length 2
expect_equal(length(A), 2)
# for 3 variables with the values given to energy.args()
- expect_equal(dim(A[[1]]), c(3, 2, 4))
+ expect_equal(dim(A[[1]]), c(3, 2, 4), check.names=FALSE)
})
test_that("A.ionization() handles arguments generated by energy.args()", {
Modified: pkg/CHNOSZ/vignettes/equilibrium.Rnw
===================================================================
--- pkg/CHNOSZ/vignettes/equilibrium.Rnw 2015-11-10 18:16:46 UTC (rev 100)
+++ pkg/CHNOSZ/vignettes/equilibrium.Rnw 2015-11-19 13:15:23 UTC (rev 101)
@@ -600,8 +600,9 @@
\item The ``Fe-S-O'' example in \texttt{?diagram} shows stability fields
for minerals (balance $\ne$ 1, after \citealp{Hel70c}).
\item Next is an example of using \emph{unequal activities} of species (mineral
-activity = 1; variable aqueous species activity) to plot aqueous species
--- mineral stability boundaries (balance = 1, after Figure 14 of \citealp{Pou49}).
+activity = 1; variable aqueous species activity indicated by the contours
+(logarithm of activity)) to plot aqueous species -- mineral stability
+boundaries (balance = 1, after Figure 14 of \citealp{Pou49}).
\end{itemize}
<<Pourbaix, message=FALSE, results="hide", fig.width=4, fig.height=3, cache=TRUE>>=
basis(c("Cu+2", "H2O", "H+", "e-"))
@@ -633,12 +634,12 @@
This total activity is the initial concentration of GSH that will
be speciated among GSH and GSSG. If the aqueous species have equal
concentrations (or activities), the fraction of GSH that has been
-oxidized is actually 2/3, because the formation of GSSG takes two
-moles of GSH. This is why the blue lines (fraction of starting GSH
-that is oxidized) are higher than the black lines (aqueous species
-distribution). Although the caption to Fig. 3 of \citet{SB01} reads
-``percent GSH that has been oxidized to GSSG'', the lines in their
-figure are closer to the black lines in the figure below.
+oxidized is actually 2/3, because the formation of one mole of GSSG
+consumes two moles of GSH. That is why the blue lines (fraction of
+starting GSH that is oxidized) are higher than the black lines (aqueous
+species distribution). Although the caption to Fig. 3 of \citet{SB01}
+reads ``percent GSH that has been oxidized to GSSG'', the lines
+in their figure are closer to the black lines in the figure below.
\end{itemize}
<<glutathione, results="hide", message=FALSE, fig.width=5, fig.height=3.5>>=
basis(c("GSH", "NH3", "H2S", "H2O", "H+", "e-"))
@@ -905,7 +906,7 @@
(e.g., for systems of proteins where the backbone group is conserved,
$n_{\mathrm{ic},i}$ is the same as $n_{i}$ in Eq. \ref{eq:a_residue_i}).
Calculate values for each of the $\boldsymbol{A}_{i}^{*}$. Metastable
-equilibrium is implied by the identity of $\boldsymbol{A}$ in all
+equilibrium is implied by the equality of $\boldsymbol{A}$ in all
of the equations.
\item Write a function for the total activity of the immobile component:
$a_{\mathrm{ic}}^{'}=\sum n_{\mathrm{ic},i}a_{i}$.
@@ -1080,7 +1081,7 @@
conservation coefficients that differ from unity, such as many mineral
and inorganic systems, where the immobile component has different
molar coefficients in the formulas. For example, consider a system
-like one described by \citealp{See96}:
+like one described by \citet{See96}:
<<SulfurSpeciation, results="hide", message=FALSE, fig.width=6, fig.height=5.5>>=
basis("CHNOS+")
Modified: pkg/CHNOSZ/vignettes/equilibrium.lyx
===================================================================
--- pkg/CHNOSZ/vignettes/equilibrium.lyx 2015-11-10 18:16:46 UTC (rev 100)
+++ pkg/CHNOSZ/vignettes/equilibrium.lyx 2015-11-19 13:15:23 UTC (rev 101)
@@ -2580,9 +2580,9 @@
\emph on
unequal activities
\emph default
- of species (mineral activity = 1; variable aqueous species activity) to
- plot aqueous species -- mineral stability boundaries (balance = 1, after
- Figure 14 of
+ of species (mineral activity = 1; variable aqueous species activity indicated
+ by the contours (logarithm of activity)) to plot aqueous species -- mineral
+ stability boundaries (balance = 1, after Figure 14 of
\begin_inset CommandInset citation
LatexCommand citealp
key "Pou49"
@@ -2704,8 +2704,8 @@
among GSH and GSSG.
If the aqueous species have equal concentrations (or activities), the fraction
of GSH that has been oxidized is actually 2/3, because the formation of
- GSSG takes two moles of GSH.
- This is why the blue lines (fraction of starting GSH that is oxidized)
+ one mole of GSSG consumes two moles of GSH.
+ That is why the blue lines (fraction of starting GSH that is oxidized)
are higher than the black lines (aqueous species distribution).
Although the caption to Fig.
3 of
@@ -3740,7 +3740,7 @@
\end_inset
.
- Metastable equilibrium is implied by the identity of
+ Metastable equilibrium is implied by the equality of
\begin_inset Formula $\boldsymbol{A}$
\end_inset
@@ -4389,7 +4389,7 @@
in the formulas.
For example, consider a system like one described by
\begin_inset CommandInset citation
-LatexCommand citealp
+LatexCommand citet
key "See96"
\end_inset
More information about the CHNOSZ-commits
mailing list