[CHNOSZ-commits] r819 - in pkg/CHNOSZ: . R inst inst/tinytest vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Dec 4 12:27:44 CET 2023


Author: jedick
Date: 2023-12-04 12:27:43 +0100 (Mon, 04 Dec 2023)
New Revision: 819

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/subcrt.R
   pkg/CHNOSZ/inst/NEWS.Rd
   pkg/CHNOSZ/inst/tinytest/test-subcrt.R
   pkg/CHNOSZ/vignettes/FAQ.Rmd
Log:
Make subcrt() respect 'IS' for auto-balanced reactions


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2023-11-29 12:01:48 UTC (rev 818)
+++ pkg/CHNOSZ/DESCRIPTION	2023-12-04 11:27:43 UTC (rev 819)
@@ -1,6 +1,6 @@
-Date: 2023-11-29
+Date: 2023-12-04
 Package: CHNOSZ
-Version: 2.0.0-38
+Version: 2.0.0-39
 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/subcrt.R
===================================================================
--- pkg/CHNOSZ/R/subcrt.R	2023-11-29 12:01:48 UTC (rev 818)
+++ pkg/CHNOSZ/R/subcrt.R	2023-12-04 11:27:43 UTC (rev 819)
@@ -266,7 +266,8 @@
           newcoeff <- c(coeff, as.numeric(bc[1, ]))
           newstate <- c(state, b.state)
           return(subcrt(species = newspecies, coeff = newcoeff, state = newstate,
-            property = property, T = outvert(T, "K"), P = P, grid = grid, convert = convert, logact = logact, exceed.Ttr = exceed.Ttr))
+            property = property, T = outvert(T, "K"), P = P, grid = grid, convert = convert, logact = logact,
+            exceed.Ttr = exceed.Ttr, exceed.rhomin = exceed.rhomin, IS = IS))
         } else warnings <- c(warnings, paste("reaction among", paste(species, collapse = ","), "was unbalanced, missing", as.chemical.formula(miss)))
       } else warnings <- c(warnings, paste("reaction among", paste(species, collapse = ","), "was unbalanced, missing", as.chemical.formula(miss)))
     }

Modified: pkg/CHNOSZ/inst/NEWS.Rd
===================================================================
--- pkg/CHNOSZ/inst/NEWS.Rd	2023-11-29 12:01:48 UTC (rev 818)
+++ pkg/CHNOSZ/inst/NEWS.Rd	2023-12-04 11:27:43 UTC (rev 819)
@@ -15,38 +15,29 @@
 \newcommand{\Cp}{\ifelse{latex}{\eqn{C_P}}{\ifelse{html}{\out{<I>C<sub>P</sub></I>}}{Cp}}}
 \newcommand{\DG0}{\ifelse{latex}{\eqn{{\Delta}G^{\circ}}}{\ifelse{html}{\out{Δ<I>G</I>°}}{ΔG°}}}
 
-\section{Changes in CHNOSZ version 2.0.0-38 (2023-11-29)}{
+\section{Changes in CHNOSZ version 2.0.0-39 (2023-12-04)}{
 
+  \subsection{NEW FEATURES}{
     \itemize{
 
-      \item Add \viglink{FAQ} vignette with the following questions:
+      \item Add \viglink{FAQ} vignette with the following questions: How is
+      \sQuote{CHNOSZ} pronounced?, How should CHNOSZ be cited?, What
+      thermodynamic models are used in CHNOSZ?, When and why do equal-activity
+      boundaries depend on total activity?, How can minerals with polymorphic
+      transitions be added to the database?, How can I make a diagram with the
+      trisulfur radical ion (S\s{3}\S{-})?, In OBIGT, what is the meaning of
+      \code{T} for solids, liquids, and gases?, and How can mineral pH buffers
+      be plotted?
 
-      \itemize{
-
-        \item How is \sQuote{CHNOSZ} pronounced?
-        \item How should CHNOSZ be cited?
-        \item What thermodynamic models are used in CHNOSZ?
-        \item When and why do equal-activity boundaries depend on total activity?
-        \item How can minerals with polymorphic transitions be added to the database?
-        \item How can I make a diagram with the trisulfur radical ion (S\s{3}\S{-})?
-        \item In OBIGT, what is the meaning of \code{T} for solids, liquids, and gases?
-        \item How can mineral pH buffers be plotted?
-
-      }
-
-      \item Add \code{use.polymorphs} argument to \code{subcrt()} to allow
+      \item Add \strong{use.polymorphs} argument to \code{subcrt()} to allow
       turning off automatic identification of stable polymorphs. This is used
-      in the FAQ (\dQuote{How can minerals with polymorphic transitions be added to
-      the database?}).
+      in the FAQ (How can minerals with polymorphic transitions be added to the
+      database?).
 
       \item Restore \file{EOSregress.R} and its reverse dependencies
-      \file{eos-regress.Rmd} and \file{demo/adenine.R}. Thanks to Kris Fecteau
+      \viglink{eos-regress} and \file{demo/adenine.R}. Thanks to Kris Fecteau
       and Kirt Robinson for the suggestion.
 
-      \item Rename \code{checkGHS()} and \code{checkEOS()} to
-      \code{check.GHS()} and \code{check.EOS()} and make
-      \code{return.difference} TRUE by default.
-
       \item \code{mosaic()} now handles the situation where the alternate basis
       species include one of the axis variables on a diagram (by changing the
       argument names in its internal calls to \code{affinity()}) and
@@ -54,34 +45,53 @@
       \dQuote{total S}, etc.). Thanks to Evgeniy Bastrakov for the feature
       request.
 
-      \item Fix bug in \code{subcrt()} for \code{exceed.Ttr} not applied to
-      automatically balanced reactions (it was stuck on FALSE regardless of the
-      argument value).
+      \item The environment variable CHNOSZ_BUILD_LARGE_VIGNETTES is used to
+      control \strong{dpi} in \pkg{knitr} chunk options. Setting this variable
+      results in larger vignettes that are used for the CHNOSZ website; if this
+      variable is unset (as on CRAN), a smaller package is built.
 
-      \item In \code{OBIGT()}, load \file{Berman_cr.csv} before
-      \file{inorganic_cr.csv} so that \code{info("Fe2O3")} matches hematite
-      rather than maghemite.
+    }
+  }
 
-      \item Add 36 charged amino acids from
-      \href{https://doi.org/10.1007/s11084-015-9428-3}{Kitadai (2015)} and
-      update several others (Arg\S{+}, Arg\S{-}, Asp\S{-}, Glu\S{-}, His\S{+},
-      Lys\S{+}, Lys\S{-}, and Tyr\S{-}). Thanks to Grayson Boyer.
 
+  \subsection{OBIGT DATABASE}{
+    \itemize{
+
       \item \code{subcrt()} now outputs \DG0 and issues a warning above the
       temperature limit for \Cp equations for minerals and other \samp{CGL}
-      species. The previous behavior of setting \DG0 to NA and issuing a
-      message is now reserved for phase stability limits (i.e., melting,
-      vaporization, or decomposition). The temperature limit for \Cp equations
-      is stored as the opposite (negative) value in OBIGT. See \viglink{FAQ}
+      species. The temperature limit for \Cp equations is stored as the
+      opposite (negative) value in OBIGT. The previous behavior of outputting
+      NA for \DG0 and issuing a message is now reserved for phase stability
+      limits (i.e., melting, vaporization, or decomposition). See \viglink{FAQ}
       for details.
       
-      \item The environment variable CHNOSZ_BUILD_LARGE_VIGNETTES is used to
-      control `dpi` in knitr chunk options. Setting this variable results in
-      larger vignettes (used for the CHNOSZ website); if this variable is unset
-      (as on CRAN), a smaller package is built.
+      \item Add 36 charged amino acids from
+      \href{https://doi.org/10.1007/s11084-015-9428-3}{Kitadai (2015)} and
+      update several others (Arg\S{+}, Arg\S{-}, Asp\S{-}, Glu\S{-}, His\S{+},
+      Lys\S{+}, Lys\S{-}, and Tyr\S{-}). Thanks to Grayson Boyer.
 
+      \item In \code{OBIGT()}, load \file{Berman_cr.csv} before
+      \file{inorganic_cr.csv} so that \code{info("Fe2O3")} matches hematite
+      rather than maghemite.
+
+      \item Rename \code{checkGHS()} and \code{checkEOS()} to
+      \code{check.GHS()} and \code{check.EOS()} and change the default for
+      \strong{return.difference} to TRUE.
+
     }
+  }
 
+
+  \subsection{BUG FIXES}{
+    \itemize{
+
+      \item Fix bugs in \code{subcrt()} where \strong{exceed.Ttr} and
+      \strong{IS} arguments were not applied to automatically balanced
+      reactions.
+
+    }
+  }
+
 }
 
 

Modified: pkg/CHNOSZ/inst/tinytest/test-subcrt.R
===================================================================
--- pkg/CHNOSZ/inst/tinytest/test-subcrt.R	2023-11-29 12:01:48 UTC (rev 818)
+++ pkg/CHNOSZ/inst/tinytest/test-subcrt.R	2023-12-04 11:27:43 UTC (rev 819)
@@ -244,6 +244,12 @@
 s2 <- subcrt("pyrrhotite", exceed.Ttr = TRUE)$out[[1]]
 expect_equal(s2$polymorph, polymorph, info = info)
 
+# Added on 20231204
+info <- "Auto-balanced reactions apply ionic strength correction"
+basis("CHNOS+")
+sres <- subcrt("acetate", 1, IS = 1)
+expect_length(sres$out$loggam, 15)
+
 # References
 
 # Amend, J. P. and Shock, E. L. (2001) 

Modified: pkg/CHNOSZ/vignettes/FAQ.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/FAQ.Rmd	2023-11-29 12:01:48 UTC (rev 818)
+++ pkg/CHNOSZ/vignettes/FAQ.Rmd	2023-12-04 11:27:43 UTC (rev 819)
@@ -792,8 +792,8 @@
 basis("K+", log10(m_K))
 a <- affinity(pH = c(2, 10), O2 = c(-55, -38), T = T, P = P, IS = IS)
 diagram(a, srt = 90)
-dTP <- as.expression(c(lT(T), lP(P)))
-legend("topleft", legend = dTP, bty = "n", inset = c(-0.05, 0), cex = 0.9)
+lTP <- as.expression(c(lT(T), lP(P)))
+legend("topleft", legend = lTP, bty = "n", inset = c(-0.05, 0), cex = 0.9)
 ltxt <- c(quote("Unit molality of Cl"^"-"), "Quartz saturation")
 legend("topright", legend = ltxt, bty = "n", cex = 0.9)
 title("Mineral data from Berman (1988)\nand Sverjensky et al. (1991) (OBIGT default)",
@@ -823,6 +823,7 @@
 ```
 
 If we use the thermodynamic parameters for minerals from @HDNB78, we get the lines shown in the second plot above, representing a larger stability field for muscovite.
+For most purposes, the default database (generating the smaller muscovite field in the first plot) should be used as it is consistent with revisions described by @SHD91.
 
 ```{r KMQ_diagram, eval = FALSE, echo = 11:15}
 ```



More information about the CHNOSZ-commits mailing list