[CHNOSZ-commits] r338 - in pkg/CHNOSZ: . R demo inst man man/macros

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Nov 1 08:25:20 CET 2018


Author: jedick
Date: 2018-11-01 08:25:18 +0100 (Thu, 01 Nov 2018)
New Revision: 338

Added:
   pkg/CHNOSZ/demo/gold.R
Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/examples.R
   pkg/CHNOSZ/R/solubility.R
   pkg/CHNOSZ/R/util.expression.R
   pkg/CHNOSZ/R/util.plot.R
   pkg/CHNOSZ/demo/00Index
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/man/examples.Rd
   pkg/CHNOSZ/man/macros/macros.Rd
   pkg/CHNOSZ/man/solubility.Rd
   pkg/CHNOSZ/man/util.expression.Rd
Log:
add demo/gold.R


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2018-10-31 06:25:35 UTC (rev 337)
+++ pkg/CHNOSZ/DESCRIPTION	2018-11-01 07:25:18 UTC (rev 338)
@@ -1,6 +1,6 @@
-Date: 2018-10-31
+Date: 2018-11-01
 Package: CHNOSZ
-Version: 1.1.3-45
+Version: 1.1.3-46
 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/examples.R
===================================================================
--- pkg/CHNOSZ/R/examples.R	2018-10-31 06:25:35 UTC (rev 337)
+++ pkg/CHNOSZ/R/examples.R	2018-11-01 07:25:18 UTC (rev 338)
@@ -28,7 +28,7 @@
 
 demos <- function(which=c("sources", "protein.equil", "affinity", "NaCl", "density", 
   "ORP", "revisit", "findit", "ionize", "buffer", "protbuff", "yeastgfp", "mosaic",
-  "copper", "oldsolub", "solubility", "wjd", "bugstab", "Shh", "activity_ratios",
+  "copper", "oldsolub", "solubility", "gold", "wjd", "bugstab", "Shh", "activity_ratios",
   "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/R/solubility.R
===================================================================
--- pkg/CHNOSZ/R/solubility.R	2018-10-31 06:25:35 UTC (rev 337)
+++ pkg/CHNOSZ/R/solubility.R	2018-11-01 07:25:18 UTC (rev 338)
@@ -3,7 +3,7 @@
 
 solubility <- function(eout, exp = 1) {
   # exp = 1: e.g. dissolution of CO2
-  # exp = 2: e.g. dissolution (dissociation) of CaCO3
+  # exp = 2: e.g. dissolution (and dissociation) of CaCO3
 
   # bookkeeping: track any single species
   itrack <- 1
@@ -19,14 +19,12 @@
   A.whatif <- loga.species.track + A.track - loga.equil.track
 
   # predictive: assuming the species distribution doesn't change,
-  # what is the total loga that would give zero affinity?
+  # what is the total loga that gives zero affinity?
   # TODO: modify this according to stoichiometry (species with > 1 of the balanced basis species)
   loga.total <- (eout$loga.balance + A.whatif) / exp
-
   message("solubility: calculated logarithm of total activity of ", eout$balance)
 
   # use the predicted loga.total to re-calculate activities of species
   aout <- eout[1:which(names(eout)=="values")]
   equilibrate(aout, loga.balance = loga.total)
 }
-

Modified: pkg/CHNOSZ/R/util.expression.R
===================================================================
--- pkg/CHNOSZ/R/util.expression.R	2018-10-31 06:25:35 UTC (rev 337)
+++ pkg/CHNOSZ/R/util.expression.R	2018-11-01 07:25:18 UTC (rev 338)
@@ -2,6 +2,9 @@
 # write descriptions of chemical species, properties, reactions, conditions
 # modified from describe(), axis.label()  20120121 jmd
 
+## if this file is interactively sourced, the following are also needed to provide unexported functions:
+#source("util.character.R")
+
 expr.species <- function(species, state="", log="", value=NULL, use.makeup=FALSE, use.molality=FALSE) {
   # make plotting expressions for chemical formulas
   # that include subscripts, superscripts (if charged)
@@ -38,16 +41,16 @@
         if(coeff==-1) coeff <- "-"
         else if(coeff==1) coeff <- "+"
         else if(coeff > 0) coeff <- paste("+", as.character(coeff), sep="")
-        # append the coefficient (as a superscript if we're not in a log expression)
-        if(log != "") expr <- substitute(a*b, list(a=expr, b=coeff))
-        else expr <- substitute(a^b, list(a=expr, b=coeff))
+        # append the coefficient as a superscript
+        expr <- substitute(a^b, list(a=expr, b=coeff))
       }
     }
   }
   # write a designation of physical state
-  # use the state given in log if it's a gas or neutral aqueous species
-  if(log %in% c("g", "gas")) state <- "g"
-  else if(!"Z" %in% names(elements) & !missing(log)) state <- log
+  ## deprecated 20181101
+  ## use the state given in log if it's a gas or neutral aqueous species
+  #if(log %in% c("g", "gas")) state <- "g"
+  #else if(!"Z" %in% names(elements) & !missing(log)) state <- log
   if(state != "") {
     # subscript it if we're not in a log expression
     if(log != "") expr <- substitute(a*group('(',italic(b),')'),list(a=expr, b=state))
@@ -89,7 +92,7 @@
   if(property=="Eh") return("Eh")
   if(property=="pH") return("pH")
   if(property=="pe") return("pe")
-  if(property=="IS") return("IS")
+  if(property=="IS") return(quote(italic(I)))
   if(property=="ZC") return(quote(italic(Z)[C]))
   # process each character in the property abbreviation
   prevchar <- character()
@@ -182,15 +185,24 @@
   return(desc)
 }
 
-describe.basis <- function(basis=get("thermo")$basis, ibasis=1:nrow(basis), digits=1, oneline=FALSE) {
+describe.basis <- function(basis = get("thermo")$basis, ibasis = 1:nrow(basis),
+  digits = 1, oneline = FALSE, use.molality = FALSE, use.pH = TRUE) {
   # make expressions for the chemical activities/fugacities of the basis species
   propexpr <- valexpr <- character()
   for(i in ibasis) {
     # propexpr is logarithm of activity or fugacity
-    propexpr <- c(propexpr, expr.species(rownames(basis)[i], log=basis$state[i]))
-    # we have an as.numeric here in case the basis$logact is character
-    # (by inclusion of a buffer for one of the other basis species)
-    valexpr <- c(valexpr, format(round(as.numeric(basis$logact[i]), digits), nsmall=digits))
+    if(rownames(basis)[i]=="H+" & use.pH) thispropexpr <- "pH"
+    else thispropexpr <- expr.species(rownames(basis)[i], log=basis$state[i], use.molality = use.molality)
+    propexpr <- c(propexpr, thispropexpr)
+    if(can.be.numeric(basis$logact[i])) {
+      # we have an as.numeric here in case the basis$logact is character
+      # (by inclusion of a buffer for one of the other basis species)
+      if(thispropexpr=="pH") valexpr <- c(valexpr, format(round(-as.numeric(basis$logact[i]), digits), nsmall=digits))
+      else valexpr <- c(valexpr, format(round(as.numeric(basis$logact[i]), digits), nsmall=digits))
+    } else {
+      # a non-numeric value is the name of a buffer
+      valexpr <- c(valexpr, basis$logact[i])
+    }
   }
   # write an equals sign between the property and value
   desc <- character()

Modified: pkg/CHNOSZ/R/util.plot.R
===================================================================
--- pkg/CHNOSZ/R/util.plot.R	2018-10-31 06:25:35 UTC (rev 337)
+++ pkg/CHNOSZ/R/util.plot.R	2018-11-01 07:25:18 UTC (rev 338)
@@ -104,7 +104,7 @@
   if(eout$vars[1]=="P") P <- envert(xpoints, "bar")
   # logaH2O is 0 unless given in eout$basis
   iH2O <- match("H2O", rownames(eout$basis))
-  if(is.na(iH2O)) logaH2O <- 0 else logaH2O <- eout$basis$logact[iH2O]
+  if(is.na(iH2O)) logaH2O <- 0 else logaH2O <- as.numeric(eout$basis$logact[iH2O])
   # pH is 7 unless given in eout$basis or plotted on one of the axes
   iHplus <- match("H+", rownames(eout$basis))
   if(eout$vars[1]=="pH") pH <- xpoints

Modified: pkg/CHNOSZ/demo/00Index
===================================================================
--- pkg/CHNOSZ/demo/00Index	2018-10-31 06:25:35 UTC (rev 337)
+++ pkg/CHNOSZ/demo/00Index	2018-11-01 07:25:18 UTC (rev 338)
@@ -14,6 +14,7 @@
 copper          Another example of mosaic(): complexation of copper with glycine species
 oldsolub        Old solubility calculations using uniroot()
 solubility      Solubility of calcite and CO2(gas) as a function of pH
+gold            Solubility of gold
 wjd             Gibbs energy minimization: prebiological atmospheres and cell periphery of yeast
 dehydration     log K of dehydration reactions; SVG file contains tooltips and links
 bugstab         Formation potential of microbial proteins in colorectal cancer

Added: pkg/CHNOSZ/demo/gold.R
===================================================================
--- pkg/CHNOSZ/demo/gold.R	                        (rev 0)
+++ pkg/CHNOSZ/demo/gold.R	2018-11-01 07:25:18 UTC (rev 338)
@@ -0,0 +1,195 @@
+# CHNOSZ/demo/gold.R: Au solubility calculations
+# 20181101 jmd first version
+
+## additions to OBIGT:
+# Au(HS) from Akinfiev and Zotov, 2010
+# (doi:10.1134/S0016702910070074)
+# corrected H taken from Pokrovski et al., 2014
+# (doi:10.1144/SP402.4)
+mod.obigt("Au(HS)", formula = "Au(HS)", state = "aq", ref1 = "AZ10", date = today(),
+  G = 8344, H = 13193, S = 50.86, Cp = 1.8, V = 56.5,
+  a1 = 9.4965, a2 = 15.4057, a3 = -0.3052, a4 = -3.1459,
+  c1 = -38.1356, c2 = 19.6524, omega = 0, z = 0)
+# AuOH from Pokrovski et al., 2014
+mod.obigt("AuOH", formula = "AuOH", state = "aq", ref1 = "PAB+14", date = today(),
+  G = -32716, H = -41533, S = 21.89, Cp = -11.1, V = 32.4,
+  a1 = 6.1937, a2 = 7.3415, a3 = 2.8644, a4 = -3.0825,
+  c1 = -3.0370, c2 = -3.9635, omega = 0, z = 0)
+
+## modifications to OBIGT:
+# AuCl2- from Akinfiev and Zotov, 2001 (reported in AZ10)
+# (http://pleiades.online/cgi-perl/search.pl/?type=abstract&name=geochem&number=10&year=1&page=990)
+mod.obigt("AuCl2-", formula = "AuCl2-", state = "aq", ref1 = "AZ01", date = today(),
+  G = -36795, H = -46664, S = 47.16, Cp = -26.4, V = 68.6,
+  a1 = 11.4774, a2 = 20.2425, a3 = -2.2063, a4 = -3.6158,
+  c1 = 27.0677, c2 = -22.240, omega = 0.8623, z = -1)
+# Au(HS)2- from Pokrovski et al., 2014
+mod.obigt("Au(HS)2-", G = 3487, H = 4703, S = 77.46, Cp = 3.3, V = 75.1,
+  a1 = 12.3373, a2 = 22.3421, a3 = 3.0317, a4 = -3.7026,
+  c1 = -53.6010, c2 = 31.4030, omega = 0.7673, z = -1)
+
+# set up system
+# use H2S here: it's the predominant species at the pH of the QMK buffer -- see sulfur()
+basis(c("Al2O3", "SiO2", "Fe", "Au", "K+", "Cl-", "H2S", "H2O", "oxygen", "H+"))
+
+# create a pH buffer
+mod.buffer("QMK", c("quartz", "muscovite", "K-feldspar"), "cr", 0)
+
+# define colors for Au(HS)2-, Au(HS), AuOH, AuCl2-
+# after Williams-Jones et al., 2009
+# (doi:10.2113/gselements.5.5.281)
+col <- c("#ED4037", "#F58645", "#0F9DE2", "#22CC88")
+
+# sulfur logfO2-pH diagrams showing redox and pH buffers at four temperatures 20181031
+sulfur <- function() {
+  species(delete = TRUE)
+  species(c("H2S", "HS-", "HSO4-", "SO4-2"))
+  T <- c(200, 300, 400, 500)
+  P <- 1000
+  O2min <- c(-50, -40, -30, -25)
+  O2max <- c(-30, -20, -20, -10)
+  par(mfrow=c(2, 2))
+  for(i in 1:4) {
+    a <- affinity(pH = c(0, 14), O2 = c(O2min[i], O2max[i]), T = T[i], P = 1000)
+    diagram(a)
+    basis("H+", "QMK")
+    pH_QMK <- -affinity(T = T[i], P = P, return.buffer = TRUE)$`H+`
+    abline(v = pH_QMK, lty = 2)
+    basis("O2", "HM")
+    O2_HM <- affinity(T = T[i], P = P, return.buffer = TRUE)$O2
+    abline(h = O2_HM, lty = 2, col = "blue")
+    text(12, O2_HM, "HM", adj = c(0, -0.5), col = "blue")
+    basis("O2", "PPM")
+    O2_PPM <- affinity(T = T[i], P = P, return.buffer = TRUE)$O2
+    abline(h = O2_PPM, lty = 2, col = "blue")
+    text(12, O2_PPM, "PPM", adj = c(0, -0.5), col = "blue")
+    # remove the buffers for next plot
+    basis("O2", 0)
+    basis("pH", 0)
+  }
+}
+
+# log(m_Au)-pH diagram like Fig. 7 of Akinfiev and Zotov, 2001
+# (http://pleiades.online/cgi-perl/search.pl/?type=abstract&name=geochem&number=10&year=1&page=990)
+Au_pH1 <- function() {
+  species(c("Au(HS)2-", "Au(HS)", "AuOH"))
+  # apply PPM buffer for fO2 and aH2S
+  basis("O2", "PPM")
+  basis("H2S", "PPM")
+  # calculate affinity, equilibrate, solubility
+  # (set IS = 0 for diagram to show "log m" instead of "log a")
+  a <- affinity(pH = c(3, 8), T = 300, P = 1000, IS = 0)
+  e <- equilibrate(a)
+  s <- solubility(e)
+  # make diagram and show total log molality
+  diagram(s, ylim = c(-10, -5), col = col, lwd = 2, lty = 1)
+  diagram(s, add = TRUE, type = "loga.balance", lwd = 3, lty = 2)
+  # add neutral pH line
+  pH <- -subcrt(c("H2O", "H+", "OH-"), c(-1, 1, 1), T = 300, P = 1000)$out$logK/2
+  abline(v = pH, lty = 3)
+  # make legend and title
+  dprop <- describe.property(c("T", "P", "IS"), c(300, 1000, 0))
+  legend("topleft", dprop, bty = "n")
+  dbasis <- describe.basis(ibasis = c(9, 7))
+  legend("bottomright", dbasis, bty = "n")
+  title(main=("After Akinfiev and Zotov, 2001, Fig. 7"), font.main = 1)
+}
+
+# log(m_Au)-pH diagram similar to Fig. 12b of Stefansson and Seward, 2004
+# (doi:10.1016/j.gca.2004.04.006)
+Au_pH2 <- function() {
+  species(c("Au(HS)2-", "Au(HS)", "AuOH", "AuCl2-"))
+  # apply PPM buffer for fO2 and aH2S
+  basis("O2", "PPM")
+  basis("H2S", "PPM")
+  # calculate affinity, equilibrate, solubility
+  # (set IS = 0 for diagram to show "log m" instead of "log a")
+  a <- affinity(pH = c(3, 8), T = 450, P = 1000, IS = 0)
+  e <- equilibrate(a)
+  s <- solubility(e)
+  # make diagram and show total log molality
+  diagram(s, ylim = c(-8, -3), col = col, lwd = 2, lty = 1)
+  diagram(s, add = TRUE, type = "loga.balance", lwd = 3, lty = 2)
+  # add neutral pH line
+  pH <- -subcrt(c("H2O", "H+", "OH-"), c(-1, 1, 1), T = 450, P = 1000)$out$logK/2
+  abline(v = pH, lty = 3)
+  # make legend and title
+  dprop <- describe.property(c("T", "P", "IS"), c(450, 1000, 0))
+  legend("topleft", dprop, bty = "n")
+  dbasis <- describe.basis(ibasis = c(6, 9, 7))
+  legend("topright", dbasis, bty = "n")
+  title(main=("After Stef\u00e1nsson and Seward, 2004, Fig. 12b"), font.main = 1, cex.main = 1.1)
+}
+
+# log(m_Au)-T diagram like Fig. 2B of Williams-Jones et al., 2009
+# (doi:10.2113/gselements.5.5.281)
+Au_T1 <- function() {
+  species(c("Au(HS)2-", "Au(HS)", "AuOH", "AuCl2-"))
+  # apply PPM buffer for fO2 and aH2S
+  basis("O2", "PPM")
+  basis("H2S", "PPM")
+  # apply QMK buffer for pH
+  basis("H+", "QMK")
+  # at 400 degC, 1000 bar, and IS=2, the logarithm of the activity coefficient of Cl- is -0.66:
+  loggam <- subcrt("Cl-", T=400, P=1000, IS=2)$out[[1]]$loggam
+  # for a total molality of 2 m (1.5 m NaCl and 0.5 m KCl), the activity of Cl- is about 10:
+  actCl <- 2/10^loggam
+  basis("Cl-", log10(actCl))
+  # calculate affinity, equilibrate, solubility
+  a <- affinity(T = c(150, 550), P = 1000, IS = 2)
+  e <- equilibrate(a)
+  s <- solubility(e)
+  # make diagram and show total log molality
+  diagram(s, ylim = c(-10, -4), col = col, lwd = 2, lty = 1)
+  diagram(s, add = TRUE, type = "loga.balance", lwd = 3, lty = 2)
+  # make legend and title
+  dprop <- describe.property(c("P", "IS"), c(1000, 2))
+  legend("topleft", dprop, bty = "n")
+  dbasis <- describe.basis(ibasis = c(6, 9, 7, 10))
+  legend("bottomright", dbasis, bty = "n")
+  title(main=("After Williams-Jones et al., 2009, Fig. 2B"), font.main = 1)
+}
+
+# log(m_Au)-T diagram like Fig. 2A of Williams-Jones et al., 2009 and Fig. 8a of Pokrovski et al., 2014
+# (doi:10.2113/gselements.5.5.281)
+# (doi:10.1144/SP402.4)
+Au_T2 <- function() {
+  species(c("Au(HS)2-", "Au(HS)", "AuOH", "AuCl2-"))
+  # set total activity of H2S
+  # TODO: the paper says total S = 0.01 m,
+  # but a higher activity makes the diagram here closer to
+  # that of Williams-Jones et al., 2009
+  basis("H2S", -1)
+  # apply HM buffer for fO2
+  basis("O2", "HM")
+  # apply QMK buffer for pH
+  basis("H+", "QMK")
+  # calculate activity coefficient of Cl- at IS=2
+  loggam <- subcrt("Cl-", T = seq(150, 550, 10), P = 1000, IS = 2)$out[[1]]$loggam
+  # calculate activity of Cl- given a total molality of 2 m (1.5 m NaCl and 0.5 m KCl)
+  actCl <- 2/10^loggam
+  # TODO: adjust Cl- activity for increasing logK(T) of Na+ + Cl- = NaCl
+  # calculate affinity, equilibrate, solubility
+  a <- affinity(T = seq(150, 550, 10), `Cl-` = log10(actCl), P = 1000, IS = 2)
+  e <- equilibrate(a)
+  s <- solubility(e)
+  # make diagram and show total log molality
+  diagram(s, ylim = c(-10, -2), col = col, lwd = 2, lty = 1)
+  diagram(s, add = TRUE, type = "loga.balance", lwd = 3, lty = 2)
+  # make legend and title
+  dprop <- describe.property(c("P", "IS"), c(1000, 2))
+  legend("topleft", dprop, bty = "n")
+  # show the log molality of Cl-
+  basis("Cl-", log10(2))
+  dbasis1 <- describe.basis(ibasis = 6, use.molality = TRUE)
+  dbasis2 <- describe.basis(ibasis = c(9, 7, 10))
+  legend("bottomright", c(dbasis1, dbasis2), bty = "n")
+  title(main=("After Williams-Jones et al., 2009, Fig. 2B"), font.main = 1)
+}
+
+# make plots
+par(mfrow=c(2, 2))
+Au_pH1()
+Au_pH2()
+Au_T1()
+Au_T2()

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2018-10-31 06:25:35 UTC (rev 337)
+++ pkg/CHNOSZ/inst/NEWS	2018-11-01 07:25:18 UTC (rev 338)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.1.3-45 (2018-10-31)
+CHANGES IN CHNOSZ 1.1.3-46 (2018-11-01)
 ---------------------------------------
 
 NEW FEATURES
@@ -6,6 +6,10 @@
 - Add solubility(). Run this after equilibrate() to calculate the
   solubility (loga.balance) of the balanced basis species.
 
+- Add demo/gold.R for calculations of Au solubility (based on diagrams
+  from Akinfiev and Zotov, 2001, Stefánsson and Seward, 2004, and
+  Williams-Jones et al., 2009).
+
 - Revise demo/solubility.R to show solubility calculations for CO2(gas)
   and calcite as a function of T and pH.
 

Modified: pkg/CHNOSZ/man/examples.Rd
===================================================================
--- pkg/CHNOSZ/man/examples.Rd	2018-10-31 06:25:35 UTC (rev 337)
+++ pkg/CHNOSZ/man/examples.Rd	2018-11-01 07:25:18 UTC (rev 338)
@@ -16,7 +16,7 @@
   demos(which = c("sources", "protein.equil", "affinity", "NaCl",
     "density", "ORP", "revisit", "findit", "ionize", "buffer",
     "protbuff", "yeastgfp", "mosaic", "copper", "oldsolub",
-    "solubility", "wjd", "bugstab", "Shh", "activity_ratios",
+    "solubility", "gold", "wjd", "bugstab", "Shh", "activity_ratios",
     "adenine", "DEW", "lambda", "TCA", "go-IU", "bison"),
     save.png=FALSE)
 }
@@ -47,6 +47,7 @@
     \code{copper} \tab * Another example of \code{\link{mosaic}}: complexation of Cu with glycine (Aksu and Doyle, 2001) \cr
     \code{oldsolub} \tab Old solubility calculations using \code{\link{uniroot}} \cr
     \code{solubility} \tab * Solubility of calcite (cf. Manning et al., 2013) and \CO2 (cf. Stumm and Morgan, 1996) \cr
+    \code{gold} \tab * Solubility of gold (Akinfiev and Zotov; 2001; Stef{\aacute}nsson and Seward, 2004; Williams-Jones et al., 2009) \cr
     \code{wjd} \tab * \eqn{G}{G} minimization: prebiological atmospheres (Dayhoff et al., 1964) and cell periphery of yeast \cr
     \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
@@ -80,6 +81,8 @@
 }
 
 \references{
+Akinfiev, N. N. and Zotov, A. V. (2001) Thermodynamic description of chloride, hydrosulfide, and hydroxo complexes of Ag(I), Cu(I), and Au(I) at temperatures of 25-500\degC and pressures of 1-2000 bar. \emph{Geochem. Int.} \bold{39}, 990--1006. \url{http://pleiades.online/cgi-perl/search.pl/?type=abstract&name=geochem&number=10&year=1&page=990}
+
 Aksu, S. and Doyle, F. M. (2001) Electrochemistry of copper in aqueous glycine solutions. \emph{J. Electrochem. Soc.} \bold{148}, B51--B57. \url{https://doi.org/10.1149/1.1344532}
 
 Amend, J. P. and Shock, E. L. (1998) Energetics of amino acid synthesis in hydrothermal ecosystems. \emph{Science} \bold{281}, 1659--1662. \url{https://doi.org/10.1126/science.281.5383.1659}
@@ -114,12 +117,16 @@
 
 Shock, E. L., Oelkers, E. H., Johnson, J. W., Sverjensky, D. A. and Helgeson, H. C. (1992) Calculation of the thermodynamic properties of aqueous species at high pressures and temperatures: Effective electrostatic radii, dissociation constants and standard partial molal properties to 1000 \degC and 5 kbar. \emph{J. Chem. Soc. Faraday Trans.} \bold{88}, 803--826. \url{https://doi.org/10.1039/FT9928800803}
 
+Stef{\aacute}nsson, A. and Seward, T. M. (2004) Gold(I) complexing in aqueous sulphide solutions to 500\degC at 500 bar. \emph{Geochim. Cosmochim. Acta} \bold{68}, 4121--4143. \url{https://doi.org/10.1016/j.gca.2004.04.006}
+
 Stumm, W. and Morgan, J. J. (1996) \emph{Aquatic Chemistry: Chemical Equilibria and Rates in Natural Waters}, John Wiley & Sons, New York, 1040 p. \url{http://www.worldcat.org/oclc/31754493}
 
 Sverjensky, D. A., Harrison, B. and Azzolini, D. (2014a) Water in the deep Earth: The dielectric constant and the solubilities of quartz and corundum to 60 kb and 1,200 \degC. \emph{Geochim. Cosmochim. Acta} \bold{129}, 125--145. \url{https://doi.org/10.1016/j.gca.2013.12.019}
 
 Sverjensky, D. A., Stagno, V. and Huang, F. (2014b) Important role for organic carbon in subduction-zone fluids in the deep carbon cycle. \emph{Nat. Geosci.} \bold{7}, 909--913. \url{https://doi.org/10.1038/ngeo2291}
 
+Williams-Jones, A. E., Bowell, R. J. and Migdisov, A. A. (2009) Gold in solution. \emph{Elements} \bold{5}, 281--287. \url{https://doi.org/10.2113/gselements.5.5.281}
+
 Zimmer, K., Zhang, Y., Lu, P., Chen, Y., Zhang, G., Dalkilic, M. and Zhu, C. (2016) SUPCRTBL: A revised and extended thermodynamic dataset and software package of SUPCRT92. \emph{Comp. Geosci.} \bold{90}, 97--111. \url{https://doi.org/10.1016/j.cageo.2016.02.013}
 }
 

Modified: pkg/CHNOSZ/man/macros/macros.Rd
===================================================================
--- pkg/CHNOSZ/man/macros/macros.Rd	2018-10-31 06:25:35 UTC (rev 337)
+++ pkg/CHNOSZ/man/macros/macros.Rd	2018-11-01 07:25:18 UTC (rev 338)
@@ -45,3 +45,4 @@
 \newcommand{\ge}{\ifelse{latex}{\eqn{\ge}}{\ifelse{html}{\out{≥}}{≥}}}
 \newcommand{\Psat}{\ifelse{latex}{\eqn{P_{\mathrm{SAT}}}}{\ifelse{html}{\out{<i>P</i><sub>SAT</sub>}}{Psat}}}
 \newcommand{\Delta}{\ifelse{latex}{\eqn{\Delta}}{\ifelse{html}{\out{Δ}}{Δ}}}
+\newcommand{\aacute}{\ifelse{latex}{\out{\'{a}}}{\ifelse{html}{\out{á}}{á}}}

Modified: pkg/CHNOSZ/man/solubility.Rd
===================================================================
--- pkg/CHNOSZ/man/solubility.Rd	2018-10-31 06:25:35 UTC (rev 337)
+++ pkg/CHNOSZ/man/solubility.Rd	2018-11-01 07:25:18 UTC (rev 338)
@@ -31,6 +31,17 @@
 The output of \code{solubility} has the same format as that of \code{equilibrate}, and can be used by \code{\link{diagram}} with \code{type = "loga.balance"}. 
 }
 
+\section{Warning}{
+This function has not been tested for systems that may form dimers or higher-order complexes (such as Au\s{2}S\s{2}\S{2-}).
+The lower figures in \code{demo("gold")} are incomplete, as they do not account for other possible reactions not involving Au, particularly the decrease of Cl\S{-} concentration owing to the rising stability of the NaCl\s{(aq)} complex at high temperature.
+Except for relatively simple systems, even after careful refinement, the results from CHNOSZ, which considers chemical activities as the independent variables, will not match the results from speciation-solubility (or Gibbs energy minimization) codes, where the system is defined by its bulk composition.
+}
+
+\seealso{
+\code{demo("solubility")} adds pH-\T diagrams to the CO\s{2} and calcite example here.
+\code{demo("gold")} shows solubility calculations for Au in aqueous solutions with hydroxide, chloride, and hydrosulfide complexes.
+}
+
 \examples{\dontshow{data(thermo)}
 # solubility of CO2 and calcite as a function of pH
 par(mfrow = c(1, 2))

Modified: pkg/CHNOSZ/man/util.expression.Rd
===================================================================
--- pkg/CHNOSZ/man/util.expression.Rd	2018-10-31 06:25:35 UTC (rev 337)
+++ pkg/CHNOSZ/man/util.expression.Rd	2018-11-01 07:25:18 UTC (rev 338)
@@ -21,7 +21,7 @@
   axis.label(label, units = NULL, basis = get("thermo")$basis, prefix = "",
     use.molality = FALSE)
   describe.basis(basis = get("thermo")$basis, ibasis = 1:nrow(basis),
-    digits = 1, oneline = FALSE)
+    digits = 1, oneline = FALSE, use.molality = FALSE, use.pH = TRUE)
   describe.property(property, value, digits = 0, oneline = FALSE,
     ret.val = FALSE)
   describe.reaction(reaction, iname = numeric(), states = NULL)
@@ -36,6 +36,7 @@
   \item{value}{numeric, logarithm of activity or fugacity of species, or value of other property}
   \item{use.makeup}{logical, use \code{\link{makeup}} to count the elements?}
   \item{use.molality}{logical, use molality (m) instead of activity (a) for aqueous species?}
+  \item{use.pH}{logical, use pH instead of log activity of H+?}
   \item{property}{character, description of chemical property}
   \item{prefix}{character, prefix for units}
   \item{per}{character, denominator in units}



More information about the CHNOSZ-commits mailing list