[CHNOSZ-commits] r175 - in pkg/CHNOSZ: . R demo inst man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Feb 24 14:00:08 CET 2017


Author: jedick
Date: 2017-02-24 14:00:08 +0100 (Fri, 24 Feb 2017)
New Revision: 175

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/NAMESPACE
   pkg/CHNOSZ/R/affinity.R
   pkg/CHNOSZ/R/basis.R
   pkg/CHNOSZ/R/diagram.R
   pkg/CHNOSZ/R/examples.R
   pkg/CHNOSZ/demo/findit.R
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/man/basis.Rd
   pkg/CHNOSZ/man/diagram.Rd
   pkg/CHNOSZ/man/nonideal.Rd
   pkg/CHNOSZ/man/species.Rd
   pkg/CHNOSZ/man/swap.basis.Rd
   pkg/CHNOSZ/man/util.affinity.Rd
   pkg/CHNOSZ/man/util.args.Rd
   pkg/CHNOSZ/man/util.array.Rd
   pkg/CHNOSZ/man/util.character.Rd
   pkg/CHNOSZ/man/util.program.Rd
   pkg/CHNOSZ/man/util.units.Rd
   pkg/CHNOSZ/man/util.water.Rd
   pkg/CHNOSZ/man/water.Rd
   pkg/CHNOSZ/vignettes/anintro.Rmd
Log:
export explicitly in NAMESPACE


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2017-02-24 06:46:29 UTC (rev 174)
+++ pkg/CHNOSZ/DESCRIPTION	2017-02-24 13:00:08 UTC (rev 175)
@@ -1,6 +1,6 @@
 Date: 2017-02-24
 Package: CHNOSZ
-Version: 1.0.8-64
+Version: 1.0.8-65
 Title: Chemical Thermodynamics and Activity Diagrams
 Author: Jeffrey Dick
 Maintainer: Jeffrey Dick <j3ffdick at gmail.com>

Modified: pkg/CHNOSZ/NAMESPACE
===================================================================
--- pkg/CHNOSZ/NAMESPACE	2017-02-24 06:46:29 UTC (rev 174)
+++ pkg/CHNOSZ/NAMESPACE	2017-02-24 13:00:08 UTC (rev 175)
@@ -1,7 +1,54 @@
-# Export all names except those beginning with F_
-# (so we don't export F_h2o92 created below)
-exportPattern("^([^F]|F($|[^_])).*")
+## Export all names except those beginning with F_
+## (so we don't export F_h2o92 created below)
+#exportPattern("^([^F]|F($|[^_])).*")
 
+# exports starting with functions used in vignettes, examples, demos, tests 20170224
+export(
+# anintro vignette
+  "info", "makeup", "as.chemical.formula", "ZC",
+  "subcrt", "T.units", "P.units", "E.units", "convert",
+  "axis.label", "expr.species", "basis", "describe.reaction",
+  "species", "affinity", "swap.basis", "diagram", "mosaic",
+  "water.lines", "mod.buffer", "thermo.plot.new",
+  "describe.property", "describe.basis", "equilibrate",
+  "aminoacids", "ZC.col",
+  "pinfo", "protein.length", "protein.formula",
+  "read.fasta", "protein.basis", "yeastgfp", "more.aa", "add.protein",
+  "unitize", "revisit", "seq2aa", "findit",
+  "thermo.refs", "mod.obigt", "today",
+# examples
+  "examples", "demos", "mtitle",
+  "list2array", "slice", "dimSums", "slice.affinity",
+  "def2gi", "read.blast", "id.blast",
+  "add.obigt", "RH2obigt",
+  "expr.property", "expr.units",
+  "mass", "entropy", "get.formula", "GHS", "water",
+  "i2A", "invertible.combs",
+  "dPdTtr", "Ttr",
+  "count.aa", "nucleic.complement", "nucleic.formula",
+  "rho.IAPWS95", "IAPWS95", "water.AW90", "WP02.auxiliary", "water.IAPWS95",
+  "getrank", "parent", "sciname", "allparents", "getnodes", "getnames",
+  "protein.obigt", "hkf", "cgl", "which.pmax",
+  "equil.boltzmann", "equil.reaction", "find.TP",
+  "ionize.aa", "MP90.cp", "aasum", "read.expr",
+  "anim.carboxylase",
+  "qqr", "RMSD", "CVRMSD", "spearman", "DGmix", "DDGmix", "DGtr",
+  "ratlab", "transfer", "draw.transfer",
+  "EOSregress", "EOScoeffs", "EOSplot", "EOSvar",
+  "wjd", "element.potentials", "is.near.equil", "guess", "run.wjd",
+# demos
+  "protein.equil", "palply",
+  "label.plot",
+  "equil.potentials", "basis.logact",
+  "label.figure", "syslab",
+# equilibrium vignette
+  "usrfig",
+# hotspring vignette
+  "strip"
+# no other functions used in tests
+# co-documented with above
+)
+
 # Load shared objects
 useDynLib(CHNOSZ, .registration = TRUE, .fixes = "F_")
 

Modified: pkg/CHNOSZ/R/affinity.R
===================================================================
--- pkg/CHNOSZ/R/affinity.R	2017-02-24 06:46:29 UTC (rev 174)
+++ pkg/CHNOSZ/R/affinity.R	2017-02-24 13:00:08 UTC (rev 175)
@@ -154,7 +154,7 @@
       loga.protein <- rep(loga.protein,length.out=length(iprotein))
       protein.fun <- function(ip) {
         tpext <- as.numeric(thermo$protein[iprotein[ip],5:25])
-        return(Reduce("+", CHNOSZ::pprod(a[ires],tpext)) - loga.protein[ip])
+        return(Reduce("+", pprod(a[ires],tpext)) - loga.protein[ip])
       }
       # use another level of indexing to let the function
       # report on its progress

Modified: pkg/CHNOSZ/R/basis.R
===================================================================
--- pkg/CHNOSZ/R/basis.R	2017-02-24 06:46:29 UTC (rev 174)
+++ pkg/CHNOSZ/R/basis.R	2017-02-24 13:00:08 UTC (rev 175)
@@ -1,8 +1,92 @@
 # CHNOSZ/basis.R
-# set up the basis species of a chemical system
+# set up the basis species of a thermodynamic system
 
-## various functions to work with basis species
+basis <- function(species=NULL, state=NULL, logact=NULL, delete=FALSE) {
+  thermo <- get("thermo")
+  ## delete the basis species if requested
+  oldbasis <- thermo$basis
+  if(delete) {
+    thermo$basis <- NULL
+    assign("thermo", thermo, "CHNOSZ")
+  }
+  ## return the basis definition if requested
+  if(is.null(species)) return(oldbasis)
+  ## from now on we need something to work with
+  if(length(species)==0) stop("species argument is empty")
+  # is the species one of the preset keywords?
+  if(species[1] %in% preset.basis()) return(preset.basis(species[1]))
+  # the species names/formulas have to be unique
+  if(!length(unique(species))==length(species)) stop("species names are not unique")
+  ## processing 'state' and 'logact' arguments
+  # they should be same length as species
+  if(!is.null(state)) state <- rep(state, length.out=length(species))
+  if(!is.null(logact)) logact <- rep(logact, length.out=length(species))
+  # results should be identical for
+  # basis(c('H2O','CO2','H2'), rep('aq',3), c(0,-3,-3))
+  # basis(c('H2O','CO2','H2'), c(0,-3,-3), rep('aq',3))
+  # first of all, do we have a third argument?
+  if(!is.null(logact)) {
+    # does the 3rd argument look like states?
+    if(is.character(logact[1])) {
+      # swap the arguments into their correct places
+      tmp <- logact
+      logact <- state
+      state <- tmp
+    }
+  } else {
+    # if the second argument is numeric, treat it like logacts
+    if(is.numeric(state[1])) {
+      logact <- state
+      state <- NULL
+    }
+  }
+  ## processing 'species' argument
+  # pH transformation
+  if("pH" %in% species) {
+    logact[species=="pH"] <- -logact[species=="pH"]
+    if(!is.null(logact)) species[species=="pH"] <- "H+"
+  }
+  # Eh and pe transformations
+  if("pe" %in% species) {
+    logact[species=="pe"] <- -logact[species=="pe"]
+    if(!is.null(logact)) species[species=="pe"] <- "e-"
+  }
+  if("Eh" %in% species) {
+    # 20090209 should be careful with this conversion as it's only for 25 deg C
+    # to be sure, just don't call species("Eh")
+    if(!is.null(logact)) logact[species=="Eh"] <- -convert(logact[species=="Eh"],"pe")
+    species[species=="Eh"] <- "e-"
+  }
+  ## if all species are in the existing basis definition, 
+  ## *and* at least one of state or logact is not NULL
+  ## modify the states and/or logacts of the existing basis species
+  if(all(species %in% rownames(oldbasis)) | all(species %in% oldbasis$ispecies)) 
+    if(!is.null(state) | !is.null(logact))
+      return(mod.basis(species, state, logact))
+  ## we're on to making a new basis definition
+  # use default logacts if they aren't present
+  if(is.null(logact)) logact <- rep(0, length(species))
+  # if species argument is numeric, it's species indices
+  if(is.numeric(species[1])) {
+    ispecies <- species
+    ina <- ispecies > nrow(thermo$obigt)
+  } else {
+    # get species indices using states from the argument, or default states
+    if(!is.null(state)) ispecies <- suppressMessages(info(species, state, check.it=FALSE))
+    else ispecies <- suppressMessages(info(species, check.it=FALSE))
+    # check if we got all the species
+    ina <- is.na(ispecies)
+    # info() returns a list if any of the species had multiple approximate matches
+    # we don't accept any of those
+    if(is.list(ispecies)) ina <- ina | sapply(ispecies,length) > 1
+  }
+  if(any(ina)) stop(paste("species not available:", paste(species[ina], "(", state[ina], ")", sep="", collapse=" ")))
+  # load new basis species
+  return(put.basis(ispecies, logact))
+}
 
+## non-exported functions
+
 # to add the basis to thermo$obigt
 put.basis <- function(ispecies, logact = rep(NA, length(ispecies))) {
   thermo <- get("thermo")
@@ -128,91 +212,3 @@
   logact[is.na(logact)] <- -3
   return(logact)
 }
-
-## the actual basis() function
-## delete, retrieve, define or modify the basis species of a thermodynamic system
-basis <- function(species=NULL, state=NULL, logact=NULL, delete=FALSE) {
-  thermo <- get("thermo")
-  ## delete the basis species if requested
-  oldbasis <- thermo$basis
-  if(delete) {
-    thermo$basis <- NULL
-    assign("thermo", thermo, "CHNOSZ")
-  }
-  ## return the basis definition if requested
-  if(is.null(species)) return(oldbasis)
-  ## from now on we need something to work with
-  if(length(species)==0) stop("species argument is empty")
-  # is the species one of the preset keywords?
-  if(species[1] %in% preset.basis()) return(preset.basis(species[1]))
-  # the species names/formulas have to be unique
-  if(!length(unique(species))==length(species)) stop("species names are not unique")
-  ## processing 'state' and 'logact' arguments
-  # they should be same length as species
-  if(!is.null(state)) state <- rep(state, length.out=length(species))
-  if(!is.null(logact)) logact <- rep(logact, length.out=length(species))
-  # results should be identical for
-  # basis(c('H2O','CO2','H2'), rep('aq',3), c(0,-3,-3))
-  # basis(c('H2O','CO2','H2'), c(0,-3,-3), rep('aq',3))
-  # first of all, do we have a third argument?
-  if(!is.null(logact)) {
-    # does the 3rd argument look like states?
-    if(is.character(logact[1])) {
-      # swap the arguments into their correct places
-      tmp <- logact
-      logact <- state
-      state <- tmp
-    }
-  } else {
-    # if the second argument is numeric, treat it like logacts
-    if(is.numeric(state[1])) {
-      logact <- state
-      state <- NULL
-    }
-  }
-  ## processing 'species' argument
-  # pH transformation
-  if("pH" %in% species) {
-    logact[species=="pH"] <- -logact[species=="pH"]
-    if(!is.null(logact)) species[species=="pH"] <- "H+"
-  }
-  # Eh and pe transformations
-  if("pe" %in% species) {
-    logact[species=="pe"] <- -logact[species=="pe"]
-    if(!is.null(logact)) species[species=="pe"] <- "e-"
-  }
-  if("Eh" %in% species) {
-    # 20090209 should be careful with this conversion as it's only for 25 deg C
-    # to be sure, just don't call species("Eh")
-    if(!is.null(logact)) logact[species=="Eh"] <- -convert(logact[species=="Eh"],"pe")
-    species[species=="Eh"] <- "e-"
-  }
-  ## if all species are in the existing basis definition, 
-  ## *and* at least one of state or logact is not NULL
-  ## modify the states and/or logacts of the existing basis species
-  if(all(species %in% rownames(oldbasis)) | all(species %in% oldbasis$ispecies)) 
-    if(!is.null(state) | !is.null(logact))
-      return(mod.basis(species, state, logact))
-  ## we're on to making a new basis definition
-  # use default logacts if they aren't present
-  if(is.null(logact)) logact <- rep(0, length(species))
-  # if species argument is numeric, it's species indices
-  if(is.numeric(species[1])) {
-    ispecies <- species
-    ina <- ispecies > nrow(thermo$obigt)
-  } else {
-    # get species indices using states from the argument, or default states
-    if(!is.null(state)) ispecies <- suppressMessages(info(species, state, check.it=FALSE))
-    else ispecies <- suppressMessages(info(species, check.it=FALSE))
-    # check if we got all the species
-    ina <- is.na(ispecies)
-    # info() returns a list if any of the species had multiple approximate matches
-    # we don't accept any of those
-    if(is.list(ispecies)) ina <- ina | sapply(ispecies,length) > 1
-  }
-  if(any(ina)) stop(paste("species not available:", paste(species[ina], "(", state[ina], ")", sep="", collapse=" ")))
-  # load new basis species
-  return(put.basis(ispecies, logact))
-}
-
-

Modified: pkg/CHNOSZ/R/diagram.R
===================================================================
--- pkg/CHNOSZ/R/diagram.R	2017-02-24 06:46:29 UTC (rev 174)
+++ pkg/CHNOSZ/R/diagram.R	2017-02-24 13:00:08 UTC (rev 175)
@@ -565,7 +565,7 @@
   }
 }
 
-find.tp <- function(x) {
+find.TP <- function(x) {
   # find triple points in an matrix of integers  20120525 jmd
   # these are the locations closest to the greatest number of different values
   # rearrange the matrix in the same way that diagram() does for 2-D predominance diagrams

Modified: pkg/CHNOSZ/R/examples.R
===================================================================
--- pkg/CHNOSZ/R/examples.R	2017-02-24 06:46:29 UTC (rev 174)
+++ pkg/CHNOSZ/R/examples.R	2017-02-24 13:00:08 UTC (rev 175)
@@ -6,12 +6,11 @@
   # run all the examples in CHNOSZ documentation
   .ptime <- proc.time()
   topics <- c("thermo", "sideeffects", "examples",
-    "util.args", "util.array", "util.blast", "util.character", 
-    "util.data", "util.expression", "util.fasta", "util.formula", "util.matrix", 
-    "util.misc", "util.program",
-    "util.seq", "util.units", "taxonomy", "info", "protein.info", "hkf", "water", "subcrt",
+    "util.args", "util.array", "util.blast", "util.character", "util.data", "util.expression",
+    "util.fasta", "util.formula", "util.matrix", "util.misc", "util.program", "util.seq", "util.units",
+    "util.water", "taxonomy", "info", "protein.info", "hkf", "water", "IAPWS95", "subcrt",
     "makeup", "basis", "swap.basis", "species", "affinity", "util.affinity", "equil.boltzmann", 
-    "diagram", "buffer", "add.protein", "protein", "ionize.aa", "more.aa", "read.expr",
+    "diagram", "buffer", "nonideal", "add.protein", "protein", "ionize.aa", "more.aa", "read.expr",
     "anim", "objective", "revisit", "transfer", "EOSregress", "wjd")
   plot.it <- FALSE
   if(is.character(do.png))

Modified: pkg/CHNOSZ/demo/findit.R
===================================================================
--- pkg/CHNOSZ/demo/findit.R	2017-02-24 06:46:29 UTC (rev 174)
+++ pkg/CHNOSZ/demo/findit.R	2017-02-24 13:00:08 UTC (rev 175)
@@ -15,7 +15,7 @@
 f2 <- findit(vars[1:2], objective, T=325, P=350, res=16, niter=5)
 title("S.D. of equilibrium log activities of sulfur species")
 # optimize logfO2, pH and T (at constant P ...)
-f3 <- findit(vars, objective, P=350, res=10, niter=10)
+f3 <- findit(vars, objective, P=350, res=10, niter=5, rat=0.5)
 title("S.D. of equilibrium log activities of sulfur species")
 # the results
 print(f1.out <- sapply(f1$value, tail, 1))

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2017-02-24 06:46:29 UTC (rev 174)
+++ pkg/CHNOSZ/inst/NEWS	2017-02-24 13:00:08 UTC (rev 175)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.0.8-64 (2017-02-24)
+CHANGES IN CHNOSZ 1.0.8-65 (2017-02-24)
 ---------------------------------------
 
 DOCUMENTATION:

Modified: pkg/CHNOSZ/man/basis.Rd
===================================================================
--- pkg/CHNOSZ/man/basis.Rd	2017-02-24 06:46:29 UTC (rev 174)
+++ pkg/CHNOSZ/man/basis.Rd	2017-02-24 13:00:08 UTC (rev 175)
@@ -6,7 +6,9 @@
 \alias{preset.logact}
 \title{Define Basis Species}
 \description{
-  Define the basis species of a chemical system. Change their physical states or chemical activities or fugacities. Get the stoichiometries of the basis species in selected species of interest.
+Define the basis species of a chemical system.
+Change their physical states or chemical activities or fugacities.
+Get the reaction coefficients of basis species in formation reactions of species.
 }
 
 \usage{
@@ -27,21 +29,32 @@
 }
 
 \details{
-  \code{basis} is used to define the basis species in a system of interest, and in many workflows is followed by calls to \code{\link{species}}, \code{\link{affinity}} and \code{\link{diagram}} for making equilibrium chemical activity diagrams. The other functions documented here are supporting functions for \code{basis} and generally are not intended to be called by the user.
+\code{basis} is used to define the basis species in a thermodynamic system.
 
-  The basis species represent the possible range of chemical compositions for all the species of interest. Any valid set of basis species used here must meet two conditions: 1) the number of basis species is the same as the number of chemical elements (including charge) in those species and 2) the square matrix representing the elemental stoichiometries of the basis species has a real inverse. Basis species might, but do not always (and not if a charged basis species is present), correspond to the thermodynamic components of a system. 
+The basis species represent the possible range of chemical compositions for all the species of interest.
+Any valid set of basis species used here must meet two conditions: 1) the number of basis species is the same as the number of chemical elements (including charge) in those species and 2) the square matrix representing the elemental stoichiometries of the basis species has a real inverse.
 
-  To create a basis definition, call \code{basis} with the names or formulas of the basis species in the first argument. Alternatively, the first argument may consist of numeric values indicating the species indices (rownumbers in \code{\link{thermo}$obigt}), but a mixture of character and numeric values will generate an error. The special names \samp{pH}, \samp{pe} and \samp{Eh} can be included in the \code{species} argument; they get translated into the names of the proton (\samp{H+}) and electron (\samp{e-}) as appropriate.
+To create a basis definition, call \code{basis} with the names or formulas of the basis species in the first argument.
+Alternatively, the first argument may consist of numeric values indicating the species indices (rownumbers in \code{\link{thermo}$obigt}), but a mixture of character and numeric values will generate an error.
+The special names \samp{pH}, \samp{pe} and \samp{Eh} can be included in the \code{species} argument; they get translated into the names of the proton (\samp{H+}) and electron (\samp{e-}) as appropriate.
 
-   If the new basis definition meets all requirements, it is stored in \code{\link{thermo}$basis}, replacing any previous basis definition; \code{put.basis} does the actual storing of the basis definition.
 
-  The physical states or logarithms of activities of species in the basis definition can be changed directly using \code{mod.basis} but usually more conveniently by calling \code{basis} with the formulas of species that are in the basis set, or their species indices. If either of the second or third arguments to \code{basis} is of type character, it refers to the name of a state (if present in \code{thermo$obigt$state}) or to the name of a chemical activity \code{\link{buffer}} (if present in \code{thermo$buffers$name}). If either of these arguments is numeric it specifies the logarithms of activities (or fugacities for gases) of the basis species. In case \samp{pH}, \samp{pe} or \samp{Eh} are named, the logarithm of activity of the basis species is converted from these values. (For example, a value of 7 for pH is stored as a logarithm of activity of -7).
+The physical states or logarithms of activities of species in the basis definition can be changed by calling \code{basis} with the formulas of species that are in the basis set, or their species indices.
+If either of the second or third arguments to \code{basis} is of type character, it refers to the name of a state (if present in \code{thermo$obigt$state}) or to the name of a chemical activity \code{\link{buffer}} (if present in \code{thermo$buffers$name}).
+If either of these arguments is numeric it specifies the logarithms of activities (or fugacities for gases) of the basis species.
+In case \samp{pH}, \samp{pe} or \samp{Eh} is named, the logarithm of activity of the basis species is converted from these values.
+For example, a value of 7 for pH is stored as a logarithm of activity of -7.
 
-  Whenever \code{basis} is called with NULL values of both \code{state} and \code{logact}, the new set of species, if they are a valid basis set, completely replaces any existing basis definition. If this occurs, any existing species definition (created by the \code{species} function) is deleted. However, \code{\link{swap.basis}} can be used to change the species (the compositions and/or physical states thereof) in the basis set while maintaining the list of species of interest, with the added benefit of equivalence of the chemical potentials of the elements before and after the swap.
+Whenever \code{basis} is called with NULL values of both \code{state} and \code{logact}, the new set of species, if they are a valid basis set, completely replaces any existing basis definition.
+If this occurs, any existing species definition (created by the \code{species} function) is deleted.
+However, \code{\link{swap.basis}} can be used to change the species (the compositions and/or physical states thereof) in the basis set while maintaining the list of species of interest, with the added benefit of equivalence of the chemical potentials of the elements before and after the swap.
 
-  Call \code{basis} with \code{delete} set to TRUE to clear the basis definition. Any current basis definition (before being deleted) is returned by this call or by calling \code{basis} with all default arguments.
+Call \code{basis} with \code{delete} set to TRUE to clear the basis definition.
+Any current basis definition (before being deleted) is returned by this call or by calling \code{basis} with all default arguments.
 
-  If the value of \code{basis} is one of the keywords in the following table, the corresponding set of basis species is loaded (defined in \code{preset.basis}), and their activities set to reference values (defined in \code{preset.logact}). This approach is used by many of the examples in the package. The basis species identified by these keywords are aqueous except for \eqn{\mathrm{H_2O}}{H2O} (liq), \eqn{\mathrm{O_2}}{O2} (gas) and \eqn{\mathrm{Fe_2O_3}}{Fe2O3} (hematite, cr1).
+If the value of \code{basis} is one of the keywords in the following table, the corresponding set of basis species is loaded (defined in \code{preset.basis}), and their activities set to reference values (defined in \code{preset.logact}).
+This approach is used by many of the examples in the package.
+The basis species identified by these keywords are aqueous except for \eqn{\mathrm{H_2O}}{H2O} (liq), \eqn{\mathrm{O_2}}{O2} (gas) and \eqn{\mathrm{Fe_2O_3}}{Fe2O3} (hematite, cr1).
 
   \tabular{ll}{
     \code{CHNOS} \tab \eqn{\mathrm{CO_2}}{CO2}, \eqn{\mathrm{H_2O}}{H2O}, \eqn{\mathrm{NH_3}}{NH3}, 
@@ -65,16 +78,18 @@
 }
 
 \value{
-  \code{basis} returns the value of \code{thermo$basis} after any modifications; or, if \code{delete} is TRUE, its value before deletion.
+\code{basis} returns the value of \code{thermo$basis} after any modifications; or, if \code{delete} is TRUE, its value before deletion.
+}
 
-
+\section{Side Effects}{
+If the new basis definition meets all requirements, it is stored in \code{\link{thermo}$basis}, replacing any previous basis definition.
 }
 
 \seealso{
   \code{\link{info}} to query the thermodynamic database in order to find what species are available. 
   \code{\link{makeup}} is used by \code{basis} to generate the stoichiometric matrix from chemical formulas.
-  \code{\link{species}} is the usual next step after \code{basis}. 
   \code{\link{swap.basis}} is used to change the chemical compounds (species formulas) used in the basis definition while keeping the chemical potentials of the elements unaltered.
+  \code{\link{species}} for setting up the formation reactions from basis species. 
 }
 
 \examples{

Modified: pkg/CHNOSZ/man/diagram.Rd
===================================================================
--- pkg/CHNOSZ/man/diagram.Rd	2017-02-24 06:46:29 UTC (rev 174)
+++ pkg/CHNOSZ/man/diagram.Rd	2017-02-24 13:00:08 UTC (rev 175)
@@ -1,7 +1,7 @@
 \name{diagram}
 \alias{diagram}
 \alias{strip}
-\alias{find.tp}
+\alias{find.TP}
 \title{Equilibrium Chemical Activity Diagrams}
 \description{
 Plot equilibrium chemical activity (1-D speciation) or equal-activity (2-D predominance) diagrams as a function of chemical activities of basis speecies, temperature and/or pressure.
@@ -19,7 +19,7 @@
     add=FALSE, plot.it=TRUE, tplot=TRUE, ...)
   strip(affinity, ispecies = NULL, col = NULL, ns = NULL, 
     xticks = NULL, ymin = -0.2, xpad = 1, cex.names = 0.7)
-  find.tp(x)
+  find.TP(x)
 }
 
 \arguments{
@@ -128,7 +128,7 @@
 An inset dot-and-line plot is created below each strip if \code{ns} is given.
 This argument has the same format as \code{ispecies}, and can be used e.g. to display the relative numbers of species for comparison with the stability calculations.
 
-\code{find.tp} finds the locations in a matrix of integers that are surrounded by the greatest number of different values.
+\code{find.TP} finds the locations in a matrix of integers that are surrounded by the greatest number of different values.
 The function counts the unique values in a 3x3 grid around each point and returns a matrix of indices (similar to \code{\link{which}(..., arr.ind = TRUE)}) for the maximum count (ties result in more than one pair of indices).
 It can be used with the output from \code{diagram} for calculations in 2 dimensions to approximately locate the triple points on the diagram.
 
@@ -230,7 +230,7 @@
 btext <- substitute(Al2O3 - SiO2 - H2O, unlist(bexpr))
 mtitle(c(as.expression(btext), "after Helgeson et al., 1978"))
 # find the approximate position of the triple point
-tp <- find.tp(d$predominant)
+tp <- find.TP(d$predominant)
 Ttp <- a$vals[[1]][tp[1, 2]]
 Ptp <- rev(a$vals[[2]])[tp[1, 1]]
 points(Ttp, Ptp, pch=10, cex=5)

Modified: pkg/CHNOSZ/man/nonideal.Rd
===================================================================
--- pkg/CHNOSZ/man/nonideal.Rd	2017-02-24 06:46:29 UTC (rev 174)
+++ pkg/CHNOSZ/man/nonideal.Rd	2017-02-24 13:00:08 UTC (rev 175)
@@ -72,10 +72,7 @@
 # cf Eq. 5.1-33: basis composition
 species(c("ATP-4", "H+", "H2O", "HPO4-2", "ADP-3", "HATP-3", "HADP-2",
   "H2PO4-"))
-# cf Eq. 5.1-32: elemental composition
-species.basis() \%*\% basis.elements()
 
-
 ### A different example
 
 # speciation of phosphate as a function of ionic strength

Modified: pkg/CHNOSZ/man/species.Rd
===================================================================
--- pkg/CHNOSZ/man/species.Rd	2017-02-24 06:46:29 UTC (rev 174)
+++ pkg/CHNOSZ/man/species.Rd	2017-02-24 13:00:08 UTC (rev 175)
@@ -41,9 +41,9 @@
 \examples{\dontshow{data(thermo)}
 # set up the basis species
 basis("CHNOS")
-# show the formation reactions of some species
-ispecies <- info(c("glutamic acid","phenylalanine"))
-species.basis(ispecies)
+## show the formation reactions of some species
+#ispecies <- info(c("glutamic acid","phenylalanine"))
+#species.basis(ispecies)
 # add, modify, delete species
 species(c("CO2","NH3"))  # aqueous species
 species(c("CO2","NH3"),"gas")  # gases

Modified: pkg/CHNOSZ/man/swap.basis.Rd
===================================================================
--- pkg/CHNOSZ/man/swap.basis.Rd	2017-02-24 06:46:29 UTC (rev 174)
+++ pkg/CHNOSZ/man/swap.basis.Rd	2017-02-24 13:00:08 UTC (rev 175)
@@ -63,18 +63,18 @@
 ## demonstrating the interconvertibility between 
 ## chemical potentials of elements and logarithms 
 ## of activities of basis species at high temperature
-basis("CHNOS+")
-bl1 <- basis()$logact
-emu <- element.mu(T=100)
-bl2 <- basis.logact(emu, T=100)
-# note that basis.logact produces a named array
-stopifnot(all.equal(bl1, as.numeric(bl2)))
+#basis("CHNOS+")
+#bl1 <- basis()$logact
+#emu <- element.mu(T=100)
+#bl2 <- basis.logact(emu, T=100)
+## note that basis.logact produces a named array
+#stopifnot(all.equal(bl1, as.numeric(bl2)))
 
 ## swapping basis species while species are defined
 ## and using numeric species indices
 basis("MgCHNOPS+") 
-# load species whose names contain "ATP"
-species(info.approx("ATP "))
+# load some Mg-ATP species
+species(c("MgATP-2", "MgHATP-", "MgH2ATP", "Mg2ATP"))
 # swap in CO2(g) for CO2(aq)
 iCO2g <- info("CO2", "gas")
 swap.basis("CO2", iCO2g)

Modified: pkg/CHNOSZ/man/util.affinity.Rd
===================================================================
--- pkg/CHNOSZ/man/util.affinity.Rd	2017-02-24 06:46:29 UTC (rev 174)
+++ pkg/CHNOSZ/man/util.affinity.Rd	2017-02-24 13:00:08 UTC (rev 175)
@@ -60,8 +60,8 @@
 \examples{\dontshow{data(thermo)}
 basis("CHNOS")
 species("acetic acid")
-eargs <- energy.args(list(O2=c(-90, -60, 5), T=c(0, 100, 5)))
-ea <- do.call(energy, eargs)
+#eargs <- energy.args(list(O2=c(-90, -60, 5), T=c(0, 100, 5)))
+#ea <- do.call(energy, eargs)
 }
 
 \keyword{utilities}

Modified: pkg/CHNOSZ/man/util.args.Rd
===================================================================
--- pkg/CHNOSZ/man/util.args.Rd	2017-02-24 06:46:29 UTC (rev 174)
+++ pkg/CHNOSZ/man/util.args.Rd	2017-02-24 13:00:08 UTC (rev 175)
@@ -32,18 +32,18 @@
 }
 
 \examples{\dontshow{data(thermo)}
-## argument processing
-eos.args("hkf",c("g","H","S","cP","V","kT","e"))
-## produces an error because "Q" is not allowed in water.SUPCRT92
-\dontrun{
-  eos.args("hkf",c("G","H","S","Cp","V","kT","E","Q")) }
-  thermo$opt$water <<- "IAPWS"  # needed for p and n in next line
-  eos.args("water",c("p","u","cv","psat","rho","n","q","x","y","epsilon"))
-  TP.args(c(273.15,373.15))
-  TP.args(c(273.15,373.15),"Psat")
-  TP.args(c(273.15,373.15),c(100,100,200,200))
-  state.args(c("AQ","GAS"))
-  state.args(c("a","l","liq"))
+### argument processing
+#eos.args("hkf",c("g","H","S","cP","V","kT","e"))
+### produces an error because "Q" is not allowed in water.SUPCRT92
+#\dontrun{
+#  eos.args("hkf",c("G","H","S","Cp","V","kT","E","Q")) }
+#  thermo$opt$water <<- "IAPWS"  # needed for p and n in next line
+#  eos.args("water",c("p","u","cv","psat","rho","n","q","x","y","epsilon"))
+#  TP.args(c(273.15,373.15))
+#  TP.args(c(273.15,373.15),"Psat")
+#  TP.args(c(273.15,373.15),c(100,100,200,200))
+#  state.args(c("AQ","GAS"))
+#  state.args(c("a","l","liq"))
 }
 
 \keyword{utilities}

Modified: pkg/CHNOSZ/man/util.array.Rd
===================================================================
--- pkg/CHNOSZ/man/util.array.Rd	2017-02-24 06:46:29 UTC (rev 174)
+++ pkg/CHNOSZ/man/util.array.Rd	2017-02-24 13:00:08 UTC (rev 175)
@@ -30,7 +30,7 @@
 
   \code{slice} extracts or assigns values from/to the \code{i}th slice(s) in the \code{d}th dimension of an array. Values are assigned to an array if \code{value} is not NULL. This function works by building an expression containing the extraction operator (\code{\link{[}}).
 
-  \code{slice.affinity} performs a slice operation on the \samp{values} element of the \samp{affinity} variable (which should be the output of \code{\link{affinity}}). This function is used e.g. by \code{\link{anim.TCA}} to extract slices that are the basis for frames of an animated stability diagram.
+  \code{slice.affinity} performs a slice operation on the \samp{values} element of the \samp{affinity} variable (which should be the output of \code{\link{affinity}}). This function is used e.g. by \code{\link{anim.TCA}} to extract slices that are the used to make frames of an animated stability diagram.
 
   \code{dimSums} sums an array along the \code{d}th dimension using only the \code{i}th slices in that dimension. If \code{i} is NULL, all slices in that dimension are summed together. For matrices, \code{dimSums(x,1)} has the same result as \code{\link{colSums}(x)} and \code{dimSums(x,2)} has the same result as \code{\link{rowSums}(x)}.
 

Modified: pkg/CHNOSZ/man/util.character.Rd
===================================================================
--- pkg/CHNOSZ/man/util.character.Rd	2017-02-24 06:46:29 UTC (rev 174)
+++ pkg/CHNOSZ/man/util.character.Rd	2017-02-24 13:00:08 UTC (rev 175)
@@ -32,13 +32,13 @@
 }
 
 \examples{\dontshow{data(thermo)}
-## string to character
-s2c("hello world")
-s2c("hello world",sep=" ",keep.sep=FALSE)
-s2c("3.141592",sep=c(".","9"))
-# character to string
-c2s(aminoacids())
-c2s(aminoacids(),sep=".")
+### string to character
+#s2c("hello world")
+#s2c("hello world",sep=" ",keep.sep=FALSE)
+#s2c("3.141592",sep=c(".","9"))
+## character to string
+#c2s(aminoacids())
+#c2s(aminoacids(),sep=".")
 }
 
 \keyword{utilities}

Modified: pkg/CHNOSZ/man/util.program.Rd
===================================================================
--- pkg/CHNOSZ/man/util.program.Rd	2017-02-24 06:46:29 UTC (rev 174)
+++ pkg/CHNOSZ/man/util.program.Rd	2017-02-24 13:00:08 UTC (rev 175)
@@ -38,11 +38,11 @@
 
 
 \examples{
-caller.name()  # character(0)
-afun <- function() caller.name()
-afun()         # character(0)
-bfun <- function() afun()
-bfun()         # "bfun"
+#caller.name()  # character(0)
+#afun <- function() caller.name()
+#afun()         # character(0)
+#bfun <- function() afun()
+#bfun()         # "bfun"
 }
 
 \keyword{utilities}

Modified: pkg/CHNOSZ/man/util.units.Rd
===================================================================
--- pkg/CHNOSZ/man/util.units.Rd	2017-02-24 06:46:29 UTC (rev 174)
+++ pkg/CHNOSZ/man/util.units.Rd	2017-02-24 13:00:08 UTC (rev 175)
@@ -84,18 +84,18 @@
 # cm3bar to calories		
 convert(10, "calories")
 
-## examples showing unit settings
-T.units("C")  
-T1in <- envert(25, "C")         # no convertion
-T1out <- outvert(313.15, "K")   # K to C
-T.units("K") 
-T2in <- envert(298.15, "C")     # K to C
-T2out <- outvert(-233.15, "C")  # C to K
-# these are the same temperature (25 deg C)
-stopifnot(all.equal(T1in, T2in))
-# these are numerically equivalent (40 deg C / 40 K)
-stopifnot(all.equal(T1out, T2out))
-T.units("C")  # return to default
+### examples showing unit settings
+#T.units("C")  
+#T1in <- envert(25, "C")         # no convertion
+#T1out <- outvert(313.15, "K")   # K to C
[TRUNCATED]

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


More information about the CHNOSZ-commits mailing list