OBIGT thermodynamic database

# assign the file name to a variable and print the file name and number of species
setfile <- function(csvfile, dat=NULL) {
  # assign csvfile outside this function
  assign("csvfile", csvfile, parent.frame())
  file <- system.file(paste0("extdata/OBIGT/", csvfile), package="CHNOSZ")
  dat <- read.csv(file,
  ## exclude entries for phase transitions
  #dat <- dat[!dat$state %in% c("cr2", "cr3", "cr4", "cr5", "cr6", "cr7", "cr8", "cr9"), ]
  # the state and class of substance (used as section header), followed by number of species
  basename <- gsub(".csv", "", csvfile)
  class <- strsplit(basename, "_")[[1]][1]
  substr(class, 1, 1) <- toupper(substr(class, 1, 1))
  state <- strsplit(basename, "_")[[1]][2]
  if(identical(state, "aq")) state <- "Aqueous "
  else if(identical(state, "cr")) state <- "Solid "
  else if(identical(state, "gas")) state <- "Gas "
  else if(identical(state, "liq")) state <- "Liquid "
  else state <- "Optional "
  paste0(state, class, " (", nrow(dat), " species)")
filerefs <- function(csvfile, dat=NULL, message=FALSE) {
  # with dat, look for ref2 in dat
  whichref <- "ref2"
  # without dat, look for ref1 in csvfile
  if(is.null(dat)) {
    file <- system.file(paste0("extdata/OBIGT/", csvfile), package="CHNOSZ")
    dat <- read.csv(file,
    whichref <- "ref1"
  ## exclude entries for phase transitions
  #dat <- dat[!dat$state %in% c("cr2", "cr3", "cr4", "cr5", "cr6", "cr7", "cr8", "cr9"), ]
  # count number of times each reference is used
  tab <- table(dat[, whichref])
  # in case there are not references (previously for H2O_aq.csv) we return the species here
  if(length(tab)==0) return(paste(dat$name, dat$state))
  # the reference keys
  keys <- names(tab)
  # warn if any keys aren't in thermo()$ref$key
  ikey <- match(keys, thermo()$ref$key)
  ina <-
  if(any(ina)) cat(paste("**WARNING: key(s)", paste(names(tab)[ina], collapse=" "), "not found in `thermo()$ref$key`**\n\n"))
  # put the table in chronological order, according to thermo()$ref
  ikey <- order(match(keys, thermo()$ref$key))
  tab <- tab[ikey]
  keys <- keys[ikey]
  xxx <- lapply(seq_along(tab), function(i){
    thiskey <- keys[i]
    # read thermo()$ref$note
    iref <- match(thiskey, thermo()$ref$key)
    note <- thermo()$ref$note[iref]
    # show the note in italics
    if(!identical(note, "")) note <- paste0(" *", note, "* ")
    # use bullets for ref2
    if(whichref=="ref2") bullet <- "- " else bullet <- ""
    # convert key (e.g. LD12.2) to ref in OBIGT.bib (e.g. LD12)
    thisref <- gsub("\\..*$", "", thiskey)
    # replace SLOP98 with slop98.dat, etc.
    # (we don't actually cite them here to keep the year from showing -- it's annoying to see e.g. "slop98.dat (1998)")
    citemark <- "@"
    if(thisref=="SLOP16") { thisref <- "slop16.dat"; citemark <- "" }
    if(thisref=="SLOP07") { thisref <- "slop07.dat"; citemark <- "" }
    if(thisref=="SLOP98") { thisref <- "slop98.dat"; citemark <- "" }
    if(thisref=="SPRONS92") { thisref <- "sprons92.dat"; citemark <- "" }
    if(thisref=="OBIGT") { thisref <- paste0("OBIGT (", thermo()$ref$year[iref], ")"); citemark <- "" }
    cat(bullet, citemark, thisref, " -- ", tab[i], note, "\n\n", sep="")
    # get ref2 if we're in the outer list
    if(whichref!="ref2") filerefs(dat=dat[dat$ref1==names(tab)[i], ])
  # return all the species listed
  paste(dat$name, dat$state)
# initialize the list of used species
used <- character()
# initialize the list of used optional species
optused <- character()

This vignette, produced on r Sys.Date(), lists the references for thermodynamic data in the OBIGT database in CHNOSZ version r sessionInfo()$otherPkgs$CHNOSZ$Version. Except for Optional Data, all data are present in the default database, which is loaded when the package is attached, or by running reset() or OBIGT().

Each section below corresponds to one of the CSV data files in the extdata/OBIGT package directory. Clicking on a button opens that section, which contains a list of primary references (from column ref1 in the file) in chronological order. Any secondary references (ref2) are listed with bullet points under the primary reference. Each citation is followed by the number of species, and a note taken from the file extdata/OBIGT/refs.csv. Additional comments (from this vignette) are present for some sections.

Abbreviations: T (temperature), P (pressure), GHS (standard Gibbs energy, enthalpy, entropy), Cp (heat capacity), V (volume), HKF (revised Helgeson-Kirkham-Flowers equations).

Aqueous Species


Gases    Liquids

Optional Data

Total count of species: References were found for r length(used) of r nrow(thermo()$OBIGT) species in the default OBIGT database and r length(optused) optional species.


Try the CHNOSZ package in your browser

Any scripts or data that you put into this service are public.

CHNOSZ documentation built on April 9, 2021, 9:08 a.m.