diff --git a/DESCRIPTION b/DESCRIPTION index 5ea5c35..bdbd147 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Date: 2023-11-29 Package: CHNOSZ -Version: 2.0.0-35 +Version: 2.0.0-36 Title: Thermodynamic Calculations and Diagrams for Geochemistry Authors@R: c( person("Jeffrey", "Dick", , "j3ffdick@gmail.com", role = c("aut", "cre"), diff --git a/inst/CHECKLIST b/inst/CHECKLIST index 43ac293..e3cd842 100644 --- a/inst/CHECKLIST +++ b/inst/CHECKLIST @@ -79,3 +79,10 @@ Making vignettes for website (https://chnosz.net) - After making vignettes, run doc/mklinks.sh in installed directory (this adds links to the HTML renditions of Rd files) + +*************** +Temporary Items +*************** + +- Replace reference to "development version of CHNOSZ (to be 2.0.1)" in FAQ.Rmd. + diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index 4c2cc32..4c31bbb 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -15,7 +15,7 @@ \newcommand{\Cp}{\ifelse{latex}{\eqn{C_P}}{\ifelse{html}{\out{CP}}{Cp}}} \newcommand{\DG0}{\ifelse{latex}{\eqn{{\Delta}G^{\circ}}}{\ifelse{html}{\out{ΔG°}}{ΔG°}}} -\section{Changes in CHNOSZ version 2.0.0-34 (2023-11-28)}{ +\section{Changes in CHNOSZ version 2.0.0-36 (2023-11-29)}{ \itemize{ @@ -30,7 +30,7 @@ \item How can minerals with polymorphic transitions be added to the database? \item How can I make a diagram with the trisulfur radical ion (S\s{3}\S{-})? \item In OBIGT, what is the meaning of \code{T} for solids, liquids, and gases? - \item How do I plot mineral buffers for pH? + \item How can mineral pH buffers be plotted? } diff --git a/vignettes/FAQ.Rmd b/vignettes/FAQ.Rmd index a944673..3b51651 100644 --- a/vignettes/FAQ.Rmd +++ b/vignettes/FAQ.Rmd @@ -751,11 +751,11 @@ In previous versions of CHNOSZ, values of Δ*G*° above the *C~p~* equation limi *Added on 2023-11-15.* -## How do I plot mineral buffers for pH? +## How can mineral pH buffers be plotted? -Unlike mineral redox buffers, the K-feldspar–muscovite–quartz (KMQ) and muscovite–kaolinite (MC) buffers for pH are known as "sliding scale" buffers because they do not determine pH but rather the activity ratio of `r Kplus` to `r Hplus` [@HA05]. -To add these buffers to a `r logfO2`–pH diagram in CHNOSZ, choose basis species that include Al+3 (the least mobile element, which the reactions are balanced on), quartz (this is needed for the KMQ buffer), the mobile ions `r Kplus` and `r Hplus`, and the remaining elements in `r H2O` and `r O2` (`oxygen` denotes the gas in OBIGT). -The formation reactions for these minerals don't involve `r O2`, but it is required so that the number of basis species equals the number of elements plus one for charge. +Unlike mineral redox buffers, the K-feldspar–muscovite–quartz (KMQ) and muscovite–kaolinite (MC) pH buffers are known as "sliding scale" buffers because they do not determine pH but rather the activity ratio of `r Kplus` to `r Hplus` [@HA05]. +To add these buffers to a `r logfO2`–pH diagram in CHNOSZ, choose basis species that include Al+3 (the least mobile element, which the reactions are balanced on), quartz (this is needed for the KMQ buffer), the mobile ions `r Kplus` and `r Hplus`, and the remaining elements in `r H2O` and `r O2`; `oxygen` denotes the gas in OBIGT. +The formation reactions for these minerals don't involve `r O2`, but it must be present so that the number of basis species equals the number of elements +1 (i.e. elements plus charge). ```{r KMQ_basis_species, message = FALSE} basis(c("Al+3", "quartz", "K+", "H+", "H2O", "oxygen")) @@ -783,15 +783,16 @@ K_AK <- 10 ^ logK_AK This calculation gives a molality of `r Kplus` that is lower than unity and accordingly makes the buffers less acidic [@HC14]. Now we can apply the calculated molality of `r Kplus` to the basis species and add the buffer lines to the diagram. -Note the `IS` argument is also used for `affinity()` so that activities are replaced by molalities (that is, affinity is calculated with standard Gibbs energies adjusted for ionic strength; this has the same effect as calculating activity coefficients). -```{r KMQ_diagram, eval = FALSE, echo = 2:9} +The `IS` argument is also used for `affinity()` so that activities are replaced by molalities (that is, affinity is calculated with standard Gibbs energies adjusted for ionic strength; this has the same effect as calculating activity coefficients). +```{r KMQ_diagram, eval = FALSE, echo = 2:10} par(mfrow = c(1, 2)) basis("K+", log10(m_K)) a <- affinity(pH = c(2, 10), O2 = c(-55, -38), T = T, P = P, IS = IS) diagram(a, srt = 90) dTP <- as.expression(c(lT(T), lP(P))) legend("topleft", legend = dTP, bty = "n", inset = c(-0.05, 0), cex = 0.9) -legend("topright", c("Unit molality of Cl-", "Quartz saturation"), bty = "n", cex = 0.9) +ltxt <- c(quote("Unit molality of Cl"^"-"), "Quartz saturation") +legend("topright", legend = ltxt, bty = "n", cex = 0.9) title("Mineral data from Berman (1988)\nand Sverjensky et al. (1991) (OBIGT default)", font.main = 1, cex.main = 0.9) add.OBIGT("SUPCRT92") @@ -804,22 +805,23 @@ OBIGT() ```{r KMQ_diagram, message = FALSE, fig.width = 8, fig.height = 4, out.width = "100%", results = "hide", echo = FALSE, dpi = dpi} ``` -In this diagram, the gray area is below the reducing stability limit of water (i.e., where the equilibrium fugacity of `r H2` exceeds unity). -The diagram in Fig. 4 of @HC14 shows lines at somewhat higher pH; ca. 5 and 6 for the two buffers. -There are several possible reasons for the differences: +The gray area, which is automatically drawn by `diagram()`, is below the reducing stability limit of water; that is, this area is where the equilibrium fugacity of `r H2` exceeds unity. + +The diagram in Fig. 4 of @HC14 shows the buffer lines at somewhat higher pH values of ca. 5 and 6. +There are several possible reasons for these differences: 1. We used different thermodynamic data for the minerals; 2. Activity coefficients either were not calculated or were calculated differently by @HC14 (however, removing `IS` from the code moves the lines to lower rather than higher pH); or -3. We calculated `r Kplus` molality incorrectly for the MC buffer [this represents "clay-rich but feldspar-free sediments", but we used the feldspathic Ab–Kfs reaction becauase no other reaction was given by @HC14]. +3. We calculated `r Kplus` molality incorrectly for the MC buffer. Although @HC14 invoked the muscovite–kaolinite buffer for "clay-rich but feldspar-free sediments", we used the feldspathic Ab–Kfs reaction for calculating `r Kplus` molality [no alternative reaction was given by @HC14]. -Addressing only the first point, note that the parameters for these minerals in the default OBIGT database come from @Ber88 and @SHD91. +Regarding only the first point, note that the parameters for these minerals in the default OBIGT database come from @Ber88 and @SHD91. ```{r KMQ_refs, message = FALSE} thermo.refs(species()$ispecies) ``` If we use the thermodynamic parameters for minerals from @HDNB78, we get the lines shown in the second plot above, representing a larger stability field for muscovite. -```{r KMQ_diagram, eval = FALSE, echo = 10:14} +```{r KMQ_diagram, eval = FALSE, echo = 11:15} ``` *Added on 2023-11-28.* diff --git a/vignettes/mklinks.sh b/vignettes/mklinks.sh index c8ec90a..cbfb849 100755 --- a/vignettes/mklinks.sh +++ b/vignettes/mklinks.sh @@ -148,3 +148,4 @@ sed -i 's/thermo.refs()<\/code>/subcrt()<\/code>/subcrt()<\/a><\/code>/g' FAQ.html sed -i 's/check.GHS()<\/code>/check.GHS()<\/a><\/code>/g' FAQ.html sed -i 's/affinity()<\/code>/affinity()<\/a><\/code>/g' FAQ.html +sed -i 's/diagram()<\/code>/diagram()<\/a><\/code>/g' FAQ.html