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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat May 21 13:06:50 CEST 2016


Author: jedick
Date: 2016-05-21 13:06:50 +0200 (Sat, 21 May 2016)
New Revision: 110

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/subcrt.R
   pkg/CHNOSZ/R/util.misc.R
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/man/subcrt.Rd
Log:
subcrt(): don't use caller.name() for flow control


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2016-05-03 12:40:02 UTC (rev 109)
+++ pkg/CHNOSZ/DESCRIPTION	2016-05-21 11:06:50 UTC (rev 110)
@@ -1,6 +1,6 @@
-Date: 2016-05-03
+Date: 2016-05-21
 Package: CHNOSZ
-Version: 1.0.7-7
+Version: 1.0.7-8
 Title: Chemical Thermodynamics and Activity Diagrams
 Author: Jeffrey Dick
 Maintainer: Jeffrey Dick <j3ffdick at gmail.com>

Modified: pkg/CHNOSZ/R/subcrt.R
===================================================================
--- pkg/CHNOSZ/R/subcrt.R	2016-05-03 12:40:02 UTC (rev 109)
+++ pkg/CHNOSZ/R/subcrt.R	2016-05-21 11:06:50 UTC (rev 110)
@@ -3,7 +3,7 @@
 # 20060817 jmd
 
 subcrt <- function(species, coeff=1, state=NULL, property=c('logK','G','H','S','V','Cp'),
-  T=seq(273.15,623.15,25), P='Psat', grid=NULL, convert=TRUE, exceed.Ttr=FALSE,
+  T=seq(273.15,623.15,25), P='Psat', grid=NULL, convert=TRUE, check.Ttr=TRUE, exceed.Ttr=FALSE,
   logact=NULL, action.unbalanced='warn', IS=0) {
 
   # revise the call if the states have 
@@ -312,8 +312,8 @@
       for(i in 1:length(iscgl)) {
         # not if we're not cgl
         if(!iscgl[i]) next
-        # not if dPdTtr is calling us
-        if(identical(caller.name(3),"dPdTtr")) next
+        # not if check.Ttr is FALSE (e.g. subcrt is called by dPdTtr)
+        if(!check.Ttr) next
         # name and state
         myname <- reaction$name[i]
         mystate <- reaction$state[i]

Modified: pkg/CHNOSZ/R/util.misc.R
===================================================================
--- pkg/CHNOSZ/R/util.misc.R	2016-05-03 12:40:02 UTC (rev 109)
+++ pkg/CHNOSZ/R/util.misc.R	2016-05-21 11:06:50 UTC (rev 110)
@@ -6,8 +6,8 @@
   # calculate dP/dT for a phase transition
   # (argument is index of the lower-T phase)
   thermo <- get("thermo")
-  t1 <- subcrt(x,P=0,T=thermo$obigt$z.T[x],convert=FALSE,exceed.Ttr=TRUE)
-  t2 <- subcrt(x+1,P=0,T=thermo$obigt$z.T[x],convert=FALSE,exceed.Ttr=TRUE)
+  t1 <- subcrt(x, P=0, T=thermo$obigt$z.T[x], convert=FALSE, check.Ttr=FALSE)
+  t2 <- subcrt(x+1, P=0, T=thermo$obigt$z.T[x], convert=FALSE, check.Ttr=FALSE)
   # if these aren't the same mineral all we can say is zero
   # actually, should be infinity ... the volume change is zero
   if(as.character(t1$species$name) != as.character(t2$species$name)) return(Inf)

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2016-05-03 12:40:02 UTC (rev 109)
+++ pkg/CHNOSZ/inst/NEWS	2016-05-21 11:06:50 UTC (rev 110)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.0.7-7 (2016-05-03)
+CHANGES IN CHNOSZ 1.0.7-8 (2016-05-21)
 --------------------------------------
 
 - Add gypsum to OBIGT.csv.
@@ -20,8 +20,15 @@
 - Use given/family naming scheme in inst/CITATION.
 
 - makeup() now works even if 'thermo' object is not available (useful
-  for other packages importing this function).
+  for other packages importing this function). Thanks to Nir Shahaf for
+  the suggestion.
 
+- So that byte-compiled package code works, subcrt() no longer uses
+  caller.name() for flow control. In its place, a new argument
+  'check.Ttr' has been added, used to bypass the checks of transition
+  temperature in calls from dPdTtr(). Thanks to Tomas Kalibera for the
+  suggestion.
+
 CHANGES IN CHNOSZ 1.0.7 (2015-11-19)
 ------------------------------------
 

Modified: pkg/CHNOSZ/man/subcrt.Rd
===================================================================
--- pkg/CHNOSZ/man/subcrt.Rd	2016-05-03 12:40:02 UTC (rev 109)
+++ pkg/CHNOSZ/man/subcrt.Rd	2016-05-21 11:06:50 UTC (rev 110)
@@ -10,8 +10,8 @@
   subcrt(species, coeff = 1, state = NULL,
     property = c("logK","G","H","S","V","Cp"),
     T = seq(273.15,623.15,25), P = "Psat", grid = NULL, 
-    convert = TRUE, exceed.Ttr = FALSE, logact = NULL,
-    action.unbalanced = "warn", IS = 0)
+    convert = TRUE, check.Ttr = TRUE, exceed.Ttr = FALSE,
+    logact = NULL, action.unbalanced = "warn", IS = 0)
 }
 
 \arguments{
@@ -22,7 +22,8 @@
   \item{T}{numeric, temperature(s) of the calculation}
   \item{P}{numeric, pressure(s) of the calculation, or character, \samp{Psat}}
   \item{grid}{character, type of \code{P}\eqn{\times}{x}\code{T} grid to produce (NULL, the default, means no gridding)}
-  \item{exceed.Ttr}{logical, calculate Gibbs energies of phases of minerals and of other species beyond their transition temperatures?}
+  \item{check.Ttr}{logical, check if temperatures are beyond transition temperatures?}
+  \item{exceed.Ttr}{logical, calculate Gibbs energies of mineral phases and other species beyond their transition temperatures?}
   \item{logact}{numeric, logarithms of activities of species in reaction}
   \item{convert}{logical, are input and output units of T and P those of the user (\code{TRUE}) (see \code{\link{T.units}}), or are they Kelvin and bar (\code{FALSE})?}
   \item{action.unbalanced}{character \samp{warn} or NULL, what action to take if unbalanced reaction is provided}



More information about the CHNOSZ-commits mailing list