[CHNOSZ-commits] r851 - in pkg/CHNOSZ: . demo inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Nov 30 05:33:28 CET 2024
Author: jedick
Date: 2024-11-30 05:33:27 +0100 (Sat, 30 Nov 2024)
New Revision: 851
Modified:
pkg/CHNOSZ/DESCRIPTION
pkg/CHNOSZ/demo/00Index
pkg/CHNOSZ/demo/sum_S.R
pkg/CHNOSZ/inst/NEWS.Rd
pkg/CHNOSZ/man/examples.Rd
Log:
Add solubility contours for Fe and Au to demo/sum_S.R
Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION 2024-11-28 07:36:27 UTC (rev 850)
+++ pkg/CHNOSZ/DESCRIPTION 2024-11-30 04:33:27 UTC (rev 851)
@@ -1,6 +1,6 @@
-Date: 2024-11-28
+Date: 2024-11-30
Package: CHNOSZ
-Version: 2.1.0-23
+Version: 2.1.0-24
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/demo/00Index
===================================================================
--- pkg/CHNOSZ/demo/00Index 2024-11-28 07:36:27 UTC (rev 850)
+++ pkg/CHNOSZ/demo/00Index 2024-11-30 04:33:27 UTC (rev 851)
@@ -9,7 +9,7 @@
protbuff Chemical activities buffered by thiol peroxidases or sigma factors
glycinate Metal-glycinate complexes
mosaic Eh-pH diagram for iron oxides, sulfides and carbonate with two sets of changing basis species
-sum_S Mineral stabilities with the sum of S species and ionic strength
+sum_S Summed molality of S species and solubility contours for iron and gold
copper Another example of mosaic(): complexation of copper with glycine species
arsenic Another example of mosaic(): Eh-pH diagram for the system As-O-H-S
solubility Solubility of calcite and CO2(gas) as a function of pH
Modified: pkg/CHNOSZ/demo/sum_S.R
===================================================================
--- pkg/CHNOSZ/demo/sum_S.R 2024-11-28 07:36:27 UTC (rev 850)
+++ pkg/CHNOSZ/demo/sum_S.R 2024-11-30 04:33:27 UTC (rev 851)
@@ -1,56 +1,78 @@
# CHNOSZ/demo/sum_S.R
-# 20240604 Fe-S-C-O-H log a (sum S) - pH modified from mosaic.R
-# 20241127 Fe-S-O-H logfO2 - log a (sum S) added IS
+# 20240604 Fe-S-O-C log a (sum S) - pH modified from mosaic.R
+# 20241130 Fe-S-O + Au logfO2 - log a (sum S) added NaCl and solubility contours
library(CHNOSZ)
-for(IS in c(0, 0.5)) {
+# Define conditions
+res <- 500
+loga_S <- c(-6, 0, res)
+logf_O2 <- c(-45, -20, res)
+pH <- 5
+T <- 300
+#P <- "Psat"
+P <- 1000
+#IS <- 0.8
- # Define conditions
- res <- 500
- loga_S <- c(-6, 0, res)
- logf_O2 <- c(-45, -20, res)
- pH <- 5
- T <- 300
- P <- "Psat"
- #IS <- 0
- # Setup chemical system
- # Use "oxygen" instead of "O2" to get the gas
- basis(c("FeO", "SO4-2", "H2O", "H+", "oxygen"))
- basis("pH", pH)
- # Add aqueous species followed by minerals
- species(c("Fe+2", "Fe+3", "HFeO2-"))
- species(c("pyrrhotite", "pyrite", "hematite", "magnetite"), add = TRUE)
+# Calculate solution composition for 0.8 mol/kg NaCl
+# Based on activity of Cl- from Fig. 18 of Skirrow and Walsh (2002)
+m_NaCl = 0.8
+NaCl <- NaCl(m_tot = m_NaCl, T = T, P = P, pH = pH)
+IS <- NaCl$IS
- # List basis species to swap through
- bases <- list( c("SO4-2", "HSO4-", "HS-", "H2S") )
+# Setup chemical system
+# Use oxygen instead of O2 to get the gas
+basis(c("Fe", "SO4-2", "oxygen", "H+", "Cl-", "H2O"))
+basis("pH", pH)
+basis("Cl-", log10(NaCl$m_Cl))
+# Add minerals as formed species
+species(c("pyrrhotite", "pyrite", "hematite", "magnetite"))
- # Start diagram for loga_Fe = -6
- species(1:3, -6)
- m1 <- mosaic(bases, "SO4-2" = loga_S, O2 = logf_O2, T = T, P = P, IS = IS)
- diagram(m1$A.species, bold = TRUE)
+# List basis species to swap through
+bases <- list( c("SO4-2", "HSO4-", "HS-", "H2S") )
+# Calculate mosaic for Fe minerals
+m <- mosaic(bases, "SO4-2" = loga_S, O2 = logf_O2, T = T, P = P, IS = IS)
- # Overlay lines and labels for loga_Fe = -5
- species(1:3, -5)
- m2 <- mosaic(bases, "SO4-2" = loga_S, O2 = logf_O2, T = T, P = P, IS = IS)
- d <- diagram(m2$A.species, add = TRUE, names = NA, fill = NA, lty = 3)
+# Loop over metals for solubility contours
+for(metal in c("Fe", "Au")) {
- # Add dashed line for water stability limti
+ # Plot diagram for Fe minerals and show sulfur species
+ d <- diagram(m$A.species, bold = TRUE, lwd = 2)
+ diagram(m$A.bases[[1]], add = TRUE, col = 4, col.names = 4, lty = 4, dx = -2.5, dy = c(-4, 0, 0, 6))
+ # Add water stability limit
water.lines(d)
+ if(metal == "Au") {
+ # Put Au as the first basis species for solubility() calculation
+ basis(c("Au", "SO4-2", "oxygen", "H+", "Cl-", "H2O"))
+ basis("pH", pH)
+ # This is the species whose solubility we want to calculate
+ species("Au")
+ # These are the aqueous species that form by dissolving Au
+ iaq <- retrieve("Au", state = "aq", ligands = c("O", "H", "S", "Cl"))
+ # Make orange contours for Au
+ cols <- c(6, 7)
+ } else {
+ # For Fe, the basis species and formed species are already set up properly for solubility()
+ # These are the aqueous species that form by dissolving Fe minerals
+ iaq <- retrieve("Fe", state = "aq", ligands = c("O", "H", "S", "Cl"))
+ # Make red contours for Fe
+ cols <- c(2, 2)
+ }
+ # Calculate solubility and convert log molality to ppb
+ s <- solubility(iaq, bases = bases, "SO4-2" = loga_S, O2 = logf_O2, T = T, P = P, IS = IS, in.terms.of = metal)
+ sp <- convert(s, "ppb")
+ # Plot twice to get deeper colors
+ for(col in cols) {
+ diagram(sp, type = "loga.balance", contour.method = "flattest", levels = 10^(-3:5), add = TRUE, col = col, lty = 3, lwd = 1.8, cex = 1.2)
+ }
+
# Add legends and title
- TP <- describe.property(c("T", "P"), c(T, P))
- PI <- c(bquote(pH == .(pH)), bquote(italic(I) == .(IS)~mol~kg^-1))
- legend1 <- lex(TP, PI)
- legend("topright", legend1, bty = "n")
+ T_P <- describe.property(c("T", "P"), c(T, P))
+ P_Cl <- c(bquote(pH == .(pH)), bquote(NaCl == .(m_NaCl)~mol~kg^-1))
+ legend <- lex(T_P, P_Cl)
+ legend("topright", legend, bty = "n")
+ main <- paste("Fe minerals with summed aq species: S (x-axis) and ppb", metal, "(contours)")
+ title(main, font.main = 1)
- Fe <- c(
- bquote(10^-5~italic(m)~Fe^"+2"),
- bquote(10^-6~italic(m)~Fe^"+2")
- )
- legend2 <- lex(Fe)
- legend("topleft", legend2, lty = c(3, 1), bty = "n")
-
- title(main = "Fe-S-O-H with summed S and ionic strength", font.main = 1)
-
}
Modified: pkg/CHNOSZ/inst/NEWS.Rd
===================================================================
--- pkg/CHNOSZ/inst/NEWS.Rd 2024-11-28 07:36:27 UTC (rev 850)
+++ pkg/CHNOSZ/inst/NEWS.Rd 2024-11-30 04:33:27 UTC (rev 851)
@@ -56,9 +56,10 @@
for uranyl species, after
\href{https://doi.org/10.1016/j.gca.2024.04.023}{Migdisov et al. (2024)}.
- \item Adjust \code{util.expression()} to show sum symbol in axis label,
- rename \file{demo/total_S.R} to \file{demo/sum_S.R}, and add ionic
- strength to demo.
+ \item Adjust \code{axis.label()} to show sum symbol.
+
+ \item Rename \file{demo/total_S.R} to \file{demo/sum_S.R}, change axes,
+ and add solubility contours for Fe and Au.
}
Modified: pkg/CHNOSZ/man/examples.Rd
===================================================================
--- pkg/CHNOSZ/man/examples.Rd 2024-11-28 07:36:27 UTC (rev 850)
+++ pkg/CHNOSZ/man/examples.Rd 2024-11-30 04:33:27 UTC (rev 851)
@@ -67,7 +67,7 @@
\item{rank.affinity}{Affinity ranking for proteins in yeast nutrient limitation (data from Tai et al., 2005)}
\item{yttrium}{\code{\link{logB.to.OBIGT}} fits at 800 and 1000 bar and Y speciation in \code{\link{NaCl}} solution at varying pH (Guan et al., 2020)}
\item{uranyl}{Total (carbonate|sulfate)-pH diagrams for uranyl species (Migdisov et al., 2024)}
- \item{sum_S}{Mineral stabilities with the sum of S species and ionic strength}
+ \item{sum_S}{Summed molality of S species and solubility contours for iron and gold (Skirrow and Walshe, 2002)}
}
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.
@@ -141,6 +141,8 @@
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. \doi{10.1039/FT9928800803}
+Skirrow, R. G. and Walshe, J. L. (2002) Reduced and oxidized Au-Cu-Bi iron oxide deposits of the Tennant Creek Inlier, Australia: An integrated geologic and chemical model. \emph{Econ. Geol.}. \bold{97}, 1167--1202. \doi{10.2113/gsecongeo.97.6.1167}
+
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. \doi{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{https://www.worldcat.org/oclc/31754493}
More information about the CHNOSZ-commits
mailing list