examples: Run examples from the documentation

View source: R/examples.R

examplesR Documentation

Run examples from the documentation

Description

Run the examples contained in each of the documentation topics.

Usage

  examples(save.png = FALSE)
  demos(which = c("references", "dehydration", "affinity", "NaCl",
    "density", "ORP", "ionize", "buffer", "protbuff",
    "glycinate", "mosaic", "copper", "arsenic", "solubility", "gold",
    "contour", "sphalerite", "minsol", "Shh", "saturation",
    "adenine", "DEW", "lambda", "potassium", "TCA", "aluminum", "AD",
    "comproportionation", "Pourbaix", "E_coli", "yttrium", "rank.affinity",
    "uranyl", "sum_S", "MgATP", "rubisco_Zc", "phosphorylate"),
    save.png = FALSE)

Arguments

save.png

logical, generate PNG image files for the plots?

which

character, which example to run

Details

examples runs all the examples in the help pages for the package. example is called for each topic with ask set to FALSE (so all of the figures are shown without prompting the user).

demos runs all the demos in the package. The demo(s) to run is/are specified by which; the default is to run them in the order of the list below.

references

Cross-check the references in refs.csv with the thermodynamic database

affinity

Affinities of metabolic reactions and amino acid synthesis (Amend and Shock, 1998, 2001)

dehydration
\logK

of dehydration reactions

NaCl

Equilibrium constant for aqueous NaCl dissociation (Shock et al., 1992)

density

Density of \H2O, inverted from IAPWS-95 equations (rho.IAPWS95)

ORP

Temperature dependence of oxidation-reduction potential for redox standards

ionize

ionize.aa(): contour plots of net charge and ionization properties of LYSC_CHICK

buffer

Minerals and aqueous species as buffers of hydrogen fugacity (Schulte and Shock, 1995)

protbuff

Chemical activities buffered by thiol peroxidases or sigma factors

glycinate

Metal-glycinate complexes (Shock and Koretsky, 1995; Azadi et al., 2019)

mosaic

Eh-pH diagram with two sets of changing basis species (Garrels and Christ, 1965)

copper

Another example of mosaic: complexation of Cu with glycine (Aksu and Doyle, 2001)

arsenic

Another example of mosaic: Eh-pH diagram for the system As-O-H-S (Lu and Zhu, 2011)

solubility

Solubility of calcite (cf. Manning et al., 2013) and \CO2 (cf. Stumm and Morgan, 1996)

gold

Solubility of gold (Akinfiev and Zotov; 2001; Stef\aacutensson and Seward, 2004; Williams-Jones et al., 2009)

contour

Gold solubility contours on a log fO2 - pH diagram (Ding et al., 2023)

sphalerite

Solubility of sphalerite (Akinfiev and Tagirov, 2014)

minsol

Solubilities of multiple minerals

Shh

Affinities of transcription factors relative to Sonic hedgehog (Dick, 2015)

saturation

Equilibrium activity diagram showing activity ratios and mineral saturation limits (Bowers et al., 1984)

adenine

HKF regression of heat capacity and volume of aqueous adenine (Lowe et al., 2017)

DEW

Deep Earth Water (DEW) model for high pressures (Sverjensky et al., 2014a and 2014b)

lambda

Effects of lambda transition on thermodynamic properties of quartz (Berman, 1988)

potassium

Comparison of thermodynamic datasets for predicting mineral stabilities (Sverjensky et al., 1991)

TCA

Standard Gibbs energies of the tricarboxylic (citric) acid cycle (Canovas and Shock, 2016)

aluminum

Reactions involving Al-bearing minerals (Zimmer et al., 2016; Tutolo et al., 2014)

carboxylase

Rank abundance distribution for RuBisCO and acetyl-CoA carboxylase

AD

Dissolved gases: Henry's constant, volume, and heat capacity (Akinfiev and Diamond, 2003)

comproportionation

Gibbs energy of sulfur comproportionation (Amend et al., 2020)

Pourbaix

Eh-pH diagram for Fe-O-H with equisolubility lines (Pourbaix, 1974)

E_coli

Gibbs energy of biomass synthesis in E. coli (LaRowe and Amend, 2016)

rank.affinity

Affinity ranking for proteins in yeast nutrient limitation (data from Tai et al., 2005)

yttrium

logK.to.OBIGT fits at 800 and 1000 bar and Y speciation in NaCl solution at varying pH (Guan et al., 2020)

uranyl

Total (carbonate|sulfate)-pH diagrams for uranyl species (Migdisov et al., 2025)

sum_S

Summed molality of S species and solubility contours for iron and gold (Skirrow and Walshe, 2002)

MgATP

Speciation of ATP with H+ and Mg+2 (Alberty, 2003)

rubisco_Zc

Zc of Rubisco vs optimal growth temperature

phosphorylate

Phosphorylation model for Gibbs energy of nucleotide polymerization into RNA (LaRowe and Dick, 2025)

For either function, if save.png is TRUE, the plots are saved in png files whose names begin with the names of the help topics or demos.

Two of the demos have external dependencies and are not automatically run by demos. ‘⁠carboxylase⁠’ creates an animated GIF; this demo requires that the ImageMagick convert commmand be available on the system (tested on Linux and Windows).

⁠carboxylase⁠’ animates diagrams showing rankings of calculated chemical activities along a combined \T and \logaH2 gradient, or makes a single plot on the default device (without conversion to animated GIF) if a single temperature (T) is specified in the code. To run this demo, an empty directory named ‘⁠png⁠’ must be present (as a subdirectory of the R working directory). The proteins in the calculation are 24 carboxylases from a variety of organisms. There are 12 ribulose phosphate carboxylase and 12 acetyl-coenzyme A carboxylase; 6 of each type are from nominally mesophilic organisms and 6 from nominally thermophilic organisms, shown as blue and red symbols on the diagrams. The activities of hydrogen at each temperature are calculated using \log a_{\mathrm{H_{2}}_{\left(aq\right)}}=-11+3/\left(40\times T\left(^{\circ}C\right)\right); this equation comes from a model of relative stabilities of proteins in a hot-spring environment (Dick and Shock, 2011).

Warning

The discontinuities apparent in the plot made by the NaCl demo illustrate limitations of the "g function" for charged species in the revised HKF model (the 355 \degC boundary of region II in Figure 6 of Shock et al., 1992). Note that SUPCRT92 (Johnson et al., 1992) gives similar output at 500 bar. However, SUPCRT does not output thermodynamic properties above 350 \degC at \Psat; see Warning in subcrt.

References

Akinfiev NN, Diamond LW. 2003. Thermodynamic description of aqueous nonelectrolytes at infinite dilution over a wide range of state parameters. Geochim Cosmochim Acta 67: 613–629. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/S0016-7037(02)01141-9")}

Akinfiev NN, Tagirov BR. 2014. Zn in hydrothermal systems: Thermodynamic description of hydroxide, chloride, and hydrosulfide complexes. Geochem Int 52: 197–214. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1134/S0016702914030021")}

Akinfiev NN, Zotov AV. 2001. Thermodynamic description of chloride, hydrosulfide, and hydroxo complexes of Ag(I), Cu(I), and Au(I) at temperatures of 25–500°C and pressures of 1–2000 bar. Geochem Int 39: 990–1006.

Aksu S, Doyle FM. 2001. Electrochemistry of copper in aqueous glycine solutions. J Electrochem Soc 148: B51–B57. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1149/1.1344532")}

Alberty RA. 2003. Thermodynamics of Biochemical Reactions. Hoboken, NJ: John Wiley & Sons. 397 p. https://www.worldcat.org/oclc/51242181

Amend JP, Shock EL. 1998. Energetics of amino acid synthesis in hydrothermal ecosystems. Science 281: 1659–1662. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1126/science.281.5383.1659")}

Amend JP, Shock EL. 2001. Energetics of overall metabolic reactions of thermophilic and hyperthermophilic Archaea and Bacteria. FEMS Microbiol Rev 25: 175–243. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/S0168-6445(00)00062-0")}

Amend JP, Aronson HS, Macalady J, LaRowe DE. 2020. Another chemolithotrophic metabolism missing in nature: sulfur comproportionation. Environ Microbiol 22: 1971–1976. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/1462-2920.14982")}

Azadi MR, Karrech A, Attar M, Elchalakani M. 2019. Data analysis and estimation of thermodynamic properties of aqueous monovalent metal-glycinate complexes. Fluid Phase Equilib 480: 25–40. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.fluid.2018.10.002")}

Berman RG. 1988. Internally-consistent thermodynamic data for minerals in the system Na\s2O-K\s2O-CaO-MgO-FeO-Fe\s2O\s3-Al\s2O\s3-SiO\s2-TiO\s2-H\s2O-CO\s2. J Petrol 29: 445–522. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/petrology/29.2.445")}

Bowers TS, Jackson KJ, Helgeson HC. 1984. Equilibrium Activity Diagrams for Coexisting Minerals and Aqueous Solutions at Pressures and Temperatures to 5 kb and 600°C. Berlin: Springer-Verlag. 397 p. https://www.worldcat.org/oclc/11133620

Canovas PA III, Shock EL. 2016. Geobiochemistry of metabolism: Standard state thermodynamic properties of the citric acid cycle. Geochim Cosmochim Acta 195: 293–322. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.gca.2016.08.028")}

Dick JM, Shock EL. 2011. Calculation of the relative chemical stabilities of proteins as a function of temperature and redox chemistry in a hot spring. PLOS One 6: e22782. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1371/journal.pone.0022782")}

Dick JM. 2015. Chemical integration of proteins in signaling and development. bioRxiv. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1101/015826")}

Ding Z, Sun X, Hu S, Chen H, Li D, Fu Y, Xu L, Wu Z, Huang F. 2023. Role of carbonaceous material in gold precipitation for orogenic gold deposits: A case study of the Bangbu gold deposit in southern Tibet, China. Ore Geol Rev 152: 105231. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.oregeorev.2022.105231")}

Garrels RM, Christ CL. 1965. Solutions, Minerals, and Equilibria. New York: Harper & Row. 450 p. https://www.worldcat.org/oclc/517586

Guan Q, Mei Y, Etschmann B, Testemale D, Louvel M, Brugger J. 2020. Yttrium complexation and hydration in chloride-rich hydrothermal fluids: A combined ab initio molecular dynamics and in situ X-ray absorption spectroscopy study. Geochim Cosmochim Acta 281: 168–189. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.gca.2020.04.015")}

Johnson JW, Oelkers EH, Helgeson HC. 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°C. Comput Geosci 18: 899–947. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/0098-3004(92)90029-Q")}

LaRowe DE, Amend JP. 2016. The energetics of anabolism in natural settings. ISME J 10: 1285–1295. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1038/ismej.2015.227")}

LaRowe DE, Dick JM. 2025. Physicochemical constraints on the abiotic polymerization of nucleotides into RNA. JGR Biogeosci 130: e2025JG009095. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1029/2025JG009095")}

Lowe AR, Cox JS, Tremaine PR. 2017. Thermodynamics of aqueous adenine: Standard partial molar volumes and heat capacities of adenine, adeninium chloride, and sodium adeninate from T = 278.15 K to 393.15 K. J Chem Thermodyn 112: 129–145. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.jct.2017.04.005")}

Lu P, Zhu C. 2011. Arsenic Eh–pH diagrams at 25°C and 1 bar. Environ Earth Sci 62: 1673–1683. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s12665-010-0652-x")}

Manning CE, Shock EL, Sverjensky DA. 2013. The chemistry of carbon in aqueous fluids at crustal and upper-mantle conditions: Experimental and theoretical constraints. Rev Mineral Geochem 75: 109–148. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2138/rmg.2013.75.5")}

Migdisov A, Bastrakov E, Alcorn C, Reece M, Boukhalfa H, Caporuscio FA, Jove-Colon C. 2025. A spectroscopic study of the stability of uranyl-carbonate complexes at 25–150°C and re-visiting the data available for uranyl-chloride, uranyl-sulfate, and uranyl-hydroxide species. Geochim Cosmochim Acta 406: 326–339. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.gca.2024.04.023")}

Pourbaix M. 1974. Atlas of Electrochemical Equilibria in Aqueous Solutions. Houston, TX: NACE; Brussels: CEBELCOR. https://www.worldcat.org/oclc/563921897

Schulte MD, Shock EL. 1995. Thermodynamics of Strecker synthesis in hydrothermal systems. Orig Life Evol Biosph 25: 161–173. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/BF01581580")}

Shock EL, Koretsky CM. 1995. Metal-organic complexes in geochemical processes: Estimation of standard partial molal thermodynamic properties of aqueous complexes between metal cations and monovalent organic acid ligands at high pressures and temperatures. Geochim Cosmochim Acta 59: 1497–1532. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/0016-7037(95)00058-8")}

Shock EL, Oelkers EH, Johnson JW, Sverjensky DA, Helgeson HC. 1992. Calculation of the thermodynamic properties of aqueous species at high pressures and temperatures: Effective electrostatic radii, dissociation constants and standard partial molal properties to 1000 °C and 5 kbar. J Chem Soc Faraday Trans 88: 803–826. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1039/FT9928800803")}

Skirrow RG, Walshe JL. 2002. Reduced and oxidized Au-Cu-Bi iron oxide deposits of the Tennant Creek Inlier, Australia: An integrated geologic and chemical model. Econ Geol 97: 1167–1202. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2113/gsecongeo.97.6.1167")}

Stefánsson A, Seward TM. 2004. Gold(I) complexing in aqueous sulphide solutions to 500°C at 500 bar. Geochim Cosmochim Acta 68: 4121–4143. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.gca.2004.04.006")}

Stumm W, Morgan JJ. 1996. Aquatic Chemistry: Chemical Equilibria and Rates in Natural Waters. 3rd ed. New York: John Wiley & Sons. 1040 p. https://www.worldcat.org/oclc/31754493

Sverjensky DA, Hemley JJ, D'Angelo WM. 1991. Thermodynamic assessment of hydrothermal alkali feldspar-mica-aluminosilicate equilibria. Geochim Cosmochim Acta 55: 989–1004. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/0016-7037(91)90157-Z")}

Sverjensky DA, Harrison B, Azzolini D. 2014a. Water in the deep Earth: The dielectric constant and the solubilities of quartz and corundum to 60 kb and 1,200°C. Geochim Cosmochim Acta 129: 125–145. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.gca.2013.12.019")}

Sverjensky DA, Stagno V, Huang F. 2014b. Important role for organic carbon in subduction-zone fluids in the deep carbon cycle. Nat Geosci 7: 909–913. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1038/ngeo2291")}

Tai SL, Boer VM, Daran-Lapujade P, Walsh MC, de Winde JH, Daran J-M, Pronk JT. 2005. Two-dimensional transcriptome analysis in chemostat cultures: Combinatorial effects of oxygen availability and macronutrient limitation in Saccharomyces cerevisiae. J Biol Chem 280: 437–447. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1074/jbc.M410573200")}

Tutolo BM, Kong X-Z, Seyfried WE Jr, Saar MO. 2014. Internal consistency in aqueous geochemical data revisited: Applications to the aluminum system. Geochim Cosmochim Acta 133: 216–234. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.gca.2014.02.036")}

Williams-Jones AE, Bowell RJ, Migdisov AA. 2009. Gold in solution. Elements 5: 281–287. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2113/gselements.5.5.281")}

Zimmer K, Zhang Y, Lu P, Chen Y, Zhang G, Dalkilic M, Zhu C. 2016. SUPCRTBL: A revised and extended thermodynamic dataset and software package of SUPCRT92. Comput Geosci 90: 97–111. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.cageo.2016.02.013")}

Examples



demos(c("ORP", "NaCl"))


CHNOSZ documentation built on Jan. 15, 2026, 3 a.m.