next up previous
Next: [1] iprotein Up: CHNOSZ examples Previous: [1] diagram (other plots)

[1] buffer

## Don't show: data(thermo)
thermo$obigt: 1809 aqueous, 3368 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 cr1 0 15 HM magnetite cr1 0 16 FeFeO Fe cr1 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 cr1 0 33 QFM fayalite cr 0 34 QFM magnetite cr1 0 35 PPM pyrite cr 0 36 PPM pyrrhotite cr1 0 37 PPM magnetite cr1 0 38 water water liq 0 39 quartz quartz cr1 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 cr1 0 37 PPM magnetite cr1 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 69 -3 aq H2O 0 2 0 1 0 1 0 liq NH3 0 3 1 0 0 68 -4 aq H2S 0 2 0 0 1 70 -7 aq O2 0 0 0 2 0 3095 -80 gas
basis("CO2","AC")
C H N O S ispecies logact state CO2 1 0 0 2 0 69 AC aq H2O 0 2 0 1 0 1 0 liq NH3 0 3 1 0 0 68 -4 aq H2S 0 2 0 0 1 70 -7 aq O2 0 0 0 2 0 3095 -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.221583 -23.455925 -27.95307 323.15 -7.057521 -13.221583 -18.455925 -22.95307 348.15 -2.057521 -8.221583 -13.455925 -17.95307 373.15 2.942479 -3.221583 -8.455925 -12.95307 $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.721583 -26.95593 -31.45307 323.15 -10.5575214 -16.721583 -21.95593 -26.45307 348.15 -5.5575214 -11.721583 -16.95593 -21.45307 373.15 -0.5575214 -6.721583 -11.95593 -16.45307 $vars [1] "O2" "T" $vals $vals[[1]] [1] -85 -80 -75 -70 $vals[[2]] [1] 25 50 75 100
# see demo('CO2Ac') 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 2007 0 cr H2S 0 2 0 1 70 -10 aq O2 0 0 2 0 67 -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 2007 0 cr pyrite 2 1 -1 -0.5 1 2011 0 cr1 pyrrhotite 3 3 -6 -1.0 6 1975 0 cr1 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) subcrt: some points above transition temperature for pyrrhotite cr1 (using NA for G) $`2007` [1] 0 0 0 0 0 0 0 0 0 0 0 $`2011` [1] NA NA NA NA NA NA NA NA NA NA NA $`1975` [1] 37.39726 41.83095 45.96106 49.82055 53.43785 56.83766 60.04153 63.06838 65.93488 68.65579 71.24424
# 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 2007 0 cr H2S 0 2 0 1 70 PPM aq O2 0 0 2 0 67 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) subcrt: some points above transition temperature for pyrrhotite cr1 (extrapolating G) buffer: ( PPM ) for activity of H2S O2 (active), FeS2 (conserved) $H2S [1] -4.090557 -3.757008 -3.445265 -3.153040 -2.878350 -2.619457 -2.374837 -2.143144 -1.923184 -1.713893 [11] -1.514320 $O2 [1] -48.05940 -45.62700 -43.36735 -41.26121 -39.29205 -37.44560 -35.70945 -34.07275 -32.52602 -31.06085 [11] -29.66984 $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) subcrt: some points above transition temperature for pyrrhotite cr1 (extrapolating G) buffer: ( PPM ) for activity of H2S O2 (active), FeS2 (conserved) $`2007` [1] 0 0 0 0 0 0 0 0 0 0 0 $`2011` [1] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 -3.552714e-15 0.000000e+00 [8] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 $`1975` [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 69 -3 aq H2O 0 2 0 1 0 0 1 0 liq NH3 0 3 1 0 0 0 68 -4 aq H2S 0 2 0 0 1 0 70 -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 69 -3 aq H2O 0 2 0 1 0 0 1 0 liq NH3 0 3 1 0 0 0 68 -4 aq H2S 0 2 0 0 1 0 70 -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 69 -3 aq H2O 0 2 0 1 0 1 0 liq NH3 0 3 1 0 0 68 -4 aq H2S 0 2 0 0 1 70 -7 aq O2 0 0 0 2 0 3095 -80 gas
basis("O2","CO2-AC")
C H N O S ispecies logact state CO2 1 0 0 2 0 69 -3 aq H2O 0 2 0 1 0 1 0 liq NH3 0 3 1 0 0 68 -4 aq H2S 0 2 0 0 1 70 -7 aq O2 0 0 0 2 0 3095 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 69 123 aq H2O 0 2 0 1 0 1 0 liq NH3 0 3 1 0 0 68 -4 aq H2S 0 2 0 0 1 70 -7 aq O2 0 0 0 2 0 3095 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


next up previous
Next: [1] iprotein Up: CHNOSZ examples Previous: [1] diagram (other plots)