Package: CHNOSZ 2.2.0-55

Jeffrey Dick

CHNOSZ: Thermodynamic Calculations and Diagrams for Geochemistry

An integrated set of tools for thermodynamic calculations in aqueous geochemistry and geobiochemistry. Functions are provided for writing balanced reactions to form species from user-selected basis species and for calculating the standard molal properties of species and reactions, including the standard Gibbs energy and equilibrium constant. Calculations of the non-equilibrium chemical affinity and equilibrium chemical activity of species can be portrayed on diagrams as a function of temperature, pressure, or activity of basis species; in two dimensions, this gives a maximum affinity or predominance diagram. The diagrams have formatted chemical formulas and axis labels, and water stability limits can be added to Eh-pH, oxygen fugacity- temperature, and other diagrams with a redox variable. The package has been developed to handle common calculations in aqueous geochemistry, such as solubility due to complexation of metal ions, mineral buffers of redox or pH, and changing the basis species across a diagram ("mosaic diagrams"). CHNOSZ also implements a group additivity algorithm for the standard thermodynamic properties of proteins.

Authors:Jeffrey Dick [aut, cre]

CHNOSZ_2.2.0-55.tar.gz
CHNOSZ_2.2.0-55.zip(r-4.7)CHNOSZ_2.2.0-55.zip(r-4.6)CHNOSZ_2.2.0-55.zip(r-4.5)
CHNOSZ_2.2.0-55.tgz(r-4.6-x86_64)CHNOSZ_2.2.0-55.tgz(r-4.6-arm64)CHNOSZ_2.2.0-55.tgz(r-4.5-x86_64)CHNOSZ_2.2.0-55.tgz(r-4.5-arm64)
CHNOSZ_2.2.0-55.tar.gz(r-4.7-arm64)CHNOSZ_2.2.0-55.tar.gz(r-4.7-x86_64)CHNOSZ_2.2.0-55.tar.gz(r-4.6-arm64)CHNOSZ_2.2.0-55.tar.gz(r-4.6-x86_64)
CHNOSZ_2.2.0-55.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
CHNOSZ/json (API)

# Install 'CHNOSZ' in R:
install.packages('CHNOSZ', repos = c('https://r-forge.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://r-forge.r-project.org/projects/chnosz

On CRAN:

Conda:

9.37 score 5 packages 281 scripts 1.2k downloads 13 mentions 125 exports 0 dependencies

Last updated from:6c659b500f. Checks:13 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK209
linux-devel-x86_64OK213
source / vignettesOK288
linux-release-arm64OK213
linux-release-x86_64OK209
macos-release-arm64OK147
macos-release-x86_64OK432
macos-oldrel-arm64OK197
macos-oldrel-x86_64OK372
windows-develOK237
windows-releaseOK208
windows-oldrelOK223
wasm-releaseOK109

Exports:add.OBIGTadd.proteinaffinityallparentsaminoacidsas.chemical.formulaaxis.labelbasisbasis.elementsbasis.logactBermanbgammacalculateDensitycalculateEpsiloncalculateGibbsOfWatercalculateQcheck.EOScheck.GHScheck.OBIGTCHNOSZconvertcount.elementsCp_s_vardescribe.basisdescribe.propertydescribe.reactiondiagramdimSumsdPdTtrdumpdataE.unitselement.muentropyEOScalcEOScoeffsEOSlabEOSplotEOSregressEOSvarequil.boltzmannequil.reactionequilibrateexpr.propertyexpr.speciesexpr.unitsfind.tpgetnamesgetnodesgetrankGHSGHS_Trhyphen.in.pdfi2AIAPWS95ibasisinfoionize.aaJANAF.to.OBIGTlabel.figurelabel.plotlist2arraylNaCllogK.to.OBIGTlPlSlTlTPmakeupmashmassmixmod.buffermod.OBIGTmolesmosaicMP90.cpmtitleNaClnonidealOBIGTP.unitspalplyparentphospho.plotphosphorylatepinfoprotein.basisprotein.formulaprotein.lengthprotein.OBIGTrank.affinityratlabrebalanceresetretrieveRH2OBIGTrho.IAPWS95scinamesliceslice.affinitysolubilityspeciesstack_mosaicsubcrtswap.basissyslabT.unitsthermothermo.axisthermo.plot.newthermo.refsTtrunitizeusrfigV_s_varwaterwater.AW90water.DEWwater.IAPWS95water.lineswater.SUPCRT92which.pmaxWP02.auxiliaryZCZC.col

Dependencies:

An Introduction to CHNOSZ
Getting Started | Basic Functionality | Organization of CHNOSZ | Functions without side effects (return values) | Functions with side effects (modify system state) | Querying the thermodynamic database | Calculating thermodynamic properties | Working with reactions | Chemical affinity and stability diagrams | Equilibrium calculations | Activity coefficients | References | Interlude: Affinity, Formation Reactions, and Balancing | Caution: Quasisolubility contours on predominance diagrams underestimate total solubility | Advanced Uses | 1. Use helper functions to create formatted labels for diagrams | 2. Use retrieve() to search species by elements | 3. Load optional data with add.OBIGT() | 4. Use OBIGT() and reset() to restore the default database and settings | 5. Use basis() species to define the compositional space | 6. Set activities of formed species() to define a quasisolubility contour | 7. When to use add = TRUE | 8. Set grid resolution and constant T, P, or ionic strength in affinity() | 9. Use NaCl() to estimate ionic strength from NaCl concentration | 10. Use solubility() to draw total solubility contours | 11. Use convert() for common unit conversions | 12. Use the transect mode of affinity() for synchronized variables | 13. Choose non-default balancing constraints in diagram() | 14. Calculate adjusted and non-standard Gibbs energy with subcrt() | 15. Calculate non-standard Gibbs energy with affinity() | And swap basis species, remove formed species, and label reactions | 16. Extract results from the output of diagram() | 17. Writing chemical formulas and counting and summing elements with makeup() | 18: Accessing and changing settings with thermo() | Interlude: From Activity to Molality | Buffers | 1. Defining buffers with mod.buffer() | 2. Retrieving buffered activities with affinity(return.buffer = TRUE) | 3. Working with multiple buffered species (e.g., r h2s and r o2 in PPM) | 4. Using diagram(type = ) to display buffered activities | 5. Using fr o2 Buffers in downstream calculations | 6. Using buffer calculations in transects with affinity() | 7. Calculating the neutral pH of water | 8. Working with mineral pH buffers | Comprehensive example: Ore formation environments | Proteins | 1. Identifying proteins | 2. Adding proteins from FASTA or CSV files | 3. Calculating protein properties | Protein length and formula | Carbon oxidation state | 4. Thermodynamic calculations for proteins | Standard thermodynamic properties | Ionization effects | 5. Setting up a chemical system with proteins | 6. Calculating affinities and equilibrium distributions | Affinities of formation reactions | Equilibrium distributions | Scaling protein abundances | 7. Additional protein analysis | End-to-end example: Parameter optimization to fit experimental protein abundances | Environmental controls on protein evolution: A case study with CRISPR-Cas systems | Further Resources - Demos | More use cases for mosaic() | Solubility contours with solubility() | Other contour plots | Calculations using the output of diagram() | Activity buffers | Other thermodynamic models | Calculations with proteins | Further Resources - Vignettes | Frequently asked questions | OBIGT thermodynamic database | Customizing the thermodynamic database | Fitting thermodynamic data | Creating multi-metal diagrams | Getting Help | Document History

Last update: 2026-06-21
Started: 2017-02-04

CHNOSZ FAQ
Where do the names CHNOSZ, OBIGT, and subcrt come from? | How should CHNOSZ be cited? | What thermodynamic models are used in CHNOSZ? | What are the main limitations of CHNOSZ? | When and why do equal-activity boundaries depend on total activity? | Set up subplots | Activate DEW model | logfO2-pH diagram for aqueous inorganic and organic carbon species at high pressure | After Figure 1b of Sverjensky et al., 2014b [SSH14] | (Nature Geoscience, https://doi.org/10.1038/NGEO2291) | Define system | A function to make the diagrams | Set total C concentration to 0.03 molal | (from EQ3NR model for eclogite [Supporting Information of SSH14]) | Restore default settings for the questions below | How can minerals with polymorphic transitions be added to the database? | How can I make a diagram with the trisulfur radical ion (r S3minus)? | Why does the published diagram have a much larger stability field for r S3minus? | Can I make the diagram using the Deep Earth Water (DEW) model? | In OBIGT, what is the meaning of T for solids, liquids, and gases? | How can mineral pH buffers be plotted? | Why are mineral stability boundaries curved on mosaic diagrams? | Get the pKa of H2S (note the minus sign!) | Reaction 1 between pyrite and pyrrhotite with H2S | Reaction 1 law of mass action (LMA) | logf_O2 = 2 logK_1 - 2 loga_H2S | Reaction 2 between pyrite and pyrrhotite with HS- | Reaction 2 LMA | logf_O2 = 2 pH + 2 logK_2 - 2 loga_HS- | The logf_O2 for each reaction is the same at the pKa of H2S | How is the sum of activities of basis species defined for mosaic diagrams? | The basis species we are speciating | The basis species defining the system | Note 1: for mosaic(), the first species in 'bases' must be in this list | Note 2: for solubility(), the first species in this list must contain S | Define a low fO2 so reduced sulfur dominates over most of the pH range | The pH range we'll look at | The logarithm of activity used for aH2S or sum(S) | Left-hand plot: Constant log aH2S, variable sum(S) | Set it up as a solubility calculation | Define a single log aH2S | Specify the aqueous species in equilibrium with H2S | Run the calculation to calculate all species' activities | Diagram individual activities then total activity | Right-hand plot: Constant sum(S), variable log aH2S | Start by loading all the candidate species with preset activities | Calculate affinities of formation reactions | Equilibrate the species for a total activity of S | Look at the stabilities of calcite and anhydrite | For afffinity(), these are single activities | For mosaic(), these are total activities for groups of species in the 'bases' list | affinity() calculation | mosaic() calculation | References

Last update: 2026-06-21
Started: 2023-05-17

Diagrams with multiple metals
Mashing | Mixing 1 | Convert formation energies from eV / atom to eV / molecule | Convert formation energies from eV / molecule to J / mol | Gibbs energies of formation (J / mol) for aqueous species | Most are from Wagman et al., 1982 | Gibbs energies of formation (J / mol) for solids from Wagman et al., 1982 | Calculate correction for difference between reference and DFT energies (Persson et al., 2012) | Apply correction to standard Gibbs energies of aqueous species (Persson et al., 2012) | Add energies to OBIGT | This function modifies OBIGT and returns the species indices of the affected species | We explicitly set the units to Joules (this is the default as of CHNOSZ 2.0.0) | We need model = "CGL" to override the Berman model for some minerals 20220919 | Formation energies (eV / atom) for bimetallic solids from Materials API | mp-1335, mp-1079399, mp-866134, mp-558525, mp-504509 (triclinic FeVO4) | Convert energies and add to OBIGT | Mosaic Stacking 1 | Mosaic Stacking 2 | Setup basis species | Fe-bearing minerals | Add aqueous species 20210220 | Start plot with just the fields for transparency effect | Cu-bearing minerals | Mosaic with all Fe species as basis species | Use only predominant Fe species as basis species (to speed up calculation) 20210224 | Use loga_aq argument to control the activity of aqueous species in mosaic calculation 20220722 | c(NA, logm_aq) means to use: | basis()'s value for logact of aqueous S species | logm_aq for logact of aqueous Fe species | Adjust labels | Highlight Ccp and Bn in orange | Thick line around Ccp field | Add second Cu label | Plot the Fe-system lines and names "on top" so they are not covered by fill colors | Restore default OBIGT database | Mixing 2 | Mosaic Stacking 3 | Fe-S-O-H diagram | Order species by a function of composition to make colors | Cu-Fe-S-O-H diagram based on reactions with the | stable Fe-bearing minerals (mosaic stack) | Mash the diagrams and adjust labels | Function to calculate solubility of Cu for stable assemblages of Fe and Cu minerals | (i.e. equilibrium is imposed with all of these minerals, not only Cu(s)) | DIAGRAM 1 | Load SLOP98 data to use legacy parameters for CuCl2- and CuCl3-2 | Calculate logK for CuCl2- dissociation at 125 °C | Sverjensky (1987) used Helgeson (1969) value, which is ca. -5.2 | Calculate the difference in ΔG° corresponding to this logK difference | We should use calories here because the database values are in calories 20220604 | Apply this difference to the CuCl2- entry in OBIGT | Do the same thing for CuCl3-2 | DIAGRAM 2 | Set up system to dissolve S2(gas) | Calculate concentration of SO4-2 | DIAGRAM 3 | Secondary Balancing | PRIMARY balancing | Only Fe-bearing minerals | Only Cu-bearing minerals | Only Fe- AND Cu-bearing minerals | SECONDARY balancing | Fe- or Cu-bearing minerals | All minerals | Other Possibilities | Balancing on a Non-Metal | Mosaic Combo | A function to calculate Keff for any combination of T and pH | Make T and pH the same length | Calculate activity of H+ | Calculate logKs | Calculate Ks | Calculate Keff (Eq. 7) | Calculate logKeff as a function of pH at 100 °C | Calculate activity of acetamide for | acetic acid + acetate = 0.01 m | ammonia + ammonium = 0.001 m | METHOD 2: Mosaic combo | Define total activities | This is 2 * 0.01 because acetic acid has 2 carbons | Load all C-bearing species (including acetamide) | Calculate distribution of C-bearing species accounting for ammonia/ammonium speciation | Plot and label diagram | Start with empty diagram | Add pH = 6 line | Add line for acetamide activity calculated with Keff | Add lines from CHNOSZ calculations | Check that we got equal values | Document History | References

Last update: 2026-06-21
Started: 2020-07-16

OBIGT thermodynamic database
Aqueous Species H2O Inorganic Organic | Solids Inorganic Organic Berman | Gases Inorganic Organic    Liquids Inorganic Organic | Optional Data SUPCRT92 SLOP98 AD DEW Testing | References

Last update: 2026-06-21
Started: 2020-07-04

Customizing the thermodynamic database
Basic structure of OBIGT | Conventions for data entry in OBIGT | Types of data | Ranges of HKF and CGL models | Required and optional data | NA or 0? | OOM scaling and r info_ | Case study: NA and 0 in the default database | Examples of adding data from a file | r add.OBIGT_ with optional data files | r add.OBIGT_ with other CSV files | Examples of adding and modifying data with a function | r mod.OBIGT_ for aqueous species | r mod.OBIGT_ for minerals | Case study: Formation constants for aqueous tungsten species | Fitting formation constants | Diagram 1: Constant molality of r F_ | Diagram 2: Variable molality of r F_ | References

Last update: 2025-06-02
Started: 2023-03-03

Regressing thermodynamic data
A note on the equations | A note on the algorithms | An example for neutral species | Setting the value of omega | An example for charged species | Doing it for volume | Making a pseudospecies: r h4sio4 | References

Last update: 2025-06-02
Started: 2017-02-06

Readme and manuals

Help Manual

Help pageTopics
Thermodynamic calculations and diagrams for geochemistryCHNOSZ-package
Functions to Work with the Thermodynamic Databaseadd.OBIGT mod.OBIGT
Amino acid compositions of proteinsadd.protein
Chemical affinities of formation reactionsaffinity
Define basis speciesbasis
Thermodynamic properties of mineralsBerman
Deep Earth Water (DEW) modelcalculateDensity calculateEpsilon calculateGibbsOfWater calculateQ DEW
Chemical activity diagramsdiagram find.tp
Regress equations-of-state parameters for aqueous speciesCp_s_var EOScalc EOScoeffs EOSlab EOSplot EOSregress EOSvar V_s_var
Equilibrium chemical activities of speciesequil.boltzmann equil.reaction equilibrate moles
Run package examples and demosdemos examples
Extra dataextdata
Properties of water from IAPWS-95IAPWS95
Search the thermodynamic databaseinfo
Properties of ionization of proteinsionize.aa
Import thermodynamic data from NIST-JANAF tablesJANAF.to.OBIGT
Fit thermodynamic parameters to formation constants (log K)logK.to.OBIGT
Parse chemical formulascount.elements makeup
Combine diagrams for multi-metal systemsmash mix rebalance
Calculating buffered chemical activitiesbuffer mod.buffer
Chemical affinities with changing basis speciesmosaic
Simple NaCl-water solution modelNaCl
Activity coefficients of aqueous speciesbgamma nonideal
Conditional parallel processingpalply
Calculate affinity of phosphorylation reactions with pH-dependent speciationphospho.plot phosphorylate
Summaries of thermodynamic properties of proteinspinfo protein.basis protein.formula protein.info protein.length protein.OBIGT
Average ranks of chemical affinitiesrank.affinity
Retrieve species by elementretrieve
Equilibrium chemical activities of speciessolubility
Species of interestspecies
Stacked mosaic diagramstack_mosaic
Properties of species and reactionssubcrt
Swap basis speciesbasis.elements basis.logact element.mu ibasis swap.basis
Extract data from NCBI taxonomy filesallparents getnames getnodes getrank parent sciname taxonomy
Thermodynamic database and system settingsCHNOSZ OBIGT reset thermo
Functions to create and modify plotsthermo.axis thermo.plot thermo.plot.new
Functions to work with multidimensional arraysdimSums list2array slice slice.affinity util.array
Functions for checking thermodynamic datacheck.EOS check.GHS check.OBIGT dumpdata RH2OBIGT thermo.refs util.data
Functions to express chemical formulas and propertiesaxis.label describe.basis describe.property describe.reaction expr.property expr.species expr.units ratlab syslab util.expression
Functions to work with chemical formulasas.chemical.formula entropy GHS i2A mass util.formula ZC
Functions to make legend textlNaCl lP lS lT lTP util.legend
Functions to work with listsutil.list which.pmax
Functions for miscellaneous tasksdPdTtr GHS_Tr Ttr unitize util.misc
Utility functions for plotshyphen.in.pdf label.figure label.plot mtitle usrfig util.plot water.lines ZC.col
Functions for proteins (other calculations)group.formulas MP90.cp util.protein
Functions to work with sequence dataaminoacids util.seq
Functions to convert unitsconvert E.units P.units T.units util.units
Functions for properties of water and steamrho.IAPWS95 util.water water.AW90 WP02.auxiliary
Properties of waterwater water.DEW water.IAPWS95 water.SUPCRT92