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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Mar 2 03:36:43 CET 2021


Author: jedick
Date: 2021-03-02 03:36:42 +0100 (Tue, 02 Mar 2021)
New Revision: 646

Added:
   pkg/CHNOSZ/demo/Pourbaix.R
   pkg/CHNOSZ/demo/potassium.R
Removed:
   pkg/CHNOSZ/demo/berman.R
   pkg/CHNOSZ/demo/pourbaix.R
Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/examples.R
   pkg/CHNOSZ/demo/00Index
   pkg/CHNOSZ/inst/NEWS.Rd
   pkg/CHNOSZ/man/examples.Rd
   pkg/CHNOSZ/vignettes/anintro.Rmd
Log:
Rename two demos


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2021-03-01 12:16:54 UTC (rev 645)
+++ pkg/CHNOSZ/DESCRIPTION	2021-03-02 02:36:42 UTC (rev 646)
@@ -1,6 +1,6 @@
-Date: 2021-03-01
+Date: 2021-03-02
 Package: CHNOSZ
-Version: 1.4.0-15
+Version: 1.4.0-16
 Title: Thermodynamic Calculations and Diagrams for Geochemistry
 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	2021-03-01 12:16:54 UTC (rev 645)
+++ pkg/CHNOSZ/R/examples.R	2021-03-02 02:36:42 UTC (rev 646)
@@ -33,8 +33,8 @@
 demos <- function(which=c("sources", "protein.equil", "affinity", "NaCl", "density", 
   "ORP", "findit", "ionize", "buffer", "protbuff", "glycinate",
   "mosaic", "copper", "arsenic", "solubility", "gold", "contour", "sphalerite", "zinc",
-  "Shh", "saturation", "adenine", "DEW", "lambda", "berman", "TCA", "aluminum",
-  "AkDi", "comproportionation", "pourbaix"), save.png=FALSE) {
+  "Shh", "saturation", "adenine", "DEW", "lambda", "potsassium", "TCA", "aluminum",
+  "AkDi", "comproportionation", "Pourbaix"), 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)) {
     # say something so the user sees where we are

Modified: pkg/CHNOSZ/demo/00Index
===================================================================
--- pkg/CHNOSZ/demo/00Index	2021-03-01 12:16:54 UTC (rev 645)
+++ pkg/CHNOSZ/demo/00Index	2021-03-02 02:36:42 UTC (rev 646)
@@ -23,10 +23,10 @@
 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
-berman          Mineral stabilities in Berman and Helgeson et al. datasets
+potassium       Comparison of thermodynamic datasets for predicting mineral stabilities
 TCA             Standard Gibbs energies of steps of the citric acid cycle
 aluminum        Reactions involving Al-bearing minerals
 carboxylase     Rank abundance distribution for RuBisCO and acetyl-CoA carboxylase
 AkDi            Henry's constant of dissolved gases
 comproportionation  Gibbs energy of sulfur comproportionation
-pourbaix        Eh-pH diagram for Fe-O-H with equisolubility lines
+Pourbaix        Eh-pH diagram for Fe-O-H with equisolubility lines

Copied: pkg/CHNOSZ/demo/Pourbaix.R (from rev 645, pkg/CHNOSZ/demo/pourbaix.R)
===================================================================
--- pkg/CHNOSZ/demo/Pourbaix.R	                        (rev 0)
+++ pkg/CHNOSZ/demo/Pourbaix.R	2021-03-02 02:36:42 UTC (rev 646)
@@ -0,0 +1,169 @@
+# CHNOSZ/demo/Pourbaix.R
+# Eh-pH diagram for Fe-O-H with equisolubility lines
+# After Pourbaix (1974, p. 312)
+# 20210301 jmd first version
+
+library(CHNOSZ)
+
+### PARAMETERS (to be changed by the user) ###
+
+# Choose an element
+# Some mostly working ones: Fe, Cu, Au, Rh, Mn
+# Incomplete: Al (no native metal), Ni, ...
+# Not working: C, Cr, ...
+#  (C gives lots of organic species, probably getting an NA affinity somewhere)
+#  (Cr has no solids in OBIGT)
+element <- "Fe"
+
+# Set temperature and pressure
+T <- 25
+# Can use "Psat" for T >= 100 degC
+P <- 1
+# Ionic strength (mol/kg)
+IS <- 0
+
+# Set plot limits and resolution
+pH <- c(-2, 16)
+Eh <- c(-2, 2)
+res <- 700
+
+# Assign levels for equisolubility lines
+levels <- seq(-6, 0, 2)
+
+# Switches for using colors
+color.fields <- TRUE
+color.water <- TRUE
+color.lines <- TRUE
+color.names <- TRUE
+
+# Names of aqueous species to move down
+# (to avoid conflict with water lines or mineral names)
+namesdown <- c("MnOH+", "MnO", "Cu+2", "CuO")
+# Names of aqueous species to move down even more
+namesdown2 <- c("Fe+3", "FeOH+2", "FeO+", "HFeO2", "FeO2-",
+"HMnO2-", "MnO2-2")
+
+### SCRIPT (can also be changed by the user if wanted!) ###
+
+# Find a species with this element
+# (to be used as a basis species)
+elem_basis <- element
+if(is.na(suppressMessages(info(elem_basis)))) {
+  elem_basis <- paste0(element, "+")
+  if(is.na(suppressMessages(info(elem_basis)))) {
+    elem_basis <- paste0(element, "+2")
+    if(is.na(suppressMessages(info(elem_basis)))) {
+      elem_basis <- paste0(element, "+3")
+    }
+  }
+}
+
+# Define system
+basis(c(elem_basis, "H2O", "H+", "e-"))
+
+# Find species
+i_cr <- retrieve(element, c("O", "H"), "cr")
+i_aq <- retrieve(element, c("O", "H"), "aq")
+
+# Add solids with unit activity
+species(i_cr, 0)
+# Add aqueous species with activity for first equisolubility line
+species(i_aq, levels[1], add = TRUE)
+
+# Calculate affinities of formation of species
+# from basis species as a function of Eh and pH
+a_all <- affinity(pH = c(pH, res), Eh = c(Eh, res), T = T, P = P, IS = IS)
+
+# Plot diagram (LAYER 1: colors for all fields)
+limit.water <- fill <- NULL
+if(!color.water) limit.water <- FALSE
+if(!color.fields) fill <- NA
+d_all <- diagram(a_all, names = FALSE, lty = 0, min.area = 0.1, limit.water = limit.water, fill = fill)
+
+# Calculate affinities for minerals
+species(i_cr)
+a_cr <- affinity(pH = c(pH, res), Eh = c(Eh, res), T = T, P = P, IS = IS)
+
+# Find all stable minerals across diagram
+d_cr <- diagram(a_cr, plot.it = FALSE)
+d_cr.stable <- d_cr$species$name[unique(as.vector(d_cr$predominant))]
+
+# Make a list to store the calculated solubilities for each mineral
+slist <- list()
+# Loop over stable minerals
+for(i in seq_along(d_cr.stable)) {
+  # Define basis species with mineral to dissolve
+  basis(c(d_cr.stable[i], "H2O", "H+", "e-"))
+  # Add aqueous species (no need to define activities here - they will be calculated)
+  species(i_aq)
+  # Calculate affinities of formation reactions
+  a <- affinity(pH = c(pH, res), Eh = c(Eh, res), T = T, P = P, IS = IS)
+  # Calculate solubility of this mineral
+  # FIXME: what to do about 'dissociation' argument?
+  s <- solubility(a, in.terms.of = element, dissociation = FALSE)
+  # Store the solubilities in the list
+  slist[[i]] <- s$loga.balance
+}
+
+# The overall solubility is the *minimum* among all the minerals
+smin <- do.call(pmin, slist)
+# Put this into the last-computed 'solubility' object
+s$loga.balance <- smin
+
+# Plot diagram (LAYER 2: equisolubility lines)
+diagram(s, type = "loga.balance", levels = levels, contour.method = "flattest", add = TRUE, lwd = 1.7)
+
+# Calculate affinities for aqueous species
+# FIXME: should be able to remove cr species from previous affinity object
+species(i_aq, 0)
+a_aq <- affinity(pH = c(pH, res), Eh = c(Eh, res), T = T, P = P, IS = IS)
+
+# Plot diagram (LAYER 3: equal-activity lines for aqueous species)
+col <- ifelse(color.lines, 4, 1)
+# Use a white background to improve contrast
+# (so the line remains visible if it coincides with an equisolubility contour)
+diagram(a_aq, add = TRUE, col = "white", lwd = 1.3, names = FALSE)
+
+# Plot diagram (LAYER 4: labels for aqueous species fields)
+# Apply y offset for specified names
+dy <- rep(0, nrow(a_aq$species))
+dy[a_aq$species$name %in% namesdown] <- -0.3
+dy[a_aq$species$name %in% namesdown2] <- -0.5
+# Use a white background for names
+rx <- diff(par("usr")[1:2])
+for(ddx in c(-rx/700, rx/700))
+  diagram(a_aq, add = TRUE, lty = 2, lwd = 0.6, col = col, dx = ddx, dy = dy, col.names = "white", bold = TRUE)
+ry <- diff(par("usr")[3:4])
+for(ddy in c(-ry/700, ry/700))
+  diagram(a_aq, add = TRUE, lty = 2, lwd = 0.6, col = col, dy = dy + ddy, col.names = "white", bold = TRUE)
+col.names <- ifelse(color.names, 4, 1)
+diagram(a_aq, add = TRUE, lty = 0, col = col, dy = dy, col.names = col.names)
+
+# Add solids with unit activity
+species(i_cr, 0)
+# Add aqueous species with activity for last equisolubility line
+# (i.e. unit activity)
+species(i_aq, levels[length(levels)], add = TRUE)
+
+# Calculate affinities of formation of species
+# from basis species as a function of Eh and pH
+a_all_0 <- affinity(pH = c(pH, res), Eh = c(Eh, res), T = T, P = P, IS = IS)
+
+# Plot diagram (LAYER 5: mineral stability boundaries and water lines)
+d_all_0 <- diagram(a_all_0, fill = NA, names = FALSE, lty = 0, lty.cr = 1, lwd = 3, add = TRUE)
+water.lines(d_all_0, lty = 5, lwd = 1.3)
+
+# Plot diagram (LAYER 6: large bold labels for all mineral fields)
+# (this is the last layer, so names are above equal-activity lines,
+# but we use positions calculated with the first equisolubility line
+# so that names are within the shrunken parts of the mineral fields)
+# Create labels using chemical formulas instead of name of minerals
+formulas <- info(a_all$species$ispecies)$formula
+formulas[a_all$species$state == "aq"] <- ""
+diagram(a_all, fill = NA, names = formulas, bold = TRUE, cex.names = 1.2, lty = 0, add = TRUE)
+
+# Add title
+Texpr <- lT(T)
+Pexpr <- lP(P)
+main <- bquote(.(element)*"-O-H at "*.(Texpr)*" and "*.(Pexpr))
+title(main = main)

Deleted: pkg/CHNOSZ/demo/berman.R
===================================================================
--- pkg/CHNOSZ/demo/berman.R	2021-03-01 12:16:54 UTC (rev 645)
+++ pkg/CHNOSZ/demo/berman.R	2021-03-02 02:36:42 UTC (rev 646)
@@ -1,56 +0,0 @@
-# CHNOSZ/demo/berman.R
-# moved from berman.Rd 20200727
-### compare mineral stabilities in the Berman and Helgeson datasets
-### on a T - log(K+/H+) diagram, after Sverjensky et al., 1991
-### (doi:10.1016/0016-7037(91)90157-Z)
-library(CHNOSZ)
-
-## set up the system: basis species
-basis(c("K+", "Al+3", "quartz", "H2O", "O2", "H+"))
-# use pH = 0 so that aK+ = aK+/aH+
-basis("pH", 0)
-# load the species
-species(c("K-feldspar", "muscovite", "kaolinite",
-          "pyrophyllite", "andalusite"), "cr")
-
-## start with the data from Helgeson et al., 1978
-add.OBIGT("SUPCRT92")
-# calculate affinities in aK+ - temperature space
-# exceed.Tr: enable calculations above stated temperature limit of pyrophyllite
-res <- 400
-a <- suppressWarnings(affinity(`K+` = c(0, 5, res), T = c(200, 650, res), P = 1000, exceed.Ttr = TRUE))
-# make base plot with colors and no lines
-diagram(a, xlab = ratlab("K+", molality = TRUE), lty = 0, fill = "terrain")
-# add the lines, extending into the low-density region (exceed.rhomin = TRUE)
-a <- affinity(`K+` = c(0, 5, res), T = c(200, 650, res), P = 1000, 
-              exceed.Ttr = TRUE, exceed.rhomin = TRUE)
-diagram(a, add = TRUE, names = FALSE, col = 2, lwd = 1.5, lty = 2)
-# the list of references:
-ref1 <- thermo.refs(species()$ispecies)$key
-
-## now use the (default) data from Berman, 1988
-# this resets the thermodynamic database
-# without affecting the basis and species settings
-OBIGT()
-# we can check that we have Berman's quartz
-# and not coesite or some other phase of SiO2
-iSiO2 <- rownames(basis()) == "SiO2"
-stopifnot(info(basis()$ispecies[iSiO2])$name == "quartz")
-# Berman's dataset doesn't have the upper temperature limits,
-# so we don't need exceed.Ttr here
-a <- affinity(`K+` = c(0, 5, res), T = c(200, 650, res), P = 1000, exceed.rhomin = TRUE)
-diagram(a, add = TRUE, names = FALSE, col = 4, lwd = 1.5)
-# the list of references:
-ref2 <- thermo.refs(species()$ispecies)$key
-ref2 <- paste(ref2, collapse = ", ")
-# add legend and title
-legend("top", "low-density region", text.font = 3, bty = "n")
-legend("topleft", describe.property(c("P", "IS"), c(1000, 1)), bty = "n", inset = c(0, 0.1))
-legend("topleft", c("Helgeson et al., 1978", "Berman, 1988 and\nSverjensky et al., 1991"),
-       lty = c(2, 1), lwd = 1.5, col = c(2, 4), bty = "n", inset = c(0.25, 0.08))
-title(main = syslab(c("K2O", "Al2O3", "SiO2", "H2O", "HCl")), line = 1.8)
-title(main = "After Sverjensky et al., 1991",
-      line = 0.3, font.main = 1)
-
-# cleanup for next example
-reset()

Copied: pkg/CHNOSZ/demo/potassium.R (from rev 645, pkg/CHNOSZ/demo/berman.R)
===================================================================
--- pkg/CHNOSZ/demo/potassium.R	                        (rev 0)
+++ pkg/CHNOSZ/demo/potassium.R	2021-03-02 02:36:42 UTC (rev 646)
@@ -0,0 +1,56 @@
+# CHNOSZ/demo/potassium.R
+# moved from berman.Rd 20200727
+### compare mineral stabilities predicted with the Berman and Helgeson datasets
+### on a T - log(K+/H+) diagram, after Sverjensky et al., 1991
+### (doi:10.1016/0016-7037(91)90157-Z)
+library(CHNOSZ)
+
+## set up the system: basis species
+basis(c("K+", "Al+3", "quartz", "H2O", "O2", "H+"))
+# use pH = 0 so that aK+ = aK+/aH+
+basis("pH", 0)
+# load the species
+species(c("K-feldspar", "muscovite", "kaolinite",
+          "pyrophyllite", "andalusite"), "cr")
+
+## start with the data from Helgeson et al., 1978
+add.OBIGT("SUPCRT92")
+# calculate affinities in aK+ - temperature space
+# exceed.Tr: enable calculations above stated temperature limit of pyrophyllite
+res <- 400
+a <- suppressWarnings(affinity(`K+` = c(0, 5, res), T = c(200, 650, res), P = 1000, exceed.Ttr = TRUE))
+# make base plot with colors and no lines
+diagram(a, xlab = ratlab("K+", molality = TRUE), lty = 0, fill = "terrain")
+# add the lines, extending into the low-density region (exceed.rhomin = TRUE)
+a <- affinity(`K+` = c(0, 5, res), T = c(200, 650, res), P = 1000, 
+              exceed.Ttr = TRUE, exceed.rhomin = TRUE)
+diagram(a, add = TRUE, names = FALSE, col = 2, lwd = 1.5, lty = 2)
+# the list of references:
+ref1 <- thermo.refs(species()$ispecies)$key
+
+## now use the (default) data from Berman, 1988
+# this resets the thermodynamic database
+# without affecting the basis and species settings
+OBIGT()
+# we can check that we have Berman's quartz
+# and not coesite or some other phase of SiO2
+iSiO2 <- rownames(basis()) == "SiO2"
+stopifnot(info(basis()$ispecies[iSiO2])$name == "quartz")
+# Berman's dataset doesn't have the upper temperature limits,
+# so we don't need exceed.Ttr here
+a <- affinity(`K+` = c(0, 5, res), T = c(200, 650, res), P = 1000, exceed.rhomin = TRUE)
+diagram(a, add = TRUE, names = FALSE, col = 4, lwd = 1.5)
+# the list of references:
+ref2 <- thermo.refs(species()$ispecies)$key
+ref2 <- paste(ref2, collapse = ", ")
+# add legend and title
+legend("top", "low-density region", text.font = 3, bty = "n")
+legend("topleft", describe.property(c("P", "IS"), c(1000, 1)), bty = "n", inset = c(0, 0.1))
+legend("topleft", c("Helgeson et al., 1978", "Berman, 1988 and\nSverjensky et al., 1991"),
+       lty = c(2, 1), lwd = 1.5, col = c(2, 4), bty = "n", inset = c(0.25, 0.08))
+title(main = syslab(c("K2O", "Al2O3", "SiO2", "H2O", "HCl")), line = 1.8)
+title(main = "After Sverjensky et al., 1991",
+      line = 0.3, font.main = 1)
+
+# cleanup for next example
+reset()

Deleted: pkg/CHNOSZ/demo/pourbaix.R
===================================================================
--- pkg/CHNOSZ/demo/pourbaix.R	2021-03-01 12:16:54 UTC (rev 645)
+++ pkg/CHNOSZ/demo/pourbaix.R	2021-03-02 02:36:42 UTC (rev 646)
@@ -1,167 +0,0 @@
-# CHNOSZ/demos/pourbaix.R
-# Eh-pH diagram for Fe-O-H with equisolubility lines
-# After Pourbaix (1974, p. 312)
-# 20210301 jmd first version
-
-library(CHNOSZ)
-
-### PARAMETERS (to be changed by the user) ###
-
-# Choose an element
-# Some mostly working ones: Fe, Cu, Au, Rh, Mn
-# Incomplete: Al (no native metal), Ni, ...
-# Not working: C, Cr, ...
-#  (C gives lots of organic species, probably getting an NA affinity somewhere)
-#  (Cr has no solids in OBIGT)
-element <- "Fe"
-
-# Set temperature and pressure
-T <- 25
-# Can use "Psat" for T >= 100 degC
-P <- 1
-
-# Set plot limits and resolution
-pH <- c(-2, 16)
-Eh <- c(-2, 2)
-res <- 700
-
-# Assign levels for equisolubility lines
-levels <- seq(-6, 0, 2)
-
-# Switches for using colors
-color.fields <- TRUE
-color.water <- TRUE
-color.lines <- TRUE
-color.names <- TRUE
-
-# Names of aqueous species to move down
-# (to avoid conflict with water lines or mineral names)
-namesdown <- c("MnOH+", "MnO", "Cu+2", "CuO")
-# Names of aqueous species to move down even more
-namesdown2 <- c("Fe+3", "FeOH+2", "FeO+", "HFeO2", "FeO2-",
-"HMnO2-", "MnO2-2")
-
-### SCRIPT (can also be changed by the user if wanted!) ###
-
-# Find a species with this element
-# (to be used as a basis species)
-elem_basis <- element
-if(is.na(suppressMessages(info(elem_basis)))) {
-  elem_basis <- paste0(element, "+")
-  if(is.na(suppressMessages(info(elem_basis)))) {
-    elem_basis <- paste0(element, "+2")
-    if(is.na(suppressMessages(info(elem_basis)))) {
-      elem_basis <- paste0(element, "+3")
-    }
-  }
-}
-
-# Define system
-basis(c(elem_basis, "H2O", "H+", "e-"))
-
-# Find species
-i_cr <- retrieve(element, c("O", "H"), "cr")
-i_aq <- retrieve(element, c("O", "H"), "aq")
-
-# Add solids with unit activity
-species(i_cr, 0)
-# Add aqueous species with activity for first equisolubility line
-species(i_aq, levels[1], add = TRUE)
-
-# Calculate affinities of formation of species
-# from basis species as a function of Eh and pH
-a_all <- affinity(pH = c(pH, res), Eh = c(Eh, res), T = T, P = P)
-
-# Plot diagram (LAYER 1: colors for all fields)
-limit.water <- fill <- NULL
-if(!color.water) limit.water <- FALSE
-if(!color.fields) fill <- NA
-d_all <- diagram(a_all, names = FALSE, lty = 0, min.area = 0.1, limit.water = limit.water, fill = fill)
-
-# Calculate affinities for minerals
-species(i_cr)
-a_cr <- affinity(pH = c(pH, res), Eh = c(Eh, res), T = T, P = P)
-
-# Find all stable minerals across diagram
-d_cr <- diagram(a_cr, plot.it = FALSE)
-d_cr.stable <- d_cr$species$name[unique(as.vector(d_cr$predominant))]
-
-# Make a list to store the calculated solubilities for each mineral
-slist <- list()
-# Loop over stable minerals
-for(i in seq_along(d_cr.stable)) {
-  # Define basis species with mineral to dissolve
-  basis(c(d_cr.stable[i], "H2O", "H+", "e-"))
-  # Add aqueous species (no need to define activities here - they will be calculated)
-  species(i_aq)
-  # Calculate affinities of formation reactions
-  a <- affinity(pH = c(pH, res), Eh = c(Eh, res), T = T, P = P)
-  # Calculate solubility of this mineral
-  # FIXME: what to do about 'dissociation' argument?
-  s <- solubility(a, in.terms.of = element, dissociation = FALSE)
-  # Store the solubilities in the list
-  slist[[i]] <- s$loga.balance
-}
-
-# The overall solubility is the *minimum* among all the minerals
-smin <- do.call(pmin, slist)
-# Put this into the last-computed 'solubility' object
-s$loga.balance <- smin
-
-# Plot diagram (LAYER 2: equisolubility lines)
-diagram(s, type = "loga.balance", levels = levels, contour.method = "flattest", add = TRUE, lwd = 1.7)
-
-# Calculate affinities for aqueous species
-# FIXME: should be able to remove cr species from previous affinity object
-species(i_aq, 0)
-a_aq <- affinity(pH = c(pH, res), Eh = c(Eh, res), T = T, P = P)
-
-# Plot diagram (LAYER 3: equal-activity lines for aqueous species)
-col <- ifelse(color.lines, 4, 1)
-# Use a white base to improve contrast
-# (so the line remains visible if it coincides with an equisolubility contour)
-diagram(a_aq, add = TRUE, col = "white", lwd = 1.3, names = FALSE)
-
-# Plot diagram (LAYER 4: labels for aqueous species fields)
-# Apply y offset for specified names
-dy <- rep(0, nrow(a_aq$species))
-dy[a_aq$species$name %in% namesdown] <- -0.3
-dy[a_aq$species$name %in% namesdown2] <- -0.5
-# Use a white base for names
-rx <- diff(par("usr")[1:2])
-for(ddx in c(-rx/700, rx/700))
-  diagram(a_aq, add = TRUE, lty = 2, lwd = 0.6, col = col, dx = ddx, dy = dy, col.names = "white", bold = TRUE)
-ry <- diff(par("usr")[3:4])
-for(ddy in c(-ry/700, ry/700))
-  diagram(a_aq, add = TRUE, lty = 2, lwd = 0.6, col = col, dy = dy + ddy, col.names = "white", bold = TRUE)
-col.names <- ifelse(color.names, 4, 1)
-diagram(a_aq, add = TRUE, lty = 0, col = col, dy = dy, col.names = col.names)
-
-# Add solids with unit activity
-species(i_cr, 0)
-# Add aqueous species with activity for last equisolubility line
-# (i.e. unit activity)
-species(i_aq, levels[length(levels)], add = TRUE)
-
-# Calculate affinities of formation of species
-# from basis species as a function of Eh and pH
-a_all_0 <- affinity(pH = c(pH, res), Eh = c(Eh, res), T = T, P = P)
-
-# Plot diagram (LAYER 5: mineral stability boundaries and water lines)
-d_all_0 <- diagram(a_all_0, fill = NA, names = FALSE, lty = 0, lty.cr = 1, lwd = 3, add = TRUE)
-water.lines(d_all_0, lty = 5, lwd = 1.3)
-
-# Plot diagram (LAYER 6: large bold labels for all mineral fields)
-# (this is the last layer, so names are above equal-activity lines,
-# but we use positions calculated with the first equisolubility line
-# so that names are within the shrunken parts of the mineral fields)
-# Create labels using chemical formulas instead of name of minerals
-formulas <- info(a_all$species$ispecies)$formula
-formulas[a_all$species$state == "aq"] <- ""
-diagram(a_all, fill = NA, names = formulas, bold = TRUE, cex.names = 1.2, lty = 0, add = TRUE)
-
-# Add title
-Texpr <- lT(T)
-Pexpr <- lP(P)
-main <- bquote(.(element)*"-O-H at "*.(Texpr)*" and "*.(Pexpr))
-title(main = main)

Modified: pkg/CHNOSZ/inst/NEWS.Rd
===================================================================
--- pkg/CHNOSZ/inst/NEWS.Rd	2021-03-01 12:16:54 UTC (rev 645)
+++ pkg/CHNOSZ/inst/NEWS.Rd	2021-03-02 02:36:42 UTC (rev 646)
@@ -10,7 +10,7 @@
 \newcommand{\s}{\ifelse{latex}{\eqn{_{#1}}}{\ifelse{html}{\out{<sub>#1</sub>}}{#1}}}
 \newcommand{\S}{\ifelse{latex}{\eqn{^{#1}}}{\ifelse{html}{\out{<sup>#1</sup>}}{^#1}}}
 
-\section{Changes in CHNOSZ version 1.4.0-14 (2021-03-01)}{
+\section{Changes in CHNOSZ version 1.4.0-16 (2021-03-02)}{
 
   \subsection{CHANGES}{
     \itemize{
@@ -39,10 +39,12 @@
       \item Restore \samp{lty.aq} and \samp{lty.cr} arguments to
       \code{diagram()} to control plotting of aq-aq and cr-cr field boundaries.
 
-      \item Add \samp{demo/pourbaix.R} (Eh-pH diagrams with equisolubility
+      \item Add \samp{demo/Pourbaix.R} (Eh-pH diagrams with equisolubility
       lines, after \href{https://www.worldcat.org/oclc/563921897}{Pourbaix,
       1974}).
 
+      \item Rename \samp{demo/berman.R} to \samp{potassium.R}.
+
     }
   }
 

Modified: pkg/CHNOSZ/man/examples.Rd
===================================================================
--- pkg/CHNOSZ/man/examples.Rd	2021-03-01 12:16:54 UTC (rev 645)
+++ pkg/CHNOSZ/man/examples.Rd	2021-03-02 02:36:42 UTC (rev 646)
@@ -17,8 +17,8 @@
     "density", "ORP", "findit", "ionize", "buffer", "protbuff",
     "glycinate", "mosaic", "copper", "arsenic", "solubility", "gold",
     "contour", "sphalerite", "zinc", "Shh", "saturation",
-    "adenine", "DEW", "lambda", "berman", "TCA", "aluminum", "AkDi",
-    "comproportionation", "pourbaix"),
+    "adenine", "DEW", "lambda", "potsassium", "TCA", "aluminum", "AkDi",
+    "comproportionation", "Pourbaix"),
     save.png=FALSE)
 }
 
@@ -56,13 +56,13 @@
     \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
-    \code{berman} \tab ineral stabilities in Berman and Helgeson et al. datasets (Sverjensky et al., 1991) \cr
+    \code{potassium} \tab Comparison of thermodynamic datasets for predicting mineral stabilities (Sverjensky et al., 1991) \cr
     \code{TCA} \tab Standard Gibbs energies of the tricarboxylic (citric) acid cycle (Canovas and Shock, 2016) \cr
     \code{aluminum} \tab Reactions involving Al-bearing minerals (Zimmer et al., 2016; Tutolo et al., 2014) \cr
     \code{carboxylase} \tab Rank abundance distribution for RuBisCO and acetyl-CoA carboxylase \cr
     \code{AkDi} \tab Henry's constant of dissolved gases (Akinfiev and Diamond, 2003) \cr
     \code{comproportionation} \tab Gibbs energy of sulfur comproportionation (Amend et al., 2020) \cr
-    \code{pourbaix} \tab Eh-pH diagram for Fe-O-H with equisolubility lines (Pourbaix, 1974) \cr
+    \code{Pourbaix} \tab Eh-pH diagram for Fe-O-H with equisolubility lines (Pourbaix, 1974) \cr
   }
 
 For either function, if \code{save.png} is TRUE, the plots are saved in \code{\link{png}} files whose names begin with the names of the help topics or demos.

Modified: pkg/CHNOSZ/vignettes/anintro.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/anintro.Rmd	2021-03-01 12:16:54 UTC (rev 645)
+++ pkg/CHNOSZ/vignettes/anintro.Rmd	2021-03-02 02:36:42 UTC (rev 646)
@@ -597,7 +597,7 @@
 ```
 
 See the demos in the package for other examples of Eh-pH diagrams.
-In particular, [<span style="color:blue">`demo(pourbaix)`</span>](../demo) shows how to plot the concentrations of metals as equisolubility (or isosolubility) lines on Eh-pH diagrams [@Pou74].
+In particular, [<span style="color:blue">`demo(Pourbaix)`</span>](../demo) shows how to plot the concentrations of metals as equisolubility (or isosolubility) lines on Eh-pH diagrams [@Pou74].
 
 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>.



More information about the CHNOSZ-commits mailing list