buffer {CHNOSZ} R Documentation

## Calculating Buffered Chemical Activities

### Description

Calculate values of activity or fugacity of basis species buffered by an assemblage of one or more species.

### Usage

  mod.buffer(name, species = NULL, state = "cr", logact = 0)


It is possible to assign different buffers to different basis species, in which case the order of their calculation depends on their order in thermo()$buffers. This function is compatible with systems of proteins, but note that for buffers made of proteins the buffer calculations presently use whole protein formulas (instead of residue equivalents) and consider nonionized proteins only. ### References Garrels, R. M. (1960) Mineral Equilibria. Harper & Brothers, New York, 254 p. https://www.worldcat.org/oclc/552690 ### See Also diagram with type set to the name of a basis species solves for the activity of the basis species. ### Examples  ## List the buffers thermo()$buffer
# Another way to do it, for a specific buffer
print(mod.buffer("PPM"))

## Buffer made of one species
# Calculate the activity of CO2 in equilibrium with
# (a buffer made of) acetic acid at a given activity
basis("CHNOS")
basis("CO2", "AC")
# What activity of acetic acid are we using?
print(mod.buffer("AC"))
# Return the activity of CO2
affinity(return.buffer = TRUE)$CO2 # -7.057521 # As a function of oxygen fugacity affinity(O2 = c(-85, -70, 4), return.buffer = TRUE) # As a function of logfO2 and temperature affinity(O2 = c(-85, -70, 4), T = c(25, 100, 4), return.buffer = TRUE) # Change the activity of species in the buffer mod.buffer("AC", logact = -10) affinity(O2 = c(-85,-70,4), T = c(25, 100, 4), return.buffer = TRUE) ## Buffer made of three species ## Pyrite-Pyrrhotite-Magnetite (PPM) # Specify basis species and initial activities basis(c("FeS2", "H2S", "O2", "H2O"), c(0, -10, -50, 0)) # Note that the affinity of formation of pyrite, # which corresponds to FeS2 in the basis, is zero species(c("pyrite", "pyrrhotite", "magnetite")) affinity(T = c(200, 400, 11), P = 2000)$values
# Setup H2S and O2 to be buffered by PPM
basis(c("H2S", "O2"), c("PPM", "PPM"))
# Inspect values of H2S activity and O2 fugacity
affinity(T = c(200, 400, 11), P = 2000, return.buffer = TRUE, exceed.Ttr = TRUE)
# Calculate affinities of formation reactions of species in the buffer
a <- affinity(T = c(200, 400, 11), P = 2000, exceed.Ttr = TRUE)$values # The affinities for species in the buffer are all equal to zero all.equal(as.numeric(a[]), rep(0, 11)) # TRUE all.equal(as.numeric(a[]), rep(0, 11)) # TRUE all.equal(as.numeric(a[]), rep(0, 11)) # TRUE ## Buffer made of one species: show values of logfO2 on an ## Eh-pH diagram; after Garrels, 1960, Figure 6 basis("CHNOSe") # Here we will buffer the activity of the electron by O2 mod.buffer("O2", "O2", "gas", 999) basis("e-", "O2") # Start our plot, then loop over values of logfO2 thermo.plot.new(xlim = c(0, 14), ylim = c(-0.8, 1.2), xlab = "pH",ylab = axis.label("Eh")) # The upper and lower lines correspond to the upper # and lower stability limits of water logfO2 <- c(0, -20, -40, -60, -83.1) for(i in 1:5) { # Update the logarithm of fugacity (logact) of O2 in the buffer mod.buffer("O2", "O2", "gas", logfO2[i]) # Get the values of the logarithm of activity of the electron a <- affinity(pH = c(0, 14, 15), return.buffer = TRUE) # Convert values of pe (-logact of the electron) to Eh Eh <- convert(-as.numeric(a$e-), "Eh")
lines(seq(0, 14, length.out = 15), Eh)
text(seq(0, 14, length.out = 15)[i*2+2], Eh[i*2+2],
paste("logfO2 =", logfO2[i]))
}
title(main = paste("Relation between logfO2(g), Eh and pH at\n",
"25 degC and 1 bar. After Garrels, 1960"))

## Buffer made of two species
# Conditions for metastable equilibrium among
# CO2 and acetic acid. note their starting activities:
print(mod.buffer("CO2-AC"))
basis("CHNOS")
basis("O2", "CO2-AC")
affinity(return.buffer = TRUE)  # logfO2 = -75.94248
basis("CO2", 123)  # what the buffer reactions are balanced on
affinity(return.buffer = TRUE)  # unchanged
# Consider more oxidizing conditions
mod.buffer("CO2-AC", logact = c(0, -10))
affinity(return.buffer = TRUE)


[Package CHNOSZ version 2.0.0 Index]