help.search
(aka ??
).
Use ??primary
to browse the most commonly used functions and ??secondary
to see other high-level, but less often-used functions.
??protein
shows functions for working with proteins, and ??extra
lists functions with extra functionality (beyond the main workflow).
For help on the thermodynamic database, use ??"thermodynamic data"
.
Finally, ??utilities
(one of the standard R keywords) can be used to locate utility functions in the package; these include useful tools for modifying the database, converting units, reading protein sequence files, parsing chemical formulas, etc.browse.refs
).
Do not assume that by adding any species to your calculation (or to any of the examples), you will necessarily obtain a reasonable answer.
Do not assume that the examples are correct, or that they can be applied to your problem.
As with the data, please compare the construction and output of the examples to the primary sources, cited in the reference list in each help page.
Examples without a reference (and some with references) demonstrate experimental features of CHNOSZ.thermo
). protein
). read.fasta
, protein
). hkf
, cgl
, subcrt
). makeup
). basis
, species
). affinity
). diagram
, equil.reaction
, equil.boltzmann
). diagram
). buffer
). revisit
). findit
). transfer
). install.packages
or its GUI menu equivalent.
library(CHNOSZ)
at the command line (or select the name of the package from the GUI menu).
help.start
, select Packages then CHNOSZ and then select a function of interest. Individual examples can be run by pasting the example block directly into the R console.
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.
dontrun
tag. You can experiment with dontrun
examples by pasting the code to the R console.
stopifnot
statements that represent expected outcomes of the calculations; if the expectation is not met, the stopifnot
statement causes an error. These tests are useful for checking the code during package development cycles, but are usually not of critical importance for the set-up of the problem (though they do sometimes employ useful programming tricks). 2) Commands written with an enclosing pair of parentheses (z <- "like this one")
are used to display the result of an assignment operation (<-
), the value of which is needed later in the calculation. In interactive use, the outermost pair of enclosing parentheses is generally not needed.
demos()
to run the demos (some of these are longer running examples that are not part of the main help pages).
thermo
.
extendInt
argument of uniroot
, used in coderho.IAPWS95).
As of version 1.0.4 (release 1.0.5 on CRAN), the package depends on R version 3.0.0 or greater (previous versions use Stangle
to extract R code from vignettes when installing the source package, leading to failure processing hotspring.Rnw, which now uses knitr instead of Sweave).
Before version 1.0.4, the recommended version of R was 2.14.0 or greater (to find vignettes in the vignettes
directory, and for availability of parallel in the standard library).
As of version 0.9-9, the package depends on R version 2.12.0 or greater (so useDynLib in the NAMESPACE can find the shared library on Windows).
Starting with version 0.9-6 of the package, the dependency was given as R version 2.10.0 or greater (to read compressed data files).
Before version 0.9-6 of the package, the dependency was given as R version 2.7.0 or greater (major update of the X11 device in 2.7.0).
Without accessing the compressed data files in extdata
it should be possible to run CHNOSZ on Unix-alikes under R versions 2.4.0 or greater (availability of the stringsAsFactors argument of data.frame
).H2O92D.f
, taken from the SUPCRT92 distribution, with only cosmetic modifications (masking of WRITE and STOP statements) made for compatibility with an R environment. 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. Work on this package at U.C. Berkeley from ~2003--2008 was supported by research grants solicited by HCH from the U.S. National Science Foundation and Department of Energy. In 2009--2011, the major research project stimulating development of this package at Arizona State University was funded by the National Science Foundation under grant EAR-0847616. The files in extdata/bison
are excerpts of results of BLAST calculations made on the Saguaro high performance computer at ASU.subcrt
does not correctly identify the stable polymorph of some minerals at high temperature. The values generated by buffer
may not be applied correctly by affinity
in calculating the affinities of the formation reactions. (The values returned by affinity(..., return.buffer=TRUE)
do appear to be correct in the examples). There is an unidentified inconsistency in transfer
causing the reaction boundaries in one of the examples (apc("closed")
) to be offset from the stability diagram. OTOH, feldspar("closed")
appears to work correctly. Values of activity coefficients may be affected by an unidentified bug in nonideal
.### Getting Started
## the 'thermo' object contains thermodynamic data and is also where
## user's settings (definition of chemical system) are stored
data(thermo)
## standard thermodynamic properties of species
subcrt("H2O")
subcrt("alanine")
# names of proteins have an underscore
subcrt("LYSC_CHICK")
# custom temperature range
T <- seq(0, 500, 100)
subcrt("H2O", T=T, P=1000)
# temperature - pressure grid
P <- seq(1000, 4000, 1000)
subcrt("H2O", T=T, P=P, grid="P")
## information about species
# query the database using formulas
info("C6H12O6")
info("SiO2")
# query using names
info("quartz")
si <- info(c("glucose", "mannose"))
# show the equations of state parameters
info(si)
# approximate matches for names or formulas
info("acid ")
info("SiO2 ")
## standard thermodynamic properties of reactions
# fermentation example
info(c("fructose", "ethanol"))
subcrt(c("fructose", "C2H5OH", "CO2"), c(-1, 2, 2))
# weathering example -- also see transfer()
subcrt(c("k-feldspar", "H2O", "H+", "kaolinite", "K+", "SiO2"),
c(-2, -1, -2, 1, 2, 4))
# partial reaction auto-completion is possible
basis(c("SiO2", "H2O", "K+", "H+", "O2"))
subcrt(c("k-feldspar", "kaolinite"), c(-2, 1))
## chemical affinities
# set basis species and their activities or fugacities
basis(c("CO2", "H2O", "O2"), c(-3, 0, -80))
# set species of interest
species(c("CH4", "C2H4O2", "CO2"))
# chemical affinities of formation reactions
# take off $values for complete output
affinity()$values
affinity(O2=c(-90, -60, 4))$values
Run the code above in your browser using DataLab