[CHNOSZ-commits] r372 - in pkg/CHNOSZ: . R demo inst man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jan 27 06:50:12 CET 2019


Author: jedick
Date: 2019-01-27 06:50:10 +0100 (Sun, 27 Jan 2019)
New Revision: 372

Added:
   pkg/CHNOSZ/demo/saturation.R
Removed:
   pkg/CHNOSZ/demo/activity_ratios.R
Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/diagram.R
   pkg/CHNOSZ/R/examples.R
   pkg/CHNOSZ/demo/00Index
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/man/diagram.Rd
   pkg/CHNOSZ/man/examples.Rd
   pkg/CHNOSZ/man/util.expression.Rd
   pkg/CHNOSZ/vignettes/anintro.Rmd
   pkg/CHNOSZ/vignettes/eos-regress.Rmd
   pkg/CHNOSZ/vignettes/vig.bib
Log:
replace demo/activity_ratios.R with demo/saturation.R


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2019-01-27 02:35:05 UTC (rev 371)
+++ pkg/CHNOSZ/DESCRIPTION	2019-01-27 05:50:10 UTC (rev 372)
@@ -1,6 +1,6 @@
 Date: 2019-01-27
 Package: CHNOSZ
-Version: 1.1.3-79
+Version: 1.1.3-80
 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry
 Authors at R: c(
     person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"),

Modified: pkg/CHNOSZ/R/diagram.R
===================================================================
--- pkg/CHNOSZ/R/diagram.R	2019-01-27 02:35:05 UTC (rev 371)
+++ pkg/CHNOSZ/R/diagram.R	2019-01-27 05:50:10 UTC (rev 372)
@@ -578,6 +578,7 @@
       }
       # colors and curves (predominance), or contours (properties)
       if(identical(predominant, NA)) {
+        contour.method <- rep(contour.method, length.out=length(plotvals))
         if(type=="saturation") {
           # for saturation plot, contour affinity=0 for all species
           for(i in 1:length(plotvals)) {
@@ -591,15 +592,15 @@
               message("diagram: beyond range for saturation line of ", names[i])
               next
             }
-            if(identical(contour.method, NULL) | identical(contour.method, NA) | identical(contour.method, ""))
+            if(identical(contour.method, NULL) | identical(contour.method[1], NA) | identical(contour.method[1], ""))
               contour(xs, ys, zs, add=TRUE, col=col, lty=lty, lwd=lwd, labcex=cex, levels=0, labels=names[i], drawlabels=FALSE)
-            else contour(xs, ys, zs, add=TRUE, col=col, lty=lty, lwd=lwd, labcex=cex, levels=0, labels=names[i], method=contour.method)
+            else contour(xs, ys, zs, add=TRUE, col=col, lty=lty, lwd=lwd, labcex=cex, levels=0, labels=names[i], method=contour.method[i])
           }
         } else {
           # contour solubilities (loga.balance), or properties using first species only
           if(length(plotvals) > 1) warning("showing only first species in 2-D property diagram")
           zs <- plotvals[[1]]
-          contour(xs, ys, zs, add=TRUE, col=col, lty=lty, lwd=lwd, labcex=cex, method=contour.method)
+          contour(xs, ys, zs, add=TRUE, col=col, lty=lty, lwd=lwd, labcex=cex, method=contour.method[1])
         }
         pn <- list(namesx=NULL, namesy=NULL, inames=NULL)
       } else {

Modified: pkg/CHNOSZ/R/examples.R
===================================================================
--- pkg/CHNOSZ/R/examples.R	2019-01-27 02:35:05 UTC (rev 371)
+++ pkg/CHNOSZ/R/examples.R	2019-01-27 05:50:10 UTC (rev 372)
@@ -28,7 +28,7 @@
 
 demos <- function(which=c("sources", "protein.equil", "affinity", "NaCl", "density", 
   "ORP", "revisit", "findit", "ionize", "buffer", "protbuff", "yeastgfp", "mosaic",
-  "copper", "solubility", "gold", "wjd", "bugstab", "Shh", "activity_ratios",
+  "copper", "solubility", "gold", "wjd", "bugstab", "Shh", "saturation",
   "adenine", "DEW", "lambda", "TCA", "go-IU", "bison"), save.png=FALSE) {
   # run one or more demos from CHNOSZ with ask=FALSE, and return the value of the last one
   for(i in 1:length(which)) {

Modified: pkg/CHNOSZ/demo/00Index
===================================================================
--- pkg/CHNOSZ/demo/00Index	2019-01-27 02:35:05 UTC (rev 371)
+++ pkg/CHNOSZ/demo/00Index	2019-01-27 05:50:10 UTC (rev 372)
@@ -18,7 +18,7 @@
 dehydration     log K of dehydration reactions; SVG file contains tooltips and links
 bugstab         Formation potential of microbial proteins in colorectal cancer
 Shh             Affinities of transcription factors relative to Sonic hedgehog
-activity_ratios Mineral stability plots with activity ratios on the axes
+saturation      Equilibrium activity diagram showing activity ratios and mineral saturation limits
 adenine         HKF parameters regressed from heat capacity and volume of aqueous adenine
 DEW             Deep Earth Water (DEW) model for high pressures
 lambda          Thermodynamic properties of lambda transition in quartz

Deleted: pkg/CHNOSZ/demo/activity_ratios.R
===================================================================
--- pkg/CHNOSZ/demo/activity_ratios.R	2019-01-27 02:35:05 UTC (rev 371)
+++ pkg/CHNOSZ/demo/activity_ratios.R	2019-01-27 05:50:10 UTC (rev 372)
@@ -1,66 +0,0 @@
-## Equilibrium activity diagrams for minerals using activity ratios as variables
-## These are made with pH = 0 (activity of H+ = 1), so (activity of the ion) is equal to
-## (activity of the ion) / [(activity of H+) ^ (charge of the ion)]
-
-opar <- par(mfrow = c(2, 2))
-res <- 200
-fill <- "terrain"
-
-data(thermo)
-## get data for gibbsite from the SUPCRT92 database, without loading minerals that
-## have been superseded by the Berman dataset (the default in CHNOSZ)
-add.obigt("SUPCRT92", "gibbsite")
-## or, get data for gibbsite and Al-bearing aqueous species from the SUPCRTBL database
-#add.obigt("SUPCRTBL")
-
-## K2O-Al2O3-SiO2-H2O, 25 degree C, 1 bar
-## Steinmann et al., 1994 (http://ccm.geoscienceworld.org/content/42/2/197)
-## Garrels and Christ, p. 361 (http://www.worldcat.org/oclc/517586)
-## https://wwwbrr.cr.usgs.gov/projects/GWC_coupled/phreeqc/html/final-75.html
-basis(c("Al+3", "pseudo-H4SiO4", "K+", "H2O", "H+", "O2"))
-species(c("gibbsite", "muscovite", "kaolinite", "pyrophyllite", "K-feldspar"))
-a <- affinity(H4SiO4 = c(-6, -2, res), `K+` = c(-3, 6, res))
-diagram(a, ylab = ratlab("K+"), fill = fill, yline = 1.7)
-title(main = syslab(c("K2O", "Al2O3", "SiO2", "H2O")))
-legend("bottomleft", describe.property(c("T", "P"), c(25, 1)), bty = "n")
-
-## H2O-CaO-MgO-SiO2 at 300 degree C and 1000 bar
-## Helgeson et al., 1969, p. 136 (http://www.worldcat.org/oclc/902423149)
-## Bowers et al., 1984, p. 246 (http://www.worldcat.org/oclc/224591948)
-basis(c("H2O", "Ca+2", "Mg+2", "SiO2", "O2", "H+"))
-species(c("quartz", "talc", "chrysotile", "forsterite", "tremolite",
-          "diopside", "wollastonite", "monticellite", "merwinite"))
-# calculate the chemical affinities of formation reactions
-a <- affinity("Mg+2" = c(4, 9, res), "Ca+2" = c(5, 14, res), T = 300, P = 1000)
-diagram(a, xlab = ratlab("Mg+2"), ylab = ratlab("Ca+2"), fill = fill, yline = 1.7)
-title(main = syslab(c("H2O", "CaO", "MgO", "SiO2")))
-legend("bottomright", describe.property(c("T", "P"), c(300, 1000)), bty = "n")
-# note: Bowers et al. use more complicated variables
-# (involving the hydration numbers of H2O and the ion)
-# with accordingly different axis ranges
-
-## MgO-CaO-SiO2-H2O at 300 degree C and Psat
-## Russell et al., 2010 (https://doi.org/10.1111/j.1472-4669.2010.00249.x)
-basis(c("Mg+2", "Ca+2", "SiO2", "H2O", "O2", "H+"))
-species(c("brucite", "chrysotile", "talc", "tremolite", "diopside", "akermanite"))
-a <- affinity(SiO2 = c(-10, 0, res), `Ca+2` = c(0, 20, res), T = 300)
-diagram(a, ylab = ratlab("Ca+2"), fill = fill, yline = 1.7)
-title(main = syslab(c("MgO", "CaO", "SiO2", "H2O")))
-legend("topright", describe.property(c("T", "P"), c(300, 85.84)), bty = "n")
-
-## CaO-MgO-SiO2-H2O and
-## CaO-Al2O3-MgO-SiO2-H2O at 300 degree C and 500 bar
-## Bach and Klein, 2009 (https://doi.org/10.1016/j.lithos.2008.10.022)
-basis(c("Ca+2", "Al+3", "Mg+2", "SiO2", "H2O", "O2", "H+"))
-species(c("clinochlore", "clinozoisite", "prehnite", "grossular"))
-a <- affinity(SiO2 = c(-5, 0, res), `Ca+2` = c(6, 11, res), T = 300, P = 500)
-diagram(a, ylab = ratlab("Ca+2"), balance = "Al+3", fill = fill, yline = 1.7)
-# (Hmmm... where is clinochlore? it doesn't appear on our diagram)
-species(delete = TRUE)
-species(c("brucite", "chrysotile", "talc", "tremolite", "diopside"))
-a <- affinity(SiO2 = c(-5, 0, res), `Ca+2` = c(6, 11, res), T = 300, P = 500)
-diagram(a, add = TRUE, col = "blue", col.names = "blue")
-title(main = syslab(c("CaO", "Al2O3", "MgO", "SiO2", "H2O")))
-legend("topright", describe.property(c("T", "P"), c(300, 500)), bty = "n")
-
-par(opar)

Copied: pkg/CHNOSZ/demo/saturation.R (from rev 371, pkg/CHNOSZ/demo/activity_ratios.R)
===================================================================
--- pkg/CHNOSZ/demo/saturation.R	                        (rev 0)
+++ pkg/CHNOSZ/demo/saturation.R	2019-01-27 05:50:10 UTC (rev 372)
@@ -0,0 +1,37 @@
+# CHNOSZ/demo/saturation.R
+# first version (activity_ratios.R) 20170217
+# keep one diagram and add saturation lines 20190127
+
+## Make equilibrium activity diagrams including saturation limits
+## and using activity ratios as variables
+
+# The ratios are calculated with pH = 0 (activity of H+ = 1), so (activity of the ion) is equal to
+# (activity of the ion) / [(activity of H+) ^ (charge of the ion)]
+
+# NOTE: Bowers et al. use more complicated variables
+# (involving the hydration numbers of H2O and the ion)
+# with subsequently different axis ranges
+
+## H2O-CaO-MgO-SiO2 at 300 degree C and 1000 bar
+## Helgeson et al., 1969, p. 136 (http://www.worldcat.org/oclc/902423149)
+## Bowers et al., 1984, p. 246 (http://www.worldcat.org/oclc/224591948)
+par(cex = 1.4)
+basis(c("H2O", "carbon dioxide", "Ca+2", "Mg+2", "SiO2", "O2", "H+"))
+species(c("quartz", "talc", "chrysotile", "forsterite", "tremolite",
+          "diopside", "wollastonite", "monticellite", "merwinite"))
+# calculate the chemical affinities of formation reactions
+a <- affinity("Mg+2" = c(4, 10, 500), "Ca+2" = c(5, 15, 500), T = 300, P = 1000)
+diagram(a, xlab = ratlab("Mg+2"), ylab = ratlab("Ca+2"), fill = "terrain", yline = 1.7)
+
+# add saturation limits for specified CO2 fugacity
+basis("CO2", -1)
+species(delete = TRUE)
+species(c("calcite", "dolomite", "magnesite", "brucite"))
+a <- affinity("Mg+2" = c(4, 10, 500), "Ca+2" = c(5, 15, 500), T = 300, P = 1000)
+diagram(a, type = "saturation", add = TRUE, contour.method = c("edge", "edge", "flattest", "flattest"), lty = 2, cex = 1.4, col = "blue3")
+
+# add title and legend
+title(main = syslab(c("H2O", "CO2", "CaO", "MgO", "SiO2")))
+dprop <- describe.property(c("T", "P"), c(300, 1000))
+dbasis <- describe.basis(ibasis = 2)
+legend("bottomright", c(dprop, dbasis), bty = "n", cex = 0.9)

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2019-01-27 02:35:05 UTC (rev 371)
+++ pkg/CHNOSZ/inst/NEWS	2019-01-27 05:50:10 UTC (rev 372)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.1.3-79 (2019-01-27)
+CHANGES IN CHNOSZ 1.1.3-80 (2019-01-27)
 ---------------------------------------
 
 BUG FIXES
@@ -85,6 +85,11 @@
 - Add demo/bison.R (average oxidation state of carbon of metagenome-
   derived proteins in different microbial phyla at Bison Pool)
 
+- demo/saturation.R replaces the previous activity_ratios.R, and
+  includes not only activity ratios on the axes but also saturation
+  limits for calcite, dolomite, magnesite, and brucite in the
+  H2O-CO2-CaO-MgO-SiO2 system.
+
 THERMODYNAMIC DATA
 
 - Add dumpdata() for returning/writing all packaged thermodynamic data

Modified: pkg/CHNOSZ/man/diagram.Rd
===================================================================
--- pkg/CHNOSZ/man/diagram.Rd	2019-01-27 02:35:05 UTC (rev 371)
+++ pkg/CHNOSZ/man/diagram.Rd	2019-01-27 05:50:10 UTC (rev 372)
@@ -156,10 +156,10 @@
 If \code{type} is \samp{auto}, and the number of dimensions is 2, then equilibrium predominance (maximum affinity) fields are plotted.
 This algorithm is based on a comparison of the affinities of the formation reactions scaled by the balancing coefficients that are determined by the \code{balance} argument.
 
-If \code{type} is \samp{saturation}, the function plots the line for each species where the affinity of formation equals zero.
+If \code{type} is \samp{saturation}, the function plots the line for each species where the affinity of formation equals zero; see \code{demo("saturation")} for an example.
 If for a given species no saturation line is possible or the range of the diagram is beyond the saturation line, the function prints a message instead.
-If \code{type} is the name of a basis species, the equilibrium activity of the selected basis species in each of the formation reactions is plotted.
-In the case of 2-D diagrams, both of these options use \code{\link{contour}} to draw the lines (see the \CO2-acetic acid example in \code{\link{buffer}}).
+If \code{type} is the name of a basis species, the equilibrium activity of the selected basis species in each of the formation reactions is plotted (see the \CO2-acetic acid example in \code{\link{buffer}}).
+In the case of 2-D diagrams, both of these options use \code{\link{contour}} to draw the lines, using the method specified in \code{contour.method}.
 The \samp{saturation} diagram can handle multiple species, but if \code{type} is the name a basis species, then only the first species of interest is used in the calculation, and a warning is produced if there is more than one.
 }
 

Modified: pkg/CHNOSZ/man/examples.Rd
===================================================================
--- pkg/CHNOSZ/man/examples.Rd	2019-01-27 02:35:05 UTC (rev 371)
+++ pkg/CHNOSZ/man/examples.Rd	2019-01-27 05:50:10 UTC (rev 372)
@@ -16,7 +16,7 @@
   demos(which = c("sources", "protein.equil", "affinity", "NaCl",
     "density", "ORP", "revisit", "findit", "ionize", "buffer",
     "protbuff", "yeastgfp", "mosaic", "copper", "solubility",
-    "gold", "wjd", "bugstab", "Shh", "activity_ratios",
+    "gold", "wjd", "bugstab", "Shh", "saturation",
     "adenine", "DEW", "lambda", "TCA", "go-IU", "bison"),
     save.png=FALSE)
 }
@@ -51,7 +51,7 @@
     \code{dehydration} \tab * \logK of dehydration reactions; SVG file contains tooltips and links \cr
     \code{bugstab} \tab * Formation potential of microbial proteins in colorectal cancer (Dick, 2016) \cr
     \code{Shh} \tab * Affinities of transcription factors relative to Sonic hedgehog (Dick, 2015) \cr
-    \code{activity_ratios} \tab * Mineral stability plots with activity ratios on the axes \cr
+    \code{saturation} \tab * Equilibrium activity diagram showing activity ratios and mineral saturation limits (Bowers et al., 1984) \cr
     \code{adenine} \tab * HKF regression of heat capacity and volume of aqueous adenine (Lowe et al., 2017) \cr
     \code{DEW} \tab * Deep Earth Water (DEW) model for high pressures (Sverjensky et al., 2014a and 2014b) \cr
     \code{lambda} \tab * Effects of lambda transition on thermodynamic properties of quartz (Berman, 1988) \cr
@@ -90,6 +90,8 @@
 
 Berman, R. G. (1988) Internally-consistent thermodynamic data for minerals in the system Na{\s2}O-K{\s2}O-CaO-MgO-FeO-Fe{\s2}O{\s3}-Al{\s2}O{\s3}-SiO{\s2}-TiO{\s2}-H{\s2}O-CO{\s2}. \emph{J. Petrol.} \bold{29}, 445-522. \url{https://doi.org/10.1093/petrology/29.2.445}
 
+Bowers, T. S., Jackson, K. J. and Helgeson, H. C. (1984) \emph{Equilibrium Activity Diagrams for Coexisting Minerals and Aqueous Solutions at Pressures and Temperatures to 5 kb and 600\degC}, Springer-Verlag, Berlin, 397 p. \url{http://www.worldcat.org/oclc/11133620}
+
 Canovas, P. A., III and Shock, E. L. (2016) Geobiochemistry of metabolism: Standard state thermodynamic properties of the citric acid cycle. \emph{Geochim. Cosmochim. Acta} \bold{195}, 293--322. \url{https://doi.org/10.1016/j.gca.2016.08.028}
 
 Dayhoff, M. O. and Lippincott, E. R. and Eck, R. V. (1964) Thermodynamic Equilibria In Prebiological Atmospheres. \emph{Science} \bold{146}, 1461--1464. \url{https://doi.org/10.1126/science.146.3650.1461}

Modified: pkg/CHNOSZ/man/util.expression.Rd
===================================================================
--- pkg/CHNOSZ/man/util.expression.Rd	2019-01-27 02:35:05 UTC (rev 371)
+++ pkg/CHNOSZ/man/util.expression.Rd	2019-01-27 05:50:10 UTC (rev 372)
@@ -121,7 +121,7 @@
 }
 
 \seealso{
-\code{demo("activity_ratios")} for examples of \code{syslab} and \code{ratlab}.
+\code{demo("saturation")} for examples of \code{syslab} and \code{ratlab}.
 }
 
 \examples{\dontshow{data(thermo)}

Modified: pkg/CHNOSZ/vignettes/anintro.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/anintro.Rmd	2019-01-27 02:35:05 UTC (rev 371)
+++ pkg/CHNOSZ/vignettes/anintro.Rmd	2019-01-27 05:50:10 UTC (rev 372)
@@ -633,7 +633,7 @@
 In systems where equilibrium is attainable, it makes sense to call this a *predominance diagram*, showing regions of maximum activity.
 
 ```{r EhpH_plot_color, fig.margin=TRUE, fig.width=4, fig.height=4, smallish.mar=TRUE, dpi=dpi, out.width="100%", echo=FALSE, message=FALSE, cache=TRUE, fig.cap="The same plot, with different colors and labels.", pngquant=pngquant, timeit=timeit}
-diagram(a, fill = "terrain", lwd = 3, lty = 3,
+diagram(a, fill = "terrain", lwd = 2, lty = 3,
         names = c("hydrogen sulfide", "bisulfide", "bisulfate", "sulfate"),
         tplot = FALSE, main = "sulfur species, 25 °C", bty = "n")
 ```
@@ -648,7 +648,9 @@
 Mineral stability diagrams often depict activity ratios, e.g. log (*a*<sub>Ca<sup>+2</sup></sub>/*a*<sub>H<sup>+</sup></sub><sup>2</sup>), on one or both axes.
 The variables used for potential calculations in CHNOSZ include only a single chemical activity, e.g. log *a*<sub>Ca<sup>+2</sup></sub>.
 However, you can set pH = 0 to generate diagrams that are geometrically equivalent to those calculated using activity ratios, and use <span style="color:green">`ratlab()`</span> to make the axes labels for the ratios.
-See [<span style="color:blue">`demo(activity_ratios)`</span>](../demo) for some examples.
+Moreover, <span style="color:green">`diagram()`</span> has a "saturation" option that can be used to draw saturation limits for minerals that do not contain the conserved basis species.
+See [<span style="color:blue">`demo(saturation)`</span>](../demo) for an example that uses activity ratios on the axes and plots saturation limits for calcite, magnesite, dolomite, and brucite on a diagram for the H<sub>2</sub>O–CO<sub>2</sub>–CaO–MgO–SiO<sub>2</sub> system.
+That demo can be used as a template to produce a wide range of diagrams similar to those in @BJH84.
 
 ## Mosaic diagrams
 
@@ -693,9 +695,9 @@
 bases <- c("H2S", "HS-", "HSO4-", "SO4-2")
 m1 <- mosaic(bases, blend = TRUE, pH = c(0, 12, res), Eh=c(-1.2, 0.75, res), T=T)
 diagram(m1$A.species, lwd = 2, fill = NA, limit.water = FALSE)
-diagram(m1$A.bases, add = TRUE, col = "red1", col.names = "red1", lty = 2,
+diagram(m1$A.bases, add = TRUE, col = "red1", col.names = "red1", lty = 3,
         limit.water = FALSE, italic = TRUE)
-water.lines(m1$A.species, col = "blue1", lty = 3)
+water.lines(m1$A.species, col = "blue1")
 ```
 
 The argument `blend = TRUE` is used to combine the diagrams according to the relative abundances of the basis species along with a mixing term (see <span style="color:blue">`?mosaic`</span>).
@@ -722,9 +724,9 @@
   m1 <- do.call(mosaic, mosaicargs)
   diagram(m1$A.species, lwd = 2, fill = "terrain",
           limit.water = FALSE)
-  diagram(m1$A.bases, add = TRUE, col = "red1", col.names = "red1", lty = 2,
+  diagram(m1$A.bases, add = TRUE, col = "red1", col.names = "red1", lty = 3,
           limit.water = FALSE, italic = TRUE)
-  water.lines(m1$A.species, col = "blue1", lty = 3)
+  water.lines(m1$A.species, col = "blue1")
   swap.basis(names(newvar), "e-")
 }
 par(mfrow = c(1, 3))

Modified: pkg/CHNOSZ/vignettes/eos-regress.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/eos-regress.Rmd	2019-01-27 02:35:05 UTC (rev 371)
+++ pkg/CHNOSZ/vignettes/eos-regress.Rmd	2019-01-27 05:50:10 UTC (rev 372)
@@ -55,7 +55,7 @@
 options(htmltools.dir.version = FALSE)
 # adjust plot margins
 knit_hooks$set(small.mar = function(before, options, envir) {
-    if (before) par(mar = c(4.2, 4.2, .1, .1))  # smaller margin on top and right
+    if (before) par(mar = c(4.2, 4.2, .3, .3))  # smaller margin on top and right
 })
 # use pngquant to optimize PNG images
 knit_hooks$set(pngquant = hook_pngquant)
@@ -420,13 +420,19 @@
 ```{r subcrt_H4SiO4, eval=FALSE}
 ```
 
-The large differences for `H4SiO4` at low temperature agree with the comparison to Shock et al. (1989) shown in Figure 3 of Stefánsson (2001).
+The large differences for `r h4sio4` at low temperature agree with the comparison to Shock et al. (1989) shown in Figure 3 of Stefánsson (2001).
 Therefore, Stefánsson's `r h4sio4` should not be used with the _default_ database in CHNOSZ for making mineral activity diagrams.
-Instead, the pseudospecies with properties calculated here, `pseudo-H4SiO4`, is preferable for use with the _default_ database in CHNOSZ---see <span style="color:blue">`?transfer`</span> and [<span style="color:blue">`demo(activity_ratios)`</span>](../demo).
+Instead, the pseudospecies with properties calculated here, `pseudo-H4SiO4`, is preferable for use with the _default_ database in CHNOSZ.
+
 On the other hand, Stefánsson's `r h4sio4` is compatible with `r sio2` in the _optional_ SUPCRTBL data file [@ZZL_16].
+The following example uses these data together with values for gibbsite from [Robie et al., 1978](http://pubs.er.usgs.gov/publication/b1452) (as recommended by Zimmer et al., 2016) to make an activity diagram for the K<sub>2</sub>O-Al<sub>2</sub>O<sub>3</sub>-SiO<sub>2</sub>-H<sub>2</sub>O system.
+This is similar to diagrams found, for example, on p. 361 of [Garrels and Christ, 1965](http://www.worldcat.org/oclc/517586) and Figure 3 of [Steinmann et al., 1994](http://ccm.geoscienceworld.org/content/42/2/197), but is quantitatively a closer match to the diagram in the [User's Guide to PHREEQC](https://wwwbrr.cr.usgs.gov/projects/GWC_coupled/phreeqc/html/final-75.html).
 
-# Other possibilities
-
-These functions are limited to treatment of calorimetric and volumetric data.
-Other software tools have been described recently for deriving HKF parameters and other thermodynamic properties from different types of experimental data [@MKDW15; @Shv15].
-
+```{r activity_diagram, fig.margin=TRUE, fig.width=4, fig.height=4, small.mar=TRUE, echo=TRUE, results="hide", message=FALSE, dpi=dpi, out.width="100%", cache=TRUE, fig.cap="Activity diagram for K<sub>2</sub>O-Al<sub>2</sub>O<sub>3</sub>-SiO<sub>2</sub>-H<sub>2</sub>O.", pngquant=pngquant}
+add.obigt("SUPCRTBL")
+basis(c("Al+3", "H4SiO4", "K+", "H2O", "H+", "O2"))
+species(c("gibbsite", "muscovite", "kaolinite", "pyrophyllite", "K-feldspar"))
+a <- affinity(H4SiO4 = c(-8, 0, 300), `K+` = c(-1, 8, 300))
+diagram(a, ylab = ratlab("K+"), fill = "terrain", yline = 1.7)
+legend("bottomleft", describe.property(c("T", "P"), c(25, 1)), bty = "n")
+```

Modified: pkg/CHNOSZ/vignettes/vig.bib
===================================================================
--- pkg/CHNOSZ/vignettes/vig.bib	2019-01-27 02:35:05 UTC (rev 371)
+++ pkg/CHNOSZ/vignettes/vig.bib	2019-01-27 05:50:10 UTC (rev 372)
@@ -40,6 +40,16 @@
   url           = {http://www.worldcat.org/oclc/12106344},
 }
 
+ at Book{BJH84,
+  author    = {Bowers, Teresa S. and Jackson, Kenneth J. and Helgeson, Harold C.},
+  publisher = {Springer-Verlag},
+  title     = {{E}quilibrium {A}ctivity {D}iagrams for {C}oexisting {M}inerals and {A}queous {S}olutions at {P}ressures and {T}emperatures to 5 kb and 600$^\circ${C}},
+  year      = {1984},
+  address   = {Heidelberg},
+  pages     = {397},
+  url       = {http://www.worldcat.org/oclc/11133620},
+}
+
 @Article{DLE64,
   author        = {Dayhoff, M. O. and Lippincott, E. R. and Eck, R. V.},
   journal       = {Science},
@@ -561,30 +571,6 @@
   issn      = {0021-9614},
 }
 
- at Article{MKDW15,
-  author    = {Miron, George D. and Kulik, Dmitrii A. and Dmytrieva, Svitlana V. and Wagner, Thomas},
-  journal   = {Applied Geochemistry},
-  title     = {{GEMSFITS}: {C}ode package for optimization of geochemical model parameters and inverse modeling},
-  year      = {2015},
-  volume    = {55},
-  pages     = {28--45},
-  note      = {Geochemical Speciation Codes and Databases},
-  doi       = {10.1016/j.apgeochem.2014.10.013},
-  issn      = {0883-2927},
-}
-
- at Article{Shv15,
-  author    = {Shvarov, Yuri},
-  journal   = {Applied Geochemistry},
-  title     = {A suite of programs, {O}ptim{A}, {O}ptim{B}, {O}ptim{C}, and {O}ptim{S} compatible with the {U}nitherm database, for deriving the thermodynamic properties of aqueous species from solubility, potentiometry and spectroscopy measurements},
-  year      = {2015},
-  volume    = {55},
-  pages     = {17--27},
-  note      = {Geochemical Speciation Codes and Databases},
-  doi       = {10.1016/j.apgeochem.2014.11.021},
-  issn      = {0883-2927},
-}
-
 @Article{HWM96,
   author    = {Hn\v{e}dkovsk\'y, Lubom\'ir and Wood, Robert H. and Majer, Vladimir},
   journal   = {Journal of Chemical Thermodynamics},



More information about the CHNOSZ-commits mailing list