[CHNOSZ-commits] r657 - in pkg/CHNOSZ: . R inst inst/extdata/thermo man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Mar 20 08:31:31 CET 2021


Author: jedick
Date: 2021-03-20 08:31:30 +0100 (Sat, 20 Mar 2021)
New Revision: 657

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/util.affinity.R
   pkg/CHNOSZ/inst/NEWS.Rd
   pkg/CHNOSZ/inst/TODO
   pkg/CHNOSZ/inst/extdata/thermo/opt.csv
   pkg/CHNOSZ/man/affinity.Rd
   pkg/CHNOSZ/man/nonideal.Rd
   pkg/CHNOSZ/man/palply.Rd
   pkg/CHNOSZ/man/subcrt.Rd
   pkg/CHNOSZ/man/thermo.Rd
   pkg/CHNOSZ/man/water.Rd
   pkg/CHNOSZ/vignettes/multi-metal.Rmd
Log:
Add option thermo()$opt$ionize.aa


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2021-03-20 04:55:12 UTC (rev 656)
+++ pkg/CHNOSZ/DESCRIPTION	2021-03-20 07:31:30 UTC (rev 657)
@@ -1,6 +1,6 @@
 Date: 2021-03-20
 Package: CHNOSZ
-Version: 1.4.0-26
+Version: 1.4.0-27
 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/R/util.affinity.R
===================================================================
--- pkg/CHNOSZ/R/util.affinity.R	2021-03-20 04:55:12 UTC (rev 656)
+++ pkg/CHNOSZ/R/util.affinity.R	2021-03-20 07:31:30 UTC (rev 657)
@@ -203,7 +203,7 @@
   A <- function() {
     out <- mapply(`-`, X.fun("logK"), logQ(), SIMPLIFY = FALSE)
     # deal with affinities of protein ionization here 20120527
-    if("H+" %in% rownames(mybasis)) {
+    if("H+" %in% rownames(mybasis) & get("thermo", CHNOSZ)$opt$ionize.aa) {
       # which species are proteins
       isprotein <- grepl("_", myspecies$name)
       if(any(isprotein)) {

Modified: pkg/CHNOSZ/inst/NEWS.Rd
===================================================================
--- pkg/CHNOSZ/inst/NEWS.Rd	2021-03-20 04:55:12 UTC (rev 656)
+++ pkg/CHNOSZ/inst/NEWS.Rd	2021-03-20 07:31:30 UTC (rev 657)
@@ -10,7 +10,7 @@
 \newcommand{\s}{\ifelse{latex}{\eqn{_{#1}}}{\ifelse{html}{\out{<sub>#1</sub>}}{#1}}}
 \newcommand{\S}{\ifelse{latex}{\eqn{^{#1}}}{\ifelse{html}{\out{<sup>#1</sup>}}{^#1}}}
 
-\section{Changes in CHNOSZ version 1.4.0-22 (2021-03-19)}{
+\section{Changes in CHNOSZ version 1.4.0-27 (2021-03-20)}{
 
   \subsection{NEW FEATURES}{
     \itemize{
@@ -70,6 +70,9 @@
       energy of biomass synthesis in E. coli, after
       \href{https://doi.org/10.1038/ismej.2015.227}{LaRowe and Amend, 2016}).
 
+      \item Add option \code{thermo()$opt$ionize.aa} to control calculation of
+      properties of ionized proteins in \code{affinity()}.
+
     }
   }
 

Modified: pkg/CHNOSZ/inst/TODO
===================================================================
--- pkg/CHNOSZ/inst/TODO	2021-03-20 04:55:12 UTC (rev 656)
+++ pkg/CHNOSZ/inst/TODO	2021-03-20 07:31:30 UTC (rev 657)
@@ -53,10 +53,6 @@
 Error in count.elements(formula) : 
   'C2.15503876355161e-07H3.72868217191069e-07O1.72868217157562eZ-7' is not a simple chemical formula
 
-[20210116]
-
-- Add an option to disable use of ionize.aa() (it's always active if the basis species have H+)
-
 [20210122] Fix incorrect states in messages:
 > subcrt("C10H22")
 info.character: found C10H22(decane); other available phases are gas, gas, gas, liq, liq, liq

Modified: pkg/CHNOSZ/inst/extdata/thermo/opt.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/thermo/opt.csv	2021-03-20 04:55:12 UTC (rev 656)
+++ pkg/CHNOSZ/inst/extdata/thermo/opt.csv	2021-03-20 07:31:30 UTC (rev 657)
@@ -1,2 +1,2 @@
-cutoff,E.units,T.units,P.units,state,water,G.tol,Cp.tol,V.tol,varP,IAPWS.sat,paramin,ideal.H,ideal.e,nonideal,Setchenow,Berman,maxcores
-1E-10,cal,C,bar,aq,SUPCRT92,100,1,1,FALSE,liquid,1000,TRUE,TRUE,Bdot,bgamma0,NA,2
+cutoff,E.units,T.units,P.units,state,water,G.tol,Cp.tol,V.tol,varP,IAPWS.sat,paramin,ideal.H,ideal.e,nonideal,Setchenow,Berman,maxcores,ionize.aa
+1E-10,cal,C,bar,aq,SUPCRT92,100,1,1,FALSE,liquid,1000,TRUE,TRUE,Bdot,bgamma0,NA,2,TRUE

Modified: pkg/CHNOSZ/man/affinity.Rd
===================================================================
--- pkg/CHNOSZ/man/affinity.Rd	2021-03-20 04:55:12 UTC (rev 656)
+++ pkg/CHNOSZ/man/affinity.Rd	2021-03-20 07:31:30 UTC (rev 657)
@@ -72,7 +72,7 @@
 }
 
 \seealso{
-\code{\link{ionize.aa}}, activated if proteins are among the species of interest and \samp{H+} is in the basis.
+\code{\link{ionize.aa}}, activated if proteins are among the species of interest, \samp{H+} is in the basis and \code{thermo()$opt$ionize.aa} is TRUE.
 \code{\link{equilibrate}} for using the results of \code{affinity} to calculate equilibrium activities of species, and \code{\link{diagram}} to plot the results.
 \code{\link{demo}("saturation")} for an example using the argument recall feature.
 }

Modified: pkg/CHNOSZ/man/nonideal.Rd
===================================================================
--- pkg/CHNOSZ/man/nonideal.Rd	2021-03-20 04:55:12 UTC (rev 656)
+++ pkg/CHNOSZ/man/nonideal.Rd	2021-03-20 07:31:30 UTC (rev 657)
@@ -37,7 +37,7 @@
 
 \section{Charged Species}{
 The default is to not apply calculations for the proton (\Hplus) and electron (\eminus); this makes sense if you are setting the pH, i.e. activity of \Hplus, to some value.
-To apply the calculations to H+ and/or e-, change \code{\link{thermo}$opt$ideal.H} or \code{ideal.e} to FALSE (see examples).
+To apply the calculations to H+ and/or e-, change \code{\link{thermo}()$opt$ideal.H} or \code{ideal.e} to FALSE (see examples).
 
 For the \samp{Alberty} method, the values of \code{IS} are combined with Alberty's (2003) equation 3.6-1 (extended Debye-Hückel equation with an empirical term valid up to 0.25 M ionic strength) and its derivatives (Alberty, 2001), to calculate adjusted molal properties at the specified ionic strength(s) and temperature(s).
 The calculations use the equation for the Debye-Hückel constant given by Clarke and Glew, 1980, which is valid between 0 and 150 °C at saturated water vapor pressure (\Psat).
@@ -56,7 +56,7 @@
 
 \section{Neutral Species}{
 For neutral species, the Setch{\eacute}now equation is used, as described in Shvarov and Bastrakov, 1999.
-If \code{\link{thermo}$opt$Setchenow} is \samp{bgamma0} (the default), the extended term parameter is set to zero and the only non-zero term is the mole fraction to molality conversion factor (using the value of \code{m_star}).
+If \code{\link{thermo}()$opt$Setchenow} is \samp{bgamma0} (the default), the extended term parameter is set to zero and the only non-zero term is the mole fraction to molality conversion factor (using the value of \code{m_star}).
 If \code{thermo()$opt$Setchenow} is \samp{bgamma}, the extended term paramter is taken from the setting for the charged species (which can be either \samp{Bdot} or \samp{bgamma}).
 Set \code{thermo()$opt$Setchenow} to any other value to disable the calculations for neutral species.
 }

Modified: pkg/CHNOSZ/man/palply.Rd
===================================================================
--- pkg/CHNOSZ/man/palply.Rd	2021-03-20 04:55:12 UTC (rev 656)
+++ pkg/CHNOSZ/man/palply.Rd	2021-03-20 07:31:30 UTC (rev 657)
@@ -19,7 +19,7 @@
 }
 
 \details{
-\code{palply} is a wrapper function to run \code{\link[parallel:clusterApply]{parallel::parLapply}} if length of \code{X} > \code{\link{thermo}$opt$paramin} and multiple cores are available, otherwise it runs \code{\link{lapply}}.
+\code{palply} is a wrapper function to run \code{\link[parallel:clusterApply]{parallel::parLapply}} if length of \code{X} > \code{\link{thermo}()$opt$paramin} and multiple cores are available, otherwise it runs \code{\link{lapply}}.
 Note that \code{parLapply} is called with \code{methods} set to FALSE.
 If lots of package startup messages are created when running \code{parallel::makeCluster} (which is called by \code{palply}), it can probably be stopped by adding a test for \code{\link{interactive}} sessions around any \code{\link{library}} commands in the \code{\link{Rprofile}}.
 }

Modified: pkg/CHNOSZ/man/subcrt.Rd
===================================================================
--- pkg/CHNOSZ/man/subcrt.Rd	2021-03-20 04:55:12 UTC (rev 656)
+++ pkg/CHNOSZ/man/subcrt.Rd	2021-03-20 07:31:30 UTC (rev 657)
@@ -51,7 +51,7 @@
          \code{kT}      \tab Isothermal compressibility            \tab cm\eqn{^3} bar\eqn{^{-1}}{^-1} \cr
  }
 
-Note that \code{E} and \code{kT} can only be calculated for aqueous species and only if the option (\code{\link{thermo}$opt$water}) for calculations of properties using \code{water} is set to \code{IAPWS}.
+Note that \code{E} and \code{kT} can only be calculated for aqueous species and only if the option (\code{\link{thermo}()$opt$water}) for calculations of properties using \code{water} is set to \code{IAPWS}.
 On the other hand, if the \code{water} option is \samp{SUPCRT} (the default), \code{E} and \code{kT} can be calculated for water but not for aqueous species.
 (This is not an inherent limitation in either formulation, but it is just a matter of implementation.)
 

Modified: pkg/CHNOSZ/man/thermo.Rd
===================================================================
--- pkg/CHNOSZ/man/thermo.Rd	2021-03-20 04:55:12 UTC (rev 656)
+++ pkg/CHNOSZ/man/thermo.Rd	2021-03-20 07:31:30 UTC (rev 657)
@@ -60,7 +60,8 @@
       \code{nonideal} \tab character \tab Option for charged species in \code{\link{nonideal}} [\code{Bdot}] \cr
       \code{Setchenow} \tab character \tab Option for neutral species in \code{\link{nonideal}} [\code{bgamma0}] \cr
       \code{Berman} \tab character \tab User data file for mineral parameters in the Berman equations [\code{NA}] \cr
-      \code{maxcores} \tab numeric \tab Maximum number of cores for parallel calculations with \code{\link{palply}} [\code{2}]
+      \code{maxcores} \tab numeric \tab Maximum number of cores for parallel calculations with \code{\link{palply}} [\code{2}] \cr
+      \code{ionize.aa} \tab numeric \tab Calculate properties of ionized proteins when \Hplus is in basis species (see \code{\link{affinity}}) [\code{TRUE}]
 }
 
     \item \code{thermo()$element}

Modified: pkg/CHNOSZ/man/water.Rd
===================================================================
--- pkg/CHNOSZ/man/water.Rd	2021-03-20 04:55:12 UTC (rev 656)
+++ pkg/CHNOSZ/man/water.Rd	2021-03-20 07:31:30 UTC (rev 657)
@@ -26,7 +26,7 @@
 \details{
 
 These functions compute the thermodynamic (Gibbs energy and it derivatives) and electrostatic (dielectric constant and its derivatives) properties of liquid or supercritical \H2O as a function of temperature and pressure using equations of state taken from the literature.
-The high-level function \code{water} performs different computations, depending on the setting of \code{\link{thermo}$opt$water}:
+The high-level function \code{water} performs different computations, depending on the setting of \code{\link{thermo}()$opt$water}:
 
 \describe{
 
@@ -106,7 +106,7 @@
 \code{water.IAPWS95} provides for calculations at specific temperature and pressure; density, needed for \code{IAPWS95}, is inverted from pressure using \code{rho.IAPWS95}.
 The function also contains routines for calculating the Born functions as numerical derivatives of the static dielectric constant (from \code{water.AW90}).
 For compatibility with geochemical modeling conventions, the values of Gibbs energy, enthalpy and entropy output by \code{IAPWS95} are converted by \code{water.IAPWS95} to the triple point reference state adopted in \code{SUPCRT92} (Johnson and Norton, 1991; Helgeson and Kirkham, 1974).
-\code{water.IAPWS95} also accepts setting \code{P} to \samp{Psat}, with the saturation pressure calculated from \code{\link{WP02.auxiliary}}; by default the returned properties are for the liquid, but this can be changed to the vapor in \code{\link{thermo}$opt$IAPWS.sat}.
+\code{water.IAPWS95} also accepts setting \code{P} to \samp{Psat}, with the saturation pressure calculated from \code{\link{WP02.auxiliary}}; by default the returned properties are for the liquid, but this can be changed to the vapor in \code{\link{thermo}()$opt$IAPWS.sat}.
 
 \code{A_DH} and \code{B_DH} are solvent parameters in the \dQuote{B-dot} (extended Debye-Huckel) equation (Helgeson, 1969; Manning, 2013).
 }

Modified: pkg/CHNOSZ/vignettes/multi-metal.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/multi-metal.Rmd	2021-03-20 04:55:12 UTC (rev 656)
+++ pkg/CHNOSZ/vignettes/multi-metal.Rmd	2021-03-20 07:31:30 UTC (rev 657)
@@ -806,11 +806,12 @@
 # Use log molality here, not log activity, because
 # activity coefficients are calculated by setting IS below
 basis("Cl-", log10(calc$m_Cl))
-# Dissolve copper to form aqueous Cu complexes
+# Initial setup: dissolve a single mineral to form aqueous Cu complexes
 species("copper")
 iaq <- retrieve("Cu", c("O", "H", "Cl", "S"), "aq")
 
 # Function to calculate solubility of Cu for stable assemblages of Fe and Cu minerals
+# (i.e. equilibrium is imposed with all of these minerals, not only Cu(s))
 mfun <- function() {
   s <- solubility(iaq, bases = list(bFe, bCu), S2 = c(-34, -10, res1), O2 = c(-55, -40, res1),
     T = T, IS = calc$IS, stable = list(dFe$predominant, dCu$predominant))



More information about the CHNOSZ-commits mailing list