[CHNOSZ-commits] r776 - in pkg/CHNOSZ: . R demo inst inst/extdata/thermo man man/macros

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Mar 9 14:14:22 CET 2023


Author: jedick
Date: 2023-03-09 14:14:21 +0100 (Thu, 09 Mar 2023)
New Revision: 776

Added:
   pkg/CHNOSZ/inst/extdata/thermo/Bdot_acirc.csv
Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/nonideal.R
   pkg/CHNOSZ/R/thermo.R
   pkg/CHNOSZ/demo/yttrium.R
   pkg/CHNOSZ/inst/NEWS.Rd
   pkg/CHNOSZ/man/basis.Rd
   pkg/CHNOSZ/man/logB.to.OBIGT.Rd
   pkg/CHNOSZ/man/macros/macros.Rd
   pkg/CHNOSZ/man/nonideal.Rd
   pkg/CHNOSZ/man/thermo.Rd
Log:
Move ion size parameters to extdata/thermo/Bdot_acirc.csv


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2023-03-04 03:43:54 UTC (rev 775)
+++ pkg/CHNOSZ/DESCRIPTION	2023-03-09 13:14:21 UTC (rev 776)
@@ -1,6 +1,6 @@
-Date: 2023-03-04
+Date: 2023-03-09
 Package: CHNOSZ
-Version: 1.9.9-67
+Version: 1.9.9-68
 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/nonideal.R
===================================================================
--- pkg/CHNOSZ/R/nonideal.R	2023-03-04 03:43:54 UTC (rev 775)
+++ pkg/CHNOSZ/R/nonideal.R	2023-03-09 13:14:21 UTC (rev 776)
@@ -94,28 +94,19 @@
     if(thisZ==0) next
     Z[i] <- thisZ
   }
-  # get species formulas to assign acirc 20181105
+  # Use formulas of species to get acirc 20181105
   formula <- get("thermo", CHNOSZ)$OBIGT$formula[species]
   if(grepl("Bdot", method)) {
     # "ion size paramter" taken from UT_SIZES.REF of HCh package (Shvarov and Bastrakov, 1999),
     # based on Table 2.7 of Garrels and Christ, 1965
-    acircdat <- c("Rb+"=2.5, "Cs+"=2.5, "NH4+"=2.5, "Tl+"=2.5, "Ag+"=2.5,
-      "K+"=3, "Cl-"=3, "Br-"=3, "I-"=3, "NO3-"=3,
-      "OH-"=3.5, "F-"=3.5, "HS-"=3.5, "BrO3-"=3.5, "IO3-"=3.5, "MnO4-"=3.5,
-      "Na+"=4, "HCO3-"=4, "H2PO4-"=4, "HSO3-"=4, "Hg2+2"=4, "SO4-2"=4, "SeO4-2"=4, "CrO4-2"=4, "HPO4-2"=4, "PO4-3"=4,
-      "Pb+2"=4.5, "CO3-2"=4.5, "SO4-2"=4.5, "MoO4-2"=4.5,
-      "Sr+2"=5, "Ba+2"=5, "Ra+2"=5, "Cd+2"=5, "Hg+2"=5, "S-2"=5, "WO4-2"=5,
-      "Li+"=6, "Ca+2"=6, "Cu+2"=6, "Zn+2"=6, "Sn+2"=6, "Mn+2"=6, "Fe+2"=6, "Ni+2"=6, "Co+2"=6,
-      "Mg+2"=8, "Be+2"=8,
-      "H+"=9, "Al+3"=9, "Cr+3"=9, "La+3"=9, "Ce+3"=9, "Y+3"=9, "Eu+3"=9,
-      "Th+4"=11, "Zr+4"=11, "Ce+4"=11, "Sn+4"=11)
-    acirc <- as.numeric(acircdat[formula])
+    Bdot_acirc <- thermo()$Bdot_acirc
+    acirc <- as.numeric(Bdot_acirc[formula])
     acirc[is.na(acirc)] <- 4.5
     ## Make a message
     #nZ <- sum(Z!=0)
     #if(nZ > 1) message("nonideal: using ", paste(acirc[Z!=0], collapse=" "), " for ion size parameters of ", paste(formula[Z!=0], collapse=" "))
     #else if(nZ==1) message("nonideal: using ", acirc[Z!=0], " for ion size parameter of ", formula[Z!=0])
-    # use correct units (cm) for ion size parameter
+    # Use correct units (cm) for ion size parameter
     acirc <- acirc * 10^-8
   } else if(grepl("bgamma", method)) {
     # "distance of closest approach" of ions in NaCl solutions (HKF81 Table 2)
@@ -189,7 +180,7 @@
   # Manning et al., 2013 (doi:10.2138/rmg.2013.75.5)
   # T in degrees C
   T <- TC
-  # are we at a pre-fitted constant pressure?
+  # Are we at a pre-fitted constant pressure?
   uP <- unique(P)
   is1 <- identical(uP, 1) & all(T==25)
   is500 <- identical(uP, 500)
@@ -205,17 +196,17 @@
   is50000 <- identical(uP, 50000)
   is60000 <- identical(uP, 60000)
   isoP <- is1 | is500 | is1000 | is2000 | is3000 | is4000 | is5000 | is10000 | is20000 | is30000 | is40000 | is50000 | is60000
-  # values for Bdot x 100 from Helgeson (1969), Figure (P = Psat)
+  # Values for Bdot x 100 from Helgeson (1969), Figure (P = Psat)
   if(!isoP | showsplines != "") {
     T0 <- c(23.8, 49.4, 98.9, 147.6, 172.6, 197.1, 222.7, 248.1, 268.7)
     B0 <- c(4.07, 4.27, 4.30, 4.62, 4.86, 4.73, 4.09, 3.61, 1.56) / 100
-    # we could use the values from Hel69 Table 2 but extrapolation of the
+    # We could use the values from Hel69 Table 2 but extrapolation of the
     # their fitted spline function turns sharply upward above 300 degC
     #T0a <- c(25, 50, 100, 150, 200, 250, 270, 300)
     #B0a <- c(4.1, 4.35, 4.6, 4.75, 4.7, 3.4, 1.5, 0)
     S0 <- splinefun(T0, B0)
   }
-  # values for bgamma x 100 from Helgeson et al., 1981 Table 27 
+  # Values for bgamma x 100 from Helgeson et al., 1981 Table 27 
   if(is500 | !isoP | showsplines != "") {
     T0.5 <- seq(0, 400, 25)
     B0.5 <- c(5.6, 7.1, 7.8, 8.0, 7.8, 7.5, 7.0, 6.4, 5.7, 4.8, 3.8, 2.6, 1.0, -1.2, -4.1, -8.4, -15.2) / 100
@@ -255,7 +246,7 @@
     if(is5000) return(S5(T))
   }
   # 10, 20, and 30 kb points from Manning et al., 2013 Fig. 11
-  # here, one control point at 10 degC is added to make the splines curve down at low T
+  # Here, one control point at 10 degC is added to make the splines curve down at low T
   if(is10000 | !isoP | showsplines != "") {
     T10 <- c(25, seq(300, 1000, 50))
     B10 <- c(12, 17.6, 17.8, 18, 18.2, 18.9, 21, 23.3, 26.5, 28.8, 31.4, 34.1, 36.5, 39.2, 41.6, 44.1) / 100
@@ -293,7 +284,7 @@
     S60 <- splinefun(T60, B60)
     if(is60000) return(S60(T))
   }
-  # show points and spline(T) curves
+  # Show points and spline(T) curves
   if(showsplines == "T") {
     thermo.plot.new(c(0, 1000), c(-.2, .7), xlab=axis.label("T"), ylab=expression(italic(b)[gamma]))
     points(T0, B0, pch=0)
@@ -335,7 +326,7 @@
     title(main=expression("Deybe-H\u00FCckel extended term ("*italic(b)[gamma]*") parameter"))
   } else if(showsplines=="P") {
     thermo.plot.new(c(0, 5), c(-.2, .7), xlab=expression(log~italic(P)*"(bar)"), ylab=expression(italic(b)[gamma]))
-    # pressures that are used to make the isothermal splines (see below)
+    # Pressures that are used to make the isothermal splines (see below)
     P25 <- c(1, 500, 1000, 2000, 3000, 4000, 5000)
     P100 <- c(1, 500, 1000, 2000, 3000, 4000, 5000, 10000, 20000)
     P200 <- c(16, 500, 1000, 2000, 3000, 4000, 5000, 10000, 20000, 30000, 40000)
@@ -347,7 +338,7 @@
     P800 <- c(10000, 20000, 30000, 40000, 50000, 60000)
     P900 <- c(10000, 20000, 30000, 40000, 50000, 60000)
     P1000 <- c(10000, 20000, 30000, 40000, 50000, 60000)
-    # plot the pressure and B-dot values used to make the isothermal splines
+    # Plot the pressure and B-dot values used to make the isothermal splines
     points(log10(P25), bgamma(25, P25))
     points(log10(P100), bgamma(100, P100))
     points(log10(P200), bgamma(200, P200))
@@ -359,7 +350,7 @@
     points(log10(P800), bgamma(800, P800))
     points(log10(P900), bgamma(900, P900))
     points(log10(P1000), bgamma(1000, P1000))
-    # plot the isothermal spline functions
+    # Plot the isothermal spline functions
     col <- tail(rev(rainbow(12)), -1)
     P <- c(1, seq(50, 5000, 50)); lines(log10(P), bgamma(25, P), col=col[1])
     P <- c(1, seq(50, 20000, 50)); lines(log10(P), bgamma(100, P), col=col[2])
@@ -376,19 +367,19 @@
     legend("bottomright", pch=1, bty = "n", legend="points from iso-P splines")
     title(main=expression("Deybe-H\u00FCckel extended term ("*italic(b)[gamma]*") parameter"))
   } else {
-    # make T and P the same length
+    # Make T and P the same length
     ncond <- max(length(T), length(P))
     T <- rep(T, length.out=ncond)
     P <- rep(P, length.out=ncond)
-    # loop over P, T conditions
+    # Loop over P, T conditions
     bgamma <- numeric()
     lastT <- NULL
     for(i in 1:length(T)) {
-      # make it fast: skip splines at 25 degC and 1 bar
+      # Make it fast: skip splines at 25 degC and 1 bar
       if(T[i]==25 & P[i]==1) bgamma <- c(bgamma, 0.041)
       else {
         if(!identical(T[i], lastT)) {
-          # get the spline fits from particular pressures for each T
+          # Get the spline fits from particular pressures for each T
           if(T[i] >= 700) {
             PT <- c(10000, 20000, 30000, 40000, 50000, 60000)
             B <- c(S10(T[i]), S20(T[i]), S30(T[i]), S40(T[i]), S50(T[i]), S60(T[i]))
@@ -402,11 +393,11 @@
             PT <- c(500, 1000, 2000, 3000, 4000, 5000, 10000, 20000, 30000, 40000, 50000, 60000)
             B <- c(S0.5(T[i]), S1(T[i]), S2(T[i]), S3(T[i]), S4(T[i]), S5(T[i]), S10(T[i]), S20(T[i]), S30(T[i]), S40(T[i]), S50(T[i]), S60(T[i]))
           } else if(T[i] >= 300) {
-            # here the lowest P is Psat
+            # Here the lowest P is Psat
             PT <- c(86, 500, 1000, 2000, 3000, 4000, 5000, 10000, 20000, 30000, 40000, 50000, 60000)
             B <- c(S0(T[i]), S0.5(T[i]), S1(T[i]), S2(T[i]), S3(T[i]), S4(T[i]), S5(T[i]), S10(T[i]), S20(T[i]), S30(T[i]), S40(T[i]), S50(T[i]), S60(T[i]))
           } else if(T[i] >= 200) {
-            # drop highest pressures because we get into ice
+            # Drop highest pressures because we get into ice
             PT <- c(16, 500, 1000, 2000, 3000, 4000, 5000, 10000, 20000, 30000, 40000)
             B <- c(S0(T[i]), S0.5(T[i]), S1(T[i]), S2(T[i]), S3(T[i]), S4(T[i]), S5(T[i]), S10(T[i]), S20(T[i]), S30(T[i]), S40(T[i]))
           } else if(T[i] >= 100) {
@@ -416,9 +407,9 @@
             PT <- c(1, 500, 1000, 2000, 3000, 4000, 5000)
             B <- c(S0(T[i]), S0.5(T[i]), S1(T[i]), S2(T[i]), S3(T[i]), S4(T[i]), S5(T[i]))
           }
-          # make a new spline as a function of pressure at this T
+          # Make a new spline as a function of pressure at this T
           ST <- splinefun(PT, B)
-          # remember this T; if it's the same as the next one, we won't re-make the spline
+          # Remember this T; if it's the same as the next one, we won't re-make the spline
           lastT <- T[i]
         }
         bgamma <- c(bgamma, ST(P[i]))
@@ -428,7 +419,7 @@
   }
 }
 
-### unexported functions ###
+### Unexported function ###
 
 Bdot <- function(TC) {
   Bdot <- splinefun(c(25, 50, 100, 150, 200, 250, 300), c(0.0418, 0.0439, 0.0468, 0.0479, 0.0456, 0.0348, 0))(TC)

Modified: pkg/CHNOSZ/R/thermo.R
===================================================================
--- pkg/CHNOSZ/R/thermo.R	2023-03-04 03:43:54 UTC (rev 775)
+++ pkg/CHNOSZ/R/thermo.R	2023-03-09 13:14:21 UTC (rev 776)
@@ -10,15 +10,16 @@
   thermodir <- system.file("extdata/thermo/", package="CHNOSZ")
   thermo <- list(
     # Use as.is = TRUE to keep character values as character and not factor
-    opt = as.list(read.csv(file.path(thermodir, "opt.csv"), as.is=TRUE)),
-    element = read.csv(file.path(thermodir, "element.csv"), as.is=1:3),
+    opt = as.list(read.csv(file.path(thermodir, "opt.csv"), as.is = TRUE)),
+    element = read.csv(file.path(thermodir, "element.csv"), as.is = 1:3),
     OBIGT = NULL,
     refs = NULL,
     Berman = NULL,
-    buffer = read.csv(file.path(thermodir, "buffer.csv"), as.is=1:3),
-    protein = read.csv(file.path(thermodir, "protein.csv"), as.is=1:4),
-    groups = read.csv(file.path(thermodir, "groups.csv"), row.names=1, check.names=FALSE),
-    stoich = read.csv(file.path(thermodir, "stoich.csv.xz"), as.is=TRUE),
+    buffer = read.csv(file.path(thermodir, "buffer.csv"), as.is = 1:3),
+    protein = read.csv(file.path(thermodir, "protein.csv"), as.is = 1:4),
+    groups = read.csv(file.path(thermodir, "groups.csv"), row.names = 1, check.names = FALSE),
+    stoich = read.csv(file.path(thermodir, "stoich.csv.xz"), as.is = TRUE),
+    Bdot_acirc = read.csv(file.path(thermodir, "Bdot_acirc.csv"), as.is = TRUE),
     basis = NULL,
     species = NULL,
     opar = NULL
@@ -28,6 +29,11 @@
   formula <- thermo$stoich[, 1]
   thermo$stoich <- as.matrix(thermo$stoich[, 2:ncol(thermo$stoich)])
   rownames(thermo$stoich) <- formula
+  
+  # Make a named numeric vector for Bdot_acirc 20230309
+  Bdot_acirc <- thermo$Bdot_acirc[, "acirc"]
+  names(Bdot_acirc) <- thermo$Bdot_acirc[, "species"]
+  thermo$Bdot_acirc <- Bdot_acirc
 
   # Get parameters in Berman equations from data files 20220203
   path <- system.file("extdata/Berman/", package = "CHNOSZ")

Modified: pkg/CHNOSZ/demo/yttrium.R
===================================================================
--- pkg/CHNOSZ/demo/yttrium.R	2023-03-04 03:43:54 UTC (rev 775)
+++ pkg/CHNOSZ/demo/yttrium.R	2023-03-09 13:14:21 UTC (rev 776)
@@ -125,9 +125,18 @@
   }
 }
 
+# Use non-default ion size parameters 20230309
+Bdot_acirc <- thermo()$Bdot_acirc
+# Cl- and Y+3 override the defaults, and YCl+2 is a new species
+Bdot_acirc <- c("Cl-" = 4, "Y+3" = 5, "YCl+2" = 4, Bdot_acirc)
+thermo("Bdot_acirc" = Bdot_acirc)
+
 # Run the functions to make plots for the demo
 opar <- par(no.readonly = TRUE)
 add.Y.species(800, plot.it = TRUE)
 add.Y.species(1000, plot.it = TRUE)
 Y_Cl()
+
+# Restore plot settings and CHNOSZ settings
 par(opar)
+reset()

Modified: pkg/CHNOSZ/inst/NEWS.Rd
===================================================================
--- pkg/CHNOSZ/inst/NEWS.Rd	2023-03-04 03:43:54 UTC (rev 775)
+++ pkg/CHNOSZ/inst/NEWS.Rd	2023-03-09 13:14:21 UTC (rev 776)
@@ -12,7 +12,7 @@
 % links to vignettes 20220723
 \newcommand{\viglink}{\ifelse{html}{\out{<a href="../CHNOSZ/doc/#1.html"><strong>#1.Rmd</strong></a>}}{\bold{#1.Rmd}}}
 
-\section{Changes in CHNOSZ version 1.9.9-63 (2023-03-02)}{
+\section{Changes in CHNOSZ version 1.9.9-68 (2023-03-09)}{
 
   \subsection{MAJOR USER-VISIBLE CHANGES}{
     \itemize{
@@ -146,8 +146,14 @@
       formation of HCl as well as NaCl) by using \code{affinity()} and
       \code{equilibrate()} instead of algebraic equations.
 
-      \item Add demo \code{yttrium.R} to show speciation of Y-Cl complexes as a
-      function of NaCl concentration, pH, \emph{T}, and \emph{P}, after
+      \item Ion size parameters used in the \samp{Bdot} equation have been
+      moved from the code for \code{nonideal()} to
+      \file{extdata/thermo/Bdot_acirc.csv}, which is read into
+      \code{thermo()$Bdot_acirc} and can be changed by the user.
+
+      \item The two preceding features are used in a new demo \code{yttrium.R}
+      to show speciation of Y-Cl complexes as a function of NaCl concentration,
+      pH, \emph{T}, and \emph{P}, after
       \href{https://doi.org/10.1016/j.gca.2020.04.015}{Guan et al. (2020)}.
 
     }
@@ -193,8 +199,8 @@
       with bornite.
 
       \item Improve handling of non-integer coefficients in
-      \code{expr.species()}. The result for FeS1.33 was previously shown as
-      FeS[.33] but is now shown correctly as FeS[1.33].
+      \code{expr.species()}. The result for FeS1.33 was previously incorrectly
+      formatted as FeS\s{.33} but is now correctly formatted as FeS\s{1.33}.
 
     }
   }

Added: pkg/CHNOSZ/inst/extdata/thermo/Bdot_acirc.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/thermo/Bdot_acirc.csv	                        (rev 0)
+++ pkg/CHNOSZ/inst/extdata/thermo/Bdot_acirc.csv	2023-03-09 13:14:21 UTC (rev 776)
@@ -0,0 +1,60 @@
+species,acirc
+Rb+,2.5
+Cs+,2.5
+NH4+,2.5
+Tl+,2.5
+Ag+,2.5
+K+,3
+Cl-,3
+Br-,3
+I-,3
+NO3-,3
+OH-,3.5
+F-,3.5
+HS-,3.5
+BrO3-,3.5
+IO3-,3.5
+MnO4-,3.5
+Na+,4
+HCO3-,4
+H2PO4-,4
+HSO3-,4
+Hg2+2,4
+SO4-2,4
+SeO4-2,4
+CrO4-2,4
+HPO4-2,4
+PO4-3,4
+Pb+2,4.5
+CO3-2,4.5
+SO3-2,4.5
+MoO4-2,4.5
+Sr+2,5
+Ba+2,5
+Ra+2,5
+Cd+2,5
+Hg+2,5
+S-2,5
+WO4-2,5
+Li+,6
+Ca+2,6
+Cu+2,6
+Zn+2,6
+Sn+2,6
+Mn+2,6
+Fe+2,6
+Ni+2,6
+Co+2,6
+Mg+2,8
+Be+2,8
+H+,9
+Al+3,9
+Cr+3,9
+La+3,9
+Ce+3,9
+Y+3,9
+Eu+3,9
+Th+4,11
+Zr+4,11
+Ce+4,11
+Sn+4,11

Modified: pkg/CHNOSZ/man/basis.Rd
===================================================================
--- pkg/CHNOSZ/man/basis.Rd	2023-03-04 03:43:54 UTC (rev 775)
+++ pkg/CHNOSZ/man/basis.Rd	2023-03-09 13:14:21 UTC (rev 776)
@@ -7,7 +7,8 @@
 }
 
 \usage{
-  basis(species = NULL, state = NULL, logact = NULL, delete = FALSE, add = FALSE)
+  basis(species = NULL, state = NULL, logact = NULL,
+    delete = FALSE, add = FALSE)
 }
 
 \arguments{

Modified: pkg/CHNOSZ/man/logB.to.OBIGT.Rd
===================================================================
--- pkg/CHNOSZ/man/logB.to.OBIGT.Rd	2023-03-04 03:43:54 UTC (rev 775)
+++ pkg/CHNOSZ/man/logB.to.OBIGT.Rd	2023-03-09 13:14:21 UTC (rev 776)
@@ -69,13 +69,14 @@
 species <- c("Co+2", "HS-", "CoHS+")
 coeffs <- c(-1, -1, 1)
 opar <- par(mfrow = c(2, 1))
-for(optimize.omega in c(TRUE, FALSE)) { 
+for(o.o in c(TRUE, FALSE)) { 
   # Fit the parameters with or without variable omega
-  inew <- logB.to.OBIGT(logB, species, coeffs, T, P, npar = 5, optimize.omega = optimize.omega)
+  inew <- logB.to.OBIGT(logB, species, coeffs, T, P, npar = 5, optimize.omega = o.o)
   # Print the new database entry
   info(inew)
   # Plot experimental logB
-  plot(T, logB, "n", c(100, 320), c(5.8, 6.8), xlab = axis.label("T"), ylab = quote(log~beta))
+  plot(T, logB, "n", c(100, 320), c(5.8, 6.8),
+    xlab = axis.label("T"), ylab = quote(log~beta))
   points(T, logB, pch = 19, cex = 2)
   # Plot calculated values
   Tfit <- seq(100, 320, 10)
@@ -82,15 +83,16 @@
   sres <- subcrt(species, coeffs, T = Tfit)
   lines(sres$out$T, sres$out$logK, col = 4)
   title(describe.reaction(sres$reaction))
-  legend <- c("Migdisov et al. (2011)",paste0("logB.to.OBIGT(optimize.omega = ",optimize.omega,")"))
-  legend("top", legend, pch = c(19, NA), lty = c(0, 1), col = c(1, 4), pt.cex = 2, bg = "#FFFFFFB0")
+  legend <- c("Migdisov et al. (2011)",paste0("logB.to.OBIGT(optimize.omega = ",o.o,")"))
+  legend("top", legend, pch = c(19, NA), lty = c(0, 1), col = c(1, 4),
+    pt.cex = 2, bg = "#FFFFFFB0")
 }
 par(opar)
 # NB. Optimizing omega leads to unphysical oscillations in the logK (first plot)
 
 ## ZnCl+ from Mei et al. (2015)
-# These are values for 5000 bar calculated from the modified Ryzhenko-Bryzgalin (RB) model
-logB <- c(-1.93, -1.16, -0.38, 0.45, 1.15, 1.76, 2.30, 2.80, 3.26, 3.70, 4.12, 4.53, 4.92)
+# Values for 5000 bar calculated with the modified Ryzhenko-Bryzgalin (RB) model
+logB <- c(-1.93,-1.16,-0.38,0.45,1.15,1.76,2.30,2.80,3.26,3.70,4.12,4.53,4.92)
 species <- c("Zn+2", "Cl-", "ZnCl+")
 coeffs <- c(-1, -1, 1)
 T <- c(25, 60, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600)

Modified: pkg/CHNOSZ/man/macros/macros.Rd
===================================================================
--- pkg/CHNOSZ/man/macros/macros.Rd	2023-03-04 03:43:54 UTC (rev 775)
+++ pkg/CHNOSZ/man/macros/macros.Rd	2023-03-09 13:14:21 UTC (rev 776)
@@ -51,6 +51,7 @@
 \newcommand{\gamma}{\ifelse{latex}{\eqn{\gamma}}{\ifelse{html}{\out{γ}}{γ}}}
 \newcommand{\alpha}{\ifelse{latex}{\eqn{\alpha}}{\ifelse{html}{\out{α}}{α}}}
 \newcommand{\lambda}{\ifelse{latex}{\eqn{\lambda}}{\ifelse{html}{\out{λ}}{λ}}}
+\newcommand{\AA}{\ifelse{latex}{\out{\AA}}{\ifelse{html}{\out{Å}}{Å}}}
 
 % links to vignettes 20200716
 \newcommand{\viglink}{\ifelse{html}{\out{<a href="../doc/#1.html"><strong>#1</strong></a>}}{\bold{#1.html}}}

Modified: pkg/CHNOSZ/man/nonideal.Rd
===================================================================
--- pkg/CHNOSZ/man/nonideal.Rd	2023-03-04 03:43:54 UTC (rev 775)
+++ pkg/CHNOSZ/man/nonideal.Rd	2023-03-09 13:14:21 UTC (rev 776)
@@ -9,7 +9,7 @@
 
 \usage{
   nonideal(species, speciesprops, IS, T, P, A_DH, B_DH,
-           m_star=NULL, method=thermo()$opt$nonideal)
+           m_star = NULL, method = thermo()$opt$nonideal)
   bgamma(TC, P, showsplines = "")
 }
 
@@ -44,7 +44,7 @@
 
 For the \samp{Bdot} method (the default), the \dQuote{B-dot} form of the extended Debye-Hückel equation is used.
 This equation is valid at ionic strengths up to approximately 3 mol / kg (Hörbrand et al., 2018).
-The distance of closest approach for different ions (the \dQuote{ion size parameter}) is taken from the UT_SIZES.REF file of the HCh package (Shvarov and Bastrakov, 1992), which is based on Table 2.7 of Garrels and Christ, 1965.
+The distance of closest approach for different ions (the \dQuote{ion size parameter}) is taken from \code{\link{thermo}()$Bdot_acirc}; any species not listed in this file is assigned a value of 4.5 \AA.
 The extended term parameter for NaCl-dominated solutions, known as \dQuote{B-dot}, is calculated as a function only of temperature (Helgeson, 1969).
 To set the extended term parameter to zero, use the \samp{Bdot0} method.
 
@@ -229,8 +229,6 @@
 
 Clarke, E. C. W. and Glew, D. N. (1980) Evaluation of Debye-Hückel limiting slopes for water between 0 and 150 °C. \emph{J. Chem. Soc. Faraday Trans.} \bold{76}, 1911--1916. \doi{10.1039/f19807601911}
 
-Garrels, R. M. and Christ, C. L. (1965) \emph{Solutions, Minerals, and Equilibria}, Harper & Row, New York, 450 p. \url{https://www.worldcat.org/oclc/517586}
-
 Helgeson, H. C. (1969) Thermodynamics of hydrothermal systems at elevated temperatures and pressures. \emph{Am. J. Sci.} \bold{267}, 729--804. \doi{10.2475/ajs.267.7.729}
 
 Helgeson, H. C., Kirkham, D. H. and Flowers, G. C. (1981) Theoretical prediction of the thermodynamic behavior of aqueous electrolytes at high pressures and temperatures. IV. Calculation of activity coefficients, osmotic coefficients, and apparent molal and standard and relative partial molal properties to 600\degC and 5 Kb. \emph{Am. J. Sci.} \bold{281}, 1249--1516. \doi{10.2475/ajs.281.10.1249}

Modified: pkg/CHNOSZ/man/thermo.Rd
===================================================================
--- pkg/CHNOSZ/man/thermo.Rd	2023-03-04 03:43:54 UTC (rev 775)
+++ pkg/CHNOSZ/man/thermo.Rd	2023-03-09 13:14:21 UTC (rev 776)
@@ -236,6 +236,12 @@
        \code{...} \tab numeric \tab Stoichiometry, one column for each element present in any species
     }
 
+    \item \code{thermo()$Bdot_acirc}
+    Values of ion size parameter (\AA) for species, taken from the UT_SIZES.REF file of the HCh package (Shvarov and Bastrakov, 1999), which is based on Table 2.7 of Garrels and Christ, 1965.
+    This is used in \code{\link{nonideal}} with the default \samp{Bdot} method.
+    Custom ion size parameters can be added to this vector; to override a default value for a species, either replace the numeric value for that species or prepend a named numeric value (for duplicated species, the first value is used).
+    See \code{demo("yttrium")} for an example of adding and overriding species.
+
     \item \code{thermo()$Berman}
     A data frame with thermodynamic parameters for minerals in the Berman equations, assembled from files in \samp{extdata/Berman} and used in \code{\link{Berman}}.
 
@@ -289,6 +295,8 @@
 \references{
 Cox, J. D., Wagman, D. D. and Medvedev, V. A., eds. (1989) \emph{CODATA Key Values for Thermodynamics}. Hemisphere Publishing Corporation, New York, 271 p. \url{https://www.worldcat.org/oclc/18559968}
 
+Garrels, R. M. and Christ, C. L. (1965) \emph{Solutions, Minerals, and Equilibria}, Harper & Row, New York, 450 p. \url{https://www.worldcat.org/oclc/517586}
+
 Thoenen, T., Hummel, W., Berner, U. and Curti, E. (2014) \emph{The PSI/Nagra Chemical Thermodynamic Database 12/07}. Paul Scherrer Institut. \url{https://www.psi.ch/en/les/database}
 
 Wagman, D. D., Evans, W. H., Parker, V. B., Schumm, R. H., Halow, I., Bailey, S. M., Churney, K. L. and Nuttall, R. L. (1982) The NBS tables of chemical thermodynamic properties. Selected values for inorganic and C\s{1} and C\s{2} organic substances in SI units. \emph{J. Phys. Chem. Ref. Data} \bold{11} (supp. 2), 1--392. \url{https://srd.nist.gov/JPCRD/jpcrdS2Vol11.pdf}



More information about the CHNOSZ-commits mailing list