[CHNOSZ-commits] r224 - in pkg/CHNOSZ: . R data demo inst inst/extdata/OBIGT man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Sep 28 08:21:10 CEST 2017


Author: jedick
Date: 2017-09-28 08:21:10 +0200 (Thu, 28 Sep 2017)
New Revision: 224

Added:
   pkg/CHNOSZ/demo/DEW.R
Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/examples.R
   pkg/CHNOSZ/R/water.R
   pkg/CHNOSZ/data/refs.csv
   pkg/CHNOSZ/demo/00Index
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/inst/extdata/OBIGT/DEW_aq.csv
   pkg/CHNOSZ/man/examples.Rd
   pkg/CHNOSZ/man/water.Rd
   pkg/CHNOSZ/vignettes/obigt.Rmd
   pkg/CHNOSZ/vignettes/obigt.bib
Log:
add demo DEW.R


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2017-09-27 15:35:15 UTC (rev 223)
+++ pkg/CHNOSZ/DESCRIPTION	2017-09-28 06:21:10 UTC (rev 224)
@@ -1,6 +1,6 @@
-Date: 2017-09-27
+Date: 2017-09-28
 Package: CHNOSZ
-Version: 1.1.0-22
+Version: 1.1.0-23
 Title: Thermodynamic Calculations for Geobiochemistry
 Author: Jeffrey Dick
 Maintainer: Jeffrey Dick <j3ffdick at gmail.com>

Modified: pkg/CHNOSZ/R/examples.R
===================================================================
--- pkg/CHNOSZ/R/examples.R	2017-09-27 15:35:15 UTC (rev 223)
+++ pkg/CHNOSZ/R/examples.R	2017-09-28 06:21:10 UTC (rev 224)
@@ -29,7 +29,7 @@
 demos <- function(which=c("sources", "protein.equil", "affinity", "NaCl", "density", 
   "ORP", "revisit", "findit", "ionize", "buffer", "protbuff", "yeastgfp", "mosaic",
   "copper", "solubility", "wjd", "dehydration", "bugstab", "Shh", "activity_ratios",
-  "adenine"), to.file=FALSE) {
+  "adenine", "DEW"), 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

Modified: pkg/CHNOSZ/R/water.R
===================================================================
--- pkg/CHNOSZ/R/water.R	2017-09-27 15:35:15 UTC (rev 223)
+++ pkg/CHNOSZ/R/water.R	2017-09-28 06:21:10 UTC (rev 224)
@@ -5,7 +5,7 @@
 water <- function(property = NULL, T = get("thermo")$opt$Tr, P = "Psat") {
   # calculate the properties of liquid H2O as a function of T and P
   # T in Kelvin, P in bar
-  if(is.null(property)) stop('property was NULL')
+  if(is.null(property)) return(get("thermo")$opt$water)
   # set water option
   if(length(property)==1 & any(property %in% c("SUPCRT", "SUPCRT92", "IAPWS", "IAPWS95", "DEW"))) {
     thermo <- get("thermo")

Modified: pkg/CHNOSZ/data/refs.csv
===================================================================
--- pkg/CHNOSZ/data/refs.csv	2017-09-27 15:35:15 UTC (rev 223)
+++ pkg/CHNOSZ/data/refs.csv	2017-09-28 06:21:10 UTC (rev 224)
@@ -29,6 +29,7 @@
 SM93,"E. L. Shock and W. B. McKinnon",1993,"Icarus 106, 464-477","CO, HCN, urea",https://doi.org/10.1006/icar.1993.1185
 SS93,"M. D. Schulte and E. L. Shock",1993,"Geochim. Cosmochim. Acta 57, 3835-3846",aldehydes,https://doi.org/10.1016/0016-7037(93)90337-V
 HSS95,"J. R. Haas, E. L. Shock and D. C. Sassani",1995,"Geochim. Cosmochim. Acta 59, 4329-4350","complexes of rare earth elements",https://doi.org/10.1016/0016-7037(95)00314-P
+PH95,"V. A. Pokrovskii and H. C. Helgeson",1995,"Am. J. Sci. 295, 1255-1342","aluminum species",https://doi.org/10.2475/ajs.295.10.1255
 PK95,"V. B. Parker and I. L. Khodakovskii",1995,"J. Phys. Chem. Ref. Data 24, 1699-1745",melanterite,https://doi.org/10.1063/1.555964
 RH95,"R. A. Robie and B. S. Hemingway",1995,"U. S. Geological Survey Bull. 2131","gypsum GHS",http://pubs.er.usgs.gov/publication/b2131
 SK95,"E. L. Shock and C. M. Koretsky",1995,"Geochim. Cosmochim. Acta 59, 1497-1532","metal-organic acid complexes",https://doi.org/10.1016/0016-7037(95)00058-8
@@ -38,6 +39,7 @@
 DSM+97,"J. D. Dale, E. L. Shock et al.",1997,"Geochim. Cosmochim. Acta 61, 4017-4024",alkylphenols,https://doi.org/10.1016/S0016-7037(97)00212-3
 DSM+97.1,"J. D. Dale, E. L. Shock et al.",1997,"Geochim. Cosmochim. Acta 61, 4017-4024","phenol, and cresol isomers",https://doi.org/10.1016/S0016-7037(97)00212-3
 DSM+97.2,"J. D. Dale, E. L. Shock et al.",1997,"Geochim. Cosmochim. Acta 61, 4017-4024","dimethylphenol isomers",https://doi.org/10.1016/S0016-7037(97)00212-3
+HP97,"P. C. Ho and D. A. Palmer",1997,"Geochim. Cosmochim. Acta 61, 3027-3040",KOH,https://doi.org/10.1016/S0016-7037(97)00146-4
 MS97,"T. M. McCollom and E. L. Shock",1997,"Geochim. Cosmochim. Acta 61, 4375-4391","MgSO<sub>4</sub>, NaSO<sub>4</sub><sup>-</sup>, and HCl",https://doi.org/10.1016/S0016-7037(97)00241-X
 MS97.1,"T. M. McCollom and E. L. Shock",1997,"Geochim. Cosmochim. Acta 61, 4375-4391",sulfur,https://doi.org/10.1016/S0016-7037(97)00241-X
 SSB97,"E. L. Shock, D. C. Sassani and H. Betz",1997,"Geochim. Cosmochim. Acta 61, 4245-4266","uranium species",https://doi.org/10.1016/S0016-7037(97)00240-8
@@ -99,8 +101,11 @@
 LD12.2,"D. E. LaRowe and J. M. Dick",2012,"Geochim. Cosmochim. Acta 80, 70-91","methionine GHS",https://doi.org/10.1016/j.gca.2011.11.041
 LD12.3,"D. E. LaRowe and J. M. Dick",2012,"Geochim. Cosmochim. Acta 80, 70-91","methionine sidechain GHS",https://doi.org/10.1016/j.gca.2011.11.041
 DEH+13,"J. M. Dick, K. A. Evans et al.",2013,"Geochim. Cosmochim. Acta 122, 247-266","phenanthrene and methylphenanthrene isomers",https://doi.org/10.1016/j.gca.2013.08.020
-FDM+14,"S. Facq et al.",2014,"Geochim. Cosmochim. Acta 132, 375-390","CO2, CO3-2, and HCO3-",https://doi.org/10.1016/j.gca.2014.01.030
-SHA14,"D. A. Sverjensky et al.",2014,"Geochim. Cosmochim. Acta 129, 125-145","AlO2- and HAlO2",https://doi.org/10.1016/j.gca.2013.12.019
+FDM+14,"S. Facq et al.",2014,"Geochim. Cosmochim. Acta 132, 375-390","CO<sub>2</sub>, CO<sub>3</sub><sup>-2</sup>, and HCO<sub>3</sub><sup>-</sup>",https://doi.org/10.1016/j.gca.2014.01.030
+SHA14,"D. A. Sverjensky et al.",2014,"Geochim. Cosmochim. Acta 129, 125-145","SiO<sub>2</sub> and Si<sub>2</sub>O<sub>4</sub>",https://doi.org/10.1016/j.gca.2013.12.019
+SHA14.1,"D. A. Sverjensky et al.",2014,"Geochim. Cosmochim. Acta 129, 125-145","revisions for AlO<sub>2</sub><sup>-</sup> and HAlO<sub>2</sub>",https://doi.org/10.1016/j.gca.2013.12.019
+SHA14.2,"D. A. Sverjensky et al.",2014,"Geochim. Cosmochim. Acta 129, 125-145","revisions for BO(OH) and BO<sub>2</sub><sup>-</sup>",https://doi.org/10.1016/j.gca.2013.12.019
+SHA14.3,"D. A. Sverjensky et al.",2014,"Geochim. Cosmochim. Acta 129, 125-145","Fitted to @HP97 data with a1 pred. from the sum of the ions and used to predict the volume",https://doi.org/10.1016/j.gca.2013.12.019
 SLOP15.1,"E. L. Shock et al.",2015,"slop15.dat computer data file",""Enthalpy changed to be compatible with the equation ΔH=ΔG+TΔS for the formation reaction from elements."",http://geopig.asu.edu/?q=tools
 SLOP15.2,"E. L. Shock et al.",2015,"slop15.dat computer data file","Zn(Ac)3-: "Enthalpy changed to be compatible with the equation ΔH=ΔG+TΔS for the formation reaction from elements. See footnote h in table 2 of @SSH97."",http://geopig.asu.edu/?q=tools
 SLOP15.3,"E. L. Shock et al.",2015,"slop15.dat computer data file","formaldehyde: "Entropy corrected to be compatible with the equation ΔH=ΔG+TΔS for the formation reaction from elements. See footnote i in table 2 of @SS93."",http://geopig.asu.edu/?q=tools
@@ -127,8 +132,6 @@
 DEW17.5,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","BaCl+, CaCl+, CaCl2: with new V from the sum of a1 values of ions",http://www.dewcommunity.org
 DEW17.6,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","revised volume increased in order that a1 of the complex is the sum of the a1 values of the ions",http://www.dewcommunity.org
 DEW17.7,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","acetate: revised January 26th, 2016; new a1 value from complexes and organics correlation.",http://www.dewcommunity.org
-DEW17.8,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","BO(OH): Revised May, 2013",http://www.dewcommunity.org
-DEW17.9,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","BO2-: revised a1 - a4  using delkappan for BO2- instead of B(OH)4- used by Shock and Helgeson (1988); Shock et al. (1997)",http://www.dewcommunity.org
 DEW17.10,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","CaSO4: revised using exptl V and pred. a1 from new correlation",http://www.dewcommunity.org
 DEW17.11,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","diglycine: Jamie & Dimitri fit to exptl Cp(T) and pred. a1-a4; delGf and S from fitting logK dimerisation values from Lemke et al. (2009).",http://www.dewcommunity.org
 DEW17.12,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","diketopiperazine: Jamie & Dimitri fit delGf and S from to logK dimerisation values from Lemke et al. (2009);  pred. a1-a4;",http://www.dewcommunity.org
@@ -143,7 +146,6 @@
 DEW17.21,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","HSO3-: revised using published estimated V and pred. a1 from new correlation",http://www.dewcommunity.org
 DEW17.22,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","isobutane: G, H, S, Cp, V from Shock & Helgeson (1990); a1 estimated with Sverjensky et al. (2014); c2 estimated with a new hydrocarbon correlation.",http://www.dewcommunity.org
 DEW17.23,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","KCl: May, 2017 Fitted to logKs from Oelkers & Helgeson (1988) + retrieved logKs from Hemley experiments at 1.0 kb using the HCl referred to above",http://www.dewcommunity.org
-DEW17.24,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","KOH: Fitted to Ho & Palmer (1997) data with a1 pred. from the sum of the ions and used to predict the volume",http://www.dewcommunity.org
 DEW17.25,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","KSO4-: Revised G, S and Cp to fit Noyes et al. (1906) & Sharygin et al. (2006) with a1 of the complex equal to the sum of the a1 values of the ions",http://www.dewcommunity.org
 DEW17.26,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","Mg(HCO3)+: Fit to Stefansson et al. (2014) & Siebert & Hostetler (1977); plus revised V increased so that a1 of the complex is the sum of the a1 values of the ions",http://www.dewcommunity.org
 DEW17.27,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","MgCO3: Sverjensky et al. (1997) revised volume increased in order that a1 of the complex is the sum of the a1 values of the ions; and Cp revised using isocoulombic reln with CaCO3,aq; also omega is set to +0.3 as for all neutral metal complexes.",http://www.dewcommunity.org
@@ -156,8 +158,9 @@
 DEW17.34,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","propane: Shock & Helgeson (1990) with new a1-a4 based on revised correlation to predict a1 in Sverjensky et al. (2013)",http://www.dewcommunity.org
 DEW17.35,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","propanoate: Revised a1 from new delVn correlation for -1 ions; kept original regression c1 and c2 plus omega from Shock & Helgeson (1990)",http://www.dewcommunity.org
 DEW17.36,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","S3-: Regression of data from Pokrovski & Dubessy (2015), Guggenheim (1971); Feb. 2015",http://www.dewcommunity.org
-DEW17.37,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","SiO2, Si2O4: Fit to Raman speciation and quartz solubility data (Sverjensky et al., 2014).",http://www.dewcommunity.org
 DEW17.38,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","SO2: Shock et al. (1989) with revised a1 predicted as a complex from delVn",http://www.dewcommunity.org
 DEW17.39,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","toluene: Plyasunov & Shock (2001) with new a1 to a4 predicted with revised a1 consistent with Sverjensky et al. (2013)",http://www.dewcommunity.org
 DEW17.40,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","urea: Revised Feb. 2015 by Dimitri: c1, c2, and omega from PS01 based on Stokes (1967) data; V from Cabani et al. (1981) with a1-a4 predicted.",http://www.dewcommunity.org
 DEW17.101,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","methane: revised with new predicted a1 for complex species",http://www.dewcommunity.org
+DEW17.102,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","MgCl<sup>+</sup>: revised volume increased in order that a1 of the complex is the sum of the a1 values of the ions",http://www.dewcommunity.org
+DEW17.103,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","NaCl: revised with new predicted a1 for complex species",http://www.dewcommunity.org

Modified: pkg/CHNOSZ/demo/00Index
===================================================================
--- pkg/CHNOSZ/demo/00Index	2017-09-27 15:35:15 UTC (rev 223)
+++ pkg/CHNOSZ/demo/00Index	2017-09-28 06:21:10 UTC (rev 224)
@@ -19,3 +19,4 @@
 Shh             affinities of transcription factors relative to Sonic hedgehog
 activity_ratios mineral stability plots with activity ratios on the axes
 adenine         HKF parameters regressed from heat capacity and volume of aqueous adenine
+DEW             Deep Earth Water (DEW) model for high pressures

Added: pkg/CHNOSZ/demo/DEW.R
===================================================================
--- pkg/CHNOSZ/demo/DEW.R	                        (rev 0)
+++ pkg/CHNOSZ/demo/DEW.R	2017-09-28 06:21:10 UTC (rev 224)
@@ -0,0 +1,119 @@
+# demo for the Deep Earth Water (DEW) model in CHNOSZ 20170927
+
+# set up subplots
+par(mfrow = c(2, 2), mar=c(3.0, 3.5, 2.5, 1.0), mgp=c(1.7, 0.3, 0), las=1, tcl=0.3, xaxs="i", yaxs="i")
+
+# activate DEW model
+water("DEW")
+
+#### plot 1: quartz solubility at high pressure
+## after Figure 7D of Sverjensky et al., 2014 
+## (Geochim. Cosmochim. Acta, https://doi.org/10.1016/j.gca.2013.12.019)
+
+# load SiO2 and Si2O4 data taken from DEW spreadsheet
+iSi <- add.obigt("DEW_aq", c("SiO2", "Si2O4"))
+# print the data references to confirm we got the right ones
+thermo.refs(iSi)
+# set temperature ranges for different pressures
+# data.frame is used to make P and T the same length
+PT0.5 <- data.frame(P=500, T=seq(200, 550, 10))
+PT1.0 <- data.frame(P=1000, T=seq(200, 700, 10))
+PT2.0 <- data.frame(P=2000, T=seq(200, 700, 10))
+PT5.0 <- data.frame(P=5000, T=seq(200, 850, 10))
+PT10.0 <- data.frame(P=10000, T=seq(200, 825, 10))
+PT20.0 <- data.frame(P=20000, T=seq(200, 800, 10))
+PT <- rbind(PT0.5, PT1.0, PT2.0, PT5.0, PT10.0, PT20.0)
+# reaction 1: quartz = SiO2(aq) [equivalent to quartz + 3 H2O = Si(OH)4]
+SiO2_logK <- subcrt(c("quartz", "SiO2"), c(-1, 1), P=PT$P, T=PT$T)$out$logK
+# reaction 2: 2 quartz = Si2O4(aq) [equivalent to 2 quartz + 3 H2O = Si2O(OH)6]
+Si2O4_logK <- subcrt(c("quartz", "Si2O4"), c(-2, 1), P=PT$P, T=PT$T)$out$logK
+# plot the sum of molalities (== activities) for each pressure
+plot(c(200, 1000), c(-2.5, 0.5), type="n", xlab=axis.label("T"), ylab="log molality")
+for(P in unique(PT$P)) {
+  icond <- PT$P == P
+  SiO2_logm <- SiO2_logK[icond]
+  Si2O4_logm <- Si2O4_logK[icond]
+  logm <- log10(10^SiO2_logm + 10^Si2O4_logm)
+  lines(PT$T[icond], logm)
+  # add text label
+  lastT <- tail(PT$T[icond], 1)
+  Pkb <- paste(format(P/1000, nsmall=1), "kb")
+  text(lastT+25, tail(logm, 1), Pkb, adj=0)
+}
+t1 <- quote("Solubility of"~alpha*"-quartz")
+t2 <- "(Sverjensky et al., 2014)"
+mtitle(as.expression(c(t1, t2)))
+# TODO: lines are a little low at highest P and P ...
+# does the Berman, 1988 quartz data increase high-PT solubilities?
+
+#### plot 2: correlations between non-solvation volume and HKF a1 parameter
+## after Figures 12B and 12C of Sverjensky et al., 2014
+## (Geochim. Cosmochim. Acta, https://doi.org/10.1016/j.gca.2013.12.019)
+# load the fitted parameters for species as used by SHA14
+# TODO: also use their Ca+2??
+# NOTE: don't load NaCl, NH4+, or HS- here because the DEW spreadsheet lists a1 from the correlation
+add.obigt("DEW_aq", c("CO3-2", "BO2-", "MgCl+", "SiO2", "HCO3-", "Si2O4"))
+# set up the plot
+V0nlab <- expression(Delta * italic(V) * degree[n]~~(cm^3~mol^-1))
+a1lab <- expression(italic(a)[1]%*%10~~(cal~mol~bar^-1))
+plot(c(-25, 50), c(-4, 12), type="n", xlab=V0nlab, ylab=a1lab)
+# a function to get the HKF parameters, calculate nonsolvation volume, plot points, labels, error bars, and correlation lines
+plotfun <- function(species, col, pch, cex, dy, error, xlim, corrfun) {
+  # get HKF parameters
+  par <- info(info(species))
+  a1 <- par$a1 * 10
+  # get the nonsolvation volume
+  Vn <- unlist(hkf("V", parameters=par, contrib="n")$aq)
+  points(Vn, a1, col=col, pch=pch, cex=cex)
+  for(i in 1:length(species)) text(Vn[i], a1[i]+dy, expr.species(species[i]))
+  arrows(Vn, a1 - error, Vn, a1 + error, length = 0.03, angle = 90, code = 3, col=col)
+  lines(xlim, corrfun(xlim), col=col)
+}
+# monovalent ions: Na+, K+, Cl-, Br-
+monofun <- function(Vn) 2.0754 + 0.10871 * Vn
+# for easier reading, set y-offset to NA so the labels aren't plotted
+plotfun(c("Na+", "K+", "Cl-", "Br-"), "red", 19, 1, NA, 0.5, c(-7, 35), monofun)
+# divalent ions: Mg+2, Ca+2, CO3-2, SO4-2
+difun <- function(Vn) 3.5321 + 0.23911 * Vn
+plotfun(c("Mg+2", "Ca+2", "CO3-2", "SO4-2"), "black", 15, 1, 1.2, 0.7, c(-20, 25), difun)
+# complexes and neutral molecules: BO2-, MgCl+, SiO2, NaCl, HCO3-, Si2O4, NH4+, HS-
+compfun <- function(Vn) 1.5204 + 0.19421 * Vn
+plotfun(c("MgCl+", "SiO2", "NaCl", "HCO3-", "Si2O4"), "blue1", 18, 1.5, 1, 0.5, c(-20, 50), compfun)
+# for easier reading, put some labels below the points
+plotfun(c("BO2-", "NH4+", "HS-"), "blue1", 18, 1.5, -1.2, 0.5, c(-20, 50), compfun)
+# include an empty subscript for better spacing between the lines
+t1 <- quote("Correlations between non-solvation"[])
+t2 <- quote("volume and HKF "*italic(a)[1]*" parameter")
+mtitle(as.expression(c(t1, t2)))
+
+#### plots 3 and 4: aqueous inorganic and organic carbon species at high pressure
+## after Figure 1b of Sverjensky et al., 2014
+## (Nature Geoscience, https://doi.org/10.1038/NGEO2291)
+
+# define system with loga.species = 0
+basis("CHNOS+")
+species(c("CO2", "HCO3-", "CO3-2", "acetic acid", "acetate", "CH4"))
+species(1:6, 0)
+
+# a function to make the diagrams
+dfun <- function(T = 600, P = 50000, res=300) {
+  a <- affinity(pH = c(0, 10, res), O2 = c(-24, -12, res), T = T, P = P)
+  diagram(a, limit.water = FALSE, fill=tail(topo.colors(7), -1))
+  dp <- describe.property(c("     T", "     P"), c(T, P), digits=0)
+  legend("bottomleft", legend=dp, bty="n")
+}
+
+# first plot: CHNOSZ default database
+dfun()
+t1 <- quote("CHNOSZ default database"[])
+t2 <- quote("(not recommended for high"~italic(P)*")")
+mtitle(as.expression(c(t1, t2)))
+# second plot: use CO2, HCO3-, CO3-2, and methane data from DEW spreadsheet
+add.obigt("DEW_aq", c("CO2", "HCO3-", "CO3-2", "methane"))
+dfun()
+CO2quote <- quote(list(CO[2], HCO[3]^"-", CO[3]^"-2"))
+DEWexpr <- substitute("DEW data for"~x, list(x=CO2quote))
+mtitle(as.expression(c(DEWexpr, "and methane")))
+
+# reset the database (including the default water computational option)
+data(thermo)

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2017-09-27 15:35:15 UTC (rev 223)
+++ pkg/CHNOSZ/inst/NEWS	2017-09-28 06:21:10 UTC (rev 224)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.1.0-21 (2017-09-27)
+CHANGES IN CHNOSZ 1.1.0-23 (2017-09-28)
 ---------------------------------------
 
 MAJOR CHANGES:
@@ -11,6 +11,8 @@
 - The computational option for water (thermo$opt$par) can now be
   set using water("DEW"), water("IAPWS"), etc.
 
+- Add demo DEW.R.
+
 - water.lines() now works for diagrams of Eh, pe, logfO2, logaO2,
   logfH2, or logaH2 vs pH, T, or P. It is possible to have T or P on
   either the x- or y-axis.

Modified: pkg/CHNOSZ/inst/extdata/OBIGT/DEW_aq.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/OBIGT/DEW_aq.csv	2017-09-27 15:35:15 UTC (rev 223)
+++ pkg/CHNOSZ/inst/extdata/OBIGT/DEW_aq.csv	2017-09-28 06:21:10 UTC (rev 224)
@@ -5,7 +5,7 @@
 AgCl,AgCl(0),AgCl,aq,DEW17,NA,26.Sep.17,-17450,-18270,34.1,6.700093692683566,27,6.745843118168457,2.1395755891092776,3.044086894026221,-2.867450054853778,9.743184747784344,-1.6697909148003578,-0.038,0
 AgCl2-,AgCl2(-),AgCl2-,aq,DEW17,NA,26.Sep.17,-51560,-61130,47,7.699895914602958,53,12.253325472403718,7.383245132546093,-1.3526803252190707,-3.0842233537794557,19.12646661571935,-1.4661312021953776,0.9169,-1
 Al+3,Al(+3),Al+3,aq,DEW17,NA,26.Sep.17,-115609,-126834,-77.7,-31.041644667421664,-44.399906639446655,-3.3802,-17.0071,14.5185,-2.0758,10.7,-8.06,2.753,3
-AlO2-,AlO2(-),AlO2-,aq,DEW17,NA,26.Sep.17,-198693,-222125,-7.22,-9.545923627939738,10.000024777758352,4.298,2.4976,-1.8258,-2.8823,19.1,-6.2,1.7418,-1
+AlO2-,AlO2(-),AlO2-,aq,PH95,SHA14.1,26.Sep.17,-198693,-222125,-7.22,-9.545923627939738,10.000024777758352,4.298,2.4976,-1.8258,-2.8823,19.1,-6.2,1.7418,-1
 argon,Ar(0),Ar,aq,DEW17,NA,26.Sep.17,3900,-2870,14.3,53.345033192928895,31.709837012547897,6.0003,6.8698,3.0499,-3.063,35.6471,7.316,-0.3073,0
 Au+,Au(+),Au+,aq,DEW17,NA,26.Sep.17,39000,47580,24.5,0.6002074730847566,11.100324833471493,3.3303289051148655,0.42332752242294425,5.604414972054319,-2.7965003597769647,8.176673476970763,-2.9123377377326354,0.18,1
 Au+3,Au(+3),Au+3,aq,DEW17,NA,26.Sep.17,103600,96930,-57.9,-36.1998871338686,-41.300343488716095,-8.030924430948104,-2.3071217010082825,13.798337217155645,-2.6836235888803177,7.572434564298444,-10.408517009169033,2.4554,3
@@ -13,8 +13,8 @@
 BaCl+,BaCl(+),BaCl+,aq,DEW17,NA,26.Sep.17,-164730,-165770,22.5,6.179558063057579,16.8,4.88510260729963,0.3679660373185725,4.529564714108292,-2.79421171598275,11.74685523578722,-1.7758240225551714,0.2126,1
 Be+2,Be(+2),Be+2,aq,DEW17,NA,26.Sep.17,-83500,-91500,-55.7,-1.3003396389719626,-25.400190859694312,-1.4186786930078727,-9.479067548613203,9.978610117542088,-2.3871353475403305,22.915360910580247,-3.299479184458589,1.9007,2
 benzene,BENZENE,C6H6,aq,DEW17,NA,26.Sep.17,32000,12230,35.7,89.11776918942088,83,17.519916303739855,12.39756204974582,-5.557137540881264,-3.291515215136492,66.9,9.8,-0.25,0
-BO(OH),BO(OH)(0),BO(OH),aq,DEW17,NA,26.Sep.17,-174854,-188505,24,3.757736459774607,20.488458792536274,5.54,1.38,3.1,-2.84,25,-10,0.1,0
-BO2-,BO2(-),BO2-,aq,DEW17,NA,26.Sep.17,-162240,-184600,-8.9,-9.000033056281316,-16.018319311958425,-0.855,-2.596,3.7,-2.6717,17.102,-4.8679,1.7595,-1
+BO(OH),BO(OH)(0),BO(OH),aq,SH88,SHA14.2,26.Sep.17,-174854,-188505,24,3.757736459774607,20.488458792536274,5.54,1.38,3.1,-2.84,25,-10,0.1,0
+BO2-,BO2(-),BO2-,aq,SH88,SHA14.2,26.Sep.17,-162240,-184600,-8.9,-9.000033056281316,-16.018319311958425,-0.855,-2.596,3.7,-2.6717,17.102,-4.8679,1.7595,-1
 Ca(HCO3)+,Ca(HCO3)(+),Ca(HCO3)+,aq,DEW17,NA,26.Sep.17,-273830,-294350,16,90.94853456234937,37.50871386743425,9.14,4.42,1.13,-2.96,65.9,15.5,0.7,1
 CaOH+,Ca(OH)(+),Ca(OH)+,aq,DEW17,NA,26.Sep.17,-171300,-179600,6.7,1.4,1.9,2.1050517913542492,-2.278918120479812,6.7489519965723215,-2.6847895248993647,11.12918151021965,-2.74942,0.4496,1
 CaCl+,CaCl(+),CaCl+,aq,DEW17,NA,26.Sep.17,-163100,-168607,4.5,17.5,11.3,3.939211612006476,-0.5326160225795666,5.284694236745089,-2.756981653626561,20.72968360566745,0.5301499999999999,0.4675,1
@@ -78,7 +78,7 @@
 H2VO4-,H2VO4(-),H2VO4-,aq,DEW17,NA,26.Sep.17,-244000,-280600,29,0.599786690084759,29.000135951263612,7.723209666336199,3.070125497718614,2.2638296142428036,-2.9059189880756877,17.479547655197138,-2.912423451229735,1.1898,-1
 H3P2O7-,H3P2O7(-),H3P2O7-,aq,DEW17,NA,26.Sep.17,-483600,-544100,51,29.599573284247107,50.99985815720648,11.83605067253385,6.985958129413217,-1.0195589380803387,-3.0677995090699426,31.407335992060318,2.994833078001135,0.8568,-1
 H3PO4,H3PO4(0),H3PO4,aq,DEW17,NA,26.Sep.17,-273100,-307920,38,23.599923831730756,48.10014673157673,10.756405444030587,5.958028771080202,-0.1576499125439561,-3.0253049093964557,17.970790887008633,1.7727044845235547,-0.22,0
-HAlO2,HAlO2(0),HAlO2,aq,DEW17,NA,26.Sep.17,-207500,-230730,-6.5,47.50000000000001,13,4.284957392520296,-0.20343174155179186,5.0086763366992475,-2.7705901318042487,38.61094984058572,6.641149999999999,0.5,0
+HAlO2,HAlO2(0),HAlO2,aq,PH95,SHA14.1,26.Sep.17,-207500,-230730,-6.5,47.50000000000001,13,4.284957392520296,-0.20343174155179186,5.0086763366992475,-2.7705901318042487,38.61094984058572,6.641149999999999,0.5,0
 HAsO4-2,HAsO4(-2),HAsO4-2,aq,DEW17,NA,26.Sep.17,-170790,-216620,-0.4,-51.800257961551424,13.000048067928327,5.589483846667549,1.038606851810061,3.9672387466500956,-2.8219360072538278,5.471025496262261,-13.586312546768024,3.2197,-2
 HCl,HCl(0),HCl,aq,DEW17,NA,26.Sep.17,-30410,-42054,3.2,39,15,4.337619042991882,-0.1532926262675389,4.966635163689084,-2.7726628828301,27.180441429650536,4.9097,-0.2,0
 HCN,HCN(0),HCN,aq,DEW17,NA,26.Sep.17,28600,26500,29.8,40.7,45.9,10.381253422424983,5.600846831434169,0.14184375892657997,-3.0105390080114884,28.993924676337578,5.25599,-0.1113,0
@@ -103,7 +103,7 @@
 In+3,In(+3),In+3,aq,DEW17,NA,26.Sep.17,-23400,-25000,-63,-34.900243873903435,-42.199861621477424,-8.322321473975174,-2.0933868165474703,13.97775562787117,-2.6924593890039277,8.747761911704586,-10.143779677114129,2.5003,3
 isobutane,Isobutane,C4H10,aq,DEW17,NA,26.Sep.17,36,-36230,40.02,133.91756433691094,82.81179816697616,17.46,12.34,-5.51,-3.29,92.3,19.12,-0.3,0
 KCl,KCl(0),KCl,aq,DEW17,NA,26.Sep.17,-98850,,34,-1.5,34,8.17150547850406,3.4969475818433433,1.9059433415888574,-2.923563813033404,6.208795648135887,-3.3401500000000004,0.1,0
-KOH,KOH(0),KOH,aq,DEW17,NA,26.Sep.17,-102800,-180000,36.3,-6.5,20.3,5.6930972968194835,1.1372571348081169,3.884521419239946,-2.8260142099529677,6.779364765232841,-4.35865,0.48,0
+KOH,KOH(0),KOH,aq,HP97,SHA14.3,26.Sep.17,-102800,-180000,36.3,-6.5,20.3,5.6930972968194835,1.1372571348081169,3.884521419239946,-2.8260142099529677,6.779364765232841,-4.35865,0.48,0
 Kr,Kr(0),Kr,aq,DEW17,NA,26.Sep.17,3554,-3650,15.06,57.600252151490054,33.500341404615675,6.2721,7.5333,2.7891,-3.0904,37.8226,8.6985,-0.2281,0
 KSO4-,KSO4(-),KSO4-,aq,DEW17,NA,26.Sep.17,-246570,-276980,34,-22,50.7,11.894275401630633,7.041393847406007,-1.0660412622670492,-3.0700912216517646,3.403681964233403,-7.516,1.0996,-1
 La+3,La(+3),La+3,aq,DEW17,NA,26.Sep.17,-164000,-169600,-52,-37.19955810028799,-38.59992886912269,-7.305253016888569,-2.839389613644978,13.35152825005105,-2.6616196333719166,4.239298364676575,-10.612149985028662,2.1572,3
@@ -115,7 +115,7 @@
 methanol,METHANOL,CH3OH,aq,DEW17,NA,26.Sep.17,-42050,-58870,31.6,37.73273933386164,38.688451864443074,8.4,4.1,-0.24,-1.43,34.4,0.96,-0.15,0
 Mg(HCO3)+,Mg(HCO3)(+),Mg(HCO3)+,aq,DEW17,NA,26.Sep.17,-250280,-275750,-5,59,25.9,6.851384005230168,2.24006098324716,2.9598308433162064,-2.871604121047438,46.524558096962714,8.983699999999999,0.62742,1
 Mg(HSiO3)+,Mg(HSiO3)(+),Mg(HSiO3)+,aq,DEW17,NA,26.Sep.17,-353025,-385700,-23.78,37.82,2.5,2.4432858982043824,-1.9568856979378308,6.478930862090473,-2.6981023452472503,36.73194270763262,4.669333999999999,0.91182432,1
-MgCl+,MgCl(+),MgCl+,aq,DEW17,NA,26.Sep.17,-139700,-150933,-19,24.998133400778386,1.252948895419198,3.21,-4.92,6.27,-2.58,28.6,2.058,0.8449,1
+MgCl+,MgCl(+),MgCl+,aq,DEW17,DEW17.102,26.Sep.17,-139700,-150933,-19,24.998133400778386,1.252948895419198,3.21,-4.92,6.27,-2.58,28.6,2.058,0.8449,1
 MgCO3,MgCO3(0),MgCO3,aq,DEW17,NA,26.Sep.17,-238760,-270570,-24,-24.8,17.9,5.140655435512176,0.6112776806154065,4.325550207006634,-2.804270219316641,-5.603873484192299,-8.086359999999999,0.3,0
 MgOH+,MgOH(+),MgOH+,aq,DEW17,NA,26.Sep.17,-149225,-152955,-17,40,-7,0.5661903278807945,-3.74406688875123,7.977465353924591,-2.624220274819024,37.39299435773115,5.1133999999999995,0.8449,1
 MgSO4,MgSO4,MgSO4,aq,DEW17,NA,26.Sep.17,-289449,-327449,-1,20,35,8.34173273925203,3.659020820618297,1.7700464668030396,-2.9302639207243604,18.348479084618972,1.0393999999999997,0.05,0
@@ -128,7 +128,7 @@
 N2,N2(0),N2,aq,DEW17,NA,26.Sep.17,4347,-2495,22.9,56.00005492647911,33.300234717032126,7.821294304942734,3.163511803667383,2.185526081703083,-2.9097795779636098,35.79107726382313,8.372611188523795,-0.3468,0
 Na(Ac),NaCH3COO(0),NaCH3COO,aq,DEW17,NA,26.Sep.17,-150720,-173540,34.2,75.1,49,11.18058643551218,6.361891153721584,-0.49628469308735923,-3.0420005802948507,52.94368401021052,12.263269999999999,0.3,0
 Na(Ac)2-,Na(CH3COO)2(-1),Na(CH3COO)2-1,aq,DEW17,NA,26.Sep.17,-238470,-292400,44,170,103.2,22.02466635946482,16.68653097396497,-9.153397338368181,-3.4688211904637125,114.6668686976503,31.594399999999997,0.9627639999999998,-1
-NaCl,NaCl(0),NaCl,aq,DEW17,NA,26.Sep.17,-92910,-96120,28,8.5083603247707,24.00006579374395,6.16322589597147,1.5848661979540304,3.5092054616696684,-2.8445183686234197,10.802940449559435,-1.3014470018442086,-0.038,0
+NaCl,NaCl(0),NaCl,aq,DEW17,DEW17.103,26.Sep.17,-92910,-96120,28,8.5083603247707,24.00006579374395,6.16322589597147,1.5848661979540304,3.5092054616696684,-2.8445183686234197,10.802940449559435,-1.3014470018442086,-0.038,0
 NaCO3-,NaCO3(-),NaCO3-,aq,DEW17,NA,26.Sep.17,-190562,,8,-1,27.8,7.642732473792389,2.9935032270800592,2.3280766620433937,-2.90275142340749,19.47301907900619,-3.2383,1.507948,-1
 NaHCO3,NaHCO3(0),NaHCO3,aq,DEW17,NA,26.Sep.17,-203088,-150000,31,73.89683329827047,36.71855532414953,9.61,2.56,1.01,-2.88,55.5,12,0.65,0
 NaHSiO3,NaHSiO3(0),NaHSiO3,aq,DEW17,NA,26.Sep.17,-307140,-333044,19,2.3400874553111497,18.7,5.133900118168457,0.6048459483767572,4.3309431535368486,-2.8040043315058956,7.187952356808203,-2.557924185353119,-0.038,0
@@ -169,8 +169,8 @@
 Sc+3,Sc(+3),Sc+3,aq,DEW17,NA,26.Sep.17,-140200,-146800,-61,-35.40031466051333,-41.90004101879543,-8.211537761284175,-2.174644827219701,13.909544099512129,-2.6891001828427377,8.45468960809784,-10.245644096346567,2.5003,3
 SeO3-2,SeO3(-2),SeO3-2,aq,DEW17,NA,26.Sep.17,-88400,-121700,3,-68.10016115780746,16.400033062227077,9.322825411120137,-6.4175234365114475,2.1796559828123065,-2.5136995811346172,-4.578294253541053,-16.90660282784538,3.1658,-2
 SeO4-2,SeO4(-2),SeO4-2,aq,DEW17,NA,26.Sep.17,-105500,-143200,12.9,-60.199604228933985,20.700183756115845,10.2644207798358,-6.149149870842385,1.4960032072884974,-2.5247941443393755,-1.298682540907194,-15.297259381433854,3.0192,-2
-Si2O4,Si2O4(0),Si2O4,aq,DEW17,NA,26.Sep.17,-400751,-427304,18,48.999991704543376,40.000174025236504,10.0724,2.6931,0.6715,-2.8903,35.8049,6.9467,0.1,0
-SiO2,SiO2(0),SiO2,aq,DEW17,NA,26.Sep.17,-199557,-213937,5.3,27.69998778469038,18.000125661346434,4.8998,1.409,4.4066,-2.8372,25.7171,2.6079,0.36,0
+Si2O4,Si2O4(0),Si2O4,aq,SHA14,NA,26.Sep.17,-400751,-427304,18,48.999991704543376,40.000174025236504,10.0724,2.6931,0.6715,-2.8903,35.8049,6.9467,0.1,0
+SiO2,SiO2(0),SiO2,aq,SHA14,NA,26.Sep.17,-199557,-213937,5.3,27.69998778469038,18.000125661346434,4.8998,1.409,4.4066,-2.8372,25.7171,2.6079,0.36,0
 Sm+2,Sm(+2),Sm+2,aq,DEW17,NA,26.Sep.17,-123000,-120500,-6.2,3.700319865124996,-5.700076552874581,2.894669121202731,-8.249676908714969,6.8468697724224805,-2.437958356593723,19.653187916533685,-2.2808448434740383,1.2285,2
 Sm+3,Sm(+3),Sm+3,aq,DEW17,NA,26.Sep.17,-159100,-165200,-50.7,-43.299678160586396,-42.00020843618984,-8.435446302621303,-2.0104116362602666,14.047408623513505,-2.6958895829570007,1.9383870992998915,-11.85474444131145,2.2955,3
 Sn+2,Sn(+2),Sn+2,aq,DEW17,NA,26.Sep.17,-6630,-2100,-3.8,-11.200138799383817,-15.499903172603366,0.5854856451575402,-8.907840514697478,8.523470725489313,-2.4107498731224064,11.450338738309945,-5.3160682734344835,1.286,2

Modified: pkg/CHNOSZ/man/examples.Rd
===================================================================
--- pkg/CHNOSZ/man/examples.Rd	2017-09-27 15:35:15 UTC (rev 223)
+++ pkg/CHNOSZ/man/examples.Rd	2017-09-28 06:21:10 UTC (rev 224)
@@ -18,7 +18,7 @@
     "density", "ORP", "revisit", "findit", "ionize", "buffer",
     "protbuff", "yeastgfp", "mosaic", "copper", "solubility",
     "wjd", "dehydration", "bugstab", "Shh", "activity_ratios",
-    "adenine"),
+    "adenine", "DEW"),
     to.file=FALSE)
 }
 
@@ -55,6 +55,7 @@
     \code{Shh} \tab affinities of transcription factors relative to Sonic hedgehog \cr
     \code{activity_ratios} \tab mineral stability plots with activity ratios on the axes \cr
     \code{adenine} \tab HKF parameters regressed from heat capacity and volume of aqueous adenine (Lowe et al., 2017) \cr
+    \code{adenine} \tab Deep Earth Water (DEW) model for high pressures (Sverjensky et al., 2014a and 2014b) \cr
   }
 
 }
@@ -79,6 +80,10 @@
   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 \eqn{^{\circ}}{°}C and 5 kbar. \emph{J. Chem. Soc. Faraday Trans.} \bold{88}, 803--826. \url{https://doi.org/10.1039/FT9928800803}
 
   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{http://www.worldcat.org/oclc/31754493}
+
+  Sverjensky, D. A., Harrison, B. and Azzolini, D. (2014a) Water in the deep Earth: The dielectric constant and the solubilities of quartz and corundum to 60 kb and 1,200 \degC. \emph{Geochim. Cosmochim. Acta} \bold{129}, 125--145. \url{https://doi.org/10.1016/j.gca.2013.12.019}
+
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/chnosz -r 224


More information about the CHNOSZ-commits mailing list