[2] buffer

## Don't show: data(thermo)
thermo$obigt: 1911 aqueous, 3588 total species
## End(Don't show) ## list the buffers thermo$buffers
name species state logact 1 AC acetic acid aq -3 2 FORM formic acid aq -3 3 AL alanine aq -3 4 GLN glutamine aq -3 5 UREA urea aq -3 6 ATP H4ATP aq -3 7 GSH glutathione aq -3 8 LYS lysine aq -3 9 RIBOSE ribose aq -3 10 GLUCOSE glucose aq -3 11 CYSTINE cystine aq -3 12 ETHANOL ethanol aq -3 13 MAMINE methanamine aq -3 14 HM hematite cr 0 15 HM magnetite cr 0 16 FeFeO iron cr 0 17 FeFeO FeO cr 0 18 CO2-AC CO2 aq -3 19 CO2-AC acetic acid aq -3 20 C2H4-AC C2H4 aq -3 21 C2H4-AC acetic acid aq -3 22 CH4-AC CH4 aq -3 23 CH4-AC acetic acid aq -10 24 ET-H C2H4 aq -3 25 ET-H C2H6 aq -15 26 cysteine-cystine cysteine aq -3 27 cysteine-cystine cystine aq -3 28 GSH-GSSG GSH aq -3 29 GSH-GSSG GSSG aq -9 30 NADred-NADox HNAD(red)- aq -3 31 NADred-NADox NAD(ox)- aq -3 32 QFM quartz cr 0 33 QFM fayalite cr 0 34 QFM magnetite cr 0 35 PPM pyrite cr 0 36 PPM pyrrhotite cr 0 37 PPM magnetite cr 0 38 water water liq 0 39 quartz quartz cr 0
# another way to do it, for a specific buffer print(mod.buffer("PPM"))
mod.buffer: nothing changed for pyrite pyrrhotite magnetite in PPM buffer name species state logact 35 PPM pyrite cr 0 36 PPM pyrrhotite cr 0 37 PPM magnetite cr 0
## 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")
C H N O S ispecies logact state CO2 1 0 0 2 0 1576 -3 aq H2O 0 2 0 1 0 1 0 liq NH3 0 3 1 0 0 66 -4 aq H2S 0 2 0 0 1 67 -7 aq O2 0 0 0 2 0 3316 -80 gas
basis("CO2","AC")
C H N O S ispecies logact state CO2 1 0 0 2 0 1576 AC aq H2O 0 2 0 1 0 1 0 liq NH3 0 3 1 0 0 66 -4 aq H2S 0 2 0 0 1 67 -7 aq O2 0 0 0 2 0 3316 -80 gas
# what activity of acetic acid are we using? print(mod.buffer("AC"))
mod.buffer: nothing changed for acetic acid in AC buffer name species state logact 1 AC acetic acid aq -3
# return the activity of CO2 (logaCO2 <- affinity(return.buffer=TRUE)$CO2)
energy.args: temperature is 25 C energy.args: pressure is Psat affinity: loading buffer species subcrt: 6 species at 298.15 K and 1 bar (wet) buffer: ( AC ) for activity of CO2 (active) [1] -7.057521
stopifnot(all.equal(logaCO2, -7.05752136)) # as a function of oxygen fugacity affinity(O2=c(-85,-70,4),return.buffer=TRUE)
energy.args: temperature is 25 C energy.args: pressure is Psat energy.args: variable 1 is log_f(O2) at 4 values from -85 to -70 affinity: loading buffer species subcrt: 6 species at 298.15 K and 1 bar (wet) buffer: ( AC ) for activity of CO2 (active) $CO2 [1] -12.057521 -7.057521 -2.057521 2.942479 $vars [1] "O2" $vals $vals[[1]] [1] -85 -80 -75 -70
# as a function of logfO2 and temperature affinity(O2=c(-85,-70,4),T=c(25,100,4),return.buffer=TRUE)
energy.args: pressure is Psat energy.args: variable 1 is log_f(O2) at 4 values from -85 to -70 energy.args: variable 2 is T at 4 values from 298.15 to 373.15 K affinity: loading buffer species subcrt: 6 species at 4 values of T and P (wet) buffer: ( AC ) for activity of CO2 (active) $CO2 -85 -80 -75 -70 298.15 -12.057521 -18.22398 -23.463408 -27.96655 323.15 -7.057521 -13.22398 -18.463408 -22.96655 348.15 -2.057521 -8.22398 -13.463408 -17.96655 373.15 2.942479 -3.22398 -8.463408 -12.96655 $vars [1] "O2" "T" $vals $vals[[1]] [1] -85 -80 -75 -70 $vals[[2]] [1] 25 50 75 100
# change the activity of species in the buffer mod.buffer("AC",logact=-10)
mod.buffer: changed state and/or logact of acetic acid in AC buffer
affinity(O2=c(-85,-70,4),T=c(25,100,4),return.buffer=TRUE)
energy.args: pressure is Psat energy.args: variable 1 is log_f(O2) at 4 values from -85 to -70 energy.args: variable 2 is T at 4 values from 298.15 to 373.15 K affinity: loading buffer species subcrt: 6 species at 4 values of T and P (wet) buffer: ( AC ) for activity of CO2 (active) $CO2 -85 -80 -75 -70 298.15 -15.5575214 -21.72398 -26.96341 -31.46655 323.15 -10.5575214 -16.72398 -21.96341 -26.46655 348.15 -5.5575214 -11.72398 -16.96341 -21.46655 373.15 -0.5575214 -6.72398 -11.96341 -16.46655 $vars [1] "O2" "T" $vals $vals[[1]] [1] -85 -80 -75 -70 $vals[[2]] [1] 25 50 75 100
# see below for a different strategy using the # 'what' argument of diagram ## 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))
Fe H O S ispecies logact state FeS2 1 0 0 2 2113 0 cr H2S 0 2 0 1 67 -10 aq O2 0 0 2 0 65 -50 aq H2O 0 2 1 0 1 0 liq
# note that the affinity of formation of pyrite, # which corresponds to FeS2 in the basis, is zero species(c("pyrite","pyrrhotite","magnetite"))
FeS2 H2S O2 H2O ispecies logact state name 1 1 0 0.0 0 2113 0 cr pyrite 2 1 -1 -0.5 1 2117 0 cr pyrrhotite 3 3 -6 -1.0 6 2081 0 cr magnetite
affinity(T=c(200,400,11),P=2000)$values
energy.args: pressure is 2000 bar energy.args: variable 1 is T at 11 values from 473.15 to 673.15 K subcrt: 7 species at 11 values of T and P (wet) info.numeric: H of magnetite(cr2) is NA; set to -265601.09 info.numeric: H of magnetite(cr2) is NA; set to -265601.09 subcrt: 3 phases for pyrrhotite ... phases 2 3 are stable subcrt: 2 phases for magnetite ... phase 1 is stable $`2113` [1] 0 0 0 0 0 0 0 0 0 0 0 $`2117` [1] 6.971808 8.542686 10.004645 11.369458 12.647266 13.846863 14.975914 16.041961 17.049550 18.003641 [11] 18.908975 $`2081` [1] 37.70052 42.19367 46.38572 50.30899 53.99138 57.45709 60.72725 63.82038 66.75281 69.53900 72.19178
# setup H2S and O2 to be buffered by PPM basis(c("H2S","O2"),c("PPM","PPM"))
Fe H O S ispecies logact state FeS2 1 0 0 2 2113 0 cr H2S 0 2 0 1 67 PPM aq O2 0 0 2 0 65 PPM aq H2O 0 2 1 0 1 0 liq
# inspect values of H2S activity and O2 fugacity affinity(T=c(200, 400, 11), P=2000, return.buffer=TRUE, exceed.Ttr=TRUE)
energy.args: pressure is 2000 bar energy.args: variable 1 is T at 11 values from 473.15 to 673.15 K affinity: loading buffer species subcrt: 7 species at 11 values of T and P (wet) info.numeric: H of magnetite(cr2) is NA; set to -265601.09 info.numeric: H of magnetite(cr2) is NA; set to -265601.09 subcrt: 3 phases for pyrrhotite ... phases 2 3 are stable subcrt: 2 phases for magnetite ... phase 1 is stable buffer: ( PPM ) for activity of H2S O2 (active), FeS2 (conserved) $H2S [1] -4.060773 -3.722926 -3.405893 -3.107481 -2.825788 -2.559160 -2.306146 -2.065886 -1.836573 -1.617071 [11] -1.406831 $O2 [1] -47.93484 -45.46878 -43.17892 -41.04612 -39.05389 -37.18795 -35.43588 -33.78431 -32.22775 -30.75857 [11] -29.36723 $FeS2 [1] 0 0 0 0 0 0 0 0 0 0 0 $vars [1] "T" $vals $vals[[1]] [1] 200 220 240 260 280 300 320 340 360 380 400
# now, the affinities of formation reactions of # species in the buffer are all equal to zero print(a <- affinity(T=c(200, 400, 11), P=2000, exceed.Ttr=TRUE)$values)
energy.args: pressure is 2000 bar energy.args: variable 1 is T at 11 values from 473.15 to 673.15 K affinity: loading buffer species subcrt: 7 species at 11 values of T and P (wet) info.numeric: H of magnetite(cr2) is NA; set to -265601.09 info.numeric: H of magnetite(cr2) is NA; set to -265601.09 subcrt: 3 phases for pyrrhotite ... phases 2 3 are stable subcrt: 2 phases for magnetite ... phase 1 is stable buffer: ( PPM ) for activity of H2S O2 (active), FeS2 (conserved) $`2113` [1] 0 0 0 0 0 0 0 0 0 0 0 $`2117` [1] -3.552714e-15 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 [8] 0.000000e+00 0.000000e+00 0.000000e+00 -1.776357e-15 $`2081` [1] 0 0 0 0 0 0 0 0 0 0 0
for(i in 1:length(a)) stopifnot(isTRUE( all.equal(as.numeric(a[[i]]),rep(0,length(a[[i]]))))) ## buffer made of one species: show values of logfO2 on an ## Eh-pH diagram; after Garrels, 1960, Figure 6 basis("CHNOSe")
C H N O S Z ispecies logact state CO2 1 0 0 2 0 0 1576 -3 aq H2O 0 2 0 1 0 0 1 0 liq NH3 0 3 1 0 0 0 66 -4 aq H2S 0 2 0 0 1 0 67 -7 aq e- 0 0 0 0 0 -1 2 -7 aq H+ 0 1 0 0 0 1 3 -7 aq
# here we will buffer the activity of the electron by O2 mod.buffer("O2","O2","gas",999)
mod.buffer: added O2
basis("e-","O2")
C H N O S Z ispecies logact state CO2 1 0 0 2 0 0 1576 -3 aq H2O 0 2 0 1 0 0 1 0 liq NH3 0 3 1 0 0 0 66 -4 aq H2S 0 2 0 0 1 0 67 -7 aq e- 0 0 0 0 0 -1 2 O2 aq H+ 0 1 0 0 0 1 3 -7 aq
# 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) # add some labels text(seq(0,14,length.out=15)[i*2+2],Eh[i*2+2], paste("logfO2=",logfO2[i],sep="")) }
mod.buffer: changed state and/or logact of O2 in O2 buffer energy.args: temperature is 25 C energy.args: pressure is Psat energy.args: variable 1 is pH at 15 values from 0 to 14 affinity: loading buffer species subcrt: 7 species at 298.15 K and 1 bar (wet) buffer: ( O2 ) for activity of e- (active) mod.buffer: changed state and/or logact of O2 in O2 buffer energy.args: temperature is 25 C energy.args: pressure is Psat energy.args: variable 1 is pH at 15 values from 0 to 14 affinity: loading buffer species subcrt: 7 species at 298.15 K and 1 bar (wet) buffer: ( O2 ) for activity of e- (active) mod.buffer: changed state and/or logact of O2 in O2 buffer energy.args: temperature is 25 C energy.args: pressure is Psat energy.args: variable 1 is pH at 15 values from 0 to 14 affinity: loading buffer species subcrt: 7 species at 298.15 K and 1 bar (wet) buffer: ( O2 ) for activity of e- (active) mod.buffer: changed state and/or logact of O2 in O2 buffer energy.args: temperature is 25 C energy.args: pressure is Psat energy.args: variable 1 is pH at 15 values from 0 to 14 affinity: loading buffer species subcrt: 7 species at 298.15 K and 1 bar (wet) buffer: ( O2 ) for activity of e- (active) mod.buffer: changed state and/or logact of O2 in O2 buffer energy.args: temperature is 25 C energy.args: pressure is Psat energy.args: variable 1 is pH at 15 values from 0 to 14 affinity: loading buffer species subcrt: 7 species at 298.15 K and 1 bar (wet) buffer: ( O2 ) for activity of e- (active)
title(main=paste("Relation between logfO2(g), Eh and pH at\n", "25 degC and 1 bar. After Garrels, 1960"))

Image buffer1

 

## buffer made of two species # conditions for metastable equilibrium among # CO2 and acetic acid. note their starting activities: print(mod.buffer("CO2-AC"))
mod.buffer: nothing changed for CO2 acetic acid in CO2-AC buffer name species state logact 18 CO2-AC CO2 aq -3 19 CO2-AC acetic acid aq -3
basis("CHNOS")
C H N O S ispecies logact state CO2 1 0 0 2 0 1576 -3 aq H2O 0 2 0 1 0 1 0 liq NH3 0 3 1 0 0 66 -4 aq H2S 0 2 0 0 1 67 -7 aq O2 0 0 0 2 0 3316 -80 gas
basis("O2","CO2-AC")
C H N O S ispecies logact state CO2 1 0 0 2 0 1576 -3 aq H2O 0 2 0 1 0 1 0 liq NH3 0 3 1 0 0 66 -4 aq H2S 0 2 0 0 1 67 -7 aq O2 0 0 0 2 0 3316 CO2-AC gas
affinity(return.buffer=TRUE) # logfO2 = -75.94248
energy.args: temperature is 25 C energy.args: pressure is Psat affinity: loading buffer species subcrt: 7 species at 298.15 K and 1 bar (wet) buffer: ( CO2-AC ) for activity of O2 (active), CO2 (conserved) $O2 [1] -75.94248 $CO2 [1] -3 $vars character(0) $vals $vals[[1]] [1] NA
basis("CO2",123) # what the buffer reactions are balanced on
C H N O S ispecies logact state CO2 1 0 0 2 0 1576 123 aq H2O 0 2 0 1 0 1 0 liq NH3 0 3 1 0 0 66 -4 aq H2S 0 2 0 0 1 67 -7 aq O2 0 0 0 2 0 3316 CO2-AC gas
affinity(return.buffer=TRUE) # unchanged
energy.args: temperature is 25 C energy.args: pressure is Psat affinity: loading buffer species subcrt: 7 species at 298.15 K and 1 bar (wet) buffer: ( CO2-AC ) for activity of O2 (active), CO2 (conserved) $O2 [1] -75.94248 $CO2 [1] -3 $vars character(0) $vals $vals[[1]] [1] NA
# consider more oxidizing conditions mod.buffer("CO2-AC",logact=c(0,-10))
mod.buffer: changed state and/or logact of CO2 acetic acid in CO2-AC buffer
affinity(return.buffer=TRUE)
energy.args: temperature is 25 C energy.args: pressure is Psat affinity: loading buffer species subcrt: 7 species at 298.15 K and 1 bar (wet) buffer: ( CO2-AC ) for activity of O2 (active), CO2 (conserved) $O2 [1] -69.44248 $CO2 [1] 0 $vars character(0) $vals $vals[[1]] [1] NA
# one can solve for the logarithm of activity of a # basis species using the 'what' argument of diagram basis("CHNOS")
C H N O S ispecies logact state CO2 1 0 0 2 0 1576 -3 aq H2O 0 2 0 1 0 1 0 liq NH3 0 3 1 0 0 66 -4 aq H2S 0 2 0 0 1 67 -7 aq O2 0 0 0 2 0 3316 -80 gas
basis("CO2", 999)
C H N O S ispecies logact state CO2 1 0 0 2 0 1576 999 aq H2O 0 2 0 1 0 1 0 liq NH3 0 3 1 0 0 66 -4 aq H2S 0 2 0 0 1 67 -7 aq O2 0 0 0 2 0 3316 -80 gas
species("acetic acid", -3)
CO2 H2O NH3 H2S O2 ispecies logact state name 1 2 2 0 0 -2 1045 -3 aq acetic acid
a <- affinity(O2=c(-85, -70, 4), T=c(25, 100, 4))
energy.args: pressure is Psat energy.args: variable 1 is log_f(O2) at 4 values from -85 to -70 energy.args: variable 2 is T at 4 values from 298.15 to 373.15 K subcrt: 6 species at 4 values of T and P (wet)
# write a title with formulas and subscripts lCO2 <- axis.label("CO2") main <- substitute(a~~b~~c,list(a=lCO2, b="buffered by", c="acetic acid")) d <- diagram(a, what="CO2", main=main) species(1, -10)
CO2 H2O NH3 H2S O2 ispecies logact state name 1 2 2 0 0 -2 1045 -10 aq acetic acid
a <- affinity(O2=c(-85, -70, 4), T=c(25, 100, 4))
energy.args: pressure is Psat energy.args: variable 1 is log_f(O2) at 4 values from -85 to -70 energy.args: variable 2 is T at 4 values from 298.15 to 373.15 K subcrt: 6 species at 4 values of T and P (wet)
d <- diagram(a, what="CO2", add=TRUE, lty=2) # add a legend lAC <- expr.species("CH3COOH", log="aq") ltext <- c(as.expression(lAC), -3, -10) lty <- c(NA, 1, 2) legend("topright", legend=ltext, lty=lty, bg="white") # do return.buffer and diagram(what) give the same results? and <- as.numeric(d$plotvals[[1]]) basis("CO2", "AC")
C H N O S ispecies logact state CO2 1 0 0 2 0 1576 AC aq H2O 0 2 0 1 0 1 0 liq NH3 0 3 1 0 0 66 -4 aq H2S 0 2 0 0 1 67 -7 aq O2 0 0 0 2 0 3316 -80 gas
mod.buffer("AC", logact=-10)
mod.buffer: nothing changed for acetic acid in AC buffer
a.buffer <- affinity(O2=c(-85, -70, 4), T=c(25, 100, 4), return.buffer=TRUE)
energy.args: pressure is Psat energy.args: variable 1 is log_f(O2) at 4 values from -85 to -70 energy.args: variable 2 is T at 4 values from 298.15 to 373.15 K affinity: loading buffer species subcrt: 6 species at 4 values of T and P (wet) buffer: ( AC ) for activity of CO2 (active)
ana <- as.numeric(unlist(a.buffer[[1]])) stopifnot(all.equal(ana, and))

Image buffer2