[CHNOSZ-commits] r125 - in pkg/CHNOSZ: . R inst tests/testthat vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Feb 2 18:17:23 CET 2017


Author: jedick
Date: 2017-02-02 18:17:22 +0100 (Thu, 02 Feb 2017)
New Revision: 125

Added:
   pkg/CHNOSZ/vignettes/CHNOSZ.png
   pkg/CHNOSZ/vignettes/newintro.Rmd
Removed:
   pkg/CHNOSZ/vignettes/EOSregress.bib
Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/info.R
   pkg/CHNOSZ/R/util.units.R
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/tests/testthat/test-info.R
   pkg/CHNOSZ/vignettes/EOSregress.Rmd
   pkg/CHNOSZ/vignettes/vig.bib
   pkg/CHNOSZ/vignettes/vig.css
Log:
begin writing newintro.Rmd


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2017-01-31 15:07:36 UTC (rev 124)
+++ pkg/CHNOSZ/DESCRIPTION	2017-02-02 17:17:22 UTC (rev 125)
@@ -1,6 +1,6 @@
-Date: 2017-01-29
+Date: 2017-02-02
 Package: CHNOSZ
-Version: 1.0.8-14
+Version: 1.0.8-15
 Title: Chemical Thermodynamics and Activity Diagrams
 Author: Jeffrey Dick
 Maintainer: Jeffrey Dick <j3ffdick at gmail.com>

Modified: pkg/CHNOSZ/R/info.R
===================================================================
--- pkg/CHNOSZ/R/info.R	2017-01-31 15:07:36 UTC (rev 124)
+++ pkg/CHNOSZ/R/info.R	2017-02-02 17:17:22 UTC (rev 125)
@@ -160,7 +160,7 @@
     if(length(approx.species)==1) {
       message("info.approx: '", species, "' is similar to ", info.text(approx.species))
     } else {
-      napprox.max <- 25
+      napprox.max <- 100
       exttext <- ":"
       if(length(approx.species) > napprox.max) exttext <- paste(" (showing first ", napprox.max, ")", sep="")
       message("info.approx: '", species, "' is ambiguous; has approximate matches to ", 

Modified: pkg/CHNOSZ/R/util.units.R
===================================================================
--- pkg/CHNOSZ/R/util.units.R	2017-01-31 15:07:36 UTC (rev 124)
+++ pkg/CHNOSZ/R/util.units.R	2017-02-02 17:17:22 UTC (rev 125)
@@ -11,7 +11,7 @@
   # set the units and return them
   if(units=="bar") with(as.environment("CHNOSZ"), thermo$opt$P.units <- "bar")
   if(units=="mpa") with(as.environment("CHNOSZ"), thermo$opt$P.units <- "MPa")
-  return(get("thermo")$opt$P.units)
+  message("changed pressure units to ", get("thermo")$opt$P.units)
 }
 
 T.units <- function(units=NULL) {
@@ -24,7 +24,7 @@
   # set the units and return them
   if(units=="c") with(as.environment("CHNOSZ"), thermo$opt$T.units <- "C")
   if(units=="k") with(as.environment("CHNOSZ"), thermo$opt$T.units <- "K")
-  return(get("thermo")$opt$T.units)
+  message("changed temperature units to ", get("thermo")$opt$T.units)
 }
 
 E.units <- function(units=NULL) {
@@ -37,7 +37,7 @@
   # set the units and return them
   if(units=="cal") with(as.environment("CHNOSZ"), thermo$opt$E.units <- "cal")
   if(units=="j") with(as.environment("CHNOSZ"), thermo$opt$E.units <- "J")
-  return(get("thermo")$opt$E.units)
+  message("changed energy units to ", get("thermo")$opt$E.units)
 }
 
 outvert <- function(value,units) {

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2017-01-31 15:07:36 UTC (rev 124)
+++ pkg/CHNOSZ/inst/NEWS	2017-02-02 17:17:22 UTC (rev 125)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.0.8-14 (2017-01-29)
+CHANGES IN CHNOSZ 1.0.8-15 (2017-02-02)
 ---------------------------------------
 
 - Add "AA" as a keyword for preset species in basis() (cysteine,
@@ -39,6 +39,8 @@
   message() from base R. As a result, the messages don't appear in Sweave
   vignettes, but can now be turned on or off easily in knitr vignettes.
 
+- Add vignette newintro.Rmd.
+
 CHANGES IN CHNOSZ 1.0.8 (2016-05-28)
 ------------------------------------
 

Modified: pkg/CHNOSZ/tests/testthat/test-info.R
===================================================================
--- pkg/CHNOSZ/tests/testthat/test-info.R	2017-01-31 15:07:36 UTC (rev 124)
+++ pkg/CHNOSZ/tests/testthat/test-info.R	2017-02-02 17:17:22 UTC (rev 125)
@@ -19,7 +19,6 @@
 })
 
 test_that("info.approx() produces expected messages", {
-  expect_message(info.approx("lact"), "showing first 25")
   expect_message(info.approx("lactic"), "is similar to lactic acid")
   expect_message(info.approx("lactic acid"), "is ambiguous")
   # note though that info("lactic acid") finds a match b/c info.character is used first...

Added: pkg/CHNOSZ/vignettes/CHNOSZ.png
===================================================================
(Binary files differ)


Property changes on: pkg/CHNOSZ/vignettes/CHNOSZ.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Modified: pkg/CHNOSZ/vignettes/EOSregress.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/EOSregress.Rmd	2017-01-31 15:07:36 UTC (rev 124)
+++ pkg/CHNOSZ/vignettes/EOSregress.Rmd	2017-02-02 17:17:22 UTC (rev 125)
@@ -5,7 +5,7 @@
 date: "`r Sys.Date()`"
 output:
   tufte::tufte_html:
-    tufte_features: ["background", "italics"]
+    tufte_features: ["background"]
     css: "vig.css"
   tufte::tufte_handout:
     citation_package: natbib
@@ -17,7 +17,7 @@
   %\VignetteIndexEntry{Regressing thermodynamic data}
   %\VignetteEngine{knitr::rmarkdown}
   \usepackage[utf8]{inputenc}
-bibliography: EOSregress.bib
+bibliography: vig.bib
 link-citations: yes
 ---
 

Deleted: pkg/CHNOSZ/vignettes/EOSregress.bib
===================================================================
--- pkg/CHNOSZ/vignettes/EOSregress.bib	2017-01-31 15:07:36 UTC (rev 124)
+++ pkg/CHNOSZ/vignettes/EOSregress.bib	2017-02-02 17:17:22 UTC (rev 125)
@@ -1,108 +0,0 @@
-% Encoding: UTF-8
-
- at Article{HKF81,
-  author     = {Helgeson, Harold C. and Kirkham, David H. and Flowers, George C.},
-  journal    = {American Journal of Science},
-  title      = {{T}heoretical prediction of the thermodynamic behavior of aqueous electrolytes at high pressures and temperatures: {IV}. {C}alculation of activity coefficients, osmotic coefficients, and apparent molal and standard and relative partial molal properties to 600°{C} and 5 {K}b},
-  year       = {1981},
-  volume     = {281},
-  number     = {10},
-  pages      = {1249--1516},
-  doi        = {10.2475/ajs.281.10.1249},
-  size       = {268 p.},
-}
-
- at Article{SSW01,
-  author    = {Schulte, Mitchell D. and Shock, Everett L. and Wood, Robert H.},
-  journal   = {Geochimica et Cosmochimica Acta},
-  title     = {{T}he temperature dependence of the standard-state thermodynamic properties of aqueous nonelectrolytes},
-  year      = {2001},
-  volume    = {65},
-  number    = {21},
-  pages     = {3919--3930},
-  doi       = {10.1016/S0016-7037(01)00717-7},
-}
-
- at Article{SH90,
-  author    = {Shock, Everett L. and Helgeson, Harold C.},
-  journal   = {Geochimica et Cosmochimica Acta},
-  title     = {{C}alculation of the thermodynamic and transport properties of aqueous species at high pressures and temperatures: {S}tandard partial molal properties of organic species},
-  year      = {1990},
-  volume    = {54},
-  number    = {4},
-  pages     = {915 -- 945},
-  doi       = {10.1016/0016-7037(90)90429-O},
-}
-
- at Article{SOJSH92,
-  author    = {Shock, Everett L. and Oelkers, Eric H. and Johnson, James W. and Sverjensky, Dimitri A. and Helgeson, Harold C.},
-  journal   = {Journal of the Chemical Society, Faraday Transactions},
-  title     = {{C}alculation of the thermodynamic properties of aqueous species at high pressures and temperatures: {E}ffective electrostatic radii, dissociation constants, and standard partial molal properties to 1000 °{C} and 5 kbar},
-  year      = {1992},
-  volume    = {88},
-  number    = {6},
-  pages     = {803 -- 826},
-  doi       = {10.1039/FT9928800803},
-}
-
- at Article{TH88,
-  author    = {Tanger, IV, John C. and Helgeson, Harold C.},
-  journal   = {American Journal of Science},
-  title     = {{C}alculation of the thermodynamic and transport properties of aqueous species at high pressures and temperatures: {R}evised equations of state for the standard partial molal properties of ions and electrolytes},
-  year      = {1988},
-  volume    = {288},
-  number    = {1},
-  pages     = {19--98},
-  doi       = {10.2475/ajs.288.1.19},
-}
-
- at Article{HW97,
-  author        = {Hn\v{e}dkovsk\'y, Lubom\'ir and Wood, Robert H.},
-  journal       = {Journal of Chemical Thermodynamics},
-  title         = {{A}pparent molar heat capacities of aqueous solutions of {CH}4, {CO}2, {H}2{S}, and {NH}3 at temperatures from 304 {K} to 704 {K} at a pressure of 28 {MP}a},
-  year          = {1997},
-  volume        = {29},
-  number        = {7},
-  pages         = {731--747},
-  doi           = {10.1006/jcht.1997.0192},
-  issn          = {0021-9614},
-}
-
- at Article{MKDW15,
-  author    = {Miron, George D. and Kulik, Dmitrii A. and Dmytrieva, Svitlana V. and Wagner, Thomas},
-  journal   = {Applied Geochemistry},
-  title     = {{GEMSFITS}: {C}ode package for optimization of geochemical model parameters and inverse modeling},
-  year      = {2015},
-  volume    = {55},
-  number    = {0},
-  pages     = {28 - 45},
-  note      = {Geochemical Speciation Codes and Databases},
-  doi       = {10.1016/j.apgeochem.2014.10.013},
-  issn      = {0883-2927},
-}
-
- at Article{Shv15,
-  author    = {Shvarov, Yuri},
-  journal   = {Applied Geochemistry},
-  title     = {{A} suite of programs, {O}ptim{A}, {O}ptim{B}, {O}ptim{C}, and {O}ptim{S} compatible with the {U}nitherm database, for deriving the thermodynamic properties of aqueous species from solubility, potentiometry and spectroscopy measurements},
-  year      = {2015},
-  volume    = {55},
-  number    = {0},
-  pages     = {17 - 27},
-  note      = {Geochemical Speciation Codes and Databases},
-  doi       = {10.1016/j.apgeochem.2014.11.021},
-  issn      = {0883-2927},
-}
-
- at Article{HWM96,
-  author    = {Hn\v{e}dkovsk\'y, Lubom\'ir and Wood, Robert H. and Majer, Vladimir},
-  journal   = {Journal of Chemical Thermodynamics},
-  title     = {{V}olumes of aqueous solutions of {CH}4, {CO}2, {H}2{S}, and {NH}3 at temperatures from 298.15 {K} to 705 {K} and pressures to 35 {MP}a},
-  year      = {1996},
-  volume    = {28},
-  number    = {2},
-  pages     = {125 -- 142},
-  doi       = {10.1006/jcht.1996.0011},
-  issn      = {0021-9614},
-}
-

Added: pkg/CHNOSZ/vignettes/newintro.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/newintro.Rmd	                        (rev 0)
+++ pkg/CHNOSZ/vignettes/newintro.Rmd	2017-02-02 17:17:22 UTC (rev 125)
@@ -0,0 +1,309 @@
+---
+title: "An Introduction to [CHNOSZ](http://www.chnosz.net)"
+author: "Jeffrey M. Dick"
+date: "`r Sys.Date()`"
+output:
+  tufte::tufte_html:
+    tufte_features: ["background"]
+    css: "vig.css"
+    toc: true
+  tufte::tufte_handout:
+    citation_package: natbib
+    latex_engine: xelatex
+  tufte::tufte_book:
+    citation_package: natbib
+    latex_engine: xelatex
+vignette: >
+  %\VignetteIndexEntry{An Introduction to CHNOSZ}
+  %\VignetteEngine{knitr::rmarkdown}
+  \usepackage[utf8]{inputenc}
+bibliography: vig.bib
+link-citations: yes
+---
+
+```{r options, include=FALSE}
+options(width = 80)
+options(digits = 6)
+```
+
+```{r setup, include=FALSE}
+# invalidate cache when the tufte version changes
+knitr::opts_chunk$set(tidy = FALSE, cache.extra = packageVersion('tufte'))
+options(htmltools.dir.version = FALSE)
+knitr::knit_hooks$set(small.mar = function(before, options, envir) {
+    if (before) par(mar = c(4, 4, .1, .1))  # smaller margin on top and right
+})
+```
+
+# About
+
+This document introduces the basic functionality of CHNOSZ, a package for the [R software environment](http://r-project.org).
+For more information on R, see "An Introduction to R" and other documents in [The R Manuals](http://cran.r-project.org/manuals.html).
+
+Since 2006, CHNOSZ has been developed to support a research project on the thermodynamic properties of proteins.
+Over time, the package has grown to calculate thermodynamic properties of reactions and to construct equilibrium chemical activity diagrams for both inorganic and organic systems.
+Development since 2009 has focused on the calculation of chemical affinities and metastable equilibrium for large numbers of proteins with applications to -omic (metagenomic and proteomic) data in various environments.
+Nevertheless, the database and functions are flexible, allowing one to model the relative stabilities of proteins, minerals or aqueous species using similar commands.
+
+## Installing and loading CHNOSZ
+
+If you have just installed R for the first time, and you have an internet connection, installing CHNOSZ should be as simple as selecting the "Install packages from CRAN" or similar menu item in the R GUI or using the following command to start the package installation process:^[Or, install the package from a local package file, which you can download from [CRAN](http://cran.r-project.org) or from the [CHNOSZ website](http://chnosz.net).
+][]()
+```{r install_CHNOSZ, eval=FALSE}
+install.packages("CHNOSZ")
+```
+
+Then load the CHNOSZ package to make its functions available in your working session.
+```{r library_CHNOSZ}
+library(CHNOSZ)
+```
+
+Then load the thermo object, which contains the thermodynamic database and is also where your system settings will be stored.
+```{r data_thermo}
+data(thermo)
+```
+
+## Organization of major functions
+
+CHNOSZ is made up of a set of functions and supporting datasets.
+The major components of the package are shown in the figure below, which is an updated version of the flowchart from @Dic08 (boxes – functions; ellipses – datasets; bold text – major user functions).
+![CHNOSZ flowchart](CHNOSZ.png)
+
+Many functions in CHNOSZ have no side effects.
+That is, the function only returns a result; to use the result in other functions, it can be assigned to a variable with `<-`.
+Major functions without side effects in CHNOSZ are:
+
+* `info()`: search for species in the thermodynamic database
+* `subcrt()`: calculate the thermodynamic properties of species and reactions
+* `affinity()`: calculate the affinities of formation reactions using given chemical activities
+* `equilibrate()`: calculate the equilibrium chemical activities of the species of interest
+* `diagram()`: plot the results
+
+Some functions in CHNOSZ do have side effects: they modify the `thermo` data object in the current R session.
+In the text (not code) of this document, the names of these functions are shown in <span style="color:red">red</span>.
+The major functions with side effects are:
+
+* <span style="color:red">`basis()`</span>: set the basis species and their chemical activities
+* <span style="color:red">`species()`</span>: set the species of interest and their (non-equilibrium) chemical activities
+* <span style="color:red">`data(thermo)`</span>: reset the database, restoring all settings to their default values.
+
+The following pseudocode shows a common sequence of commands.
+In actual usage, the ... are replaced by arguments that define the chemical makeup and range of conditions of the system:
+```{r, eval=FALSE}
+basis(...)
+species(...)
+a <- affinity(...)
+e <- equilibrate(a)  ## optional
+diagram(e)           ## or diagram(a)
+data(thermo)         ## clear system settings
+```
+
+Some experimental functions are available:
+
+* (**experimental**) using `revisit()` to calculate/plot summary statistics of the chemical activities of the species of interest and `findit()` to search for combinations of activities of basis species, temperature and/or pressure that optimize those statistics.
+
+# Thermodynamic database and chemical formulas
+
+While an attempt has been made to provide a primary database (`OBIGT.csv`) that is generally internally consistent, all thermodynamic data, calculations, and examples are provided *as is*.^[
+For crucial problems, check not only the accuracy of the database, but also the *suitability of the data* for your problem.
+If there is any doubt about the suitability of data, please consult the primary sources (which can be located using `browse.refs()`; see Section XXX).
+As with the data, please check the *suitability and accuracy of the available computational techniques*, at least by comparing the construction and output of the examples to the primary sources cited in each help page.
+Some examples without references demonstrate the more experimental features of CHNOSZ. 
+]
+Where possible, data with known or suspected inconsistencies have been placed into a secondary database (`OBIGT-2.csv`) that should be regarded as experimental.
+
+## The `info()` function
+
+The `info()` function provides an interface to the thermodynamic database packaged with CHNOSZ.
+Suppose you are interested in the thermodynamic properties aqueous ethylene.
+You can search for the species by name:
+```{r info_ethylene}
+info("ethylene")
+```
+
+Multiple entries exist for ethylene; the index of the `aq` (aqueous) species is returned by default.
+A second argument can be used to specify a different physical state:
+```{r info_ethylene_gas}
+info("ethylene", "gas")
+```
+
+Knowing that aqueous ethylene is species number 88 in the database, you can again use `info()` to retrieve the set of standard molal thermodynamic properties and equations of state parameters:
+```{r info_88}
+info(88)
+```
+
+This number can be used as an argument (`ispecies`) for other functions in CHNOSZ to uniquely identify any species; some commonly used functions also accept the species names.
+Liquid water is species number 1; it has NA entries in the database because specialized functions are used to compute its properties:
+```{r info_info_water}
+info(info("water"))
+```
+
+## Fuzzy searches
+
+Calling `info()` with a string that does not exactly match the name of any species invokes a fuzzy search of the database:
+```{r width180, include=FALSE}
+options(width = 180)
+```
+```{r info_acid}
+info("acid")
+```
+```{r width80, include=FALSE}
+options(width = 80)
+```
+
+The message includes e.g. "uracil" and "metacinnabar" because their names have some similarity to the search term.
+
+As "ribose" is the name of a species in the database, to find species with similar names, add an extra character to the search:
+```{r info_ribose}
+info(" ribose")
+```
+
+The messages may be useful for browsing the database, but owing to their ambiguous results, these fuzzy searches return an `NA` value for the species index.
+
+## Counting elements, chemical formulas, `ZC()`
+
+Continuing with the example of ethylene, let's look at its chemical formula:
+```{r info_88_formula}
+info(88)$formula
+```
+
+We can use the `makeup()` function to count the elements in the formula, followed by `as.chemical.formula()` to return to the formula:
+```{r makeup_88}
+makeup(88)
+as.chemical.formula(makeup(88))
+```
+
+For organic species, a simple calculation of the average oxidation state of carbon ($Z_C$) is possible given the species index, chemical formula, or elemental count:
+```{r ZC_88}
+ZC(88)
+ZC(info(88)$formula)
+ZC(makeup(88))
+```
+
+# Calculating thermodynamic properties
+
+To calculate the standard molal properties of species and reactions, use `subcrt()`.^[
+The inspiration for this function (as well as its name), and the source of the FORTRAN subroutine used to calculate the thermodynamic properties of H<sub>2</sub>O, is SUPCRT (Johnson et al. 1992).]<sup> [- at JOH92]</sup>
+If no reaction coefficients are given, `subcrt()` calculates the standard molal properties of invididual species:
+```{r subcrt_water}
+subcrt("water")
+```
+
+That uses the default temperature and pressure settings: equally-spaced temperature grid from 0 to 350 °C at _P_<sub>sat</sub>.^[_P_<sub>sat</sub> is 1 bar below 100 °C, or the pressure of liquid-vapor coexistence at higher temperatures.]
+The columns in the output are^[The corresponding units are °C (`T`), bar (`P`), g cm<sup>-3</sup> (`rho`), cal mol<sup>-1</sup> (`G` and `H`), cal K<sup>-1</sup> mol<sup>-1</sup> (`S`), cm<sup>3</sup> mol<sup>-1</sup> (`V`), and cal K<sup>-1</sup> mol<sup>-1</sup> (`Cp`).] temperature, pressure, density of water, logarithm of the equilibrium constant (only meaningful for reactions; see below), standard molal Gibbs energy and enthalpy of formation from the elements, standard molal entropy, volume, and heat capacity.
+
+A custom temperature-pressure grid can be specified.
+Here, we calculate the properties of H<sub>2</sub>O on a _T_,_P_ grid in the supercritical region, with conditions grouped by pressure:
+```{r subcrt_water_grid}
+subcrt("water", T=c(400, 500, 600), P=c(200, 400, 600), grid="P")$out$water
+```
+
+```{r subcrt_water_plot, fig.margin=TRUE, fig.width=4, fig.height=4, small.mar=TRUE, dpi=50, out.width="100%", echo=FALSE, message=FALSE, fig.cap="Isothermal contours of density (g cm<sup>-3</sup>) and pressure (bar) of H<sub>2</sub>O.", cache=TRUE}
+H2O <- subcrt("water", T=seq(0, 1000, 100), P=c(NA, seq(1, 500, 1)), grid="T")
+H2O <- H2O$out$water
+plot(H2O$P, H2O$rho, type="l")
+```
+The additional operations (`$out$water`) are used to extract a specific part of the results; this can be used with e.g. `write.table()` or `plot()` for further processing:
+```{r subcrt_water_plot, eval=FALSE}
+```
+
+## Changing units
+
+The default units of temperature, pressure, and energy are °C, bar, and calories.
+The functions <span style="color:red">`T.units()`</span>, <span style="color:red">`P.units()`</span>, and <span style="color:red">`E.units()`</span> can be used to change the units used by various functions in CHNOSZ.
+What is the Gibbs energy (J/mol) of aqueous methane at 298.15 K and 0.1 MPa?
+```{r methane_units, message=FALSE}
+T.units("K")
+P.units("MPa")
+E.units("J")
+subcrt("methane", T=298.15, P=0.1)$out$methane$G
+data(thermo)  ## restore default settings
+```
+
+A related function, `convert()`, can be used to convert given values between units.
+Let's convert the standard Gibbs energy of aqueous methane listed in the database from cal/mol to J/mol:
+```{r methane_G, message=FALSE}
+convert(info(info("methane"))$G, "J")
+```
+
+As expected, we get the same result from both operations.
+
+# Properties of reactions
+
+## Reaction definitions
+
+To calculate the thermodynamic properties of reactions, give the names of species, the physical states (optional), and reaction coefficients as the arguments to `subcrt()`.
+Here we calculate properties for the dissolution of CO<sub>2</sub>:
+```{r CO2_dissolution}
+subcrt(c("CO2", "CO2"), c("gas", "aq"), c(-1, 1))
+```
+
+<p> <!--- needed to make the citation appear correction 20170202 -->
+In order to make a plot like that shown by Manning et al. [- at MSS13, Figure 18], let's run more calculations and store the results.
+In addition to the reaction definition, we specify a greater number of temperature points than the default:
+```{r dissolution, echo=FALSE, message=FALSE}
+T <- seq(0, 350, 10)
+CO2 <- subcrt(c("CO2", "CO2"), c("gas", "aq"), c(-1, 1), T=T)$out$logK
+CO <- subcrt(c("CO", "CO"), c("gas", "aq"), c(-1, 1), T=T)$out$logK
+CH4 <- subcrt(c("CH4", "CH4"), c("gas", "aq"), c(-1, 1), T=T)$out$logK
+logK <- data.frame(T, CO2, CO, CH4)
+```
+```{r dissolution_plot, fig.margin=TRUE, fig.width=4, fig.height=4, small.mar=TRUE, dpi=50, out.width="100%", echo=FALSE, message=FALSE, fig.cap="Equilibrium constants calculated for dissolution of CO<sub>2</sub>, CO, and CH<sub>4</sub>.", cache=TRUE}
+matplot(logK[, 1], logK[, -1], type="l",
+        xlab=axis.label("T"), ylab=axis.label("logK"))
+```
+```{r dissolution, eval=FALSE}
+```
+
+Now we can make the plot.
+Here, the `axis.label()` function of CHNOSZ is used to create formatted axis labels:
+```{r dissolution_plot, eval=FALSE}
+```
+
+## Unbalanced reactions
+
+## Setting the basis species
+
+## Auto-balancing reactions
+
+# Basic diagrams
+
+## Setting the species of interest
+
+## Thermodynamic potential: `affinity()`
+
+## Predominance: the `diagram()` function
+
+## Labels, colors, etc.
+
+# Equilibration
+
+## Getting from affinity to equilibrium
+
+## Setting the constraints
+
+# Other things you can do with affinity
+
+## Buffers
+
+## T-, P-, activity-transect
+
+# Other things you can do with equilibrate
+
+## Choosing different balancing constraints
+
+# Other things you can do with diagrams
+
+## Mosaic diagrams
+
+## Groups of species
+
+# Proteins
+
+## Group additivity
+
+## Sources of amino acid data
+
+## Ionization
+
+## Normalizing for different lengths

Modified: pkg/CHNOSZ/vignettes/vig.bib
===================================================================
--- pkg/CHNOSZ/vignettes/vig.bib	2017-01-31 15:07:36 UTC (rev 124)
+++ pkg/CHNOSZ/vignettes/vig.bib	2017-02-02 17:17:22 UTC (rev 125)
@@ -299,6 +299,18 @@
   url =           {http://www.worldcat.org/oclc/583263}
 }
 
+ at Article{HKF81,
+  author     = {Helgeson, Harold C. and Kirkham, David H. and Flowers, George C.},
+  journal    = {American Journal of Science},
+  title      = {{T}heoretical prediction of the thermodynamic behavior of aqueous electrolytes at high pressures and temperatures: {IV}. {C}alculation of activity coefficients, osmotic coefficients, and apparent molal and standard and relative partial molal properties to 600°{C} and 5 {K}b},
+  year       = {1981},
+  volume     = {281},
+  number     = {10},
+  pages      = {1249--1516},
+  doi        = {10.2475/ajs.281.10.1249},
+  size       = {268 p.},
+}
+
 @Article{HFG+03,
   author =        {Huh, Won-Ki and Falvo, James V. and Gerke, Luke C. and Carroll, Adam S. and Howson, Russell W. and Weissman, Jonathan S. and O'Shea, Erin K.},
   journal =       {Nature},
@@ -324,7 +336,7 @@
 @Article{JOH92,
   author    = {Johnson, James W. and Oelkers, Eric H. and Helgeson, Harold C.},
   journal   = {Computers \& Geosciences},
-  title     = {{SUPCRT}92: {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$^\circ${C}},
+  title     = {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°C},
   year      = {1992},
   volume    = {18},
   number    = {7},
@@ -342,6 +354,17 @@
   doi           = {10.1016/j.gca.2011.11.041},
 }
 
+ at Article{MSS13,
+  author    = {Manning, Craig E. and Shock, Everett L. and Sverjensky, Dimitri A.},
+  journal   = {Reviews in Mineralogy and Geochemistry},
+  title     = {The chemistry of carbon in aqueous fluids at crustal and upper-mantle conditions: Experimental and theoretical constraints},
+  year      = {2013},
+  volume    = {75},
+  number    = {1},
+  pages     = {109-148},
+  doi       = {10.2138/rmg.2013.75.5},
+}
+
 @Article{MIS+08,
   author =        {Markowitz, Victor M. and Ivanova, Natalia N. and Szeto, Ernest and Palaniappan, Krishna and Chu, Ken and Dalevi, Daniel and Chen, I-Min A. and Grechkin, Yuri and Dubchak, Inna and Anderson, Iain and Lykidis, Athanasios and Mavromatis, Konstantinos and Hugenholtz, Philip and Kyrpides, Nikos C.},
   journal =       {Nucleic Acids Research},
@@ -469,6 +492,17 @@
   doi =           {10.1007/BF01581580},
 }
 
+ at Article{SSW01,
+  author    = {Schulte, Mitchell D. and Shock, Everett L. and Wood, Robert H.},
+  journal   = {Geochimica et Cosmochimica Acta},
+  title     = {{T}he temperature dependence of the standard-state thermodynamic properties of aqueous nonelectrolytes},
+  year      = {2001},
+  volume    = {65},
+  number    = {21},
+  pages     = {3919--3930},
+  doi       = {10.1016/S0016-7037(01)00717-7},
+}
+
 @Article{See96,
   author =        {Seewald, Jeffrey S.},
   journal =       {Materials Research Society Symposium Proceedings},
@@ -504,6 +538,17 @@
   doi       = {10.1016/0016-7037(90)90429-O},
 }
 
+ at Article{SOJSH92,
+  author    = {Shock, Everett L. and Oelkers, Eric H. and Johnson, James W. and Sverjensky, Dimitri A. and Helgeson, Harold C.},
+  journal   = {Journal of the Chemical Society, Faraday Transactions},
+  title     = {{C}alculation of the thermodynamic properties of aqueous species at high pressures and temperatures: {E}ffective electrostatic radii, dissociation constants, and standard partial molal properties to 1000 °{C} and 5 kbar},
+  year      = {1992},
+  volume    = {88},
+  number    = {6},
+  pages     = {803 -- 826},
+  doi       = {10.1039/FT9928800803},
+}
+
 @Article{SWM+05,
   author =        {Spear, John R. and Walker, Jeffrey J. and McCollom, Thomas M. and Pace, Norman R.},
   journal =       {Proceedings of the National Academy of Sciences of the United States of America},
@@ -536,6 +581,17 @@
   doi =           {10.1016/S0016-7037(01)00705-0},
 }
 
+ at Article{TH88,
+  author    = {Tanger, IV, John C. and Helgeson, Harold C.},
+  journal   = {American Journal of Science},
+  title     = {{C}alculation of the thermodynamic and transport properties of aqueous species at high pressures and temperatures: {R}evised equations of state for the standard partial molal properties of ions and electrolytes},
+  year      = {1988},
+  volume    = {288},
+  number    = {1},
+  pages     = {19--98},
+  doi       = {10.2475/ajs.288.1.19},
+}
+
 @Article{WJD58,
   author =        {White, W. B. and Johnson, S. M. and Dantzig, G. B.},
   journal =       {Journal of Chemical Physics},
@@ -573,3 +629,53 @@
   issn =          {1474-760X},
 }
 
+ at Article{HW97,
+  author    = {Hn\v{e}dkovsk\'y, Lubom\'ir and Wood, Robert H.},
+  journal   = {Journal of Chemical Thermodynamics},
+  title     = {{A}pparent molar heat capacities of aqueous solutions of {CH}4, {CO}2, {H}2{S}, and {NH}3 at temperatures from 304 {K} to 704 {K} at a pressure of 28 {MP}a},
+  year      = {1997},
+  volume    = {29},
+  number    = {7},
+  pages     = {731--747},
+  doi       = {10.1006/jcht.1997.0192},
+  issn      = {0021-9614},
+}
+
+ at Article{MKDW15,
+  author    = {Miron, George D. and Kulik, Dmitrii A. and Dmytrieva, Svitlana V. and Wagner, Thomas},
+  journal   = {Applied Geochemistry},
+  title     = {{GEMSFITS}: {C}ode package for optimization of geochemical model parameters and inverse modeling},
+  year      = {2015},
+  volume    = {55},
+  number    = {0},
+  pages     = {28 - 45},
+  note      = {Geochemical Speciation Codes and Databases},
+  doi       = {10.1016/j.apgeochem.2014.10.013},
+  issn      = {0883-2927},
+}
+
+ at Article{Shv15,
+  author    = {Shvarov, Yuri},
+  journal   = {Applied Geochemistry},
+  title     = {{A} suite of programs, {O}ptim{A}, {O}ptim{B}, {O}ptim{C}, and {O}ptim{S} compatible with the {U}nitherm database, for deriving the thermodynamic properties of aqueous species from solubility, potentiometry and spectroscopy measurements},
+  year      = {2015},
+  volume    = {55},
+  number    = {0},
+  pages     = {17 - 27},
+  note      = {Geochemical Speciation Codes and Databases},
+  doi       = {10.1016/j.apgeochem.2014.11.021},
+  issn      = {0883-2927},
+}
+
+ at Article{HWM96,
+  author    = {Hn\v{e}dkovsk\'y, Lubom\'ir and Wood, Robert H. and Majer, Vladimir},
+  journal   = {Journal of Chemical Thermodynamics},
+  title     = {{V}olumes of aqueous solutions of {CH}4, {CO}2, {H}2{S}, and {NH}3 at temperatures from 298.15 {K} to 705 {K} and pressures to 35 {MP}a},
+  year      = {1996},
+  volume    = {28},
+  number    = {2},
+  pages     = {125 -- 142},
+  doi       = {10.1006/jcht.1996.0011},
+  issn      = {0021-9614},
+}
+

Modified: pkg/CHNOSZ/vignettes/vig.css
===================================================================
--- pkg/CHNOSZ/vignettes/vig.css	2017-01-31 15:07:36 UTC (rev 124)
+++ pkg/CHNOSZ/vignettes/vig.css	2017-02-02 17:17:22 UTC (rev 125)
@@ -1,5 +1,26 @@
-html { font-size: 14px; }
+html { 
+  font-size: 14px;
+}
 
-body { font-family: ‘Times New Roman’, Times, serif; }
+body {
+  font-family: ‘Times New Roman’, Times, serif;
+}
 
-li { padding: 0.25rem 0; }
+li {
+  padding: 0.25rem 0;
+}
+
+/* zero margin around pre blocks (looks more like R console output) */
+pre {
+  margin-top: 0;
+  margin-bottom: 0;
+}
+
+/* for CHNOSZ links */
+h1 a:link {
+  color: red;
+}
+
+h3 a:link {
+    color: red;
+}



More information about the CHNOSZ-commits mailing list