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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Mar 21 04:11:42 CET 2020


Author: jedick
Date: 2020-03-21 04:11:41 +0100 (Sat, 21 Mar 2020)
New Revision: 523

Added:
   pkg/CHNOSZ/demo/comproportionation.R
Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/examples.R
   pkg/CHNOSZ/demo/00Index
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/man/examples.Rd
Log:
add demo/comproportionation.R


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2020-03-02 03:19:34 UTC (rev 522)
+++ pkg/CHNOSZ/DESCRIPTION	2020-03-21 03:11:41 UTC (rev 523)
@@ -1,6 +1,6 @@
-Date: 2020-03-02
+Date: 2020-03-21
 Package: CHNOSZ
-Version: 1.3.5-1
+Version: 1.3.6-1
 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	2020-03-02 03:19:34 UTC (rev 522)
+++ pkg/CHNOSZ/R/examples.R	2020-03-21 03:11:41 UTC (rev 523)
@@ -30,7 +30,8 @@
 demos <- function(which=c("sources", "protein.equil", "affinity", "NaCl", "density", 
   "ORP", "findit", "ionize", "buffer", "protbuff", "glycinate",
   "mosaic", "copper", "arsenic", "solubility", "gold", "contour", "sphalerite", "wjd",
-  "bugstab", "Shh", "saturation", "adenine", "DEW", "lambda", "TCA", "aluminum", "bison", "AkDi"), save.png=FALSE) {
+  "bugstab", "Shh", "saturation", "adenine", "DEW", "lambda", "TCA", "aluminum", "bison",
+  "AkDi", "comproportionation"), 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
@@ -40,8 +41,11 @@
       next 
     } else message(paste("demos: running '", which[i], "'", sep=""))
     if(save.png & !which[i]=="dehydration") {
-      if(which[i]=="bugstab") png(paste(which[i], "%d.png", sep=""), width=700, height=500, pointsize=12)
-      else png(paste(which[i], "%d.png", sep=""), width=500, height=500, pointsize=12)
+      width <- 500
+      height <- 500
+      if(which[i]=="comproportionation") width <- 600
+      if(which[i]=="bugstab") width <- 700
+      png(paste(which[i], "%d.png", sep=""), width = width, height = height, pointsize = 12)
     }
     out <- demo(which[i], package="CHNOSZ", character.only=TRUE, echo=FALSE, ask=FALSE)
     if(save.png & !which[i]=="dehydration") dev.off()

Modified: pkg/CHNOSZ/demo/00Index
===================================================================
--- pkg/CHNOSZ/demo/00Index	2020-03-02 03:19:34 UTC (rev 522)
+++ pkg/CHNOSZ/demo/00Index	2020-03-21 03:11:41 UTC (rev 523)
@@ -29,3 +29,4 @@
 carboxylase     Rank abundance distribution for RuBisCO and acetyl-CoA carboxylase
 bison           Average oxidation state of carbon in proteins for phyla at Bison Pool
 AkDi            Henry's constant of dissolved gases
+comproportionation  Gibbs energy of sulfur comproportionation

Added: pkg/CHNOSZ/demo/comproportionation.R
===================================================================
--- pkg/CHNOSZ/demo/comproportionation.R	                        (rev 0)
+++ pkg/CHNOSZ/demo/comproportionation.R	2020-03-21 03:11:41 UTC (rev 523)
@@ -0,0 +1,71 @@
+# CHNOSZ/demo/comproportionation.R
+# Gibbs energy of sulfur comproportionation,
+# after Fig. 1 of Amend et al., 2020 (doi:10.1111/1462-2920.14982)
+# 20191112 jmd first version
+
+# set basis species and activities
+basis(c("H2S", "SO4-2", "H2O", "H+"))
+basis("H2S", -3)
+basis("SO4-2", -2)
+# form native sulfur from sulfide and sulfate
+species("S")
+
+# if we calculate the affinity like this, we're stuck with H2S and SO4-2
+#a <- affinity(T = c(0, 100), pH = c(0, 7))
+# instead, use mosaic() to speciate H2S/HS- and SO4-2/HSO4-
+bases <- list(c("H2S", "HS-"), c("SO4-2", "HSO4-"))
+m <- mosaic(bases, T = c(0, 100), pH = c(0, 7))
+a <- m$A.species
+
+# get plot values
+T <- a$vals[[1]]
+pH <- a$vals[[2]]
+# the affinity as a function of T (rows) and pH (columns)
+A <- a$values[[1]]
+# convert dimensionless affinity (A/2.303RT) to delta G (cal)
+TK <- convert(T, "K")
+G.cal <- convert(A, "G", T = TK)
+# convert cal to kJ
+G.J <- convert(G.cal, "J")
+G.kJ <- G.J / 1000
+# multiply by 4
+# (formation reaction in CHNOSZ is for 1 S; reaction in paper has 4 S)
+G.kJ.4 <- G.kJ * 4
+
+# use subcrt() to write the balanced reaction (shown on the plot)
+rxn <- subcrt("S", 1)$reaction
+rxn$coeff <- rxn$coeff * 4
+rxntext <- describe.reaction(rxn)
+# set units to get label for Delta G (kJ / mol)
+E.units("J")
+DGlab <- axis.label("DGr", prefix = "k")
+
+# calculate pK of H2S and HSO4-
+pK_H2S <- subcrt(c("HS-", "H+", "H2S"), c(-1, -1, 1), T = T)$out$logK
+pK_HSO4 <- subcrt(c("SO4-2", "H+", "HSO4-"), c(-1, -1, 1), T = T)$out$logK
+
+# make contour plot
+filled.contour(T, pH, G.kJ.4, xlab = axis.label("T"), ylab = axis.label("pH"),
+  levels = -55:0,
+  color.palette = function(n) hcl.colors(n),
+  # use plot.axes to label the contour plot (see ?filled.contour)
+  plot.axes = {
+    contour(T, pH, G.kJ.4, levels = c(-10, -30, -50), add = TRUE, col = "white", lwd = 2, labcex = 0.8)
+    legend("topleft", legend = rxntext, bty = "n", inset = c(0, 0.03))
+    legend("topleft", describe.basis(ibasis = 1:2), bty = "n", inset = c(0, 0.08))
+    lines(T, pK_H2S, lty = 2)
+    text(85, 6.7, expr.species("HS-"))
+    text(85, 6.3, expr.species("H2S"))
+    lines(T, pK_HSO4, lty = 2)
+    text(85, 3.0, expr.species("SO4-2"))
+    text(85, 2.5, expr.species("HSO4-"))
+    axis(1)
+    axis(2)
+    title("Sulfur comproportionation, after Amend et al., 2020", font.main = 1)
+  }
+)
+
+# add legend text
+par(xpd = NA)
+text(87, 7.3, DGlab)
+par(xpd = FALSE)

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2020-03-02 03:19:34 UTC (rev 522)
+++ pkg/CHNOSZ/inst/NEWS	2020-03-21 03:11:41 UTC (rev 523)
@@ -1,14 +1,20 @@
-CHANGES IN CHNOSZ 1.3.5-1 (2020-03-02)
+CHANGES IN CHNOSZ 1.3.6-1 (2020-03-21)
 --------------------------------------
 
-- Fix for R-devel: test-add.protein.R had a test that failed with new
-  stringsAsFactors = FALSE default for read.table().
+- Add demo/comproportionation.R: Gibbs energy of sulfur
+  comproportionation, after Amend et al., 2020.
 
+CHANGES IN CHNOSZ 1.3.6 (2020-03-16)
+------------------------------------
+
+- Fix for R-devel (4.0.0): test-add.protein.R had a test that failed
+  with new stringsAsFactors = FALSE default for read.table().
+
 CHANGES IN CHNOSZ 1.3.5 (2020-02-16)
 ------------------------------------
 
-- Fix for R-devel: remove documentation for unused argument '...' in
-  add.protein.Rd.
+- Fix for R-devel (4.0.0): remove documentation for unused argument
+  '...' in add.protein.Rd.
 
 CHANGES IN CHNOSZ 1.3.4 (2019-12-15)
 ------------------------------------

Modified: pkg/CHNOSZ/man/examples.Rd
===================================================================
--- pkg/CHNOSZ/man/examples.Rd	2020-03-02 03:19:34 UTC (rev 522)
+++ pkg/CHNOSZ/man/examples.Rd	2020-03-21 03:11:41 UTC (rev 523)
@@ -17,7 +17,8 @@
     "density", "ORP", "findit", "ionize", "buffer", "protbuff",
     "glycinate", "mosaic", "copper", "arsenic", "solubility", "gold",
     "contour", "sphalerite", "wjd", "bugstab", "Shh", "saturation",
-    "adenine", "DEW", "lambda", "TCA", "aluminum", "bison", "AkDi"),
+    "adenine", "DEW", "lambda", "TCA", "aluminum", "bison", "AkDi",
+    "comproportionation"),
     save.png=FALSE)
 }
 
@@ -61,6 +62,7 @@
     \code{carboxylase} \tab Rank abundance distribution for RuBisCO and acetyl-CoA carboxylase \cr
     \code{bison} \tab Average oxidation state of carbon in proteins for phyla at Bison Pool (Dick and Shock, 2013) \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
   }
 
 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.
@@ -96,6 +98,8 @@
 
 Amend, J. P. and Shock, E. L. (2001) Energetics of overall metabolic reactions of thermophilic and hyperthermophilic Archaea and Bacteria. \emph{FEMS Microbiol. Rev.} \bold{25}, 175--243. \url{https://doi.org/10.1016/S0168-6445(00)00062-0}
 
+Amend, J. P., Aronson, H. S., Macalady, J. and LaRowe, D. E. (2020) Another chemolithotrophic metabolism missing in nature: sulfur comproportionation. \emph{Environ. Microbiol.} \url{https://doi.org/10.1111/1462-2920.14982}
+
 Azadi, M. R., Karrech, A., Attar, M. and Elchalakani, M. (2019) Data analysis and estimation of thermodynamic properties of aqueous monovalent metal-glycinate complexes. \emph{Fluid Phase Equilib.} \bold{480}, 25-40. \url{https://doi.org/10.1016/j.fluid.2018.10.002}
 
 Berman, R. G. (1988) Internally-consistent thermodynamic data for minerals in the system Na{\s2}O-K{\s2}O-CaO-MgO-FeO-Fe{\s2}O{\s3}-Al{\s2}O{\s3}-SiO{\s2}-TiO{\s2}-H{\s2}O-CO{\s2}. \emph{J. Petrol.} \bold{29}, 445-522. \url{https://doi.org/10.1093/petrology/29.2.445}



More information about the CHNOSZ-commits mailing list