[CHNOSZ-commits] r103 - in pkg/CHNOSZ: . R data demo inst inst/extdata/thermo man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Nov 25 05:43:03 CET 2015


Author: jedick
Date: 2015-11-25 05:43:03 +0100 (Wed, 25 Nov 2015)
New Revision: 103

Added:
   pkg/CHNOSZ/demo/dehydration.R
Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/examples.R
   pkg/CHNOSZ/data/OBIGT.csv
   pkg/CHNOSZ/data/refs.csv
   pkg/CHNOSZ/demo/00Index
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/inst/extdata/thermo/OBIGT-2.csv
   pkg/CHNOSZ/man/examples.Rd
Log:
add demo dehydration.R


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2015-11-19 16:53:20 UTC (rev 102)
+++ pkg/CHNOSZ/DESCRIPTION	2015-11-25 04:43:03 UTC (rev 103)
@@ -1,6 +1,6 @@
-Date: 2015-11-19
+Date: 2015-11-25
 Package: CHNOSZ
-Version: 1.0.7
+Version: 1.0.7-1
 Title: Chemical Thermodynamics and Activity Diagrams
 Author: Jeffrey Dick
 Maintainer: Jeffrey Dick <j3ffdick at gmail.com>

Modified: pkg/CHNOSZ/R/examples.R
===================================================================
--- pkg/CHNOSZ/R/examples.R	2015-11-19 16:53:20 UTC (rev 102)
+++ pkg/CHNOSZ/R/examples.R	2015-11-25 04:43:03 UTC (rev 103)
@@ -32,15 +32,18 @@
 demos <- function(which=c("sources", "NaCl", "density", 
   "nucleobase", "ORP", "revisit", "findit",
   "ionize", "buffer", "yeastgfp", "mosaic",
-  "copper", "solubility", "wjd"), do.png=FALSE) {
+  "copper", "solubility", "wjd", "dehydration"), to.file=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
     msgout("------------\n")
-    msgout(paste("demos: running '", which[i], "'\n", sep=""))
-    if(do.png) png(paste(which[i],"%d.png",sep=""),width=500,height=500,pointsize=12)
+    if(which[i]=="dehydration" & !to.file) {
+      msgout("demos: skipping dehydration demo as to.file is FALSE\n")
+      next 
+    } else msgout(paste("demos: running '", which[i], "'\n", sep=""))
+    if(to.file & !which[i]=="dehydration") png(paste(which[i],"%d.png",sep=""),width=500,height=500,pointsize=12)
     out <- demo(which[i], package="CHNOSZ", character.only=TRUE, echo=FALSE, ask=FALSE)
-    if(do.png) dev.off()
+    if(to.file & !which[i]=="dehydration") dev.off()
   }
   return(invisible(out))
 }

Modified: pkg/CHNOSZ/data/OBIGT.csv
===================================================================
--- pkg/CHNOSZ/data/OBIGT.csv	2015-11-19 16:53:20 UTC (rev 102)
+++ pkg/CHNOSZ/data/OBIGT.csv	2015-11-25 04:43:03 UTC (rev 103)
@@ -2551,6 +2551,7 @@
 "2-iodobenzoic acid",NA,C7H5IO2,cr,RG11,NA,07.Jan.12,-41260.994,-70602.294,52.187,40.17,110.2,-1.828,133.724,1.892,0,0,0,0,435.02
 "3-iodobenzoic acid",NA,C7H5IO2,cr,RG11,NA,07.Jan.12,-46041.109,-75382.409,52.187,40.17,114.8,-1.828,133.724,1.892,0,0,0,0,460.3
 "4-iodobenzoic acid",NA,C7H5IO2,cr,RG11,NA,07.Jan.12,-45921.606,-75262.906,52.187,40.17,115.5,-1.828,133.724,1.892,0,0,0,0,543.7
+gypsum,NA,CaSO4*2H2O,cr,RH95,Kel60,22.Nov.15,-429493,-483509,46.32,NA,74.69,21.84,76,0,0,0,0,0,400
 pyridine,NA,C5H5N,liq,LH06b,NA,11.Jul.03,43370,23890,42.52,31.72,80.86,10.24,64.34,2.042,0,0,0,0,1000
 piperidine,NA,C5H11N,liq,LH06b,NA,16.Jul.03,24270,-20860,50.18,42.95,99.4,2.42,98.88,9.831,0,0,0,0,1000
 methane,NA,CH4,liq,HOK+98,NA,30.Aug.06,-8976,-18895,30.57,14.68,58.2,-1.55,47.6,1.81,0,0,0,0,111.64

Modified: pkg/CHNOSZ/data/refs.csv
===================================================================
--- pkg/CHNOSZ/data/refs.csv	2015-11-19 16:53:20 UTC (rev 102)
+++ pkg/CHNOSZ/data/refs.csv	2015-11-25 04:43:03 UTC (rev 103)
@@ -28,8 +28,9 @@
 FDK+04,"P. M. B. Fernandes, T. Domitrovic et al.",2004,"FEBS Lett. 556, 153-160",http://dx.doi.org/10.1016/S0014-5793(03)01396-6
 FPC+04,"D. Fenclova, S. Perez-Casas, M. Costas, and V. Dohnal",2004,"J. Chem. Eng. Data 49, 1833-1838",http://dx.doi.org/10.1021/je049738c
 GLL+98,"C. Godon, G. Lagniel et al.",1998,"J. Biol. Chem. 273, 22480-22489",http://dx.doi.org/10.1074/jbc.273.35.22480
+GM09,"K.-D. Grevel and J. Majzlan",2009,"Geochim. Cosmochim. Acta 73, 6805 - 6815",http://dx.doi.org/10.1016/j.gca.2009.08.005
 Gur96,"S. Gurrieri",1996,"personal communication",
-HDN+78,"H. C. Helgeson, J. M. Delany et al.",1978,"Am. J. Sci. 278A, 1-229",http://www.worldcatlibraries.org/oclc/13594862
+HDN+78,"H. C. Helgeson, J. M. Delany et al.",1978,"Am. J. Sci. 278A, 1-229",http://www.worldcat.org/oclc/13594862
 Hel85b,"H. C. Helgeson",1985,"Am. J. Sci. 285, 845-855",http://dx.doi.org/10.2475/ajs.285.9.845
 HOK+98,"H. C. Helgeson, C. E. Owens et al.",1998,"Geochim. Cosmochim. Acta 62, 985-1081",http://dx.doi.org/10.1016/S0016-7037(97)00219-6
 HPT06,"B. Hawrylak, R. Palepu and P. R. Tremaine",2006,"J. Chem. Thermodynamics 38, 988-1007",http://dx.doi.org.ezproxy1.lib.asu.edu/10.1016/j.jct.2005.10.013
@@ -49,8 +50,8 @@
 LLD+99,"J. J. M. ter Linde, H. Liang et al.",1999,"J. Bacteriol. 181, 7409-7413",http://jb.asm.org/cgi/content/abstract/181/24/7409
 MA07,"L. Marini and M. Accornero",2007,"Environ. Geol. 52, 1343-1363",http://dx.doi.org/10.1007/s00254-006-0578-5
 MA10,"L. Marini and M. Accornero",2010,"Environ. Earth Sci. 59, 1601-1606",http://dx.doi.org/10.1007/s12665-009-0369-x
-MGN03,"J. Majzlan, K. D. Grevel and A. Navrotsky",2003,"Am. Mineral. 88, 855-859",http://ammin.geoscienceworld.org/cgi/content/abstract/88/5-6/855
-MLS+03,"J. Majzlan, B. E. Lang et al.",2003,"Am. Mineral. 88, 846-854",http://ammin.geoscienceworld.org/cgi/content/abstract/88/5-6/846
+MGN03,"J. Majzlan, K.-D. Grevel and A. Navrotsky",2003,"Am. Mineral. 88, 855-859",http://dx.doi.org/10.2138/am-2003-5-614
+MLS+03,"J. Majzlan, B. E. Lang et al.",2003,"Am. Mineral. 88, 846-854",http://dx.doi.org/10.2138/am-2003-5-613
 MNM+06,"J. Majzlan, A. Navrotsky et al.",2006,"Eur. J. Mineral. 18, 175-186",http://dx.doi.org/10.1127/0935-1221/2006/0018-0175
 MS97,"T. M. McCollom and E. L. Shock",1997,"Geochim. Cosmochim. Acta 61, 4375-4391",http://dx.doi.org/10.1016/S0016-7037(97)00241-X
 MSB+04,"J. Majzlan, R. Stevens et al.",2004,"Phys. Chem. Mineral. 31, 518-531",http://dx.doi.org/10.1007/s00269-004-0405-z

Modified: pkg/CHNOSZ/demo/00Index
===================================================================
--- pkg/CHNOSZ/demo/00Index	2015-11-19 16:53:20 UTC (rev 102)
+++ pkg/CHNOSZ/demo/00Index	2015-11-25 04:43:03 UTC (rev 103)
@@ -12,3 +12,4 @@
 copper          another example of mosaic(): complexation of copper with glycine species
 solubility      solubility of calicite or CO2(gas) as a function of pH
 wjd             run.wjd() with proteins: cell periphery of yeast
+dehydration     log K of dehydration reactions; SVG file contains tooltips and links

Added: pkg/CHNOSZ/demo/dehydration.R
===================================================================
--- pkg/CHNOSZ/demo/dehydration.R	                        (rev 0)
+++ pkg/CHNOSZ/demo/dehydration.R	2015-11-25 04:43:03 UTC (rev 103)
@@ -0,0 +1,83 @@
+# plot temperature dependence of log K for some dehydration reactions
+
+# the RSVGTipsDevice packages allows us to create an SVG file with
+# tooltips and hyperlinks
+if(require("RSVGTipsDevice")) {
+
+# because the tooltip titles in the SVG file are shown by recent browsers,
+# we do not need to draw the tooltips explicitly, so set toolTipMode=0
+devSVGTips("dehydration.svg", toolTipMode=0, title="Dehydration reactions")
+
+# unfortunately, plotmath can't be used with devSVGTips,
+# so axis labels here don't contain italics.
+T <- seq(1, 175)
+plot(range(T), c(-2, 1), type="n", xlab="T, °C", ylab="log K")
+title(main="Dehydration reactions")
+
+# add.obigt is needed to add malate and fumarate,
+# and epsomite and hexahydrite to thermo$obigt
+add.obigt()
+reactants <- c("[AABB]", "[AABB]", "malate-2", "goethite", "gypsum", "epsomite", "ethanol")
+products <- c("[UPBB]", "[PBB]", "fumarate-2", "hematite", "anhydrite", "hexahydrite", "ethylene")
+rstate <- c("aq", "cr", "aq", "cr", "cr", "cr", "aq")
+pstate <- c("aq", "cr", "aq", "cr1", "cr", "cr", "gas")
+rcoeff <- c(-1, -1, -1, -2, -0.5, -1, -1)
+pcoeff <- c(1, 1, 1, 1, 0.5, 1, 1)
+# position and rotation of the names
+ilab <- c(140, 120, 60, 60, 20, 120, 120)
+srt <- c(10, 29, 25, 12, 13, 20, 35)
+# reference and temperature for examples of similar calculations
+ex.T <- c(NA, NA, NA, NA, 40, NA, 170)
+ex.txt <- c(NA, NA, NA, NA, "cf. Mercury et al., 2001", NA, "Shock, 1993")
+ex.doi <- c(NA, NA, NA, NA, "10.1016/S0883-2927(00)00025-1", NA, "10.1016/0016-7037(93)90542-5")
+
+for(i in 1:length(reactants)) {
+
+  # lines
+  s <- subcrt(c(reactants[i], products[i], "H2O"),
+              c(rstate[i], pstate[i], "liq"),
+              c(rcoeff[i], pcoeff[i], 1), T=T)
+  lines(T, s$out$logK)
+
+  # points
+  if(!is.na(ex.T[i])) {
+    URL <- paste0("http://dx.doi.org/", ex.doi[i])
+    setSVGShapeURL(URL, target="_blank")
+    setSVGShapeContents(paste0("<title>", ex.txt[i], "</title>"))
+    # we would use this instead with toolTipMode=1 :
+    #setSVGShapeToolTip(title=ex.txt[i])
+    points(ex.T[i], s$out$logK[ex.T[i]])
+  }
+
+  # names
+  for(j in 1:2) {
+    formula <- thermo$obigt$formula[s$reaction$ispecies[j]]
+    key1 <- thermo$obigt$ref1[s$reaction$ispecies[j]]
+    ikey1 <- which(thermo$refs$key==key1)
+    URL1 <- thermo$refs$URL[ikey1]
+    setSVGShapeURL(URL1, target="_blank")
+    setSVGShapeContents(paste0("<title>", paste(formula, s$reaction$state[j]), "</title>"))
+    if(j==1) dy <- 0.08 else dy <- -0.03
+    if(j==1) dx <- 0 else dx <- 5
+    # strip charge from names
+    name <- gsub("-.*", "", s$reaction$name[j])
+    text(T[ilab[i]] + dx, s$out$logK[ilab[i]] + dy, name, adj=1, srt=srt[i])
+    # add a second reference link if needed
+    key2 <- thermo$obigt$ref2[s$reaction$ispecies[j]]
+    if(!is.na(key2)) {
+      ikey2 <- which(thermo$refs$key==key2)
+      URL2 <- thermo$refs$URL[ikey2]
+      setSVGShapeURL(URL2, target="_blank")
+      setSVGShapeContents("<title>2nd reference</title>")
+      text(T[ilab[i]] + dx, s$out$logK[ilab[i]] + dy, "(*)", adj=0)
+    }
+  }
+
+}
+
+# dotted line for logaH2O = 0
+abline(h=0, lty=3)
+# done!
+dev.off()
+
+}

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2015-11-19 16:53:20 UTC (rev 102)
+++ pkg/CHNOSZ/inst/NEWS	2015-11-25 04:43:03 UTC (rev 103)
@@ -1,6 +1,18 @@
-CHANGES IN CHNOSZ 1.0.7 (2015-11-19)
+CHANGES IN CHNOSZ 1.0.7-1 (2015-11-25)
 --------------------------------------
 
+- Add gypsum to OBIGT.csv.
+
+- Add MgSO4 and hydrated Mg sulfate minerals to OBIGT-2.csv (kieserite,
+  starkeyite, hexahydrite and epsomite from Grevel and Majzlan, 2009).
+
+- Add demo dehydration.R. This demo requires the RSVGTipsDevice package,
+  which is currently unavailable on Windows.
+
+
+CHANGES IN CHNOSZ 1.0.7 (2015-11-19)
+------------------------------------
+
 - Add functions usrfig() (get figure limits in user coordinates) and
   label.figure() (add label to figure outside of plot region).
 

Modified: pkg/CHNOSZ/inst/extdata/thermo/OBIGT-2.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/thermo/OBIGT-2.csv	2015-11-19 16:53:20 UTC (rev 102)
+++ pkg/CHNOSZ/inst/extdata/thermo/OBIGT-2.csv	2015-11-25 04:43:03 UTC (rev 103)
@@ -304,3 +304,8 @@
 goethite,NA,FeOOH,cr,MGN03,MLS+03,13.Apr.09,-117065,-134010.5,14.269,17.7724665391969,20.881,0.298,55.736,0.75,0,0,0,0,375
 lepidocrocite,NA,FeOOH,cr,MGN03,MLS+03,13.Apr.09,-114746.7,-131309.8,15.559,16.5248565965583,22.395,14.283,14.465,-1.847,0,0,0,0,390
 maghemite,NA,Fe2O3,cr,MGN03,MLS+03,13.Apr.09,-173972.3,-193140.5,22.228,25.0215105162524,32.779,25.526,15.557,-4.508,0,0,0,0,760
+MgSO4,NA,MgSO4,cr,WEP+82,NA,24.Nov.15,-279780,-307100,21.89,NA,NA,23.06,0,0,0,0,0,0,NA
+kieserite,NA,MgSO4.H2O,cr,GM09,NA,24.Nov.15,-343670,-385160,30.11,NA,NA,24.65,0.41,-4.29,0,0,0,0,400
+starkeyite,NA,MgSO4*4H2O,cr,GM09,NA,24.Nov.15,-514770,-596580,62.12,NA,NA,0,0,0,0,0,0,0,400
+hexahydrite,NA,MgSO4*6H2O,cr,GM09,NA,24.Nov.15,-629130,-737880,83.29,NA,NA,48.56,1.6,-10.68,0,0,0,0,400
+epsomite,NA,MgSO4*7H2O,cr,GM09,NA,24.Nov.15,-686190,-809920,88.74,NA,NA,52.29,1.78,-11.67,0,0,0,0,400

Modified: pkg/CHNOSZ/man/examples.Rd
===================================================================
--- pkg/CHNOSZ/man/examples.Rd	2015-11-19 16:53:20 UTC (rev 102)
+++ pkg/CHNOSZ/man/examples.Rd	2015-11-25 04:43:03 UTC (rev 103)
@@ -9,6 +9,7 @@
 \arguments{
   \item{do.png}{logical, generate PNG files for the plots?}
   \item{which}{character, which example to run}
+  \item{to.file}{logical, generate image files for the plots?}
 }
 
 \usage{
@@ -16,7 +17,7 @@
   demos(which = c("sources", "NaCl", "density",
     "nucleobase", "ORP", "revisit", "findit", 
     "ionize", "buffer", "yeastgfp", "mosaic",
-    "copper", "solubility", "wjd"), do.png=FALSE)
+    "copper", "solubility", "wjd", "dehydration"), to.file=FALSE)
 }
 
 \details{
@@ -45,6 +46,7 @@
     \code{copper} \tab another example of \code{\link{mosaic}}: complexation of Cu with glycine (Aksu and Doyle, 2001) \cr
     \code{solubility} \tab solubility of calcite (cf. Manning et al., 2013) or CO2(gas) (cf. Stumm and Morgan, 1996) \cr
     \code{wjd} \tab run.wjd() with proteins: cell periphery of yeast \cr
+    \code{dehydration} \tab log K of dehydration reactions; SVG file contains tooltips and links \cr
   }
 
 }



More information about the CHNOSZ-commits mailing list