| CHNOSZ-package {CHNOSZ} | R Documentation |
CHNOSZ is a package for thermodynamic calculations, primarily with applications in geochemistry and biochemistry. 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. The package can be used interactively and in batch mode, through the use of R source files containing a sequence of commands. The major features of the package are outlined below, with links to specific help topics in this document, which constitutes the primary technical description of the package. If you are a new user, the ‘anintro’ vignette (An introduction to CHNOSZ) may offer a more comfortable way to get started with using the package.
Major features in CHNOSZ:
thermo).
protein).
read.fasta, protein).
hkf, cgl), subcrt.
makeup).
basis, species).
affinity).
diagram, equil.react, equil.boltz).
buffer).
diagram).
revisit).
findit).
transfer).
Here are some tips for new users:
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 about five to ten minutes depending on your system. You should receive four warning messages when the examples are finished; don't worry, they are an expected result.
dontrun tag. You can experiment with dontrun examples by pasting the code to the R console.
thermo.
The package depends on 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). However, without accessing the compressed data files in extdata it should be possible to run CHNOSZ under R versions 2.4.0 or greater (availability of the stringsAsFactors argument to data.frame).
This package was made possible by the fearless leadership of the late Professor Harold C. Helgeson. He took no heed of disciplinary boundaries, and encouraged the author to pursue unconventional problems. Hal, and those in his research group, are in some way responsible for many parts of this package, such as the aqueous equations of state used here, the thermodynamic parameters for many species, and actual computer code (H2O92D.f, borrowed from the SUPCRT92 program). Work on this project at U.C. Berkeley (through 2008) was supported by research grants from the U.S. National Science Foundation and Department of Energy. In 2009–2011, research projects involving this package were supported by the National Science Foundation under grant EAR-0847616 (http://www.nsf.gov/awardsearch/showAward.do?AwardNumber=0847616).
### Getting Started
## 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
# basis species
basis(c("CO2","H2O","O2"))
# 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,5))$values