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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Nov 1 15:13:48 CET 2017


Author: jedick
Date: 2017-11-01 15:13:47 +0100 (Wed, 01 Nov 2017)
New Revision: 275

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/diagram.R
   pkg/CHNOSZ/R/util.expression.R
   pkg/CHNOSZ/man/CHNOSZ-package.Rd
Log:
clean up CHNOSZ-package.Rd


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2017-11-01 04:17:02 UTC (rev 274)
+++ pkg/CHNOSZ/DESCRIPTION	2017-11-01 14:13:47 UTC (rev 275)
@@ -1,6 +1,6 @@
 Date: 2017-11-01
 Package: CHNOSZ
-Version: 1.1.0-73
+Version: 1.1.0-74
 Title: Thermodynamic Calculations for Geobiochemistry
 Author: Jeffrey Dick
 Maintainer: Jeffrey Dick <j3ffdick at gmail.com>

Modified: pkg/CHNOSZ/R/diagram.R
===================================================================
--- pkg/CHNOSZ/R/diagram.R	2017-11-01 04:17:02 UTC (rev 274)
+++ pkg/CHNOSZ/R/diagram.R	2017-11-01 14:13:47 UTC (rev 275)
@@ -284,13 +284,15 @@
         if(is.na(legend.x)) {
           maxvals <- do.call(pmax, pv)
           dy <- rep(dy, length.out=length(plotvals))
+          # don't assign to adj becuase that messes up the missing test below
+          alladj <- rep(adj, length.out=length(plotvals))
           for(i in 1:length(plotvals)) {
             # y-values for this line
             myvals <- as.numeric(plotvals[[i]])
             # don't take values that lie close to or above the top of plot
             myvals[myvals > ylim[1] + 0.95*diff(ylim)] <- ylim[1]
             # the starting x-adjustment
-            thisadj <- adj
+            thisadj <- alladj[i]
             # if this line has any of the overall maximum values, use only those values
             # (useful for labeling straight-line affinity comparisons 20170221)
             is.max <- myvals==maxvals

Modified: pkg/CHNOSZ/R/util.expression.R
===================================================================
--- pkg/CHNOSZ/R/util.expression.R	2017-11-01 04:17:02 UTC (rev 274)
+++ pkg/CHNOSZ/R/util.expression.R	2017-11-01 14:13:47 UTC (rev 275)
@@ -314,6 +314,12 @@
     }
     if(grepl("-[0-9]?$", formula)) {
       fsplit <- strsplit(formula, "-")[[1]]
+      # for formula=="H-citrate-2", unsplit H-citrate
+      if(length(fsplit) > 2) {
+        f2 <- tail(fsplit, 1)
+        f1 <- paste(head(fsplit, -1), collapse="-")
+        fsplit <- c(f1, f2)
+      }
       if(is.na(fsplit[2])) Z <- -1 else Z <- -as.numeric(fsplit[2])
     }
     formula <- fsplit[1]

Modified: pkg/CHNOSZ/man/CHNOSZ-package.Rd
===================================================================
--- pkg/CHNOSZ/man/CHNOSZ-package.Rd	2017-11-01 04:17:02 UTC (rev 274)
+++ pkg/CHNOSZ/man/CHNOSZ-package.Rd	2017-11-01 14:13:47 UTC (rev 275)
@@ -2,15 +2,23 @@
 \name{CHNOSZ-package}
 \alias{CHNOSZ-package}
 \docType{package}
-\title{Chemical Thermodynamics and Activity Diagrams}
+\title{Thermodynamic Calculations for Geobiochemistry}
 \description{
 CHNOSZ is a package for thermodynamic calculations, primarily with applications in geochemistry and compositional biology.
 It can be used to calculate the standard molal thermodynamic properties and chemical affinities of reactions relevant to geobiochemical processes, and to visualize the equilibrium activities of species on chemical speciation and predominance diagrams.
 }
 
+\section{Warm Tips}{
+  \itemize{
+    \item Be sure to check out the vignette titled \emph{An Introduction to CHNOSZ}. Run \code{\link{help.start}()}, select \sQuote{Packages} then \sQuote{CHNOSZ} followed by \sQuote{User guides, package vignettes and other documentation}.
+    \item Running the examples from the help pages is a good way to become more familiar with the usage of the functions. After running \code{help.start()}, select \sQuote{Packages} then \sQuote{CHNOSZ} and then select a function of interest. Individual examples can be run by pasting the example block into the \R window.
+    \item Run the command \code{\link{examples}()} to run all of the examples provided in CHNOSZ. This should take about a minute.
+    \item Also try out \code{\link{demos}()} to run the demos (longer examples that are not part of the main help pages).
+    \item To learn how to update the thermodynamic database, look at \code{\link{add.obigt}}.
+  }
+}
+
 \section{Getting Help}{
-The major features of the package are outlined in the Overview given below, with links to specific help topics.
-See the vignette \emph{An Introduction to CHNOSZ} (\code{anintro.Rmd}) for more in-depth example of the usage the functions.
 Each help page (other than this one) has been given one of the following \dQuote{concept index entries}:
 \itemize{
   \item Main workflow: \code{\link{info}}, \code{\link{subcrt}}, \code{\link{basis}}, \code{\link{species}}, \code{\link{affinity}}, \code{\link{equilibrate}}, \code{\link{diagram}}
@@ -30,70 +38,22 @@
 All thermodynamic data and examples are provided on an as-is basis.
 It is up to you to check not only the accuracy of the data, but also the \emph{suitability of the data AND computational techniques} for your problem.
 By combining data taken from different sources, it is possible to build an inconsistent and/or nonsensical calculation.
-An attempt has been made to provide a primary database (OBIGT) that is internally consistent, but no guarantee can be made.
+An attempt has been made to provide a default database (OBIGT) that is internally consistent, but no guarantee can be made.
 If there is any doubt about the accuracy or suitability of data for a particular problem, please consult the primary sources (see \code{\link{thermo.refs}}).
 }
 
-\section{Overview}{
-
-  Major features in CHNOSZ:
-
-\itemize{
-
-  \item Thermodynamic database - assembles literature values of the standard thermodynamic properties and equations of state parameters of minerals, aqueous organic and inorganic species, gases and liquids (\code{\link{thermo}}).
-
-  \item Group additivity for proteins - estimate the standard thermodynamic properties and equations of state parameters for unfolded proteins from their amino acid composition; includes an additive calculation of ionization state of proteins as a function of temperature and pH (\code{\link{protein}}).
-
-  \item File and internet access - read protein sequences from FASTA files, and download sequence information from UniProt (\code{\link{read.fasta}}, \code{\link{protein}}).
-
-  \item Equations of state - calculate the standard thermodynamic properties of proteins or other species in the database, and reactions between them, as a function of temperature and pressure (\code{\link{hkf}}, \code{\link{cgl}}, \code{\link{subcrt}}).
-
-  \item Stoichiometry - count elements in chemical formulas of species, check and optionally correct mass balance of chemical reactions (\code{\link{makeup}}).
-
-  \item System of interest - define the basis species for a system together with one or more species of interest; compute the stoichiometries of the formation reactions of the species of interest (\code{\link{basis}}, \code{\link{species}}).
-
-  \item Chemical affinity - calculate the chemical affinities of the formation reactions of the species of interest at a single point, or as a function of one or more of chemical activities of the basis species, temperature and/or pressure (\code{\link{affinity}}).
-
-  \item Chemical activity - calculate the equilibrium activities of the species of interest as a function of the same variables used in the affinity calculation, using a reference state transformation (either the Boltzmann distribution or a reaction matrix approach). (\code{\link{diagram}}, \code{\link{equil.reaction}}, \code{\link{equil.boltzmann}}).
-
-  \item Activity diagrams - plot the equilibrium activities at a single point (as barplots), or as a function of one (species activity diagrams) or two (predominance diagrams) variables (\code{\link{diagram}}).
-
-  \item Buffer calculations - compute activities of basis species that are determined by a buffer of one or more species (e.g., pyrite-pyrrhotite-magnetite; acetic acid-\CO2) (\code{\link{buffer}}).
-
-  \item Activity coefficients - calculate activity coefficients of aqueous species using the extended Debye-Hückel equation (\code{\link{nonideal}}).
-
-  \item Activity statistics (\bold{experimental}) - calculate summary statistics for equilibrium activities of species (\code{\link{revisit}}).
-
-  \item Multidimensional optimization (\bold{experimental}) - using an iterative gridded optimization, find a combination of chemical activities of basis species, temperature and/or pressure that maximize or minimize the value of a target statistic (\code{\link{findit}}).
-
-}
-
-  Here are some tips for new users:
-
-  \itemize{
-    \item Running the examples shown in the various help topics is a good way to become more familiar with the usage of the functions. From \code{\link{help.start}}, select \sQuote{Packages} then \sQuote{CHNOSZ} and then select a function of interest. Individual examples can be run by pasting the example block directly into the R console.
-    \item Type the command \code{\link{examples}()} to run all of the examples provided in CHNOSZ. This takes a few minutes depending on your system. If things go as expected, the entire set will run without any warnings or errors.
-    \item Also try out \code{\link{demos}()} to run the demos (longer examples that are not part of the main help pages).
-    \item To learn how to update the thermodynamic database, look at \code{\link{add.obigt}}.
-  }
-
-}
-
 \section{Acknowledgements}{
-  This package would not exist without the leadership and encouragement of Professor Harold C. Helgeson.
-  Hal and his students and collaborators are in some way responsible for many of the equations and data contained in this package.
-  A direct contribution of code is the file \code{H2O92D.f}, taken from the SUPCRT92 distribution, with minor modifications (masking of WRITE and STOP statements) made for compatibility with an \R environment and for allowing sub-zero degrees C calculations (keep valTP flag TRUE).
-  The revised Helgeson-Kirkham-Flowers equations of state are used in this package, together with the thermodynamic properties and parameters for many species taken from numerous papers coauthored by Helgeson.
+  This package would not exist without the encouragement and groudbreaking work of the late Professor Harold C. Helgeson.
+  The revised Helgeson-Kirkham-Flowers equations of state are used in this package, together with thermodynamic properties of minerals and aqueous species from many papers coauthored by Helgeson.
+  CHNOSZ uses Fortran code from \code{H2O92D.f} in the SUPCRT92 package (Johnson et al., 1992), with only minor modifications (masking of WRITE and STOP statements made for compatibility with the \R environment and keep \code{valTP} flag TRUE to permit sub-zero \degC calculations).
 
-  Work on this package at U.C. Berkeley from ~2003--2008 was supported by research grants to HCH from the U.S. National Science Foundation and Department of Energy.
+  Work on this package at U.C. Berkeley from ca. 2003 to 2008 was supported by research grants to HCH from the U.S. National Science Foundation and Department of Energy.
   In 2009--2011, development of this package was based upon work supported by the National Science Foundation under grant EAR-0847616.
   The files in \code{extdata/bison} are derived from BLAST calculations made on the Saguaro high performance computer at Arizona State University. 
 }
 
-\section{Known Bugs}{
-  \code{\link{subcrt}} does not correctly identify the stable polymorph of some minerals at high temperature (see skarn example).
-
-  The values generated by \code{\link{buffer}} may not be applied correctly by \code{\link{affinity}} in calculating the affinities of the formation reactions. (The values returned by \code{affinity(..., return.buffer=TRUE)} do appear to be correct in the examples).
+\references{
+Johnson, J. W., Oelkers, E. H. and Helgeson, H. C. (1992) SUPCRT92: A software package for calculating the standard molal thermodynamic properties of minerals, gases, aqueous species, and reactions from 1 to 5000 bar and 0 to 1000\degC. \emph{Comp. Geosci.} \bold{18}, 899--947. \url{https://doi.org/10.1016/0098-3004(92)90029-Q}
 }
 
 \keyword{package}



More information about the CHNOSZ-commits mailing list