[CHNOSZ-commits] r33 - in pkg/CHNOSZ: . R inst inst/doc inst/tests man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Dec 18 14:25:21 CET 2012


Author: jedick
Date: 2012-12-18 14:25:21 +0100 (Tue, 18 Dec 2012)
New Revision: 33

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/species.R
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/inst/TODO
   pkg/CHNOSZ/inst/doc/anintro.pdf
   pkg/CHNOSZ/inst/doc/equilibrium.pdf
   pkg/CHNOSZ/inst/doc/hotspring.pdf
   pkg/CHNOSZ/inst/doc/wjd.pdf
   pkg/CHNOSZ/inst/tests/test-affinity.R
   pkg/CHNOSZ/inst/tests/test-species.R
   pkg/CHNOSZ/man/affinity.Rd
   pkg/CHNOSZ/man/equilibrate.Rd
   pkg/CHNOSZ/man/sideeffects.Rd
   pkg/CHNOSZ/man/subcrt.Rd
   pkg/CHNOSZ/vignettes/anintro.Rnw
   pkg/CHNOSZ/vignettes/anintro.lyx
   pkg/CHNOSZ/vignettes/equilibrium.Rnw
   pkg/CHNOSZ/vignettes/equilibrium.lyx
   pkg/CHNOSZ/vignettes/hotspring.Rnw
   pkg/CHNOSZ/vignettes/hotspring.lyx
   pkg/CHNOSZ/vignettes/wjd.Rnw
   pkg/CHNOSZ/vignettes/wjd.lyx
Log:
be able to change logact of species by name


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2012-12-16 13:22:50 UTC (rev 32)
+++ pkg/CHNOSZ/DESCRIPTION	2012-12-18 13:25:21 UTC (rev 33)
@@ -1,6 +1,6 @@
-Date: 2012-12-16
+Date: 2012-12-18
 Package: CHNOSZ
-Version: 0.9.8-7
+Version: 0.9.8-8
 Title: Chemical Thermodynamics and Activity Diagrams
 Author: Jeffrey M. Dick
 Maintainer: Jeffrey M. Dick <jmdick at asu.edu>

Modified: pkg/CHNOSZ/R/species.R
===================================================================
--- pkg/CHNOSZ/R/species.R	2012-12-16 13:22:50 UTC (rev 32)
+++ pkg/CHNOSZ/R/species.R	2012-12-18 13:25:21 UTC (rev 33)
@@ -44,6 +44,7 @@
   # 20080925 default quiet=TRUE 20101003 default quiet=FALSE
   # 20120128 remove 'quiet' argument (messages can be hidden with suppressMessages())
   # 20120523 return thermo$species instead of rownumbers therein, and remove message showing thermo$species
+  ## argument processing
   # we can't deal with NA species
   if(identical(species, NA)) {
     cn <- caller.name()
@@ -78,12 +79,12 @@
     }
     return(thermo$species)
   }
-  # parse state argument
-  state <- state.args(state)
   # if no species or states are given, just return the species list
   if(is.null(species) & is.null(state)) return(thermo$species)
   # if no species are given use all of them if available
   if(is.null(species) & !is.null(thermo$species)) species <- 1:nrow(thermo$species)
+  # parse state argument
+  state <- state.args(state)
   # make species and state arguments the same length
   if(length(species) > length(state) & !is.null(state)) state <- rep(state,length.out=length(species)) else 
   if(length(state) > length(species) & !is.null(species)) species <- rep(species,length.out=length(state))
@@ -99,9 +100,14 @@
     species <- paste(species, state, sep="_")
     state <- rep(thermo$opt$state, length.out=length(state))
   }
-  # character first argument, look for species in thermo$obigt
+  # parse species argument
   iobigt <- NULL
   if(is.character(species[1])) {
+    # look for named species in species definition
+    ispecies <- match(species, thermo$species$name)
+    # if all species names match, and logact is given, re-call the function with the species indices
+    if(!any(is.na(ispecies)) & !is.null(logact)) return(species(ispecies, state=logact, index.return=index.return))
+    # look for species in thermo$obigt
     iobigt <- suppressMessages(info(species, state))
     # check if we got all the species
     ina <- is.na(iobigt)
@@ -112,6 +118,7 @@
     if(is.null(thermo$species)) nspecies <- 0
     if(max(species) > nspecies) iobigt <- species
   }
+  ## done with argument processing ... now to do work
   # create or add to species definition
   if(!is.null(iobigt)) {
     if(is.null(thermo$basis)) stop("basis species are not defined")
@@ -143,8 +150,14 @@
   } else {
     # update activities or states of existing species
     # first get the rownumbers in thermo$species
-    if(is.numeric(species[1])) ispecies <- species
-    else ispecies <- match(species, thermo$species$name)
+    if(is.numeric(species[1])) {
+      ispecies <- species
+      # if state and logact are both NULL we don't do anything but return the selected species
+      if(is.null(state) & is.null(logact)) {
+        if(index.return) return(ispecies)
+        else return(thermo$species[ispecies, ])
+      }
+    } else ispecies <- match(species, thermo$species$name)
     # replace activities?
     if(!is.null(logact)) {
       thermo$species$logact[ispecies] <<- logact

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2012-12-16 13:22:50 UTC (rev 32)
+++ pkg/CHNOSZ/inst/NEWS	2012-12-18 13:25:21 UTC (rev 33)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 0.9.8-7 (2012-12-16)
+CHANGES IN CHNOSZ 0.9.8-8 (2012-12-18)
 --------------------------------------
 
 SIGNIFICANT USER-VISIBLE CHANGES:

Modified: pkg/CHNOSZ/inst/TODO
===================================================================
--- pkg/CHNOSZ/inst/TODO	2012-12-16 13:22:50 UTC (rev 32)
+++ pkg/CHNOSZ/inst/TODO	2012-12-18 13:25:21 UTC (rev 33)
@@ -4,22 +4,12 @@
 
 - revisit the documentation, make it consistent with code changes!
 
-- check docs and function: does affinity return A/RT or A/2.303RT?
-
-- check examples of protein buffer calculations
-
-- get demo("copper") to work ... might involve refactoring species()
-
-
 ********
 features
 ********
 
-- let diagram() map NA's - as in kyanite/sillimanite/andalusite example
-
 - make is.near.equil() a function of ep (element.potentials), not w (wjd)?
 
-
 ***********
 performance
 ***********
@@ -31,6 +21,7 @@
 - does affinity(iprotein=...) add H2O_RESIDUE to thermo$obigt?
   ... if so stop it from doing so?
 
+- byte-compiling is known to break test-subcrt.R
 
 *****
 style
@@ -53,11 +44,12 @@
 
 - get away from determining species indices with rownames(thermo$obigt)
 
-
 *************
 documentation
 *************
 
+- check docs: does affinity return A/RT or A/2.303RT?
+
 - better documentation on how makeup() handles charge
 
 - does mod.obigt() use order-of-magnitude scaling factors or not?
@@ -85,7 +77,6 @@
 
 - add a lograt example to revisit.Rd
 
-
 ********
 database
 ********
@@ -100,7 +91,6 @@
 
 - get up-to-date with SLOP07 data set?
 
-
 ***********
 longer term
 ***********

Modified: pkg/CHNOSZ/inst/doc/anintro.pdf
===================================================================
(Binary files differ)

Modified: pkg/CHNOSZ/inst/doc/equilibrium.pdf
===================================================================
(Binary files differ)

Modified: pkg/CHNOSZ/inst/doc/hotspring.pdf
===================================================================
(Binary files differ)

Modified: pkg/CHNOSZ/inst/doc/wjd.pdf
===================================================================
(Binary files differ)

Modified: pkg/CHNOSZ/inst/tests/test-affinity.R
===================================================================
--- pkg/CHNOSZ/inst/tests/test-affinity.R	2012-12-16 13:22:50 UTC (rev 32)
+++ pkg/CHNOSZ/inst/tests/test-affinity.R	2012-12-18 13:25:21 UTC (rev 33)
@@ -116,7 +116,7 @@
 
 test_that("affinity() for proteins (with/without 'iprotein') returns same value as in previous package versions", {
   # our test case is CSG_HALJP because it has no methionine
-  # (aqueous [Met] was updated in 0.9.8)
+  # (aqueous [Met] was updated in 0.9-9)
   # these values were calculated using versions 0.6, 0.8 and 0.9-7
   # (25 degrees C, 1 bar, basis species "CHNOS" or "CHNOS+")
   A.2303RT.nonionized <- -3795.297

Modified: pkg/CHNOSZ/inst/tests/test-species.R
===================================================================
--- pkg/CHNOSZ/inst/tests/test-species.R	2012-12-16 13:22:50 UTC (rev 32)
+++ pkg/CHNOSZ/inst/tests/test-species.R	2012-12-18 13:25:21 UTC (rev 33)
@@ -31,11 +31,11 @@
   expect_is(species(delete=TRUE), "NULL")
 })
 
-test_that("non-available species cause error, and species can be added or modified by numeric index", {
+test_that("non-available species cause error, and species can be added or modified", {
   basis("CHNOS")
   expect_error(species("wate"), "species not available")
   # add CO2, aq
-  species("CO2")
+  sdef <- species("CO2")
   # we can't add the same species twice
   expect_equal(nrow(species("CO2")), 1)
   # change it to gas
@@ -46,6 +46,12 @@
   expect_equal(nrow(species("CO2")), 2)
   # add alanine by index in thermo$obigt
   expect_equal(nrow(species(info("alanine"))), 3)
+  # if we just use an index, get only that species
+  expect_equal(species(3)$name, "alanine")
+  # we can add a species with the same name but different state
+  expect_equal(nrow(species("alanine", "cr")), 4)
+  # we can modify the logact of a named species (only first match)
+  expect_equal(species("alanine", -7)$logact[3], -7)
 })
 
 test_that("index_return provides indices for touched species", {

Modified: pkg/CHNOSZ/man/affinity.Rd
===================================================================
--- pkg/CHNOSZ/man/affinity.Rd	2012-12-16 13:22:50 UTC (rev 32)
+++ pkg/CHNOSZ/man/affinity.Rd	2012-12-18 13:25:21 UTC (rev 33)
@@ -23,7 +23,9 @@
 }
 
 \details{
-  \code{affinity} calculates the chemical affinities of reactions to form the species of interest from the basis species. The calculation of chemical affinities relies on the global definitions of the \code{\link{basis}} species and \code{\link{species}} of interest. It is possible to use the results of \code{affinity} to generate equilibrium activity diagrams using \code{\link{diagram}}.
+\code{affinity} calculates the chemical affinities of reactions to form the species of interest from the basis species.
+The calculation of chemical affinities relies on the current definitions of the \code{\link{basis}} species and \code{\link{species}} of interest.
+It is possible to use the results of \code{affinity} to generate equilibrium activity diagrams using \code{\link{diagram}}.
 
   The equation used to calculate chemical affinity \emph{\bold{A}} is \emph{\bold{A}}=\eqn{RT\ln (K/Q)}{RT*ln(K/Q)} (Kondepudi and Prigogine, 1998), where \eqn{K} denotes the equilibrium constant of the reaction and \eqn{Q} stands for the activity product of the species in the reaction. (The equilibrium constant is related to standard Gibbs energy of reaction, \eqn{\Delta G^{\circ}_r}{DeltaG0r}, by \eqn{\Delta G^{\circ}_r = -2.303RT\log K}{DeltaG0r = -2.303*RT*logK}, where \eqn{R} and \eqn{T} stand for, respectively, the gas constant and temperature). With the approach of a given reaction to a state of equilibrium, the chemical affinity tends toward zero, or \eqn{K = Q}. 
 
@@ -33,7 +35,10 @@
 
    If one or more buffers are assigned to the definition of \code{\link{basis}} species, \code{affinity} calls \code{\link{buffer}} to calculate the logarithms of activities of these basis species from the buffer.
 
-   The \code{iprotein} and \code{loga.protein} arguments can be used to compute the chemical affinities of formation reactions of proteins that are not in the global \code{\link{species}} definition. This approach can be utilized in order to calculate the properties of many proteins in a fraction of the time it would take to calculate them individually. The appropriate \code{\link{basis}} species still must be defined prior to calling \code{affinity}. \code{iprotein} contains indices of desired proteins in \code{\link{thermo}$protein}; \code{affinity} add to the species list the amino acid residues and protein backbone group then calculate the properties of the reactions for the residues (including ionization effects), and adds them together to get those of the indicated proteins.
+The \code{iprotein} and \code{loga.protein} arguments can be used to compute the chemical affinities of formation reactions of proteins that are not in the current \code{\link{species}} definition.
+This approach can be utilized in order to calculate the properties of many proteins in a fraction of the time it would take to calculate them individually.
+The appropriate \code{\link{basis}} species still must be defined prior to calling \code{affinity}.
+\code{iprotein} contains indices of desired proteins in \code{\link{thermo}$protein}; \code{affinity} adds to the species list the amino acid residues and protein backbone group then calculate the properties of the reactions for the residues (including ionization effects), and adds them together to get those of the indicated proteins.
 
   In CHNOSZ version 0.9, \code{energy} gained a new argument \samp{transect} which is set to TRUE by \code{energy.args} when the length(s) of the variables is(are) greater than three. In this mode of operation, instead of performing the calculations on an \eqn{n}{n}-dimensional grid, the affinities are calculated on an \eqn{n}{n}-dimensional transect through chemical potential (possibly including T and/or P) space. 
 

Modified: pkg/CHNOSZ/man/equilibrate.Rd
===================================================================
--- pkg/CHNOSZ/man/equilibrate.Rd	2012-12-16 13:22:50 UTC (rev 32)
+++ pkg/CHNOSZ/man/equilibrate.Rd	2012-12-18 13:25:21 UTC (rev 33)
@@ -51,7 +51,7 @@
 \code{normalize} if TRUE indicates to normalize the molar formulas of species by the balance coefficients.
 This operation is intended for systems of polymers, such as proteins, whose conventional formulas are much larger than the basis speices.
 The normalization also applies to the balancing coefficients, which as a result consist of \samp{1}s.
-\code{normalize} has the same effect as did \code{diagram(..., residue=TRUE)} in versions of CHNOSZ before 0.9.8.
+\code{normalize} has the same effect as did \code{diagram(..., residue=TRUE)} in versions of CHNOSZ before 0.9-9.
 
 \code{ispecies} can be supplied to identify a subset of the species to include in the calculation.
 
@@ -68,8 +68,8 @@
 
 In \code{equil.reaction} (the algorithm described in Dick, 2008 and the only one available prior to CHNOSZ-0.8), the calculations of relative abundances of species are based on a solving a system of equations representing the two constraints stated above.
 A close approximation of the solution is found using \code{\link{uniroot}}.
-Prior to CHNOSZ_0.9.8, the values in the \code{Astar} were used to generate initial guesses of the logarithms of activities of species; values of \code{loga.balance} that were hugely different from these guesses could generate errors from \code{uniroot} such as "f() values at end points not of opposite sign".
-Now (from version 0.9.8), a more flexible method for generating guesses is in place. 
+Prior to CHNOSZ_0.9-9, the values in the \code{Astar} were used to generate initial guesses of the logarithms of activities of species; values of \code{loga.balance} that were hugely different from these guesses could generate errors from \code{uniroot} such as "f() values at end points not of opposite sign".
+Now (from version 0.9-9), a more flexible method for generating guesses is in place. 
 
 In \code{equil.boltzmann} (algorithm available beginning with CHNOSZ-0.8), the chemical activities of species are calculated using the Boltzmann distribution.
 This calculation is faster than the algorithm of \code{equil.reaction}, but is limited to systems where the transformations are all balanced on one mole of species.

Modified: pkg/CHNOSZ/man/sideeffects.Rd
===================================================================
--- pkg/CHNOSZ/man/sideeffects.Rd	2012-12-16 13:22:50 UTC (rev 32)
+++ pkg/CHNOSZ/man/sideeffects.Rd	2012-12-18 13:25:21 UTC (rev 33)
@@ -29,7 +29,7 @@
     \code{opar} \tab \code{\link{thermo.plot.new}} \tab -- \tab graphical parameters \cr
   }
 
-  Beginning with CHNOSZ version 0.9.8, instances of \code{\link{<<-}} in the code have the effect of \dQuote{superassignment} to an enclosing environment (\samp{CHNOSZ:thermo} on the search path), instead of the \emph{very} highly discouraged assignment to the global environment (user's workspace) used in previous versions of the package. This convention means that if, from the command line, \emph{you} wish to alter something in \code{thermo}, you also should use the \code{\link{<<-}} operator; examples of changing \code{thermo$opt$water} in this manner can found in the help page for \code{\link{water}}.
+  Beginning with CHNOSZ version 0.9-9, instances of \code{\link{<<-}} in the code have the effect of \dQuote{superassignment} to an enclosing environment (\samp{CHNOSZ:thermo} on the search path), instead of the \emph{very} highly discouraged assignment to the global environment (user's workspace) used in previous versions of the package. This convention means that if, from the command line, \emph{you} wish to alter something in \code{thermo}, you also should use the \code{\link{<<-}} operator; examples of changing \code{thermo$opt$water} in this manner can found in the help page for \code{\link{water}}.
   
 }
 

Modified: pkg/CHNOSZ/man/subcrt.Rd
===================================================================
--- pkg/CHNOSZ/man/subcrt.Rd	2012-12-16 13:22:50 UTC (rev 32)
+++ pkg/CHNOSZ/man/subcrt.Rd	2012-12-18 13:25:21 UTC (rev 33)
@@ -56,13 +56,19 @@
 
   (Note that \code{E} and \code{kT} can only be calculated for aqueous species and only if the option (\code{\link{thermo}$opt$water}) for calculations of properties using \code{water} is set to \code{IAPWS}. On the other hand, if the \code{water} option is \samp{SUPCRT} (the default), \code{E} and \code{kT} can be calculated for water but not for aqueous species. (This is not an inherent limitation in either formulation, but it is just a matter of implementation.))
 
-  Depending on the global units definition (\code{\link{E.units}}) the values of \code{G}, \code{H}, \code{S} and \code{Cp} are returned in calories or Joule, but only if \code{convert} is \code{TRUE}. Likewise, the input values of \code{T} and \code{P} should be in units specified through \code{\link{T.units}} and \code{\link{P.units}}, but setting \code{convert} to \code{FALSE} forces \code{subcrt} to treat them as Kelvin and bar, respectively.
+Depending on the units currently defined (\code{\link{E.units}}) the values of \code{G}, \code{H}, \code{S} and \code{Cp} are returned using calories or Joules as the unit of energy, but only if \code{convert} is \code{TRUE}.
+Likewise, the input values of \code{T} and \code{P} are interpreted to have the units specified through \code{\link{T.units}} and \code{\link{P.units}}, but setting \code{convert} to \code{FALSE} forces \code{subcrt} to treat them as Kelvin and bar, respectively.
 
   A chemical reaction is defined if \code{coeff} is given. In this mode the standard molal properties of species are summed according to the stoichiometric \code{coeff}icients, where negative values denote reactants. Reactions that do not conserve elements are permitted; \code{subcrt} prints the missing composition needed to balance the reaction and produces a warning but computes anyway. Alternatively, if the \code{\link{basis}} species of a system were previously defined, and if the species being considered are within the compositional range of the basis species, an unbalanced reaction given in the arguments to \code{subcrt} will be balanced automatically, without altering the coefficients on the species identified in the arguments (unless perhaps they correspond to basis species), and without a warning. However, if a reaction is unbalanced and \code{action.unbalanced} is set to NULL, no warnings are generated and no attempt is made to balance the reaction.
 
   Minerals with phase transitions (denoted by having states \samp{cr1}, \samp{cr2} etc.) can be defined generically by \samp{cr} in the \code{state} argument. As of CHNOSZ-0.9-6, to consider phase transitions the \code{species} must be character, not numeric. \code{subcrt} in this case simultaneously calculates the requested properties of all the phases of each such mineral (phase species) and, using the values of the transition temperatures calculated from those at P = 1 bar given in the thermodynamic database together with functions of the entropies and volumes of transitions (see \code{\link{dPdTtr}}), determines the stable phase of the mineral at any grid point and substitutes the properties of this phase at that point for further calculations. If individual phase species of minerals are specified (by \samp{cr1}, \samp{cr2} etc. in \code{state}), and \code{exceed.Ttr} is \code{FALSE} (the default), the Gibbs energies of these minerals are assigned values of NA at conditions beyond their transition temperature, where another of the phases is stable. If you set \code{exceed.Ttr} to \code{TRUE} while investigating the properties of phases of minerals identified generically (by \samp{cr}) the function will identify the stable phase on the basis not of the transition temperatures but of the calculated Gibbs energies of the phase species. This is not generally advised, since the computed standard molal properties of a phase species lose their physical meaning beyond the transition temperatures of the phase.
 
-  The chemical affinities of reactions are calculated if \code{logact} is provided. This argument indicates the logarithms of activities (fugacities for gases) of species in the reaction; if there are fewer values of \code{logact} than number of species those values are repeated as necessary. If the reaction was unbalanced to start, the logarithms of activities of any basis species added to the reaction are taken from the global basis definition. Columns appended to the output are \code{logQ} for the activity product of the reaction, and \code{A} for the chemical affinity (the latter in units corresponding to those of Gibbs energy). Note that \code{\link{affinity}} provides related functionality but is geared toward the properties of formation reactions of species from the basis species and can be performed in more dimensions. Calculations of chemical affinity in \code{subcrt} can be performed for any reaction of interest; however, they are currently limited to constant values of the logarithms of activities of species in the reactions, and hence of \code{logQ}, across the computational range.
+If \code{logact} is provided, the chemical affinities of reactions are calculated.
+\code{logact} indicates the logarithms of activities (fugacities for gases) of species in the reaction; if there are fewer values of \code{logact} than number of species those values are repeated as necessary.
+If the reaction was unbalanced to start, the logarithms of activities of any basis species added to the reaction are taken from the current definition of the \code{\link{basis}} species.
+Columns appended to the output are \code{logQ} for the log10 of the activity product of the reaction, and \code{A} for the chemical affinity, in the units set by \code{\link{E.units}}.
+Note that \code{\link{affinity}} provides related functionality but is geared toward the properties of formation reactions of species from the basis species and can be performed in more dimensions.
+Calculations of chemical affinity in \code{subcrt} can be performed for any reaction of interest; however, they are currently limited to constant values of the logarithms of activities of species in the reactions, and hence of \code{logQ}, across the computational range.
 
   If \code{IS} is set to a single value other than zero, \code{\link{nonideal}} is used to calculate the apparent properties (\code{G}, \code{H}, \code{S} and \code{Cp}) of charged aqueous species at the given ionic strength. To perform calculations at a single \code{P} and \code{T} and for multiple values of ionic strength, supply these values in \code{IS}. Calculations can also be performed on a \code{P}-\code{IS}, \code{T}-\code{IS} or \code{P,T}-\code{IS} grid. Values of \code{logK} of reactions calculated for \code{IS} not equal to zero are consistent with the apparent Gibbs energies of the charged aqueous species.
 
@@ -79,7 +85,7 @@
 \section{Warning}{
 
 Comparison of the output of \code{subcrt} with that of \acronym{SUPCRT92} indicates the two give similar values of properties for neutral aqueous species up to 1000 \eqn{^{\circ}}{°}C and 5000 bar.
-Changes were made in CHNOSZ 0.9.8 to improve the calculation of the \eqn{g}{g}- and \eqn{f}{f}-functions (Shock et al., 1992) for the partial derivatives of the omega parameter which are used by the \code{\link{hkf}} function, so thermodynamic properties of charged aqueous species over the temperature range 0 to 1000 \eqn{^{\circ}}{°}C are now mostly consistent with \acronym{SUPCRT92}.
+Changes were made in CHNOSZ 0.9-9 to improve the calculation of the \eqn{g}{g}- and \eqn{f}{f}-functions (Shock et al., 1992) for the partial derivatives of the omega parameter which are used by the \code{\link{hkf}} function, so thermodynamic properties of charged aqueous species over the temperature range 0 to 1000 \eqn{^{\circ}}{°}C are now mostly consistent with \acronym{SUPCRT92}.
 Note, however, that while \acronym{SUPCRT92} limits calculations at Psat to 350 \eqn{^{\circ}}{°}C (\dQuote{beyond range of applicability of aqueous species equations}), there is no corresponding limit in place in \code{subcrt} (or \code{\link{hkf}}), so that inapplicable calculations will be performed up to the critical temperature (373.917 \eqn{^{\circ}}{°}C) without any warning.
 It is probably for this reason that there is a noticeable jump in the value of logK at Psat shown in the one of the examples (\code{\link{demos}("NaCl")}).
 

Modified: pkg/CHNOSZ/vignettes/anintro.Rnw
===================================================================
--- pkg/CHNOSZ/vignettes/anintro.Rnw	2012-12-16 13:22:50 UTC (rev 32)
+++ pkg/CHNOSZ/vignettes/anintro.Rnw	2012-12-18 13:25:21 UTC (rev 33)
@@ -1,13 +1,12 @@
-%% LyX 2.0.4 created this file.  For more info, see http://www.lyx.org/.
+%% LyX 2.0.5 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}
+\documentclass[noae,round]{article}
 \usepackage{mathpazo}
 \usepackage[T1]{fontenc}
 \usepackage[latin9]{inputenc}
 \usepackage[letterpaper]{geometry}
 \geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm}
 \usepackage{color}
-\usepackage{babel}
 \usepackage{amsbsy}
 \usepackage{amssymb}
 \usepackage{graphicx}
@@ -38,7 +37,7 @@
 {\end{list}}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
-%\VignetteIndexEntry{An introduction to CHNOSZ}
+%\VignetteIndexEntry{An Introduction to CHNOSZ}
 
 % so DOIs in bibliography show up as hyperlinks
 \newcommand*{\doi}[1]{\href{http://dx.doi.org/#1}{doi: #1}}
@@ -104,7 +103,7 @@
 the affinities of formation reactions of the species of interest under
 reference (non-equilibrium) conditions, calculate the equilibrium
 chemical activities, and finally plot the results;%
-\footnote{\texttt{equilibrate()} appeared in version 0.9.8 of CHNOSZ. In previous
+\footnote{\texttt{equilibrate()} appeared in version 0.9-9 of CHNOSZ. In previous
 versions, the equilibrium calculations were invoked by calls to \texttt{diagram()}.%
 }
 \item using \texttt{revisit()} to calculate/plot statistics of the chemical
@@ -136,7 +135,7 @@
 install.packages("CHNOSZ")
 @
 
-\selectlanguage{english}%
+
 Then load the CHNOSZ package to make its functions and data available
 in your working session.
 
@@ -144,7 +143,7 @@
 library(CHNOSZ)
 @
 
-\selectlanguage{english}%
+
 The rest of this document assumes that the CHNOSZ package is loaded.
 
 
@@ -163,7 +162,7 @@
 info("ethylene")
 @
 
-\selectlanguage{english}%
+
 There are two species named ``ethylene'' in the database. Normally,
 \texttt{info()} gives preference to aqueous species if they exist,
 so in this case we find that aqueous ethylene is species number 88
@@ -174,7 +173,7 @@
 info(88)
 @
 
-\selectlanguage{english}%
+
 If you were instead interested in the properties of the gas, you could
 run:
 
@@ -182,7 +181,7 @@
 info("ethylene","gas")
 @
 
-\selectlanguage{english}%
+
 \texttt{info()} itself is used by other functions in the package.
 It prints output to the screen, but also returns a numeric value if
 it finds a species matching the search term. So, we can retrieve the
@@ -206,7 +205,7 @@
 summary(thermo)
 @
 
-\selectlanguage{english}%
+
 Within this list, the thermodynamic database is contained in a data
 frame (an R object that is like a matrix with named columns), \texttt{thermo\$obigt},
 and the references to the original sources of thermodynamic data in
@@ -222,7 +221,7 @@
 browse.refs(88)
 @
 
-\selectlanguage{english}%
+
 \texttt{browse.refs: opening URL for SH90 (E. L. Shock and H. C. Helgeson,
 \citeyear{SH90})}
 
@@ -235,7 +234,7 @@
 info("acid")
 @
 
-\selectlanguage{english}%
+
 Here, \texttt{info()} couldn't find an exact match to a name, so it
 performed a fuzzy search. That's why ``uracil'' and ``metacinnabar''
 show up above. If you really just want species whose names include
@@ -248,7 +247,7 @@
 info(" acid")
 @
 
-\selectlanguage{english}%
+
 The names of species other than proteins use (almost) exclusively
 lowercase letters. \texttt{info()} can also be used to search the
 text of the chemical formulas as they are entered in the database;
@@ -279,7 +278,7 @@
 aa2eos(aa)
 @
 
-\selectlanguage{english}%
+
 What happened there? Well, the first line found the row number (6)
 of \texttt{thermo\$protein} that contains the amino acid composition
 of LYSC\_CHICK. The second line extracted as a data frame. The third
@@ -308,7 +307,7 @@
 info(si)
 @
 
-\selectlanguage{english}%
+
 When CHNOSZ is first loaded, the thermodynamic properties and parameters
 of the proteins are not present in \texttt{thermo\$obigt}. Therefore,
 the first call to\texttt{ info()} just above had a side effect of
@@ -335,7 +334,7 @@
 subcrt("water")
 @
 
-\selectlanguage{english}%
+
 The columns in the output are temperature ($^{\circ}$C), pressure
 (bar), density of water (g cm$^{-3}$), logarithm of the equilibrium
 constant (only meaningful for reactions; see below), and standard
@@ -360,7 +359,7 @@
 subcrt(c("C2H5OH","O2","CO2","H2O"),c(-1,-3,2,3),T=37)
 @
 
-\selectlanguage{english}%
+
 For historical reasons (i.e., the prevalence of the use of oxygen
 fugacity in geochemical modeling; \citealp{And05}), $\mathrm{O_{2}}$
 breaks the general rule in CHNOSZ that species whose states are not
@@ -374,7 +373,7 @@
 subcrt(c("C2H5OH","O2","CO2","H2O"),c(-1,-3,2,3),c("aq","aq","aq","liq"),T=37)
 @
 
-\selectlanguage{english}%
+
 A useful feature of \texttt{subcrt()} is that it emits a warning if
 the reaction is not balanced. Let's say you forgot to account for
 oxygen on the left-hand side of the reaction%
@@ -389,7 +388,7 @@
 subcrt(c("C2H5OH","CO2","H2O"),c(-1,2,3),T=37)
 @
 
-\selectlanguage{english}%
+
 The function still reports the results of the calculations, but use
 them very cautiously (only if you have a specific reason for writing
 an unbalanced reaction). In the next section we'll see how to use
@@ -417,7 +416,6 @@
 basis(c("CO2","H2O","NH3","H2S","H+"))
 @
 
-\selectlanguage{english}%
 \begin{lyxcode}
 Error~in~put.basis(basis,~mystates)~:~
 
@@ -439,7 +437,7 @@
 basis(c("CO2","H2O","NH3","O2","H2S","H+"))
 @
 
-\selectlanguage{english}%
+
 First basis definition! Note the column names, which give CHNOSZ its
 name. These represent the elements in the commonly-occurring amino
 acids, together with charge, denoted by ``Z''.
@@ -454,7 +452,7 @@
 subcrt(c("C2H5OH","CO2","H2O"),c(-1,2,3),T=37)
 @
 
-\selectlanguage{english}%
+
 Here, \texttt{subcrt()} detected an unbalanced reaction, but since
 the missing element was among the elements of the basis species, it
 added the appropriate amount of $\mathrm{O_{2}}_{\left(gas\right)}$
@@ -466,7 +464,7 @@
 subcrt(c("C2H5OH"),c(-1),T=37)
 @
 
-\selectlanguage{english}%
+
 What if you were interested in the thermodynamic properties of the
 reaction of ethanol to acetaldehyde, but didn't want to balance the
 reaction yourself (and you also didn't know how the formulas of the
@@ -476,7 +474,7 @@
 subcrt(c("ethanol","acetaldehyde"),c(-1,1),T=37)
 @
 
-\selectlanguage{english}%
+
 Notice how 2 H's needed to be added to the right-hand side of the
 reaction; in our definition of basis species this comes out to $\mathrm{H_{2}O}-0.5\mathrm{O_{2}}$.
 With a different choice of basis species, but the same elements, the
@@ -491,7 +489,7 @@
 subcrt(c("ethanol","acetaldehyde"),c(-1,1),T=37)
 @
 
-\selectlanguage{english}%
+
 In this case, the function finds that 2 H's are the compositional
 equivalent of $0.5\mathrm{C_{6}H_{13}NO_{2}}-0.125\mathrm{C_{6}H_{14}N_{2}O_{2}}-0.250\mathrm{C_{9}H_{11}NO_{3}}$.
 It's pretty easy for the computer to figure that out using matrix
@@ -516,7 +514,7 @@
 subcrt("LYSC_CHICK",1,T=25)
 @
 
-\selectlanguage{english}%
+
 Note that using the keyword argument in \texttt{basis()} also set
 the logarithms of activities (or fugacity in the case of $\mathrm{O_{2}}_{\left(g\right)}$)
 to nominal values. While these settings do not affect the results
@@ -535,7 +533,6 @@
 subcrt("ALAT1_HUMAN",1,T=25)
 @
 
-\selectlanguage{english}%
 \begin{lyxcode}
 Shall~I~try~an~online~search~for~~ALAT1\_HUMAN~\_~SWISS~?~y
 
@@ -614,8 +611,8 @@
 @
 \setkeys{Gin}{width=1.0\textwidth}
 
-\selectlanguage{english}%
 
+
 \subsection{Stability diagram for proteins}
 
 Suppose that we are asked to calculate the relative stabilities of
@@ -635,7 +632,7 @@
 species(c("SLAP_ACEKI", "CSG_METJA", "CSG_METVO", "CSG_HALJP"))
 @
 
-\selectlanguage{english}%
+
 Note the output: the matrix denotes the coefficients of each of the
 basis species in the formation reaction for one mole of each of the
 species of interest. The \textbf{formation reaction} is the chemical
@@ -663,7 +660,7 @@
 a <- affinity(O2=c(-90,-70))
 @
 
-\selectlanguage{english}%
+
 Now we can use \texttt{equilibrate()} to calculate the equilibrium
 activities of the proteins and \texttt{diagram()} to plot them. \texttt{normalize=TRUE}
 invokes the normalization of the chemical formulas of the proteins
@@ -678,7 +675,7 @@
 @
 \setkeys{Gin}{width=1.0\textwidth}
 
-\selectlanguage{english}%
+
 Notably, the protein from the organism found at the highest temperatures
[TRUNCATED]

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


More information about the CHNOSZ-commits mailing list