[CHNOSZ-commits] r232 - in pkg/CHNOSZ: . R data demo man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Oct 1 05:39:30 CEST 2017


Author: jedick
Date: 2017-10-01 05:39:25 +0200 (Sun, 01 Oct 2017)
New Revision: 232

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/EOSregress.R
   pkg/CHNOSZ/R/cgl.R
   pkg/CHNOSZ/R/hkf.R
   pkg/CHNOSZ/R/nonideal.R
   pkg/CHNOSZ/R/protein.info.R
   pkg/CHNOSZ/R/util.affinity.R
   pkg/CHNOSZ/R/util.data.R
   pkg/CHNOSZ/R/util.formula.R
   pkg/CHNOSZ/R/util.units.R
   pkg/CHNOSZ/R/water.R
   pkg/CHNOSZ/R/wjd.R
   pkg/CHNOSZ/data/opt.csv
   pkg/CHNOSZ/demo/wjd.R
   pkg/CHNOSZ/man/EOSregress.Rd
   pkg/CHNOSZ/man/data.Rd
   pkg/CHNOSZ/man/util.formula.Rd
   pkg/CHNOSZ/man/util.units.Rd
   pkg/CHNOSZ/man/water.Rd
   pkg/CHNOSZ/vignettes/dayhoff.pdf
   pkg/CHNOSZ/vignettes/wjd.Rnw
   pkg/CHNOSZ/vignettes/wjd.lyx
Log:
cleanup: remove thermo$opt$Tr, Pr, Theta, Psi, R


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/DESCRIPTION	2017-10-01 03:39:25 UTC (rev 232)
@@ -1,6 +1,6 @@
 Date: 2017-09-30
 Package: CHNOSZ
-Version: 1.1.0-30
+Version: 1.1.0-31
 Title: Thermodynamic Calculations for Geobiochemistry
 Author: Jeffrey Dick
 Maintainer: Jeffrey Dick <j3ffdick at gmail.com>

Modified: pkg/CHNOSZ/R/EOSregress.R
===================================================================
--- pkg/CHNOSZ/R/EOSregress.R	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/R/EOSregress.R	2017-10-01 03:39:25 UTC (rev 232)
@@ -19,17 +19,18 @@
 EOSvar <- function(var, T, P, ...) {
   # get the variables of a term in a regression equation
   # T (K), P (bar)
-  opt <- get("thermo")$opt
+  Theta <- 228 # K
+  Psi <- 2600  # bar
   out <- switch(EXPR = var,
     "(Intercept)" = rep(1, length(T)),
     "T" = T,
     "P" = P,
-    "TTheta" = T-opt$Theta,                 # T-Theta
-    "invTTheta" = (T-opt$Theta)^-1,         # 1/(T-Theta)
-    "TTheta2" = (T-opt$Theta)^2,            # (T-Theta)^2
-    "invTTheta2" = (T-opt$Theta)^-2,        # 1/(T-Theta)^2
-    "invPPsi" = (P+opt$Psi)^-1,             # 1/(P-Psi)
-    "invPPsiTTheta" = (P+opt$Psi)^-1 * (T-opt$Theta)^-1,  # 1/[(P-Psi)(T-Theta)]
+    "TTheta" = T - Theta,                 # T-Theta
+    "invTTheta" = (T - Theta)^-1,         # 1/(T-Theta)
+    "TTheta2" = (T - Theta)^2,            # (T-Theta)^2
+    "invTTheta2" = (T - Theta)^-2,        # 1/(T-Theta)^2
+    "invPPsi" = (P + Psi)^-1,             # 1/(P+Psi)
+    "invPPsiTTheta" = (P + Psi)^-1 * (T - Theta)^-1,  # 1/[(P+Psi)(T-Theta)]
     "TXBorn" = T*water("XBorn", T=T, P=P)[, 1],
     "drho.dT" = -water("rho", T=T, P=P)[, 1]*water("E", T=T, P=P)[, 1],
     "V.kT" = water("V", T=T, P=P)[, 1]*water("kT", T=T, P=P)[, 1],

Modified: pkg/CHNOSZ/R/cgl.R
===================================================================
--- pkg/CHNOSZ/R/cgl.R	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/R/cgl.R	2017-10-01 03:39:25 UTC (rev 232)
@@ -4,14 +4,10 @@
 
 cgl <- function(property = NULL, parameters = NULL, T = 298.15, P = 1) {
   # calculate properties of crystalline, liquid (except H2O) and gas species
-  # argument handling
-  thermo <- get("thermo")
-  Tr <- thermo$opt$Tr
-  Pr <- thermo$opt$Pr
-
+  Tr <- 298.15
+  Pr <- 1
   # the number of T, P conditions
   ncond <- max(c(length(T), length(P)))
-
   # initialize output list
   out <- list()
   # loop over each species
@@ -27,7 +23,7 @@
     for(i in 1:length(property)) {
       PROP <- property[i]
       # a test for availability of the EoS parameters
-      # here we assume that the parameters are in the same position as in thermo$obigt
+      # here we assume that the parameters are in the same columns as in thermo$obigt
       # leave T transition (in 20th column) alone
       hasEOS <- any(!is.na(PAR[, 13:19]))
       # if at least one of the EoS parameters is available, zero out any NA's in the rest
@@ -110,10 +106,10 @@
   # the corrections are 0 for anything other than quartz and coesite
   if(!PAR$name %in% c("quartz", "coesite")) return(list(G=0, H=0, S=0, V=0))
   ncond <- max(c(length(T), length(P)))
-  # get Tr, Pr and TtPr (transition temperature at Pr)
-  Pr <- get("thermo")$opt$Pr # 1 bar
-  Tr <- get("thermo")$opt$Tr # 298.15 K
-  TtPr <- 848                # Kelvin
+  # Tr, Pr and TtPr (transition temperature at Pr)
+  Pr <- 1      # bar
+  Tr <- 298.15 # K
+  TtPr <- 848  # K
   # constants from SUP92D.f
   aa <- 549.824
   ba <- 0.65995

Modified: pkg/CHNOSZ/R/hkf.R
===================================================================
--- pkg/CHNOSZ/R/hkf.R	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/R/hkf.R	2017-10-01 03:39:25 UTC (rev 232)
@@ -10,12 +10,11 @@
   # calculate G, H, S, Cp, V, kT, and/or E using
   # the revised HKF equations of state
   # H2O.props - H2O properties needed for subcrt() output
-  thermo <- get("thermo")
   # constants
-  Tr <- thermo$opt$Tr
-  Pr <- thermo$opt$Pr
-  Theta <- thermo$opt$Theta
-  Psi <- thermo$opt$Psi
+  Tr <- 298.15 # K
+  Pr <- 1      # bar
+  Theta <- 228 # K
+  Psi <- 2600  # bar
   # make T and P equal length
   if(!identical(P, "Psat")) {
     if(length(P) < length(T)) P <- rep(P, length.out = length(T))
@@ -28,6 +27,7 @@
   # rho - for subcrt() output and g function
   # Born functions and epsilon - for HKF calculations
   H2O.props <- c(H2O.props, "QBorn", "XBorn", "YBorn", "epsilon")
+  thermo <- get("thermo")
   if(grepl("SUPCRT", thermo$opt$water)) {
     # using H2O92D.f from SUPCRT92: alpha, daldT, beta - for partial derivatives of omega (g function)
     H2O.props <- c(H2O.props, "alpha", "daldT", "beta")
@@ -40,7 +40,7 @@
     # using DEW model: get beta to calculate dgdP
     H2O.props <- c(H2O.props, "beta")
   }
-  H2O <- water(H2O.props, T = c(thermo$opt$Tr, T), P = c(thermo$opt$Pr, P))
+  H2O <- water(H2O.props, T = c(Tr, T), P = c(Pr, P))
   H2O.PrTr <- H2O[1, ]
   H2O.PT <- H2O[-1, ]
   ZBorn <- -1 / H2O.PT$epsilon

Modified: pkg/CHNOSZ/R/nonideal.R
===================================================================
--- pkg/CHNOSZ/R/nonideal.R	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/R/nonideal.R	2017-10-01 03:39:25 UTC (rev 232)
@@ -26,11 +26,12 @@
     # Alberty, 2003 Eq. 3.6-1
     loggamma <- function(a,Z,I,B) { - a * Z^2 * I^(1/2) / (1 + B * I^(1/2)) }
     # TODO: check the following equations 20080208 jmd
+    R <- 1.9872  # gas constant, cal K^-1 mol^-1
     if(prop=='log') return(loggamma(eval(A),Z,I,B))
-    else if(prop=='G') return(thermo$opt$R * T * loggamma(eval(A),Z,I,B))
-    else if(prop=='H') return(thermo$opt$R * T^2 * loggamma(eval(DD(A,'T',1)),Z,I,B))
-    else if(prop=='S') return(- thermo$opt$R * T * loggamma(eval(DD(A,'T',1)),Z,I,B))
-    else if(prop=='Cp') return(thermo$opt$R * T^2 *loggamma(eval(DD(A,'T',2)),Z,I,B))
+    else if(prop=='G') return(R * T * loggamma(eval(A),Z,I,B))
+    else if(prop=='H') return(R * T^2 * loggamma(eval(DD(A,'T',1)),Z,I,B))
+    else if(prop=='S') return(- R * T * loggamma(eval(DD(A,'T',1)),Z,I,B))
+    else if(prop=='Cp') return(R * T^2 *loggamma(eval(DD(A,'T',2)),Z,I,B))
   }
   if(!is.numeric(species[[1]])) species <- info(species,'aq')
   proptable <- as.list(proptable)
@@ -50,7 +51,7 @@
     if(species[i] == info("e-") & thermo$opt$ideal.e) next
     didit <- FALSE
     for(j in 1:ncol(myprops)) {
-      #if(colnames(myprops)[j]=='G') myprops[,j] <- myprops[,j] + thermo$opt$R * T * mlg(Z,IS,convert(T,'C'))
+      #if(colnames(myprops)[j]=='G') myprops[,j] <- myprops[,j] + R * T * mlg(Z,IS,convert(T,'C'))
       cname <- colnames(myprops)[j]
       if(cname %in% c('G','H','S','Cp')) {
         myprops[,j] <- myprops[,j] + loggamma2(Z,IS,T,cname)

Modified: pkg/CHNOSZ/R/protein.info.R
===================================================================
--- pkg/CHNOSZ/R/protein.info.R	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/R/protein.info.R	2017-10-01 03:39:25 UTC (rev 232)
@@ -191,7 +191,8 @@
     G0protform <- G0protform + G0ionization
   }
   # standard Gibbs energy of formation reaction of non/ionized residue equivalents, dimensionless
-  G0res.RT <- G0protform/thermo$opt$R/TK/plength
+  R <- 1.9872  # gas constant, cal K^-1 mol^-1
+  G0res.RT <- G0protform/R/TK/plength
   message("protein.equil [1]: per residue, reaction to form ", iword, " protein from basis species has G0/RT of ", signif(G0res.RT[1], digits))
   # coefficients of basis species in formation reactions of residues
   resbasis <- suppressMessages(protein.basis(aa, T=T, normalize=TRUE))

Modified: pkg/CHNOSZ/R/util.affinity.R
===================================================================
--- pkg/CHNOSZ/R/util.affinity.R	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/R/util.affinity.R	2017-10-01 03:39:25 UTC (rev 232)
@@ -17,7 +17,7 @@
 
 ### unexported functions ###
 
-energy <- function(what,vars,vals,lims,T=get("thermo")$opt$Tr,P="Psat",IS=0,sout=NULL,exceed.Ttr=FALSE,transect=FALSE) {
+energy <- function(what,vars,vals,lims,T=298.15,P="Psat",IS=0,sout=NULL,exceed.Ttr=FALSE,transect=FALSE) {
   # 20090329 extracted from affinity() and made to
   # deal with >2 dimensions (variables)
 
@@ -235,7 +235,7 @@
   transect <- any(sapply(args,length) > 3)
   ## convert T, P args and take care of 
   # single values for T, P or IS
-  T <- thermo$opt$Tr
+  T <- 298.15
   P <- "Psat"
   IS <- 0
   T.is.var <- P.is.var <- IS.is.var <- FALSE
@@ -371,7 +371,7 @@
   return(args)
 }
 
-A.ionization <- function(iprotein, vars, vals, T=get("thermo")$opt$Tr, P="Psat", pH=7, transect=FALSE) {
+A.ionization <- function(iprotein, vars, vals, T=298.15, P="Psat", pH=7, transect=FALSE) {
   # a function to build a list of values of A/2.303RT of protein ionization
   # that can be used by energy(); 20120527 jmd
   # some of the variables might not affect the values (e.g. logfO2)

Modified: pkg/CHNOSZ/R/util.data.R
===================================================================
--- pkg/CHNOSZ/R/util.data.R	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/R/util.data.R	2017-10-01 03:39:25 UTC (rev 232)
@@ -156,6 +156,7 @@
   # 20110808 jmd
   thermo <- get("thermo")
   # get calculated value based on EOS
+  Theta <- 228  # K
   if(identical(state, "aq")) {
     if(prop=="Cp") {
       # value of X consistent with IAPWS95
@@ -163,7 +164,7 @@
       # we use the value of X consistent with SUPCRT
       X <- -3.055586E-7
       refval <- eos$Cp
-      calcval <- eos$c1 + eos$c2/(298.15-thermo$opt$Theta)^2 + eos$omega*298.15*X
+      calcval <- eos$c1 + eos$c2/(298.15-Theta)^2 + eos$omega*298.15*X
       tol <- thermo$opt$Cp.tol
       units <- "cal K-1 mol-1"
     } else if(prop=="V") {
@@ -173,7 +174,7 @@
       Q <- 0.00002775729
       refval <- eos$V
       calcval <- 41.84*eos$a1 + 41.84*eos$a2/2601 + 
-        (41.84*eos$a3 + 41.84*eos$a4/2601) / (298.15-thermo$opt$Theta) - Q * eos$omega
+        (41.84*eos$a3 + 41.84*eos$a4/2601) / (298.15-Theta) - Q * eos$omega
       tol <- thermo$opt$V.tol
       units <- "cm3 mol-1"
     }
@@ -181,7 +182,7 @@
     # all other states
     if(prop=="Cp") {
       refval <- eos$Cp
-      Tr <- thermo$opt$Tr
+      Tr <- 298.15
       calcval <- eos$a + eos$b*Tr + eos$c*Tr^-2 + eos$d*Tr^-0.5 + eos$e*Tr^2 + eos$f*Tr^eos$lambda
       tol <- thermo$opt$Cp.tol
       units <- "cal K-1 mol-1"
@@ -222,7 +223,8 @@
   refval <- ghs[,8]
   DH <- ghs[,9]
   S <- ghs[,10]
-  calcval <- DH - thermo$opt$Tr * (S - Se)
+  Tr <- 298.15
+  calcval <- DH - Tr * (S - Se)
   # now on to the comparison
   # calculate the difference
   diff <- calcval - refval

Modified: pkg/CHNOSZ/R/util.formula.R
===================================================================
--- pkg/CHNOSZ/R/util.formula.R	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/R/util.formula.R	2017-10-01 03:39:25 UTC (rev 232)
@@ -80,7 +80,7 @@
   return(entropy)
 }
 
-GHS <- function(formula, G=NA, H=NA, S=NA, T=get("thermo")$opt$Tr) {
+GHS <- function(formula, G=NA, H=NA, S=NA, T=298.15) {
   # for all NA in G, H and S, do nothing
   # for no  NA in G, H and S, do nothing
   # for one NA in G, H and S, calculate its value from the other two:

Modified: pkg/CHNOSZ/R/util.units.R
===================================================================
--- pkg/CHNOSZ/R/util.units.R	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/R/util.units.R	2017-10-01 03:39:25 UTC (rev 232)
@@ -40,8 +40,8 @@
   message("changed energy units to ", get("thermo")$opt$E.units)
 }
 
-convert <- function(value, units, T=get("thermo")$opt$Tr,
-  P=get("thermo")$opt$Pr, pH=7, logaH2O=0) {
+convert <- function(value, units, T=298.15,
+  P=1, pH=7, logaH2O=0) {
   # converts value(s) to the specified units
 
   if(is.null(value)) return(NULL)
@@ -65,7 +65,7 @@
     if(units=='cal') value <- value / Jcal
   }
   else if(units %in% c('g','logk')) {
-    R <- get("thermo")$opt$R
+    R <- 1.9872  # gas constant, cal K^-1 mol^-1
     if(units=='logk') value <- value / (-log(10) * R * T)
     if(units=='g') value <- value * (-log(10) * R * T)
   }

Modified: pkg/CHNOSZ/R/water.R
===================================================================
--- pkg/CHNOSZ/R/water.R	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/R/water.R	2017-10-01 03:39:25 UTC (rev 232)
@@ -2,7 +2,7 @@
 # calculate thermodynamic and electrostatic properties of H2O
 # 20061016 jmd
 
-water <- function(property = NULL, T = get("thermo")$opt$Tr, P = "Psat") {
+water <- function(property = NULL, T = 298.15, 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)) return(get("thermo")$opt$water)
@@ -156,15 +156,16 @@
     return(convert(P, "bar"))
   }
   ## thermodynamic properties
+  Tr <- 298.15
   # convert to SUPCRT reference state
   # at the triple point
   # I2S = SUPCRT - IAPWS ( + entropy in G )
   dH <- -68316.76 - 451.75437
   dS <- 16.7123 - 1.581072
-  dG <- -56687.71 + 19.64228 - dS * (T - get("thermo")$opt$Tr)
+  dG <- -56687.71 + 19.64228 - dS * (T - Tr)
   # does the reference state used for GHS also go here?
   dU <- -67434.5 - 451.3229
-  dA <- -55814.06 + 20.07376 - dS * (T - get("thermo")$opt$Tr)
+  dA <- -55814.06 + 20.07376 - dS * (T - Tr)
   # calculate pressure from the given T and estimated rho
   pressure <- function() return(convert(IAPWS95("p", T=T, rho=my.rho), "bar"))
   # convert IAPWS95() (specific, joule) to (molar, cal) 
@@ -344,7 +345,7 @@
   ilow <- T < 373.15 | P < 1000
   if(any(ilow)) {
     out[ilow, ] <- water.SUPCRT92(property, T=T[ilow], P=P[ilow])
-    iPrTr <- T==get("thermo")$opt$Tr & P==get("thermo")$opt$Pr
+    iPrTr <- T == 298.15 & P == 1
     if(sum(iPrTr)==sum(ilow)) message(paste("water.DEW: using SUPCRT calculations for Pr,Tr"))
     if(sum(iPrTr)==0) message(paste("water.DEW: using SUPCRT calculations for", sum(ilow), "low-T or low-P condition(s)"))
     if(sum(iPrTr)==1 & sum(ilow) > sum(iPrTr)) message(paste("water.DEW: using SUPCRT calculations for Pr,Tr and", sum(ilow)-1, "other low-T or low-P condition(s)"))

Modified: pkg/CHNOSZ/R/wjd.R
===================================================================
--- pkg/CHNOSZ/R/wjd.R	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/R/wjd.R	2017-10-01 03:39:25 UTC (rev 232)
@@ -359,7 +359,8 @@
   ## assemble the standard molal Gibbs energies of the species
   s <- subcrt(ispecies, P=P, T=T, property="G", exceed.Ttr=TRUE)
   G0 <- sapply(1:length(s$out), function(i) s$out[[i]]$G)
-  G0.RT <- G0/get("thermo")$opt$R/convert(T, "K")
+  R <- 1.9872  # gas constant, cal K^-1 mol^-1
+  G0.RT <- G0/R/convert(T, "K")
   ## if Y is provided use that as initial guess
   if(!missing(Y)) {
     # giving both Y and B is not allowed
@@ -416,6 +417,7 @@
 
 equil.potentials <- function(w, tol=0.01, T=25) {
   ## return the average of the element.potentials, only if w is.near.equil  20120613
+  R <- 1.9872  # gas constant, cal K^-1 mol^-1
   if(!is.near.equil(w, tol=tol)) return(NULL)
-  else return(colMeans(element.potentials(w)) * get("thermo")$opt$R * convert(T, "K"))
+  else return(colMeans(element.potentials(w)) * R * convert(T, "K"))
 }

Modified: pkg/CHNOSZ/data/opt.csv
===================================================================
--- pkg/CHNOSZ/data/opt.csv	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/data/opt.csv	2017-10-01 03:39:25 UTC (rev 232)
@@ -1,2 +1,2 @@
-Tr,Pr,Theta,Psi,R,cutoff,E.units,T.units,P.units,state,water,G.tol,Cp.tol,V.tol,varP,IAPWS.sat,paramin,ideal.H,ideal.e
-298.15,1,228,2600,1.9872,1e-10,cal,C,bar,aq,SUPCRT92,100,1,1,FALSE,liquid,1000,TRUE,TRUE
+cutoff,E.units,T.units,P.units,state,water,G.tol,Cp.tol,V.tol,varP,IAPWS.sat,paramin,ideal.H,ideal.e
+1E-10,cal,C,bar,aq,SUPCRT92,100,1,1,FALSE,liquid,1000,TRUE,TRUE

Modified: pkg/CHNOSZ/demo/wjd.R
===================================================================
--- pkg/CHNOSZ/demo/wjd.R	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/demo/wjd.R	2017-10-01 03:39:25 UTC (rev 232)
@@ -7,7 +7,9 @@
 # turn formulas into a stoichiometric matrix
 A <- i2A(dlen$formula)
 # assemble Gibbs energies/RT at 500 K
-G0.RT <- 1000 * dlen$G500 / thermo$opt$R / thermo$opt$Tr
+T <- 500  # K
+R <- 1.9872  # gas constant, cal K^-1 mol^-1
+G0.RT <- 1000 * dlen$G500 / R / T
 # a function to minimize Gibbs energy for system with 
 # given mole fraction of carbon (xC)
 min.atmos <- function(xC) {

Modified: pkg/CHNOSZ/man/EOSregress.Rd
===================================================================
--- pkg/CHNOSZ/man/EOSregress.Rd	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/man/EOSregress.Rd	2017-10-01 03:39:25 UTC (rev 232)
@@ -149,7 +149,8 @@
 title("Cp from EOS parameters in database")
 
 # continuing from above, with user-defined variables
-invTTTheta3 <- function(T, P) (2*T)/(T-T*thermo$opt$Theta)^3
+Theta <- 228  # K 
+invTTTheta3 <- function(T, P) (2*T)/(T-T*Theta)^3
 invTX <- function(T, P) 1/T*water("XBorn", T=T, P=P)[,1]
 # print the calculated values of invTTTheta3
 EOSvar("invTTTheta3", d$T, d$P)

Modified: pkg/CHNOSZ/man/data.Rd
===================================================================
--- pkg/CHNOSZ/man/data.Rd	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/man/data.Rd	2017-10-01 03:39:25 UTC (rev 232)
@@ -44,20 +44,14 @@
   \itemize{
      
     \item \code{thermo$opt} 
-    List of operational parameters. Square brackets indicate default values.
+    List of computational settings. Square brackets indicate default values.
     \tabular{lll}{
-      \code{Tr} \tab numeric \tab Reference temperature (K) [298.15]\cr 
-      \code{Pr} \tab numeric \tab Reference pressure (bar) [1]\cr 
-      \code{Theta} \tab numeric \tab \eqn{\Theta}{Theta} in the revised HKF equations of state (K) [228]\cr 
-      \code{Psi} \tab numeric \tab \eqn{\Psi}{Psi} in the revised HKF equations of state (bar) [2600]\cr
-      \code{R} \tab numeric \tab Value of the gas constant (cal K\ifelse{latex}{\eqn{^{-1}}}{\ifelse{html}{\out{<sup>-1</sup>}}{^-1}} mol\ifelse{latex}{\eqn{^{-1}}}{\ifelse{html}{\out{<sup>-1</sup>}}{^-1}}) [1.9872]\cr
       \code{cutoff} \tab numeric \tab Cutoff below which values are taken to be zero [1e-10] (see \code{\link{makeup}})\cr
-      \code{E.units} \tab character \tab The user's units of energy ([\samp{cal}] or \samp{J})\cr
+      \code{E.units} \tab character \tab The user's units of energy ([\samp{cal}] or \samp{J}) (see \code{\link{subcrt}})\cr
       \code{T.units} \tab character \tab The user's units of temperature ([\samp{C}] or \samp{K})\cr
       \code{P.units} \tab character \tab The user's units of pressure ([\samp{bar}] or \samp{MPa})\cr
-      \code{state} \tab character \tab The default physical state for searching species [\samp{aq}]\cr
-      \code{water} \tab character \tab Computational option for properties of water ([\samp{SUPCRT}] or \samp{IAPWS})\cr
-      \code{online} \tab logical \tab Allow online searches of protein composition? Default [\code{NA}] is to ask the user.\cr
+      \code{state} \tab character \tab The default physical state for searching species [\samp{aq}] (see \code{\link{info}})\cr
+      \code{water} \tab character \tab Computational option for properties of water ([\samp{SUPCRT}] or \samp{IAPWS}; see \code{\link{water}})\cr
       \code{G.tol} \tab numeric \tab Difference in G above which \code{\link{checkGHS}} produces a message (cal mol\ifelse{latex}{\eqn{^{-1}}}{\ifelse{html}{\out{<sup>-1</sup>}}{^-1}}) [100]\cr
       \code{Cp.tol} \tab numeric \tab Difference in Cp above which \code{\link{checkEOS}} produces a message (cal K\ifelse{latex}{\eqn{^{-1}}}{\ifelse{html}{\out{<sup>-1</sup>}}{^-1}} mol\ifelse{latex}{\eqn{^{-1}}}{\ifelse{html}{\out{<sup>-1</sup>}}{^-1}}) [1]\cr
       \code{V.tol} \tab numeric \tab Difference in V above which \code{\link{checkEOS}} produces a message (cm\ifelse{latex}{\eqn{^{3}}}{\ifelse{html}{\out{<sup>3</sup>}}{^3}} mol\ifelse{latex}{\eqn{^{-1}}}{\ifelse{html}{\out{<sup>-1</sup>}}{^-1}}) [1]\cr

Modified: pkg/CHNOSZ/man/util.formula.Rd
===================================================================
--- pkg/CHNOSZ/man/util.formula.Rd	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/man/util.formula.Rd	2017-10-01 03:39:25 UTC (rev 232)
@@ -17,7 +17,7 @@
   as.chemical.formula(makeup, drop.zero = TRUE)
   mass(formula)
   entropy(formula)
-  GHS(formula, G = NA, H = NA, S = NA, T = get("thermo")$opt$Tr)
+  GHS(formula, G = NA, H = NA, S = NA, T = 298.15)
   ZC(formula)
   i2A(formula)
 }

Modified: pkg/CHNOSZ/man/util.units.Rd
===================================================================
--- pkg/CHNOSZ/man/util.units.Rd	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/man/util.units.Rd	2017-10-01 03:39:25 UTC (rev 232)
@@ -14,8 +14,7 @@
   P.units(units = NULL)
   T.units(units = NULL)
   E.units(units = NULL)
-  convert(value, units, T = get("thermo")$opt$Tr,
-    P = get("thermo")$opt$Pr, pH = 7, logaH2O = 0)
+  convert(value, units, T = 298.15, P = 1, pH = 7, logaH2O = 0)
 }
 
 \arguments{

Modified: pkg/CHNOSZ/man/water.Rd
===================================================================
--- pkg/CHNOSZ/man/water.Rd	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/man/water.Rd	2017-10-01 03:39:25 UTC (rev 232)
@@ -10,7 +10,7 @@
 }
 
 \usage{
-  water(property = NULL, T = get("thermo")$opt$Tr, P = "Psat")
+  water(property = NULL, T = 298.15, P = "Psat")
   water.SUPCRT92(property=NULL, T = 298.15, P = 1)
   water.IAPWS95(property=NULL, T = 298.15, P = 1)
   water.DEW(property=NULL, T = 373.15, P = 1000)

Modified: pkg/CHNOSZ/vignettes/dayhoff.pdf
===================================================================
(Binary files differ)

Modified: pkg/CHNOSZ/vignettes/wjd.Rnw
===================================================================
--- pkg/CHNOSZ/vignettes/wjd.Rnw	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/vignettes/wjd.Rnw	2017-10-01 03:39:25 UTC (rev 232)
@@ -1,4 +1,4 @@
-%% LyX 2.2.2 created this file.  For more info, see http://www.lyx.org/.
+%% LyX 2.2.3 created this file.  For more info, see http://www.lyx.org/.
 %% Do not edit unless you really know what you are doing.
 \documentclass[english,noae,round]{article}
 \usepackage{mathpazo}
@@ -17,7 +17,6 @@
 \hypersetup{pdftitle={Winding journey down (in Gibbs energy)},
  pdfauthor={Jeffrey M. Dick},
  citecolor=blue}
-\usepackage{breakurl}
 
 \makeatletter
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
@@ -69,7 +68,6 @@
 data(thermo)
 @
 
-
 \section{Is it winding?}
 
 The ``winding'' in the title refers to the observation that the
@@ -158,7 +156,6 @@
 identical(diff(w$F.Y), sort(diff(w$F.Y)))
 @
 
-
 \section{Is it near the bottom? Testing for equilibrium}
 
 
@@ -215,7 +212,6 @@
 w3 <- wjd(imax=3)
 ep3 <- element.potentials(w3, plot.it=TRUE)
 @
-
 \end{center}
 \setkeys{Gin}{width=1.0\textwidth}
 
@@ -251,7 +247,6 @@
 is.near.equil(w, tol=0.00001)
 @
 
-
 \subsection{Different initial solutions yield similar results}
 
 \paragraph{Different guesses for an underdetermined system}
@@ -409,7 +404,9 @@
 # turn formulas into a stoichiometric matrix
 A <- i2A(dlen$formula)
 # assemble Gibbs energies/RT at 500 K
-G0.RT <- 1000 * dlen$G500 / thermo$opt$R / thermo$opt$Tr
+T <- 500  # K
+R <- 1.9872  # gas constant, cal K^-1 mol^-1
+G0.RT <- 1000 * dlen$G500 / R / T
 # a function to minimize Gibbs energy for system with 
 # given mole fraction of carbon (xC)
 min.atmos <- function(xC) {
@@ -452,7 +449,6 @@
 # text(35, log10(Xs[, 27]) + 0.5, dlen$formula, adj=0)
 # text(7, log10(Xs[, 1]), dlen$formula, adj=1)
 @
-
 \begin{center}
 \includegraphics[width=0.7\columnwidth]{dayhoff}
 \par\end{center}
@@ -536,7 +532,6 @@
 basis.logact(ep)
 @
 
-
 \subsection{Bulk composition instead of moles of species}
 
 \texttt{run.wjd()} can be given B (bulk chemical composition), instead
@@ -562,7 +557,6 @@
 basis.logact(ep)
 @
 
-
 \section{Document History}
 \begin{itemize}
 \item 2012-01-01 Initial version

Modified: pkg/CHNOSZ/vignettes/wjd.lyx
===================================================================
--- pkg/CHNOSZ/vignettes/wjd.lyx	2017-09-30 02:19:19 UTC (rev 231)
+++ pkg/CHNOSZ/vignettes/wjd.lyx	2017-10-01 03:39:25 UTC (rev 232)
@@ -2092,11 +2092,21 @@
 
 \begin_layout Plain Layout
 
-G0.RT <- 1000 * dlen$G500 / thermo$opt$R / thermo$opt$Tr
+T <- 500  # K
 \end_layout
 
 \begin_layout Plain Layout
 
+R <- 1.9872  # gas constant, cal K^-1 mol^-1
+\end_layout
+
+\begin_layout Plain Layout
+
+G0.RT <- 1000 * dlen$G500 / R / T
+\end_layout
+
+\begin_layout Plain Layout
+
 # a function to minimize Gibbs energy for system with 
 \end_layout
 



More information about the CHNOSZ-commits mailing list