[CHNOSZ-commits] r773 - in pkg/CHNOSZ: . man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Mar 4 03:02:13 CET 2023
Author: jedick
Date: 2023-03-04 03:02:13 +0100 (Sat, 04 Mar 2023)
New Revision: 773
Modified:
pkg/CHNOSZ/DESCRIPTION
pkg/CHNOSZ/man/IAPWS95.Rd
pkg/CHNOSZ/man/add.OBIGT.Rd
pkg/CHNOSZ/man/affinity.Rd
pkg/CHNOSZ/man/basis.Rd
pkg/CHNOSZ/man/buffer.Rd
pkg/CHNOSZ/man/diagram.Rd
pkg/CHNOSZ/man/equilibrate.Rd
pkg/CHNOSZ/man/examples.Rd
pkg/CHNOSZ/man/info.Rd
pkg/CHNOSZ/man/ionize.aa.Rd
pkg/CHNOSZ/man/makeup.Rd
pkg/CHNOSZ/man/mosaic.Rd
pkg/CHNOSZ/man/nonideal.Rd
pkg/CHNOSZ/man/retrieve.Rd
pkg/CHNOSZ/man/species.Rd
pkg/CHNOSZ/man/taxonomy.Rd
pkg/CHNOSZ/man/thermo.Rd
pkg/CHNOSZ/man/util.array.Rd
pkg/CHNOSZ/man/util.data.Rd
pkg/CHNOSZ/man/util.expression.Rd
pkg/CHNOSZ/man/util.fasta.Rd
pkg/CHNOSZ/man/util.formula.Rd
pkg/CHNOSZ/man/util.misc.Rd
pkg/CHNOSZ/man/util.seq.Rd
pkg/CHNOSZ/man/util.water.Rd
Log:
Capitalize comments in examples
Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION 2023-03-03 04:56:39 UTC (rev 772)
+++ pkg/CHNOSZ/DESCRIPTION 2023-03-04 02:02:13 UTC (rev 773)
@@ -1,6 +1,6 @@
-Date: 2023-03-03
+Date: 2023-03-04
Package: CHNOSZ
-Version: 1.9.9-64
+Version: 1.9.9-65
Title: Thermodynamic Calculations and Diagrams for Geochemistry
Authors at R: c(
person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"),
Modified: pkg/CHNOSZ/man/IAPWS95.Rd
===================================================================
--- pkg/CHNOSZ/man/IAPWS95.Rd 2023-03-03 04:56:39 UTC (rev 772)
+++ pkg/CHNOSZ/man/IAPWS95.Rd 2023-03-04 02:02:13 UTC (rev 773)
@@ -38,8 +38,8 @@
}
\examples{
-## calculate pressure for given temperature, density
-IAPWS95("P", T=500, rho=838.0235)
+# Calculate pressure for given temperature and density
+IAPWS95("P", T = 500, rho = 838.0235)
}
\references{
Modified: pkg/CHNOSZ/man/add.OBIGT.Rd
===================================================================
--- pkg/CHNOSZ/man/add.OBIGT.Rd 2023-03-03 04:56:39 UTC (rev 772)
+++ pkg/CHNOSZ/man/add.OBIGT.Rd 2023-03-04 02:02:13 UTC (rev 773)
@@ -134,18 +134,18 @@
# Another use of add.OBIGT(): calculate Delta G of
# H4SiO4 = SiO2 + 2H2O using different data for SiO2.
-# first, get H4SiO4 from Stefansson, 2001
+# First, get H4SiO4 from Stefansson, 2001
add.OBIGT("AS04", "H4SiO4")
T <- seq(0, 350, 10)
s1 <- subcrt(c("H4SiO4", "SiO2", "H2O"), c(-1, 1, 2), T = T)
-# now, get SiO2 from Apps and Spycher, 2004
+# Now, get SiO2 from Apps and Spycher, 2004
add.OBIGT("AS04", "SiO2")
s2 <- subcrt(c("H4SiO4", "SiO2", "H2O"), c(-1, 1, 2), T = T)
-# plot logK from the first and second calculations
+# Plot logK from the first and second calculations
plot(T, s1$out$G, type = "l", xlab = axis.label("T"),
ylab = axis.label("DG"), ylim = c(-500, 2500))
lines(T, s2$out$G, lty = 2)
-# add title and legend
+# Add title and legend
title(main = describe.reaction(s1$reaction))
stxt <- lapply(c("H4SiO4", "SiO2", "SiO2"), expr.species)
legend("top", legend = as.expression(stxt), bty = "n")
Modified: pkg/CHNOSZ/man/affinity.Rd
===================================================================
--- pkg/CHNOSZ/man/affinity.Rd 2023-03-03 04:56:39 UTC (rev 772)
+++ pkg/CHNOSZ/man/affinity.Rd 2023-03-04 02:02:13 UTC (rev 773)
@@ -78,27 +78,27 @@
}
\examples{
-\dontshow{reset()}## set up a system and calculate
+\dontshow{reset()}## Set up a system and calculate
## chemical affinities of formation reactions
basis(c("SiO2", "MgO", "H2O", "O2"), c(-5, -5, 0, 999))
species(c("quartz","enstatite","forsterite"))
-# chemical affinities (A/2.303RT) at 25 deg C and 1 bar
+# Chemical affinities (A/2.303RT) at 25 deg C and 1 bar
affinity()
-# at higher temperature and pressure
-affinity(T=500, P=2000)
-# at 25 temperatures and pressures,
+# At higher temperature and pressure
+affinity(T = 500, P = 2000)
+# At 25 temperatures and pressures,
# some are in the low-density region so we suppress warnings
-suppressWarnings(affinity(T=c(500, 1000, 5), P=c(1000, 5000, 5)))
-# equilibrium constants of formation reactions
-affinity(property="logK")
-# standard molal Gibbs energies of species,
-# user units (default: cal/mol)
-affinity(property="G.species")
-# standard molal Gibbs energies of reactions
-affinity(property="G")
-# a T,P-transect
+suppressWarnings(affinity(T = c(500, 1000, 5), P = c(1000, 5000, 5)))
+# Equilibrium constants of formation reactions
+affinity(property = "logK")
+# Standard molal Gibbs energies of species,
+# in units set by E.units() (default: J/mol)
+affinity(property = "G.species")
+# Standard molal Gibbs energies of reactions
+affinity(property = "G")
+# A T,P-transect
# (fluid pressure from Helgeson et al., 2009 Fig. 7)
-affinity(T=c(25, 110, 115, 215), P=c(11, 335, 500, 1450))
+affinity(T = c(25, 110, 115, 215), P = c(11, 335, 500, 1450))
}
\references{
Modified: pkg/CHNOSZ/man/basis.Rd
===================================================================
--- pkg/CHNOSZ/man/basis.Rd 2023-03-03 04:56:39 UTC (rev 772)
+++ pkg/CHNOSZ/man/basis.Rd 2023-03-04 02:02:13 UTC (rev 773)
@@ -83,28 +83,28 @@
\examples{
\dontshow{reset()}
-## define basis species
-# one, two and three element examples
+## Define basis species
+# with one, two or three elements
basis("O2")
basis(c("H2O", "O2"))
basis(c("H2O", "O2", "H+"))
-## clear the basis species
+## Clear the basis species
basis("")
\dontrun{
-## marked dontrun because they produce errors
-# fewer species than elements
+## Marked dontrun because they produce errors
+# Fewer species than elements
basis(c("H2O", "H+"))
-# more species than elements
+# More species than elements
basis(c("H2O", "O2", "H2", "H+"))
-# non-independent species
+# Non-independent species
basis(c("CO2", "H2O", "HCl", "Cl-", "H+"))}
-## specify activities and states
+## Specify activities and states
basis(c("H2O", "O2", "CO2"), c(-2, -78, -3), c("liq", "aq", "aq"))
-# change logarithms of activities/fugacities
+# Change logarithms of activities/fugacities
basis(c("H2O", "O2"), c(0, -80))
-# change state of CO2
+# Change state of CO2
basis("CO2", "gas")
}
Modified: pkg/CHNOSZ/man/buffer.Rd
===================================================================
--- pkg/CHNOSZ/man/buffer.Rd 2023-03-03 04:56:39 UTC (rev 772)
+++ pkg/CHNOSZ/man/buffer.Rd 2023-03-04 02:02:13 UTC (rev 773)
@@ -47,68 +47,68 @@
\examples{
\dontshow{reset()}
-## list the buffers
+## List the buffers
thermo()$buffer
-# another way to do it, for a specific 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
+## 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?
+# What activity of acetic acid are we using?
print(mod.buffer("AC"))
-# return the activity of CO2
+# Return the activity of CO2
affinity(return.buffer = TRUE)$CO2 # -7.057521
-# as a function of oxygen fugacity
+# As a function of oxygen fugacity
affinity(O2 = c(-85, -70, 4), return.buffer = TRUE)
-# as a function of logfO2 and temperature
+# 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
+# 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
+## Buffer made of three species
## Pyrite-Pyrrhotite-Magnetite (PPM)
-# specify basis species and initial activities
+# 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,
+# 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
+# Setup H2S and O2 to be buffered by PPM
basis(c("H2S", "O2"), c("PPM", "PPM"))
-# inspect values of H2S activity and O2 fugacity
+# 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
+# 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
+# The affinities for species in the buffer are all equal to zero
all.equal(as.numeric(a[[1]]), rep(0, 11)) # TRUE
all.equal(as.numeric(a[[2]]), rep(0, 11)) # TRUE
all.equal(as.numeric(a[[3]]), rep(0, 11)) # TRUE
-## buffer made of one species: show values of logfO2 on an
+## 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
+# 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
+# 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
+# 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
+ # 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
+ # 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
+ # 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
+ # Add some labels
text(seq(0, 14, length.out = 15)[i*2+2], Eh[i*2+2],
paste("logfO2 =", logfO2[i]))
}
@@ -115,8 +115,8 @@
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
+## 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")
@@ -124,7 +124,7 @@
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
+# Consider more oxidizing conditions
mod.buffer("CO2-AC", logact = c(0, -10))
affinity(return.buffer = TRUE)
}
Modified: pkg/CHNOSZ/man/diagram.Rd
===================================================================
--- pkg/CHNOSZ/man/diagram.Rd 2023-03-03 04:56:39 UTC (rev 772)
+++ pkg/CHNOSZ/man/diagram.Rd 2023-03-04 02:02:13 UTC (rev 773)
@@ -216,13 +216,13 @@
\examples{
\dontshow{reset()}
-## calculate the equilibrium logarithm of activity of a
+## Calculate the equilibrium logarithm of activity of a
## basis species in different reactions
basis("CHNOS")
species(c("ethanol", "lactic acid", "deoxyribose", "ribose"))
-a <- affinity(T=c(0, 150))
-diagram(a, type="O2", legend.x="topleft", col=rev(rainbow(4)), lwd=2)
-title(main="Equilibrium logfO2 for 1e-3 mol/kg of CO2 and ... ")
+a <- affinity(T = c(0, 150))
+diagram(a, type = "O2", legend.x = "topleft", col = rev(rainbow(4)), lwd = 2)
+title(main = "Equilibrium logfO2 for 1e-3 mol/kg of CO2 and ... ")
### 1-D diagrams: logarithms of activities
@@ -230,10 +230,10 @@
## After Fig. 1 of Aksu and Doyle, 2001
basis("CHNOS+")
species(ispecies <- info(c("glycinium", "glycine", "glycinate")))
-a <- affinity(pH=c(0, 14))
+a <- affinity(pH = c(0, 14))
e <- equilibrate(a)
-diagram(e, alpha=TRUE, lwd=1)
-title(main=paste("Degrees of formation of aqueous glycine species\n",
+diagram(e, 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
@@ -243,26 +243,26 @@
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-"))
-a <- affinity(T=c(0, 120, 25))
+a <- affinity(T = c(0, 120, 25))
e <- equilibrate(a)
-diagram(e, alpha=TRUE)
-title(main=paste("Degrees of formation of ATP species,\n",
+diagram(e, 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)
+ cex.main = 0.9)
### 2-D diagrams: predominance diagrams
-### these use the maximum affinity method
+### These use the maximum affinity method
## Fe-S-O at 200 deg C, after Helgeson, 1970
basis(c("Fe", "oxygen", "S2"))
species(c("iron", "ferrous-oxide", "magnetite",
"hematite", "pyrite", "pyrrhotite"))
-# the calculations include the phase transitions of
+# The calculations include the phase transitions of
# pyrrhotite; no additional step is needed
-a <- affinity(S2=c(-50, 0), O2=c(-90, -10), T=200)
-diagram(a, fill="heat")
-title(main=paste("Fe-S-O, 200 degrees C, 1 bar",
- "After Helgeson, 1970", sep="\n"))
+a <- affinity(S2 = c(-50, 0), O2 = c(-90, -10), T=200)
+diagram(a, fill = "heat")
+title(main = paste("Fe-S-O, 200 degrees C, 1 bar",
+ "After Helgeson, 1970", sep = "\n"))
## pe-pH diagram for hydrated iron sulfides,
## goethite and pyrite, after Majzlan et al., 2006
@@ -270,13 +270,13 @@
c(0, log10(3), log10(0.75), 999, 999))
species(c("rhomboclase", "ferricopiapite", "hydronium jarosite",
"goethite", "melanterite", "pyrite"))
-a <- affinity(pH=c(-1, 4, 256), pe=c(-5, 23, 256))
-d <- diagram(a, main="Fe-S-O-H, after Majzlan et al., 2006")
-water.lines(d, lwd=2)
-text(3, 22, describe.basis(2:3, digits=2, oneline=TRUE))
-text(3, 21, describe.property(c("T", "P"), c(25, 1), oneline=TRUE))
+a <- affinity(pH = c(-1, 4, 256), pe = c(-5, 23, 256))
+d <- diagram(a, main = "Fe-S-O-H, after Majzlan et al., 2006")
+water.lines(d, lwd = 2)
+text(3, 22, describe.basis(2:3, digits = 2, oneline = TRUE))
+text(3, 21, describe.property(c("T", "P"), c(25, 1), oneline = TRUE))
-## aqueous Al species, after Tagirov and Schott, 2001
+## Aqueous Al species, after Tagirov and Schott, 2001
basis(c("Al+3", "F-", "H+", "O2", "H2O"))
AlOH <- c("Al(OH)4-", "Al(OH)3", "Al(OH)2+", "AlOH+2")
Al <- "Al+3"
@@ -299,17 +299,17 @@
# T/P limits of the water() calculations;
basis(c("corundum", "quartz", "oxygen"))
species(c("kyanite", "sillimanite", "andalusite"))
-# database has transition temperatures of kyanite and andalusite
+# Database has transition temperatures of kyanite and andalusite
# at 1 bar only, so we permit calculation at higher temperatures
-a <- affinity(T=c(200, 900, 99), P=c(0, 9000, 101), exceed.Ttr=TRUE)
-d <- diagram(a, fill=NULL)
+a <- affinity(T = c(200, 900, 99), P = c(0, 9000, 101), exceed.Ttr = TRUE)
+d <- diagram(a, fill = NULL)
slab <- syslab(c("Al2O3", "SiO2", "H2O"))
mtitle(c(as.expression(slab), "after Helgeson et al., 1978"))
-# find the approximate position of the triple point
+# Find the approximate position of the triple point
tp <- find.tp(d$predominant)
Ttp <- a$vals[[1]][tp[1, 2]]
Ptp <- rev(a$vals[[2]])[tp[1, 1]]
-points(Ttp, Ptp, pch=10, cex=5)
+points(Ttp, Ptp, pch = 10, cex = 5)
}
\references{
Modified: pkg/CHNOSZ/man/equilibrate.Rd
===================================================================
--- pkg/CHNOSZ/man/equilibrate.Rd 2023-03-03 04:56:39 UTC (rev 772)
+++ pkg/CHNOSZ/man/equilibrate.Rd 2023-03-04 02:02:13 UTC (rev 773)
@@ -115,29 +115,29 @@
\examples{
\dontshow{reset()}
-## equilibrium in a simple system:
+## Equilibrium in a simple system:
## ionization of carbonic acid
basis("CHNOS+")
species(c("CO2", "HCO3-", "CO3-2"))
-# set unit activity of the species (0 = log10(1))
+# Set unit activity of the species (0 = log10(1))
species(1:3, 0)
-# calculate Astar (for unit activity)
+# Calculate Astar (for unit activity)
res <- 100
-Astar <- affinity(pH=c(0, 14, res))$values
-# the logarithms of activity for a total activity
+Astar <- affinity(pH = c(0, 14, res))$values
+# The logarithms of activity for a total activity
# of the balancing component (CO2) equal to 0.001
loga.boltz <- equil.boltzmann(Astar, c(1, 1, 1), 0.001)
-# calculated another way
+# Calculated another way
loga.react <- equil.reaction(Astar, c(1, 1, 1), rep(0.001, 100))
-# probably close enough for most purposes
+# They should be pretty close
stopifnot(all.equal(loga.boltz, loga.react))
-# the first ionization constant (pKa)
+# The first ionization constant (pKa)
ipKa <- which.min(abs(loga.boltz[[1]] - loga.boltz[[2]]))
-pKa.equil <- seq(0, 14, length.out=res)[ipKa]
-# calculate logK directly
-logK <- subcrt(c("CO2","H2O","HCO3-","H+"), c(-1, -1, 1, 1), T=25)$out$logK
-# we could decrease tolerance here by increasing res
-stopifnot(all.equal(pKa.equil, -logK, tolerance=1e-2))
+pKa.equil <- seq(0, 14, length.out = res)[ipKa]
+# Calculate logK directly
+logK <- subcrt(c("CO2","H2O","HCO3-","H+"), c(-1, -1, 1, 1), T = 25)$out$logK
+# We could decrease tolerance here by increasing res
+stopifnot(all.equal(pKa.equil, -logK, tolerance = 1e-2))
}
\references{
Modified: pkg/CHNOSZ/man/examples.Rd
===================================================================
--- pkg/CHNOSZ/man/examples.Rd 2023-03-03 04:56:39 UTC (rev 772)
+++ pkg/CHNOSZ/man/examples.Rd 2023-03-04 02:02:13 UTC (rev 773)
@@ -152,7 +152,7 @@
\examples{
\dontshow{reset()}
-\dontshow{opar <- par(no.readonly=TRUE)}
+\dontshow{opar <- par(no.readonly = TRUE)}
demos(c("ORP", "NaCl"))
\dontshow{par(opar)}
}
Modified: pkg/CHNOSZ/man/info.Rd
===================================================================
--- pkg/CHNOSZ/man/info.Rd 2023-03-03 04:56:39 UTC (rev 772)
+++ pkg/CHNOSZ/man/info.Rd 2023-03-04 02:02:13 UTC (rev 773)
@@ -46,38 +46,38 @@
\examples{
\dontshow{reset()}
-## summary of available data
+## Summary of available data
info()
-## species information
-# search for something named (or whose formula is) "Fe"
+## Species information
+# Search for something named (or whose formula is) "Fe"
si <- info("Fe")
-# use the number to get the full entry
+# Use the number to get the full entry
info(si)
-# show data for the higher-temperature phases
+# Show data for the higher-temperature phases
info(si:(si+3))
-## dealing with states
-# standard order of precedence for names:
+## Dealing with states
+# Order of precedence for names:
# aq > cr > gas > liq
info(c("ethanol", "adenosine")) # aq, aq
-# state argument overrides the default
+# State argument overrides the default
info(c("ethanol", "adenosine"), state = c("gas", "cr"))
-# exceptions: gases have precedence for names of methane and inorganic gases
+# Exceptions: gases have precedence for names of methane and inorganic gases
info(c("methane", "oxygen")) # gas, gas
-# formulas default to aqueous species, if available
+# Formulas default to aqueous species, if available
i1 <- info(c("CH4", "CO2", "CS2", "MgO"))
info(i1)$state # aq, aq, gas, cr
-# state argument overrides the default
+# State argument overrides the default
i2 <- info(c("CH4", "CO2", "MgO"), "gas")
info(i2)$state # gas, gas, NA
-## partial name or formula searches
+## Partial name or formula searches
info("ATP")
info("thiol")
info("MgC")
-# add an extra character to refine a search
+# Add an extra character to refine a search
# or to search using terms that have exact matches
info("MgC ")
info("acetate ")
Modified: pkg/CHNOSZ/man/ionize.aa.Rd
===================================================================
--- pkg/CHNOSZ/man/ionize.aa.Rd 2023-03-03 04:56:39 UTC (rev 772)
+++ pkg/CHNOSZ/man/ionize.aa.Rd 2023-03-04 02:02:13 UTC (rev 773)
@@ -38,24 +38,24 @@
pH <- c(5, 9, 3)
T <- seq(0, 100)
# Cp of non-ionized protein
-Cp.nonion <- subcrt("LYSC_CHICK", T=T)$out[[1]]$Cp
-plot(T, Cp.nonion, xlab=axis.label("T"), type="l",
- ylab=axis.label("Cp"), ylim=c(5000, 8000))
+Cp.nonion <- subcrt("LYSC_CHICK", T = T)$out[[1]]$Cp
+plot(T, Cp.nonion, xlab = axis.label("T"), type = "l",
+ ylab = axis.label("Cp"), ylim = c(5000, 8000))
# Cp of ionization and ionized protein
aa <- pinfo(pinfo("LYSC_CHICK"))
for(pH in c(5, 9, 3)) {
- Cp.ionized <- Cp.nonion + ionize.aa(aa, "Cp", T=T, pH=pH)[, 1]
- lines(T, Cp.ionized, lty=2)
- text(80, Cp.ionized[70], paste("pH =",pH) )
+ Cp.ionized <- Cp.nonion + ionize.aa(aa, "Cp", T = T, pH = pH)[, 1]
+ lines(T, Cp.ionized, lty = 2)
+ text(80, Cp.ionized[70], paste("pH =", pH) )
}
# Makhatadze and Privalov's group contributions
T <- c(5, 25, 50, 75, 100, 125)
points(T, convert(MP90.cp("LYSC_CHICK", T), "cal"))
# Privalov and Makhatadze's experimental values
-e <- read.csv(system.file("extdata/cpetc/PM90.csv", package="CHNOSZ"))
-points(e$T, convert(e$LYSC_CHICK, "cal"), pch=16)
-legend("bottomright", pch=c(16, 1, NA, NA), lty=c(NA, NA, 1, 2),
- legend=c("PM90 experiment", "MP90 groups",
+e <- read.csv(system.file("extdata/cpetc/PM90.csv", package = "CHNOSZ"))
+points(e$T, convert(e$LYSC_CHICK, "cal"), pch = 16)
+legend("bottomright", pch = c(16, 1, NA, NA), lty = c(NA, NA, 1, 2),
+ legend = c("PM90 experiment", "MP90 groups",
"DLH06 groups no ion", "DLH06 groups ionized"))
title("Heat capacity of unfolded LYSC_CHICK")
}
Modified: pkg/CHNOSZ/man/makeup.Rd
===================================================================
--- pkg/CHNOSZ/man/makeup.Rd 2023-03-03 04:56:39 UTC (rev 772)
+++ pkg/CHNOSZ/man/makeup.Rd 2023-03-04 02:02:13 UTC (rev 773)
@@ -78,7 +78,7 @@
# balance in a chemical reaction
formula <- c("H2O", "H+", "(Z-1)", "O2")
mf <- makeup(formula, c(-1, 2, 2, 0.5), sum = TRUE)
-all(mf==0) # TRUE
+all(mf == 0) # TRUE
}
\seealso{ \code{\link{mass}}, \code{\link{entropy}}, \code{\link{basis}}, \code{\link{i2A}} }
Modified: pkg/CHNOSZ/man/mosaic.Rd
===================================================================
--- pkg/CHNOSZ/man/mosaic.Rd 2023-03-03 04:56:39 UTC (rev 772)
+++ pkg/CHNOSZ/man/mosaic.Rd 2023-03-04 02:02:13 UTC (rev 773)
@@ -66,8 +66,8 @@
\examples{
\dontshow{reset()}# Fe-minerals and aqueous species in Fe-S-O-H system
-# speciate SO4-2, HSO4-, HS-, H2S as a function of Eh and pH
-# after Garrels and Christ, 1965 Figure 7.20
+# Speciate SO4-2, HSO4-, HS-, H2S as a function of Eh and pH
+# After Garrels and Christ, 1965 Figure 7.20
pH <- c(0, 14)
Eh <- c(-1, 1)
T <- 25
@@ -75,16 +75,16 @@
basis("SO4-2", -6)
species(c("Fe+2", "Fe+3"), -6)
species(c("pyrrhotite", "pyrite", "hematite", "magnetite"), add = TRUE)
-# the basis species we'll swap through
+# The basis species we'll swap through
bases <- c("SO4-2", "HSO4-", "HS-", "H2S")
-# calculate affinities using the relative abundances of the basis species
+# Calculate affinities using the relative abundances of the basis species
# NOTE: set blend = FALSE for sharp transitions between the basis species
# (looks more like the diagram in GC65)
m1 <- mosaic(bases, pH = pH, Eh = Eh, T = T)
-# make a diagram and add water stability lines
+# Make a diagram and add water stability lines
d <- diagram(m1$A.species, lwd = 2)
water.lines(d, col = "seagreen", lwd = 1.5)
-# show lines for Fe(aq) = 10^-4 M
+# Show lines for Fe(aq) = 10^-4 M
species(c("Fe+2", "Fe+3"), -4)
m2 <- mosaic(bases, pH = pH, Eh = Eh, T = T)
diagram(m2$A.species, add = TRUE, names = FALSE)
@@ -91,8 +91,8 @@
title(main=paste("Iron oxides and sulfides in water, log(total S) = -6",
"After Garrels and Christ, 1965", sep="\n"))
legend("bottomleft", c("log(act_Fe) = -4", "log(act_Fe) = -6"), lwd = c(2, 1), bty = "n")
-# we could overlay the basis species predominance fields
-#diagram(m1$A.bases, add=TRUE, col="blue", col.names="blue", lty=3)
+# We could overlay the predominance fields for the basis species
+#diagram(m1$A.bases, add = TRUE, col = "blue", col.names = "blue", lty = 3)
}
\references{
Modified: pkg/CHNOSZ/man/nonideal.Rd
===================================================================
--- pkg/CHNOSZ/man/nonideal.Rd 2023-03-03 04:56:39 UTC (rev 772)
+++ pkg/CHNOSZ/man/nonideal.Rd 2023-03-04 02:02:13 UTC (rev 773)
@@ -88,7 +88,7 @@
}
\examples{\dontshow{reset()}
-## each of the available methods
+## Each of the available methods
nonideal("Alberty")
nonideal("bgamma0")
nonideal("bgamma")
@@ -95,61 +95,61 @@
nonideal("Bdot0")
nonideal("Bdot") # the default
-## what's the activity coefficient of Na+ at
+## What's the activity coefficient of Na+ at
## 25 degC and 1 bar and an ionic strength of 0.7?
sres <- subcrt("Na+", T = 25, IS = 0.7)
-# exponentiate to convert log10(gamma) to gamma
+# Exponentiate to convert log10(gamma) to gamma
10^sres$out[[1]]$loggam
-# now use a different method
+# Now use a different method
nonideal("bgamma")
sres <- subcrt("Na+", T = 25, IS = 0.7)
10^sres$out[[1]]$loggam
-## what are activity coefficients of -3, -2, -1, 0, +1, +2, +3 charged species
+## What are activity coefficients of -3, -2, -1, 0, +1, +2, +3 charged species
## as a function of ionic strength and temperature?
-# first choose the method
+# First choose the method
nonideal("Bdot")
-# define the ionic strength and temperature increments
+# Define the ionic strength and temperature increments
IS <- c(0.001, 0.01, 0.1, 0.7)
T <- seq(0, 100, 25)
-# use species charged -3, -2, -1, 0, +1, +2, +3
+# Use species with charges -3, -2, -1, 0, +1, +2, +3
species <- c("PO4-3", "HPO4-2", "H2PO4-", "H3PO4", "Na+", "Ca+2", "Al+3")
-# initialize empty output table for T (rows) and charge (columns)
+# Initialize empty output table for T (rows) and charge (columns)
gamtab <- matrix(nrow = length(T), ncol = length(species))
rownames(gamtab) <- T
colnames(gamtab) <- -3:3
-# make a list of tables to hold the activity coefficients, one for each IS
+# Make a list of tables to hold the activity coefficients, one for each IS
gamma <- rep(list(gamtab), length(IS))
names(gamma) <- IS
-# loop over the values of ionic strength
+# Loop over the values of ionic strength
for(i in seq_along(IS)) {
- # calculate properties of species, including logarithm of activity coefficient
+ # Calculate properties of species, including logarithm of activity coefficient
sres <- subcrt(species, T = T, IS = IS[i])
- # exponentiate to convert log10(gamma) to gamma, and put the values into the tables
+ # Exponentiate to convert log10(gamma) to gamma, and put the values into the tables
for(j in seq_along(species)) gamma[[i]][, j] <- 10^sres$out[[j]]$loggam
}
-# print the output and make a plot
+# Print the output and make a plot
print(gamma)
matplot(T, gamma$`0.001`, type = "l")
title(main = "activity coefficients of -3, -2, -1, 0, +1, +2, +3 charged species")
## Alberty, 2003 p. 16 Table 1.3: adjusted pKa of acetic acid
-## we use the 'IS' argument in subcrt() to calculate adjusted thermodynamic properties
-# set ideal.H to FALSE to calculate activity coefficients for the proton
+## We use the 'IS' argument in subcrt() to calculate adjusted thermodynamic properties
+# Set ideal.H to FALSE to calculate activity coefficients for the proton
# (needed for replication of the values in Alberty's book)
nonideal("Alberty")
thermo("opt$ideal.H" = FALSE)
sres <- subcrt(c("acetate", "H+", "acetic acid"), c(-1, -1, 1),
IS=c(0, 0.1, 0.25), T=25, property="logK")
-# we're within 0.01 of Alberty's pK values
+# We're within 0.01 of Alberty's pK values
Alberty_logK <- c(4.75, 4.54, 4.47)
# The maximum (absolute) pairwise difference between x and y
max(abs(Alberty_logK - sres$out$logK)) # 0.0072
-# reset option to default
+# Reset option to default
thermo("opt$ideal.H" = TRUE)
## An example using IS with affinity():
-## speciation of phosphate as a function of ionic strength
+## Speciation of phosphate as a function of ionic strength
opar <- par(mfrow = c(2, 1))
basis("CHNOPS+")
Ts <- c(25, 100)
@@ -165,7 +165,7 @@
legend("topright", lty = c(NA, 1, 1), col = c(NA, "black", "red"), legend = dp)
text(0.07, -2.76, expr.species("HPO4-2"))
text(0.07, -2.90, expr.species("H2PO4-"))
-## phosphate predominance f(IS,pH)
+## Phosphate predominance f(IS,pH)
a <- affinity(IS = c(0, 0.14), pH = c(6, 13), T = Ts[1])
d <- diagram(a, fill = NULL)
a <- affinity(IS = c(0, 0.14), pH = c(6, 13), T = Ts[2])
@@ -172,16 +172,16 @@
d <- diagram(a, add = TRUE, names = FALSE, col = "red")
par(opar)
-## activity coefficients for monovalent ions at 700 degC, 10 kbar
-# after Manning, 2013, Fig. 7
-# here we use the b_gamma equation
+## Activity coefficients for monovalent ions at 700 degC, 10 kbar
+# After Manning, 2013, Fig. 7
+# Here we use the b_gamma equation
nonideal("bgamma")
IS <- c(0.001, 0.01, 0.1, 1, 2, 2.79)
-# we're above 5000 bar, so need to use IAPWS-95 or DEW
+# We're above 5000 bar, so need to use IAPWS-95 or DEW
oldwat <- water("DEW")
sres <- subcrt("Na+", T = 700, P = 10000, IS = IS)
water(oldwat)
-# compare the calculated activity coefficient to values from Manning's figure
+# Compare the calculated activity coefficient to values from Manning's figure
gamma <- 10^sres$out[[1]]$loggam
Manning_gamma <- c(0.93, 0.82, 0.65, 0.76, 1.28, 2)
gamma - Manning_gamma
@@ -191,7 +191,7 @@
bgamma(showsplines = "T")
bgamma(showsplines = "P")
-## a longer example, using nonideal() directly
+## A longer example, using nonideal() directly
# Alberty, 2003 p. 273-276: activity coefficient (gamma)
# as a function of ionic strength and temperature
nonideal("Alberty")
@@ -203,9 +203,9 @@
thermo.plot.new(xlim = range(IS), ylim = c(0, 1),
xlab = axis.label("IS"), ylab = "gamma")
for(j in 1:3) {
- # use subcrt to generate speciesprops
+ # Use subcrt to generate speciesprops
speciesprops <- subcrt(species, T = rep(T[j], length(IS)))$out
- # use nonideal to calculate loggamma; this also adjusts G, H, S, Cp,
+ # Use nonideal to calculate loggamma; this also adjusts G, H, S, Cp,
# but we don't use them here
nonidealprops <- nonideal(species, speciesprops, IS = IS, T = convert(T[j], "K"))
for(i in 1:4) lines(IS, 10^(nonidealprops[[i]]$loggam), lty=lty[j], col=col[i])
@@ -218,7 +218,7 @@
legend("top", lty=1, col=col, bty="n",
legend = as.expression(lapply(species, expr.species)))
-## reset method to default
+## Reset method to default
nonideal("Bdot") # or reset()
}
Modified: pkg/CHNOSZ/man/retrieve.Rd
===================================================================
--- pkg/CHNOSZ/man/retrieve.Rd 2023-03-03 04:56:39 UTC (rev 772)
+++ pkg/CHNOSZ/man/retrieve.Rd 2023-03-04 02:02:13 UTC (rev 773)
@@ -48,25 +48,25 @@
}
\examples{
-# species index of Ti-bearing minerals
+# Species index of Ti-bearing minerals
retrieve("Ti")
-# thermodynamic data for those minerals
+# Thermodynamic data for those minerals
info(retrieve("Ti"))
-# all species that have Au
+# All species that have Au
retrieve("Au")
-# all species that have both Au and Cl
+# All species that have both Au and Cl
retrieve(c("Au", "Cl"))
# Au-Cl system: species that have Au and/or Cl,
# including charged species, but no other elements
retrieve(list("Au", "Cl"))
-# all Au-bearing species in the Au-Cl system
+# All Au-bearing species in the Au-Cl system
retrieve("Au", "Cl")
-# all uncharged Au-bearing species in the Au-Cl system
+# All uncharged Au-bearing species in the Au-Cl system
retrieve("Au", "Cl", add.charge = FALSE)
-# minerals in the system SiO2-MgO-CaO-CO2
-retrieve(list("Si", "Mg", "Ca", "C", "O"), state="cr")
+# Minerals in the system SiO2-MgO-CaO-CO2
+retrieve(list("Si", "Mg", "Ca", "C", "O"), state = "cr")
\dontshow{par(thermo()$opar)}
}
Modified: pkg/CHNOSZ/man/species.Rd
===================================================================
--- pkg/CHNOSZ/man/species.Rd 2023-03-03 04:56:39 UTC (rev 772)
+++ pkg/CHNOSZ/man/species.Rd 2023-03-04 02:02:13 UTC (rev 773)
@@ -69,7 +69,7 @@
# Delete all the species
species(delete = TRUE)
-# changing the elements in the basis definition
+# Changing the elements in the basis definition
# causes species to be deleted
basis(c("CaO", "CO2", "H2O", "SiO2", "MgO", "O2"))
species(c("dolomite", "quartz", "calcite", "forsterite"))
Modified: pkg/CHNOSZ/man/taxonomy.Rd
===================================================================
--- pkg/CHNOSZ/man/taxonomy.Rd 2023-03-03 04:56:39 UTC (rev 772)
+++ pkg/CHNOSZ/man/taxonomy.Rd 2023-03-04 02:02:13 UTC (rev 773)
@@ -41,54 +41,53 @@
}
\examples{
-## get information about Homo sapiens from the
+## Get information about Homo sapiens from the
## packaged taxonomy files
-taxdir <- system.file("extdata/taxonomy",package="CHNOSZ")
+taxdir <- system.file("extdata/taxonomy", package = "CHNOSZ")
# H. sapiens' taxonomic id
id1 <- 9606
-# that is a species
-getrank(id1,taxdir)
-# the next step up the taxonomy
-id2 <- parent(id1,taxdir)
+# That is a species
+getrank(id1, taxdir)
+# The next step up the taxonomy
+id2 <- parent(id1, taxdir)
print(id2)
-# that is a genus
-getrank(id2,taxdir)
-# that genus is "Homo"
-sciname(id2,taxdir)
-# we can ask what phylum is it part of?
-id3 <- parent(id1,taxdir,"phylum")
-# answer: "Chordata"
-sciname(id3,taxdir)
+# That is a genus
+getrank(id2, taxdir)
+# That genus is "Homo"
+sciname(id2, taxdir)
+# We can ask what phylum is it part of?
+id3 <- parent(id1, taxdir, "phylum")
+# Answer: "Chordata"
+sciname(id3, taxdir)
# H. sapiens' complete taxonomy
-id4 <- allparents(id1,taxdir)
-sciname(id4,taxdir)
+id4 <- allparents(id1, taxdir)
+sciname(id4, taxdir)
-## the names of the organisms in the supplied taxonomy files
-taxdir <- system.file("extdata/taxonomy",package="CHNOSZ")
-id5 <- c(83333,4932,9606,186497,243232)
-sciname(id5,taxdir)
-# these are not all species, though
+## The names of the organisms in the supplied taxonomy files
+taxdir <- system.file("extdata/taxonomy", package = "CHNOSZ")
+id5 <- c(83333, 4932, 9606, 186497, 243232)
+sciname(id5, taxdir)
+# These are not all species, though
# (those with "no rank" are something like strains,
# e.g. Escherichia coli K-12)
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/chnosz -r 773
More information about the CHNOSZ-commits
mailing list