[CHNOSZ-commits] r563 - in pkg/CHNOSZ: . inst man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jul 16 03:33:01 CEST 2020


Author: jedick
Date: 2020-07-16 03:32:59 +0200 (Thu, 16 Jul 2020)
New Revision: 563

Added:
   pkg/CHNOSZ/vignettes/multi-metal.Rmd
Removed:
   pkg/CHNOSZ/vignettes/multi_metal.Rmd
Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/inst/NEWS.Rd
   pkg/CHNOSZ/man/equilibrate.Rd
   pkg/CHNOSZ/man/extdata.Rd
   pkg/CHNOSZ/man/palply.Rd
   pkg/CHNOSZ/man/subcrt.Rd
   pkg/CHNOSZ/man/util.expression.Rd
   pkg/CHNOSZ/vignettes/vig.bib
Log:
Add "Other possibilities" to multi-metal.Rmd vignette


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2020-07-15 07:28:56 UTC (rev 562)
+++ pkg/CHNOSZ/DESCRIPTION	2020-07-16 01:32:59 UTC (rev 563)
@@ -1,6 +1,6 @@
-Date: 2020-07-15
+Date: 2020-07-16
 Package: CHNOSZ
-Version: 1.3.6-36
+Version: 1.3.6-37
 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/inst/NEWS.Rd
===================================================================
--- pkg/CHNOSZ/inst/NEWS.Rd	2020-07-15 07:28:56 UTC (rev 562)
+++ pkg/CHNOSZ/inst/NEWS.Rd	2020-07-16 01:32:59 UTC (rev 563)
@@ -5,7 +5,7 @@
 % macros
 \newcommand{\H2O}{\ifelse{latex}{\eqn{\mathrm{H_{2}O}}}{\ifelse{html}{\out{H<sub>2</sub>O}}{H2O}}}
 
-\section{Changes in CHNOSZ version 1.3.6-36 (2020-07-15)}{
+\section{Changes in CHNOSZ version 1.3.6-37 (2020-07-17)}{
 
   \subsection{MAJOR CHANGES}{
     \itemize{
@@ -74,7 +74,7 @@
   \subsection{DEMOS AND VIGNETTES}{
     \itemize{
 
-      \item Add \samp{multi_metal.Rmd} for examples of diagrams with multiple
+      \item Add \samp{multi-metal.Rmd} for examples of diagrams with multiple
       metals.
 
       \item Add \samp{demo/comproportionation.R}: Gibbs energy of sulfur

Modified: pkg/CHNOSZ/man/equilibrate.Rd
===================================================================
--- pkg/CHNOSZ/man/equilibrate.Rd	2020-07-15 07:28:56 UTC (rev 562)
+++ pkg/CHNOSZ/man/equilibrate.Rd	2020-07-16 01:32:59 UTC (rev 563)
@@ -103,6 +103,8 @@
 \seealso{
 \code{\link{diagram}} has examples of using \code{equilibrate} to make equilibrium activity diagrams. \code{\link{revisit}} can be used to perform further analysis of the equilibrium activities.
 \code{\link{palply}} is used by both \code{equil.reaction} and \code{equil.boltzmann} to parallelize intensive parts of the calculations.
+
+See the vignette \code{multi-metal.Rmd} for an example of balancing on two elements (N in the basis species, C in the formed species).
 }
 
 \value{
@@ -135,23 +137,6 @@
 logK <- subcrt(c("CO2","H2O","HCO3-","H+"), c(-1, -1, 1, 1), T=25)$out$logK
 # we could decrease tolerance here by increasing res
 stopifnot(all.equal(pKa.equil, -logK, tolerance=1e-2))
-
-# equilibrate with mosaic: balancing on two elements (N and C)
-# thanks to Kirt Robinson for the feature request and test case
-loga_N <- -4
-loga_C <- -3
-basis(c("CO2", "NH3", "O2", "H2O", "H+"))
-basis("NH3", loga_N)
-species(c("acetamide", "acetic acid", "acetate"))
-# this calculates equilibrium activities of NH3 and NH4+ for given loga_N
-# and calculates the corresponding affinities of the formed species
-m <- mosaic(c("NH3", "NH4+"), pH = c(0, 14))
-# this calculates equilibrium activities of the formed species for given loga_C
-# and combines them with the activities of the changing basis species (NH3 and NH4+)
-eqc <- equilibrate(m, loga.balance = loga_C)
-diagram(eqc, ylim = c(-10, -2))
-title(main = paste("log(total N in basis species) =", loga_N,
-                   "\nlog(total C in formed species) =", loga_C), font.main = 1)
 }
 
 \references{

Modified: pkg/CHNOSZ/man/extdata.Rd
===================================================================
--- pkg/CHNOSZ/man/extdata.Rd	2020-07-15 07:28:56 UTC (rev 562)
+++ pkg/CHNOSZ/man/extdata.Rd	2020-07-16 01:32:59 UTC (rev 563)
@@ -44,9 +44,9 @@
     \item \code{SS98_Fig5a.csv}, \code{SS98_Fig5b.csv} Values of logarithm of fugacity of \O2 and pH as a function of temperature for mixing of seawater and hydrothermal fluid, digitized from Figs. 5a and b of Shock and Schulte, 1998. See the vignette \code{anintro.Rmd} for an example that uses this file.
     \item \code{rubisco.csv} UniProt IDs for Rubisco, ranges of optimal growth temperature of organisms, domain and name of organisms, and URL of reference for growth temperature, from Dick, 2014. See the vignette \code{anintro.Rmd} for an example that uses this file.
     \item \code{bluered.txt} Blue - light grey - red color palette, computed using \CRANpkg{colorspace}\code{::diverge_hcl(1000,} \code{c = 100, l = c(50, 90), power = 1)}. This is used by \code{\link{ZC.col}}.
-    \item \code{AD03_Fig1?.csv} Experimental data points digitized from Figure 1 of Akinfiev and Diamond, 2003, used in \code{\link{demos}("AkDi")}.
-    \item \code{TKSS14_Fig2.csv} Experimental data points digitized from Figure 2 of Tutolo et al., 2014, used in \code{\link{demos}("aluminum")}.
-    \item \code{Mer75_Table4.csv} Values of log(aK+/aH+) and log(aNa+/aH+) from Table 4 of Merino, 1975, used in \code{\link{demos}("aluminum")}.
+    \item \code{AD03_Fig1?.csv} Experimental data points digitized from Figure 1 of Akinfiev and Diamond, 2003, used in \code{demo("AkDi")}.
+    \item \code{TKSS14_Fig2.csv} Experimental data points digitized from Figure 2 of Tutolo et al., 2014, used in \code{demo("aluminum")}.
+    \item \code{Mer75_Table4.csv} Values of log(aK+/aH+) and log(aNa+/aH+) from Table 4 of Merino, 1975, used in \code{demo("aluminum")}.
   }
 
   Files in \code{protein} contain protein sequences and amino acid compositions for proteins.

Modified: pkg/CHNOSZ/man/palply.Rd
===================================================================
--- pkg/CHNOSZ/man/palply.Rd	2020-07-15 07:28:56 UTC (rev 562)
+++ pkg/CHNOSZ/man/palply.Rd	2020-07-16 01:32:59 UTC (rev 563)
@@ -26,7 +26,7 @@
 
 \seealso{
 \code{\link{read.fasta}}, \code{\link{count.aa}}, \code{\link{affinity}}, \code{\link{equil.boltzmann}} and \code{\link{equil.reaction}} for functions that use \code{palply}.
-Tests are in \file{tests/test-util.program.R}, and a \dQuote{real world} example is in \file{demos/density.R}.
+Tests are in \file{tests/test-util.program.R}, and a \dQuote{real world} example is in \file{demo/density.R}.
 }
 
 \concept{Utility functions}

Modified: pkg/CHNOSZ/man/subcrt.Rd
===================================================================
--- pkg/CHNOSZ/man/subcrt.Rd	2020-07-15 07:28:56 UTC (rev 562)
+++ pkg/CHNOSZ/man/subcrt.Rd	2020-07-16 01:32:59 UTC (rev 563)
@@ -94,7 +94,7 @@
 \section{Warning}{
 Although \acronym{SUPCRT92} prohibits calculations above 350 \degC at \Psat (\dQuote{beyond range of applicability of aqueous species equations}), CHNOSZ does not impose this limitation, and allows calculations up to the critical temperature (373.917 \degC) at \Psat.
 Interpret calculations between 350 \degC and the critical temperature at \Psat at your own risk.
-The discontinuity in the value of \logK at \Psat that is apparent in \code{\link{demos}("NaCl")} demonstrates one unexpected result.
+The discontinuity in the value of \logK at \Psat that is apparent in \code{demo("NaCl")} demonstrates one unexpected result.
 
 \code{NA}s are produced for calculations at \samp{Psat} when the temperature exceeds the critical temperature of \H2O.
 In addition, properties of species using the revised HKF equations are set to \code{NA} wherever the density of \H2O < 0.35 g/cm\S{3} (threshold just above the critical isochore; Johnson et al., 1992).

Modified: pkg/CHNOSZ/man/util.expression.Rd
===================================================================
--- pkg/CHNOSZ/man/util.expression.Rd	2020-07-15 07:28:56 UTC (rev 562)
+++ pkg/CHNOSZ/man/util.expression.Rd	2020-07-16 01:32:59 UTC (rev 563)
@@ -126,7 +126,8 @@
 }
 
 \seealso{
-  \code{\link{util.legend}}; \code{demo("saturation")} for examples of \code{syslab} and \code{ratlab}.
+  \code{\link{util.legend}} for other functions to make legends.
+  \code{demo("saturation")} for examples of \code{syslab} and \code{ratlab}.
 }
 
 \examples{\dontshow{reset()}

Copied: pkg/CHNOSZ/vignettes/multi-metal.Rmd (from rev 562, pkg/CHNOSZ/vignettes/multi_metal.Rmd)
===================================================================
--- pkg/CHNOSZ/vignettes/multi-metal.Rmd	                        (rev 0)
+++ pkg/CHNOSZ/vignettes/multi-metal.Rmd	2020-07-16 01:32:59 UTC (rev 563)
@@ -0,0 +1,223 @@
+---
+title: "Diagrams with multiple metals"
+author: "Jeffrey M. Dick"
+output:
+  html_vignette:
+    mathjax: null
+vignette: >
+  %\VignetteIndexEntry{Diagrams with multiple metals}
+  %\VignetteEngine{knitr::rmarkdown}
+  %\VignetteEncoding{UTF-8}
+bibliography: vig.bib
+csl: elementa.csl
+---
+<style>
+/* https://gomakethings.com/how-to-break-an-image-out-of-its-parent-container-with-css/ */
+ at media (min-width: 700px) {
+  .full-width {
+    left: 50%;
+    margin-left: -50vw;
+    margin-right: -50vw;
+    max-width: 100vw;
+    position: relative;
+    right: 50%;
+    width: 100vw;
+  }
+}
+ at media (min-width: 1020px) {
+  .full-width {
+    left: 50vw; /* fallback if needed */
+    left: calc(50vw - 160px);
+    width: 1000px;
+    position: relative;
+    background-color: #9ecff7;
+    padding:10px;
+  }
+}
+/* zero margin around pre blocks (looks more like R console output) */
+pre {
+  margin-top: 0;
+  margin-bottom: 0;
+}
+</style>
+<script>
+function ToggleDiv(ID) {
+  var D = document.getElementById("D-" + ID);
+  var B = document.getElementById("B-" + ID);
+  if (D.style.display === "none") {
+    // open the div and change button text
+    D.style.display = "block";
+    B.innerText = "Hide code";
+  } else {
+    // close the div and change button text
+    D.style.display = "none";
+    B.innerText = "Show code";
+  }
+}
+</script>
+
+```{r setup, include=FALSE}
+## use pngquant to optimize PNG images
+library(knitr)
+knit_hooks$set(pngquant = hook_pngquant)
+pngquant <- "--speed=1 --quality=0-25"
+if (!nzchar(Sys.which("pngquant"))) pngquant <- NULL
+```
+
+```{r CHNOSZ_reset, include=FALSE}
+library(CHNOSZ)
+reset()
+```
+
+This vignette was compiled on `r Sys.Date()` with CHNOSZ version `r sessionInfo()$otherPkgs$CHNOSZ$Version`.
+
+Basic diagrams in CHNOSZ are made for reactions that are *balanced on an element* (see [Equilibrium in CHNOSZ](equilibrium.html)) and therefore represent minerals or aqueous species that all have one element, often a metal, in common.
+This vignette describes some methods for constructing diagrams for elements with multiple metals.
+The methods are **simple overlay**, **mosaic series**, and **secondary balancing**.
+
+## Simple Overlay
+
+Simple overlay refers to independent calculations for two different systems that are displayed on the same diagram.
+It is easy to make such a diagram, but there is no interaction between the systems.
+
+## Mosaic Series
+
+A mosaic diagram shows the effects of changing basis species on the stabilities of minerals.
+The Fe-S-O-H system is a common example: the speciation of aqueous sulfur species affects the stabilities of iron oxides and sulfides.
+Examples of mosaic diagrams with Fe or other single metals are given elsewhere.
+
+A mosaic series is when predominance fields for minerals calculated in one mosaic diagram are used as input to a second mosaic diagram, where the minerals are now themselves basis species.
+The example here shows the construction of a Cu-Fe-S-O-H diagram.
+
+First we define the conditions and basis species.
+It is important to put Cu^+^ first so that it will be used as the balance for the reactions with Cu-bearing minerals (which also have Fe).
+Pyrite is chosen as the starting Fe-bearing basis species, which will be changed as indicated in `bases2`.
+
+```{r mosaic1, results = "hide", message = FALSE}
+logaH2S <- -2
+T <- 200
+pH <- c(0, 12, 500)
+O2 <- c(-50, -30, 500)
+basis(c("Cu+", "pyrite", "H2S", "oxygen", "H2O", "H+"))
+basis("H2S", logaH2S)
+bases1 <- c("H2S", "HS-", "HSO4-", "SO4-2")
+bases2 <- c("pyrite", "pyrrhotite", "magnetite", "hematite")
+```
+
+Now we calculate affinities for minerals in the Fe-S-O-H system using changing aqueous sulfur species in `bases1`.
+The result is used to make different layers of the diagram:
+
+1. Water stability region (bounded by the grey area)
+2. Predominance fields for the aqueous S species (italic blue text and dashed lines)
+3. Stability areas for the Fe-bearing minerals (black text and solid lines)
+
+```{r mosaic2, eval = FALSE, echo = 1:6}
+species(bases2)
+mFe <- mosaic(bases1, pH = pH, O2 = O2, T = T)
+diagram(mFe$A.bases, lty = 0, names = NA)
+diagram(mFe$A.bases, lty = 2, col = 4, col.names = 4,
+        italic = TRUE, add = TRUE, limit.water = FALSE)
+dFe <- diagram(mFe$A.species, add = TRUE, limit.water = FALSE)
+species(c("chalcopyrite", "bornite"))
+mCu <- mosaic(list(bases1, bases2), pH = pH, O2 = O2,
+              T = T, predominant = list(NULL, dFe$predominant))
+diagram(mCu$A.species, add = TRUE, col = 2, col.names = 2,
+        lwd = 2, bold = TRUE, limit.water = FALSE)
+TP <- describe.property(c("T", "P"), c(T, "Psat"))
+legend("topright", TP, bty = "n")
+title(paste("Cu-Fe-S-O-H; Total S =", 10^logaH2S, "m"))
+```
+
+Next we load the Cu-bearing minerals and calculate their affinities while changing *both* the aqueous sulfur species and the Fe-bearing minerals whose stability fields were just calculated.
+The result is used to plot the final layer of the diagram:
+
+4. Stability areas for Cu-bearing minerals (bold red text and solid lines)
+
+After that we add the legend and title.
+
+```{r mosaic2, echo=7:14, results = "hide", message = FALSE, fig.width = 6, fig.height = 5, out.width = "80%", fig.align = "center", pngquant = pngquant}
+```
+
+This diagram has a distinctive chalcopyrite "hook" that is controlled on the low-pH side by the reaction with pyrite.
+Only that reaction is shown in many published diagrams [e.g. @And75;@Gio02], but diagrams with a similar chalcopyrite wedge or hook can be seen in @BBR77.
+
+## Secondary Balancing
+
+Predominance diagrams in CHNOSZ are made using the maximum affinity method, where the affinities of formation reactions of species are divided by the *balancing coefficients* [@Dic19].
+Usually, these balancing coefficients are taken from the formation reactions themselves; for example, if they are the coefficients on the Fe-bearing basis species, then the reactions are said to be "balanced on Fe".
+
+Some diagrams in the literature are made with secondary balancing constraints in addition to the primary ones.
+For example, reactions of Fe-bearing minerals are balanced on Fe, and reactions of Cu-bearing minerals are balanced on Cu; these are both primary balancing coefficients.
+Then, reactions between all minerals are balanced on H^+^ as the secondary balancing coefficients.
+The challenge is to implement the secondary balance while also maintaining the primary balance; such a method has been implemented in `bimetal()` function.
+
+TODO: add example.
+Although the diagram from @MH85 is drawn only for H~2~S, we can go further and make a mosaic diagram.
+
+## Other Possibilities
+
+Conceptually, the methods described above treat different metal-bearing elements as parts of distinct chemical systems that are then joined together.
+Other methods may be more suitable for considering multiple metals (or other elements) in one system.
+
+### Balancing on a Non-Metal
+
+As shown in the **secondary balancing** example, there is no requirement that the balancing coefficients come from a metal-bearing species.
+It is possible to make diagrams for minerals with different metallic elements simply by using a non-metallic element as the primary balance.
+Here is an example for the Cu-Fe-S-O-H system based on Figure 3 of @MH85.
+The reactions are balanced on O~2~, which means that no O~2~ appears in the reaction between any two minerals, but Fe^+2^ and/or Cu^+^ can be present, depending on the chemical composition.
+Saturation limits are shown for species that have no O~2~ in their formation reactions.
+
+```{r non-metal, results = "hide", message = FALSE, fig.width = 6, fig.height = 5, out.width = "80%", fig.align = "center", pngquant = pngquant}
+basis(c("Fe+2", "Cu+", "hydrogen sulfide", "oxygen", "H2O", "H+"))
+basis("H2S", 2)
+species(c("pyrite", "magnetite", "hematite", "covellite", "tenorite", "chalcopyrite", "bornite"))
+a <- affinity("Cu+" = c(-8, 2, 500), "Fe+2" = c(-4, 12, 500), T = 400, P = 2000)
+d <- diagram(a, xlab = ratlab("Cu+"), ylab = ratlab("Fe+2"), balance = "O2")
+title(paste("Cu-Fe-S-O-H; 1° balance:", d$balance))
+# Add saturation lines
+species(c("pyrrhotite", "ferrous-oxide", "chalcocite", "cuprite"))
+asat <- affinity(a)  # argument recall
+diagram(asat, type = "saturation", add = TRUE, lty = 2, col = 4)
+legend("topleft", legend = lTP(400, 2000), bty = "n")
+```
+
+In some ways this is like the inverse of the **mosaic series** example.
+There, reactions were balanced on Fe or Cu, and *f*~O<sub>2</sub>~ and pH were used as plotting variables.
+Here, the reactions are balanced on O~2~ and implicitly on H^+^ through the activity ratios with *a*~Fe^+2^~ and *a*~Cu^+^~, which are the plotting variables.
+
+More common diagrams of this type are balanced on Si or Al.
+See `demo(saturation)` for an example in the H~2~O-CO~2~-CaO-MgO-SiO~2~ system.
+
+### Mosaic Combo
+
+Instead of adding minerals with different metals by stacking mosaic diagrams (**mosaic series**), it may be possible to include two different metals in the basis species and formed species.
+The `mosaic()` and `equilibrate()` functions can be combined to balance on two different elements.
+The example here is for N and C rather than metals.
+Thanks to Kirt Robinson for the feature request and test case.
+
+First, the `mosaic()` command calculates equilibrium activities of NH~3~ and NH~4~^+^ for a given total activity of N in the basis species, and calculates the corresponding affinities of the formed species.
+Then, the `equilibrate()` command calculates equilibrium activities of the formed species for given total activity of C, and combines them with the activities of the changing basis species (NH~3~ and NH~4~^+^).
+
+```{r mosaic-combo, results = "hide", message = FALSE, fig.width = 6, fig.height = 5, out.width = "80%", fig.align = "center", pngquant = pngquant}
+loga_N <- -4
+loga_C <- -3
+basis(c("CO2", "NH3", "O2", "H2O", "H+"))
+basis("NH3", loga_N)
+species(c("acetamide", "acetic acid", "acetate"))
+m <- mosaic(c("NH3", "NH4+"), pH = c(0, 14))
+e <- equilibrate(m, loga.balance = loga_C)
+diagram(e, ylim = c(-10, -2))
+tN <- paste("log(total N in basis species) =", loga_N)
+tC <- paste("log(total C in formed species) =", loga_C)
+title(main = paste(tN, tC, sep = "\n"), font.main = 1)
+```
+
+The diagram shows the expected ionization of acetic acid and NH~3~ at different pHs.
+The appearance of acetamide (CH~3~CONH~2~) is a consequence of the interaction between the N-bearing and C-bearing species, and is analogous to the formation of a multi-metal complex.
+
+
+## Document History
+
+* 2020-07-15 First version.
+
+## References

Deleted: pkg/CHNOSZ/vignettes/multi_metal.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/multi_metal.Rmd	2020-07-15 07:28:56 UTC (rev 562)
+++ pkg/CHNOSZ/vignettes/multi_metal.Rmd	2020-07-16 01:32:59 UTC (rev 563)
@@ -1,158 +0,0 @@
----
-title: "Diagrams with multiple metals"
-author: "Jeffrey M. Dick"
-output:
-  html_vignette:
-    mathjax: null
-vignette: >
-  %\VignetteIndexEntry{Diagrams with multiple metals}
-  %\VignetteEngine{knitr::rmarkdown}
-  %\VignetteEncoding{UTF-8}
-bibliography: vig.bib
-csl: elementa.csl
----
-<style>
-/* https://gomakethings.com/how-to-break-an-image-out-of-its-parent-container-with-css/ */
- at media (min-width: 700px) {
-  .full-width {
-    left: 50%;
-    margin-left: -50vw;
-    margin-right: -50vw;
-    max-width: 100vw;
-    position: relative;
-    right: 50%;
-    width: 100vw;
-  }
-}
- at media (min-width: 1020px) {
-  .full-width {
-    left: 50vw; /* fallback if needed */
-    left: calc(50vw - 160px);
-    width: 1000px;
-    position: relative;
-    background-color: #9ecff7;
-    padding:10px;
-  }
-}
-/* zero margin around pre blocks (looks more like R console output) */
-pre {
-  margin-top: 0;
-  margin-bottom: 0;
-}
-</style>
-<script>
-function ToggleDiv(ID) {
-  var D = document.getElementById("D-" + ID);
-  var B = document.getElementById("B-" + ID);
-  if (D.style.display === "none") {
-    // open the div and change button text
-    D.style.display = "block";
-    B.innerText = "Hide code";
-  } else {
-    // close the div and change button text
-    D.style.display = "none";
-    B.innerText = "Show code";
-  }
-}
-</script>
-
-```{r setup, include=FALSE}
-## use pngquant to optimize PNG images
-library(knitr)
-knit_hooks$set(pngquant = hook_pngquant)
-pngquant <- "--speed=1 --quality=0-25"
-if (!nzchar(Sys.which("pngquant"))) pngquant <- NULL
-```
-
-```{r CHNOSZ_reset, include=FALSE}
-library(CHNOSZ)
-reset()
-```
-
-This vignette was compiled on `r Sys.Date()` with CHNOSZ version `r sessionInfo()$otherPkgs$CHNOSZ$Version`.
-
-Basic diagrams in CHNOSZ are made for reactions that are *balanced on an element* (see [Equilibrium in CHNOSZ](equilibrium.html)) and therefore represent minerals or aqueous species that all have one element, often a metal, in common.
-This vignette describes some methods for constructing diagrams for elements with multiple metals.
-The methods are **simple overlay**, **mosaic series**, and **secondary balancing**.
-
-## Simple Overlay
-
-Simple overlay refers to independent calculations for two different systems that are displayed on the same diagram.
-It is easy to make such a diagram, but there is no interaction between the systems.
-
-## Mosaic Series
-
-A mosaic diagram shows the effects of changing basis species on the stabilities of minerals.
-The Fe-S-O-H system is a common example: the speciation of aqueous sulfur species affects the stabilities of iron oxides and sulfides.
-A mosaic series is when predominance fields for minerals calculated in one mosaic diagram are used as input to a second mosaic diagram, where the minerals are now themselves basis species.
-The example here shows the construction of a Cu-Fe-S-O-H diagram.
-
-First we define the conditions and basis species.
-It is important to put Cu^+^ first so that it will be used as the balance for the reactions with Cu-bearing minerals (which also have Fe).
-Pyrite is chosen as the starting Fe-bearing basis species, which will be changed as indicated in `bases2`.
-
-```{r mosaic1, results = "hide", message = FALSE}
-logaH2S <- -2
-T <- 200
-pH <- c(0, 12, 500)
-O2 <- c(-50, -30, 500)
-basis(c("Cu+", "pyrite", "H2S", "oxygen", "H2O", "H+"))
-basis("H2S", logaH2S)
-bases1 <- c("H2S", "HS-", "HSO4-", "SO4-2")
-bases2 <- c("pyrite", "pyrrhotite", "magnetite", "hematite")
-```
-
-Now we calculate affinities for minerals in the Fe-S-O-H system using changing aqueous sulfur species in `bases1`.
-The result is used to make different layers of the diagram:
-
-1. Water stability region (bounded by the grey area)
-2. Predominance fields for the aqueous S species (italic blue text and dashed lines)
-3. Stability areas for the Fe-bearing minerals (black text and solid lines)
-
-```{r mosaic2, eval = FALSE, echo = 1:6}
-species(bases2)
-mFe <- mosaic(bases1, pH = pH, O2 = O2, T = T)
-diagram(mFe$A.bases, lty = 0, names = NA)
-diagram(mFe$A.bases, lty = 2, col = 4, col.names = 4,
-        italic = TRUE, add = TRUE, limit.water = FALSE)
-dFe <- diagram(mFe$A.species, add = TRUE, limit.water = FALSE)
-species(c("chalcopyrite", "bornite"))
-mCu <- mosaic(list(bases1, bases2), pH = pH, O2 = O2,
-              T = T, predominant = list(NULL, dFe$predominant))
-diagram(mCu$A.species, add = TRUE, col = 2, col.names = 2,
-        lwd = 2, bold = TRUE, limit.water = FALSE)
-TP <- describe.property(c("T", "P"), c(T, "Psat"))
-legend("topright", TP, bty = "n")
-title(paste("Cu-Fe-S-O-H; Total S =", 10^logaH2S, "m"))
-```
-
-Next we load the Cu-bearing minerals and calculate their affinities while changing *both* the aqueous sulfur species and the Fe-bearing minerals whose stability fields were just calculated.
-The result is used to plot the final layer of the diagram:
-
-4. Stability areas for Cu-bearing minerals (bold red text and solid lines)
-
-After that we add the legend and title.
-
-```{r mosaic2, echo=7:14, results = "hide", message = FALSE, fig.width = 6, fig.height = 5, out.width = "80%", fig.align = "center", pngquant = pngquant}
-```
-
-This diagram has a distinctive chalcopyrite "hook" that is controlled on the low-pH side by the reaction with pyrite.
-Usually only that reaction is shown in published diagrams [e.g. @And75;@Gio02], but diagrams with a similar chalcopyrite wedge or hook can be seen in @BBR77.
-
-## Secondary Balancing
-
-Predominance diagrams in CHNOSZ are made using the maximum affinity method, where the affinities of formation reactions of species are divided by the *balancing coefficients* [@Dic19].
-Usually, these balancing coefficients are taken from the formation reactions themselves; for example, if they are the coefficients on the Fe-bearing basis species, then the reactions are said to be "balanced on Fe".
-
-Some diagrams in the literature are made with secondary balancing constraints in addition to the primary ones.
-For example, reactions of Fe-bearing minerals are balanced on Fe, and reactions of Cu-bearing minerals are balanced on Cu; these are both primary balancing coefficients.
-Then, reactions between all minerals are balanced on H^+^ as the secondary balancing coefficients.
-The challenge is to implement the secondary balance while also maintining the primary balance; such a method has been implemented in `bimetal()` function.
-
-TODO: add example.
-
-## Document history
-
-* 2020-07-15 First version.
-
-## References

Modified: pkg/CHNOSZ/vignettes/vig.bib
===================================================================
--- pkg/CHNOSZ/vignettes/vig.bib	2020-07-15 07:28:56 UTC (rev 562)
+++ pkg/CHNOSZ/vignettes/vig.bib	2020-07-16 01:32:59 UTC (rev 563)
@@ -293,6 +293,17 @@
   doi       = {10.2138/rmg.2013.75.5},
 }
 
+ at Article{MH85,
+  author    = {McKenzie, William F. and Helgeson, Harold C.},
+  journal   = {Economic Geology},
+  title     = {{P}hase relations among silicates, copper iron sulfides, and aqueous solutions at magmatic temperatures},
+  year      = {1985},
+  number    = {7},
+  pages     = {1965 -- 1973},
+  volume    = {80},
+  doi       = {10.2113/gsecongeo.80.7.1965},
+}
+
 @InProceedings{NPW_79,
   author    = {Nordstrom, D. K. and Plummer, L. N. and Wigley, T. M. L. and Wolery, T. J. and Ball, J. W. and Jenne, E. A. and Bassett, R. L. and Crerar, D. A. and Florence, T. M. and Fritz, B. and Hoffman, M. and Holdren, G. R., Jr. and Lafon, G. M. and Mattigod, S. V. and McDuff, R. E. and Morel, F. and Reddy, M. M. and Sposito, G. and Thrailkill, J.},
   title     = {A comparison of computerized chemical models for equilibrium calculations in aqueous systems},



More information about the CHNOSZ-commits mailing list