data(thermo)
## chemical affinities of formation (for equal activities)
## and equilibrium activities (for equal affinities) of amino acids
opar <- par(mfrow=c(2,2))
mycol <- rev(rainbow(5))
basis("CHNOS+")
# comment out next line to find predominance of methionine
basis("H2S",-25)
aa <- c("glutamic acid","methionine","isoleucine",
"leucine","tyrosine")
species(aa)
# affinities of reactions per CO2 at fixed conditions
a <- affinity()
diagram(a,what="A",col=mycol,yline=3,
main=paste("affinity of formation reactions per CO2
",
"logfO2 = -80, logaH2O = 0"))
# affinities of reactions as a function of oxygen fugacity
a <- affinity(O2=c(-80,-66))
diagram(a,what="A",ylim=c(-15,5),col=mycol,lwd=2)
title("affinity per CO2; logaH2O = 0")
## logarithms of activities of amino acids
# reactions balanced on CO2
diagram(a,legend.x="bottomright",col=mycol,lwd=2)
title("equilibrium activities; logaH2O = 0")
# in two dimensions
a <- affinity(O2=c(-80,-66),H2O=c(-8,4))
diagram(a,color=mycol)
title("highest equilibrium activities")
# reset the plot device
par(opar)
### calculate the equilibrium logarithm of activity of a basis species
basis("CHNOS")
species(c("ethanol","acetic acid","lactic acid"))
a <- affinity(T=c(0,150))
diagram(a,what="O2")
# can also be done in 2 dimensions
a <- affinity(T=c(0,150),CO2=c(-10,0))
diagram(a,what="O2",ispecies=1,main=NULL)
diagram(a,what="O2",ispecies=2,col="red",add=TRUE)
diagram(a,what="O2",ispecies=3,col="blue",add=TRUE)
title(main="logfO2 ethanol/acetic/lactic (black/red/blue)")
### 1-D logarithm of activity plots
### (speciation diagrams)
## Aqueous sulfur species (after Seewald, 1997)
basis("CHNOS+")
basis("pH",5)
species(c("H2S","S2-2","S3-2","S2O3-2","S2O4-2","S3O6-2",
"S5O6-2","S2O6-2","HSO3-","SO2","HSO4-"))
diagram(affinity(O2=c(-50,-15),T=325,P=350),
ylim=c(-30,0),logact=-2,legend.x="topleft")
title(main=paste("Aqueous sulfur speciation, 325 degC, 350 bar
",
"After Seewald, 1997"))
# try it with and without the logact argument (total activity of
# the balanced quantity, in this case H2S aka sulfur)
## Degrees of formation of ionized forms of glycine
## After Fig. 1 of Aksu and Doyle, 2001
basis("CHNOS+")
species(ispecies <- info(c("glycinium","glycine","glycinate")))
a <- affinity(pH=c(0,14))
diagram(a,alpha=TRUE,lwd=1)
title(main=paste("Degrees of formation of aqueous glycine species\n",
"after Aksu and Doyle, 2001"))
## Degrees of formation of ATP species as a function of
## temperature, after LaRowe and Helgeson, 2007
# Mg+2 here is the immobile component
# cf. LH07, where bulk composition of Mg+2 is specified
basis(c("CO2","NH3","H2O","H3PO4","O2","H+","Mg+2"),
c(999,999,999,999,999,-5,-4))
species(c("HATP-3","H2ATP-2","MgATP-2","MgHATP-"))
diagram(affinity(T=c(0,120,25)),alpha=TRUE)
title(main=paste("Degrees of formation of ATP species,\n",
"pH=5, log(aMg+2)=-3. After LaRowe and Helgeson, 2007"),
cex.main=0.9)
## using strip(): equilibrium abundances of
## proteins from different mammals
organisms <- c("BOVIN","CANFA","HUMAN","MOUSE","PIG")
proteins <- c("AQP1","MYG","P53")
basis("CHNOS+")
species(rep(proteins,each=5),organisms)
a <- affinity(O2=c(-85,-65,128))
ispecies <- list(1:5,6:10,11:15)
desc <- c("(Aquaporin-1)","(Myoglobin)",
"(Cellular tumor antigen p53)")
names(ispecies) <- paste(proteins,desc)
col <- rainbow(5)
strip(a,ispecies=ispecies,ymin=-0.7,col=col)
legend("bottomright",legend=organisms,col=col,
lty=1,lwd=4,bty="n")
title(main=paste("Equilibrium degrees of formation of",
"proteins from different mammals",sep="\n"))
### predominance diagrams (equal activities of
### species as a function of two variables)
## T-P stability diagram for SiO2, after Ernst, 1976, Fig. 4.4
# the system is SiO2 (one component) but the basis species require
# all the elements: note that basis(c("SiO2","O2")) would identify
# SiO2(aq) which is okay but brings in calculations of properties
# of water which are relatively slow.
basis(c("quartz","O2")) # cr, gas
# browse the species of interest
info("SiO2 ")
# we'll take the crystalline ones
si <- info("SiO2","cr")
species(si)
# calculate chemical affinities
# the do.phases argument is necessary for
# dealing with the phase transitions of minerals
a <- affinity(T=c(0,2000),P=c(0,30000),do.phases=TRUE)
diagram(a)
title(main="Phases of SiO2\nafter Ernst, 1976")
## Distribution of copper on Eh-pH diagram
## after Fig. 15 of Pourbaix, 1949
basis(c("Cu+2","Cl-","H2O","H+","e-"))
basis("Cl-",-2)
# two aqueous species, three solid ones
# (our CuCl is aq but it was cr in P's Fig. 15)
species(c("CuCl","Cu+2","copper","cuprite","tenorite"))
# (which is equivalent to ...)
# species(c("CuCl","Cu+2","Cu","Cu2O","CuO"),c("","","","","","cr"))
a <- affinity(pH=c(0,7),Eh=c(-0.1,1))
# this one corresponds to activity contours of
# aqueous species at 10^-3 (the default aq activity in CHNOSZ)
diagram(a,color=NULL)
# here we set activities to unity; aq-cr boundaries change
species(c("CuCl","Cu+2"),c(0,0))
a <- affinity(pH=c(0,7),Eh=c(-0.1,1))
diagram(a,add=TRUE,names=NULL,col="blue",color=NULL)
water.lines()
title(main=paste("H2O-Cl-(Cu); activities of 10^-3 (black)\n",
"or 0 (blue); after Pourbaix, 1949"))
## a pe-pH diagram for hydrated iron sulfides,
## goethite and pyrite, After Majzlan et al., 2006
# add some of these species to the database
add.obigt()
basis(c("Fe+2","SO4-2","H2O","H+","e-"),c(0,log10(3),log10(0.75),999,999))
species(c("rhomboclase","ferricopiapite","hydronium jarosite",
"goethite","melanterite","pyrite"))
a <- affinity(pH=c(-1,4),pe=c(-5,23))
diagram(a)
water.lines(yaxis="pe")
title(main=paste("Fe-S-O-H After Majzlan et al., 2006",
describe(thermo$basis[2:3,],digits=2),sep="\n"))
# reset the database
data(thermo)
## cysteine-cysteinate-cystine Eh-pH at 25 and 100 deg C
basis("CHNOSe")
species(c("cysteine","cysteinate","cystine"))
a <- affinity(pH=c(5,10),Eh=c(-0.5,0))
diagram(a,color=NULL)
water.lines()
a <- affinity(pH=c(5,10),Eh=c(-0.5,0),T=100)
diagram(a,col="red",add=TRUE,names=NULL)
water.lines(T=convert(100,"K"),col="red")
title(main=paste("Cysteine Cysteinate Cystine",
"25 and 100 deg C",sep="\n"))
## Soil Organic Matter CO2-H2O, O2-H2O (after Tardy et al., 1997)
# NH3 is conserved, and H2O is on an axis of the diagram
# formulas for aqueous species, names for phases ...
add.obigt()
basis(c("NH3","water","CO2","O2"),c(999,999,-2.5,-28))
# switch to gaseous CO2 (aq is the default)
basis("CO2","gas")
# load the species of interest
species(c("microflore","plantes","acide fulvique",
"acide humique","humine"))
# proceed with the diagrams
diagram(affinity(H2O=c(-0.6,0.1),CO2=c(-3,-1)))
title(main=paste("Relative stabilities of soil organic matter\n",
"after Tardy et al., 1997"))
# this is the O2-H2O diagram
# diagram(affinity(H2O=c(-1,0.5),O2=c(-28.5,-27.5)))
data(thermo)
## Aqueous Aluminum Species F-/OH- (afer Tagirov and Schott, 2001)
# in order to reproduce this calculation, we have to
# consider the properties of species given by these authors,
# which are not the default ones in the database
add.obigt()
# The coefficients on H+ and O2 in all the formation reactions
# are zero, so the number of basis species here is three. Al+3
# becomes the conservant, and F- and OH- are being plotted ...
# so their initial activities don't have to be set.
basis(c("Al+3","F-","OH-","H+","O2"),rep(999,5))
species(c("Al+3","Al(OH)4-","AlOH+2","Al(OH)2+","Al(OH)3",
"AlF+2","AlF2+","AlF3","AlF4-","Al(OH)2F2-","Al(OH)2F","AlOHF2"))
# Increase the x- and y- resolution from the default and calculate
# and plot predominance limits. Names of charged basis species,
# such as "H+", "e-" and the ones shown here, should be quoted
# when given as arguments to affinity(). The OH- values shown here
# correspond to pH=c(0,14) (at unit activity of water).
a <- affinity("OH-"=c(-14,0),"F-"=c(-1,-8),T=200)
diagram(a)
title(main=paste("Aqueous aluminium species, T=200 C, P=Psat\n",
"after Tagirov and Schott, 2001"))
# We could do this to overlay boundaries for a different pressure
#a.P <- affinity("OH-"=c(-14,0),"F-"=c(-1,-8),T=200,P=5000)
#diagram(a.P,names=NULL,color=NULL,col="blue",add=TRUE)
# restore thermodynamic database to default
data(thermo)
## Fe-S-O at 200 deg C, After Helgeson, 1970
basis(c("Fe","O2","S2"))
species(c("iron","ferrous-oxide","magnetite",
"hematite","pyrite","pyrrhotite"))
a <- affinity(S2=c(-50,0),O2=c(-90,-10),T=200)
diagram(a,color="heat")
title(main=paste("Fe-S-O, 200 degrees C, 1 bar",
"After Helgeson, 1970",sep="\n"))
## Temperature-Pressure: kayanite-sillimanite-andalusite
# this is a system of a single component (Al2SiO5)
# but we still have to use the same number of
# basis species as the number of elements
basis(c("kyanite","quartz","oxygen"))
species(c("kyanite","sillimanite","andalusite"))
diagram(affinity(T=c(0,1000,200),P=c(500,5000,200)),color=NULL)
title(main="Al2SiO5") # end donttest
Run the code above in your browser using DataLab