[CHNOSZ-commits] r20 - in pkg/CHNOSZ: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Sep 23 13:08:04 CEST 2012


Author: jedick
Date: 2012-09-23 13:08:03 +0200 (Sun, 23 Sep 2012)
New Revision: 20

Modified:
   pkg/CHNOSZ/R/diagram.R
   pkg/CHNOSZ/R/info.R
   pkg/CHNOSZ/R/util.expression.R
   pkg/CHNOSZ/man/diagram.Rd
Log:
diagram() stops if formation reactions have no shared basis species and balance vector is not provided
expr.species() accepts cr1, cr2, cr3, cr4 as states
info.character() reports other available states


Modified: pkg/CHNOSZ/R/diagram.R
===================================================================
--- pkg/CHNOSZ/R/diagram.R	2012-09-23 10:28:46 UTC (rev 19)
+++ pkg/CHNOSZ/R/diagram.R	2012-09-23 11:08:03 UTC (rev 20)
@@ -114,6 +114,7 @@
     residue <- TRUE
   if(is.null(balance)) {
     ib <- which.balance(affinity$species)
+    if(length(ib)==0) stop("a shared basis species is not present in all formation reactions")
     if(!is.null(ib)) {
       balance <- rownames(basis())[ib[1]]
       nbalance <- affinity$species[,ib[1]]

Modified: pkg/CHNOSZ/R/info.R
===================================================================
--- pkg/CHNOSZ/R/info.R	2012-09-23 10:28:46 UTC (rev 19)
+++ pkg/CHNOSZ/R/info.R	2012-09-23 11:08:03 UTC (rev 20)
@@ -86,7 +86,8 @@
   if(length(ispecies) > length(ispecies.out)) {
     ispecies.other <- ispecies[!ispecies %in% ispecies.out]
     othertext <- paste(thermo$obigt$state[ispecies.other], collapse=", ")
-    msgout("info.character: ", species, " also available in ", othertext, "\n")
+    msgout("info.character: found ", species, "(", thermo$obigt$state[ispecies.out], 
+      "), also available in ", othertext, "\n")
   }
   return(ispecies.out)
 }

Modified: pkg/CHNOSZ/R/util.expression.R
===================================================================
--- pkg/CHNOSZ/R/util.expression.R	2012-09-23 10:28:46 UTC (rev 19)
+++ pkg/CHNOSZ/R/util.expression.R	2012-09-23 11:08:03 UTC (rev 20)
@@ -41,7 +41,7 @@
   }
   # write logarithm of activity or fugacity
   if(log != "") {
-    if(log %in% c("aq", "cr", "liq")) acity <- "a"
+    if(log %in% c("aq", "cr", "liq", "cr1", "cr2", "cr3", "cr4")) acity <- "a"
     else if(log %in% c("g", "gas")) acity <- "f"
     else stop(paste("'",log,"' is not a recognized state", sep=""))
     logacity <- substitute(log*italic(a), list(a=acity))

Modified: pkg/CHNOSZ/man/diagram.Rd
===================================================================
--- pkg/CHNOSZ/man/diagram.Rd	2012-09-23 10:28:46 UTC (rev 19)
+++ pkg/CHNOSZ/man/diagram.Rd	2012-09-23 11:08:03 UTC (rev 20)
@@ -71,7 +71,12 @@
 
   The \code{diagram} function takes as its primary input the results from \code{\link{affinity}} and displays diagrams representing either the thermodynamic properties of species, or the chemical activities of the species. The chemical activities are obtained by switching from an equal-activity reference state (values calculated using \code{\link{affinity}}) to an equal-affinity reference state (calculated using either a reaction matrix or the Maxwell-Boltzmann distribution). The activity diagrams that can be produced include chemical speciation diagrams as a function of one of temperature, pressure, or the chemical activities of the basis species, or equal-activity (predominance) diagrams as a function of two of these variables.
 
-  To generate the stability relations from affinities of formation reactions, a reaction conservation rule is either automatically determined or specified by the user. For example, 3Fe2O3 = 2Fe3O4 + 1/2O2 is balanced on Fe (or a basis species containing Fe) and 4Fe2O3 + Fe = 3Fe3O4 is balanced on O (or a basis species containing O). The default action, if \code{balance} is \code{NULL}, is to balance on a basis species that appears in the formation reactions of all of the species of interest. The first such basis species (in order of their appearance in \code{thermo$basis}) will be used; this basis species is determined using \code{\link{which.balance}}. If a common basis species is not available, or if \code{balance} is \eqn{1}, the balance is set to unity. For proteins, an additional conservation rule is available; if \code{balance} is \code{PBB}, or if it is missing and all the species appear to be proteins (their names contain underscores) the metastability calculations will be balanced on protein length (number of protein backbone groups). 
+To generate the stability relations from affinities of formation reactions, a reaction conservation rule is automatically determined or can be specified by the user in \code{balance}.
+For example, 3Fe2O3 = 2Fe3O4 + 1/2O2 is balanced on Fe (or a basis species containing Fe) and 4Fe2O3 + Fe = 3Fe3O4 is balanced on O (or a basis species containing O).
+The default action, if \code{balance} is \code{NULL}, is to balance on a basis species that appears in the formation reactions of all of the species of interest.
+The first such basis species (in order of their appearance in \code{thermo$basis}) will be used; this basis species is determined using \code{\link{which.balance}}.
+An error is generated if a shared basis species is not available, unless \code{balance} is specified.
+For proteins, an additional conservation rule is available; if \code{balance} is \code{PBB}, or if it is missing and all the species appear to be proteins (their names contain underscores) the metastability calculations will be balanced on protein length (number of protein backbone groups). 
 
   Predominance (2-D) diagrams are usually produced using the maximum affinity method, which is based on the notion that the predominant species at any point in the diagram is that one that has the greatest affinity of formation divided by the balanced quantity. This behavior can be altered by specifiying \code{mam} as \code{FALSE}, in which case the relative abundances of all species are calculated in the manner described below and the most abundant one at each grid point identified as the predominant species. However, this procedure can be very slow unless the reactions are cast in terms of residues (i.e., to use \code{\link{equil.boltzmann}} instead of \code{\link{equil.reaction}}).
 



More information about the CHNOSZ-commits mailing list