[CHNOSZ-commits] r367 - in pkg/CHNOSZ: . R inst man vignettes
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jan 24 13:36:38 CET 2019
Author: jedick
Date: 2019-01-24 13:36:38 +0100 (Thu, 24 Jan 2019)
New Revision: 367
Modified:
pkg/CHNOSZ/DESCRIPTION
pkg/CHNOSZ/R/diagram.R
pkg/CHNOSZ/inst/NEWS
pkg/CHNOSZ/man/mosaic.Rd
pkg/CHNOSZ/vignettes/anintro.Rmd
pkg/CHNOSZ/vignettes/vig.bib
Log:
anintro.Rmd: add section on solubility calculations
Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION 2019-01-24 01:45:17 UTC (rev 366)
+++ pkg/CHNOSZ/DESCRIPTION 2019-01-24 12:36:38 UTC (rev 367)
@@ -1,6 +1,6 @@
-Date: 2019-01-23
+Date: 2019-01-24
Package: CHNOSZ
-Version: 1.1.3-74
+Version: 1.1.3-75
Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry
Authors at R: c(
person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"),
Modified: pkg/CHNOSZ/R/diagram.R
===================================================================
--- pkg/CHNOSZ/R/diagram.R 2019-01-24 01:45:17 UTC (rev 366)
+++ pkg/CHNOSZ/R/diagram.R 2019-01-24 12:36:38 UTC (rev 367)
@@ -325,6 +325,11 @@
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]
+ # if we're adding to a plot, don't take values that are above the top of this plot
+ if(add) {
+ this.ylim <- par("usr")[3:4]
+ myvals[myvals > this.ylim[1] + 0.95*diff(this.ylim)] <- this.ylim[1]
+ }
# the starting x-adjustment
thisadj <- alladj[i]
# if this line has any of the overall maximum values, use only those values
Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS 2019-01-24 01:45:17 UTC (rev 366)
+++ pkg/CHNOSZ/inst/NEWS 2019-01-24 12:36:38 UTC (rev 367)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.1.3-72 (2019-01-23)
+CHANGES IN CHNOSZ 1.1.3-75 (2019-01-24)
---------------------------------------
BUG FIXES
@@ -77,8 +77,9 @@
2009). This depends on the revised nonideal() and new NaCl() functions
described above.
-- anintro.Rmd: add cuprite to mosaic diagram example, and note about
- implications of changing balance to 1.
+- anintro.Rmd: add section on solubility calculations. Also, add
+ cuprite to mosaic diagram example, and note about implications of
+ changing balance to 1.
- Add demo/bison.R (average oxidation state of carbon of metagenome-
derived proteins in different microbial phyla at Bison Pool)
Modified: pkg/CHNOSZ/man/mosaic.Rd
===================================================================
--- pkg/CHNOSZ/man/mosaic.Rd 2019-01-24 01:45:17 UTC (rev 366)
+++ pkg/CHNOSZ/man/mosaic.Rd 2019-01-24 12:36:38 UTC (rev 367)
@@ -28,8 +28,8 @@
The first species listed in \code{bases} should be in the current basis definition.
The arguments in \code{...} are passed to \code{affinity} to specify the conditions.
If \code{blend} is FALSE (the default), the function returns the affinities calculated using the single predominant basis species in \code{bases} at each condition.
-If \code{blend} is TRUE, the function combines the affinities of the formation reactions weighted by the relative abundances of the basis species at each condition.
-This tends to produce curved boundaries.
+If \code{blend} is TRUE, the function combines the affinities of the formation reactions in proportion to the relative abundances of the basis species at each condition, including a term to account for the Gibbs energy of mixing.
+See the second example in \code{\link{solubility}} for a numerical test of the calculations using \code{blend}.
The basis species listed in \code{bases} should all be related to the first basis species there (i.e. all share the same element).
A second, independent set of basis species can be provided in \code{bases2} (for example \samp{CO3-2}, \samp{HCO3-}, \samp{CO2}, if the first set of basis species are the sulfur-bearing ones listed above).
Modified: pkg/CHNOSZ/vignettes/anintro.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/anintro.Rmd 2019-01-24 01:45:17 UTC (rev 366)
+++ pkg/CHNOSZ/vignettes/anintro.Rmd 2019-01-24 12:36:38 UTC (rev 367)
@@ -390,7 +390,7 @@
Here we calculate properties for the dissolution of CO<sub>2</sub>:
```{marginfigure}
Because of aqueous speciation, this doesn't give the _solubility_ of CO<sub>2</sub>.
-For an example of a solubility calculation, see [<span style="color:blue">`demo(solubility)`</span>](../demo), which is based on a figure in Manning et al. (2013).
+Some examples of solubility calculations are in [<span style="color:blue">`demo(solubility)`</span>](../demo) ([see below](#complete-equilibrium-solubility)).
```
```{r subcrt_CO2}
subcrt(c("CO2", "CO2"), c("gas", "aq"), c(-1, 1), T = seq(0, 250, 50))
@@ -926,12 +926,41 @@
```{r bjerrum_diagram, echo=12:13, eval=FALSE}
```
-The possible reactions between species are all balanced on 1 C.
-Therefore, although pH alters the total activity of C, in a system with ideal mixing the total activity of C doesn't affect the relative activities of these species.
-```{marginfigure}
-See [<span style="color:blue">`demo(solubility)`</span>](../demo) for calculations of the total activity of C in equilibrium with either CO<sub>2(<i>gas</i>)</sub> or calcite.
+## Complete equilibrium: Solubility
+
+It is important to remember that <span style="color:green">`equilibrate()`</span> calculates an equilibrium distribution of species for a given total activity of the conserved basis species.
+For instance, the previous diagram shows the relative abundances of CO<sub>2</sub>, HCO<sub>3</sub><sup>-</sup>, and CO<sub>3</sub><sup>-2</sup> as a function of pH assuming that the possible reactions between species are all balanced on 1 C and the total activity of C is constant.
+Although this assumption of metastable equilibrium is useful for making many types of diagrams for aqueous species, the aqueous solutions would not be in equilibrium with other phases, including gases or solids such as carbon dioxide or calcite.
+
+Moving away from metastable equilibrium to complete equilibrium actually involves a simplification of the computations.
+Instead of finding the activities of aqueous species where the affinities of formation reactions are equal to each other, equilibrium corresponds to the configuration where the affinities are equal to zero.
+However, this simplification comes with a different constraint: the reactions should be balanced on something that anchors them to a real quantity.
+It makes sense to think of this quantity as a conserved basis species (one that is present in the formation reactions of all species considered), which corresponds to a pure substance that is being dissolved.
+
+The <span style="color:green">`solubility()`</span> function provides a way to compute activities of aqueous species in equilibrium with a solid or gas, which is usually defined as the first basis species.
+The following example for corundum (Al<sub>2</sub>O<sub>3</sub>) is based on Figure 15 of @Man13.
+Corundum is set as the first basis species, and the formed species all contain Al.
+The affinities of the formation reactions, for any given activities of the species, but unit activity of the solid basis species (corundum), are input to <span style="color:green">`solubility()`</span>.
+An additional argument, `in.terms.of`, is used to compute the total molality of Al in solution, that is, twice the number of moles of Al<sub>2</sub>O<sub>3</sub> that are dissolved.
+<span style="color:green">`diagram()`</span> is used twice, first to plot the total molality of Al, then the concentrations of the individual species, using `adj` and `dy` to adjust the positions of labels in the *x*- and *y*-directions.
+Note that setting `IS` to 0 in <span style="color:green">`affinity()`</span> has no effect on the calculations, but signals <span style="color:green">`diagram()`</span> to label the *y* axis with logarithm of molality instead of logarithm of activity.
+
+```{r corundum, fig.margin=TRUE, fig.width=4, fig.height=4, dpi=dpi, out.width="100%", results="hide", message=FALSE, cache=TRUE, fig.cap="Solubility of corundum (green line) and equilibrium concentrations of aqueous species (black lines).", pngquant=pngquant, timeit=timeit}
+basis(c("corundum", "H2O", "H+", "O2"))
+species(c("Al+3", "AlO2-", "AlOH+2", "AlO+", "HAlO2"))
+a <- affinity(pH = c(0, 10), IS = 0)
+s <- solubility(a, in.terms.of = "Al+3")
+diagram(s, type = "loga.balance", ylim = c(-10, 0), lwd = 4, col = "green3")
+diagram(s, add = TRUE, adj = c(0, 1, 2.1, -0.2, -1.5), dy = c(0, 0, 4, -0.3, 0.1))
+legend("topright", c("25 °C", "1 bar"), text.font = 2, bty = "n")
```
+Other examples of using <span style="color:green">`solubility()`</span> are available in CHNOSZ.
+See [<span style="color:blue">`demo(solubility)`</span>](../demo) for calculations of the solubility of CO<sub>2(<i>gas</i>)</sub> and calcite as a function of pH and temperature.
+The calculation assumes the stoichiometric dissolution of calcite, in which CaCO<sub>3</sub> dissociates to form equal quantities of Ca<sup>+2</sup> and CO<sub>3</sub><sup>-2</sup> ions.
+Adding in activity coefficients, a different example in <span style="color:blue">`?solubility`</span> uses the `find.IS` option to find the final ionic strength for dissolving calcite into pure water.
+[<span style="color:blue">`demo(gold)`</span>](../demo) shows calculations of the solubility of gold as a function of pH and *T* as well as oxygen fugacity set by diferent mineral buffers, and considers ionic strength effects on activity coefficients, so that activities are transformed to molalities ([see below](#transformation-of-variables)).
+
## Groups of species
Sometimes it is helpful to look at the summed activities of species as groups on species distribution diagrams.
@@ -2165,9 +2194,10 @@
```{marginfigure}
<span style="color:green">`browse.refs()`</span> was renamed to <span style="color:green">`thermo.refs()`</span> in 2017.
```
-* 2012-06-16 Add “More activity diagrams”.
+* 2012-06-16 Add "More activity diagrams".
* 2015-05-14 Add warning about internal consistency of thermodynamic data.
* 2017-02-15 Completely rewritten; switch from Sweave to knitr (Tufte style).
+* 2019-01-24 Add section on solubility calculations.
View the R Markdown source of this document [on R-Forge](https://r-forge.r-project.org/scm/viewvc.php/pkg/CHNOSZ/vignettes/anintro.Rmd?view=markup&root=chnosz) or in R:
Modified: pkg/CHNOSZ/vignettes/vig.bib
===================================================================
--- pkg/CHNOSZ/vignettes/vig.bib 2019-01-24 01:45:17 UTC (rev 366)
+++ pkg/CHNOSZ/vignettes/vig.bib 2019-01-24 12:36:38 UTC (rev 367)
@@ -21,23 +21,23 @@
}
@Article{AH00,
- author = {Amend, Jan P. and Helgeson, Harold C.},
- journal = {Biophysical Chemistry},
- title = {{C}alculation of the standard molal thermodynamic properties of aqueous biomolecules at elevated temperatures and pressures. {II}. {U}nfolded proteins},
- year = {2000},
- volume = {84},
- number = {2},
- pages = {105--136},
- doi = {10.1016/S0301-4622(00)00116-2},
+ author = {Amend, Jan P. and Helgeson, Harold C.},
+ journal = {Biophysical Chemistry},
+ title = {{C}alculation of the standard molal thermodynamic properties of aqueous biomolecules at elevated temperatures and pressures. {II}. {U}nfolded proteins},
+ year = {2000},
+ volume = {84},
+ number = {2},
+ pages = {105--136},
+ doi = {10.1016/S0301-4622(00)00116-2},
}
@Book{BPJ85,
- author = {Bard, A. J. and Parsons, R. and Jordan, J.},
- publisher = {M. Dekker},
- title = {Standard Potentials in Aqueous Solution},
- year = {1985},
- address = {New York},
- url = {http://www.worldcat.org/oclc/12106344},
+ author = {Bard, A. J. and Parsons, R. and Jordan, J.},
+ publisher = {M. Dekker},
+ title = {{S}tandard {P}otentials in {A}queous {S}olution},
+ year = {1985},
+ address = {New York},
+ url = {http://www.worldcat.org/oclc/12106344},
}
@Article{DLE64,
@@ -78,7 +78,7 @@
@Article{Dic09,
author = {Dick, Jeffrey M.},
journal = {BMC Systems Biology},
- title = {Calculation of the relative metastabilities of proteins in subcellular compartments of \emph{{S}accharomyces cerevisiae}},
+ title = {{C}alculation of the relative metastabilities of proteins in subcellular compartments of \emph{Saccharomyces cerevisiae}},
year = {2009},
volume = {3},
pages = {75},
@@ -117,7 +117,7 @@
@Article{DS11,
author = {Dick, Jeffrey M. and Shock, Everett L.},
journal = {PLoS ONE},
- title = {Calculation of the relative chemical stabilities of proteins as a function of temperature and redox chemistry in a hot spring},
+ title = {{C}alculation of the relative chemical stabilities of proteins as a function of temperature and redox chemistry in a hot spring},
year = {2011},
volume = {6},
number = {8},
@@ -203,14 +203,14 @@
}
@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°{C}},
- year = {1992},
- volume = {18},
- number = {7},
- pages = {899--947},
- doi = {10.1016/0098-3004(92)90029-Q},
+ 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°{C}},
+ year = {1992},
+ volume = {18},
+ number = {7},
+ pages = {899--947},
+ doi = {10.1016/0098-3004(92)90029-Q},
}
@Article{LD12,
@@ -224,36 +224,36 @@
}
@Article{LH06a,
- author = {LaRowe, Douglas E. and Helgeson, Harold C.},
- journal = {Geochimica et Cosmochimica Acta},
- title = {{B}iomolecules in hydrothermal systems: {C}alculation of the standard molal thermodynamic properties of nucleic-acid bases, nucleosides, and nucleotides at elevated temperatures and pressures},
- year = {2006},
- volume = {70},
- number = {18},
- pages = {4680--4724},
- doi = {10.1016/j.gca.2006.04.010},
+ author = {LaRowe, Douglas E. and Helgeson, Harold C.},
+ journal = {Geochimica et Cosmochimica Acta},
+ title = {{B}iomolecules in hydrothermal systems: {C}alculation of the standard molal thermodynamic properties of nucleic-acid bases, nucleosides, and nucleotides at elevated temperatures and pressures},
+ year = {2006},
+ volume = {70},
+ number = {18},
+ pages = {4680--4724},
+ doi = {10.1016/j.gca.2006.04.010},
}
@Article{LH06b,
- author = {LaRowe, Douglas E. and Helgeson, Harold C.},
- journal = {Thermochimica Acta},
- title = {{T}he energetics of metabolism in hydrothermal systems: {C}alculation of the standard molal thermodynamic properties of magnesium-complexed adenosine nucleotides and {NAD} and {NADP} at elevated temperatures and pressures},
- year = {2006},
- volume = {448},
- number = {2},
- pages = {82--106},
- doi = {10.1016/j.tca.2006.06.008},
+ author = {LaRowe, Douglas E. and Helgeson, Harold C.},
+ journal = {Thermochimica Acta},
+ title = {{T}he energetics of metabolism in hydrothermal systems: {C}alculation of the standard molal thermodynamic properties of magnesium-complexed adenosine nucleotides and {NAD} and {NADP} at elevated temperatures and pressures},
+ year = {2006},
+ volume = {448},
+ number = {2},
+ pages = {82--106},
+ doi = {10.1016/j.tca.2006.06.008},
}
@Article{MSS13,
- author = {Manning, Craig E. and Shock, Everett L. and Sverjensky, Dimitri A.},
- journal = {Reviews in Mineralogy and Geochemistry},
- title = {{T}he chemistry of carbon in aqueous fluids at crustal and upper-mantle conditions: {E}xperimental and theoretical constraints},
- year = {2013},
- volume = {75},
- number = {1},
- pages = {109--148},
- doi = {10.2138/rmg.2013.75.5},
+ author = {Manning, Craig E. and Shock, Everett L. and Sverjensky, Dimitri A.},
+ journal = {Reviews in Mineralogy and Geochemistry},
+ title = {{T}he chemistry of carbon in aqueous fluids at crustal and upper-mantle conditions: {E}xperimental and theoretical constraints},
+ year = {2013},
+ volume = {75},
+ number = {1},
+ pages = {109--148},
+ doi = {10.2138/rmg.2013.75.5},
}
@InProceedings{NPW_79,
@@ -428,14 +428,14 @@
}
@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 = {Calculation 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},
+ 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{SS98,
@@ -483,14 +483,14 @@
}
@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},
+ 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{WP02,
@@ -517,15 +517,15 @@
}
@Article{WE08,
- author = {Wu, Martin and Eisen, Jonathan A.},
- journal = {Genome Biology},
- title = {A simple, fast, and accurate method of phylogenomic inference},
- year = {2008},
- volume = {9},
- number = {10},
- pages = {R151},
- doi = {10.1186/gb-2008-9-10-r151},
- issn = {1474-760X},
+ author = {Wu, Martin and Eisen, Jonathan A.},
+ journal = {Genome Biology},
+ title = {{A} simple, fast, and accurate method of phylogenomic inference},
+ year = {2008},
+ volume = {9},
+ number = {10},
+ pages = {R151},
+ doi = {10.1186/gb-2008-9-10-r151},
+ issn = {1474-760X},
}
@Article{ZZL_16,
@@ -650,6 +650,18 @@
doi = {10.2172/138894},
}
+ at Article{Man13,
+ author = {Manning, Craig E.},
+ journal = {Reviews in Mineralogy and Geochemistry},
+ title = {{T}hermodynamic modeling of fluid-rock interaction at mid-crustal to upper-mantle conditions},
+ year = {2013},
+ volume = {76},
+ number = {1},
+ pages = {135--164},
+ doi = {10.2138/rmg.2013.76.5},
+ issn = {1529-6466},
+}
+
@Article{Ber88,
author = {Berman, R. G.},
journal = {Journal of Petrology},
More information about the CHNOSZ-commits
mailing list