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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jul 28 10:02:08 CEST 2020


Author: jedick
Date: 2020-07-28 10:02:07 +0200 (Tue, 28 Jul 2020)
New Revision: 590

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/mix.R
   pkg/CHNOSZ/inst/NEWS.Rd
   pkg/CHNOSZ/vignettes/multi-metal.Rmd
Log:
Make mix() work when only one bimetallic species is present


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2020-07-27 11:44:09 UTC (rev 589)
+++ pkg/CHNOSZ/DESCRIPTION	2020-07-28 08:02:07 UTC (rev 590)
@@ -1,6 +1,6 @@
-Date: 2020-07-27
+Date: 2020-07-28
 Package: CHNOSZ
-Version: 1.3.6-63
+Version: 1.3.6-64
 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/mix.R
===================================================================
--- pkg/CHNOSZ/R/mix.R	2020-07-27 11:44:09 UTC (rev 589)
+++ pkg/CHNOSZ/R/mix.R	2020-07-28 08:02:07 UTC (rev 590)
@@ -30,11 +30,16 @@
     # - '.balance' is defined to add d3 to get required amount of Fe
     # - d2 (V) is first, so we need to reverse the 'parts' values
     m23 <- mix(d2, d3, d3, parts = rev(parts), .balance = d1$balance)
-    # Mix d3 with itself (combinations of bimetallic species)
-    m33 <- mix(d3, d3, d3, parts = parts, .balance = c(d1$balance, d2$balance))
     # Merge all the species and affinity values
-    species <- rbind(m12$species, m13$species, m23$species, m33$species)
-    values <- c(m12$values, m13$values, m23$values, m33$values)
+    species <- rbind(m12$species, m13$species, m23$species)
+    values <- c(m12$values, m13$values, m23$values)
+    if(nrow(d3$species) > 1) {
+      # Mix d3 with itself (combinations of bimetallic species)
+      m33 <- mix(d3, d3, d3, parts = parts, .balance = c(d1$balance, d2$balance))
+      # Merge all the species and affinity values
+      species <- rbind(species, m33$species)
+      values <- c(values, m33$values)
+    } 
     # Remove duplicates
     # (i.e. bimetallic species that exactly match the composition in 'parts'
     # and therefore appear in multiple combinations with

Modified: pkg/CHNOSZ/inst/NEWS.Rd
===================================================================
--- pkg/CHNOSZ/inst/NEWS.Rd	2020-07-27 11:44:09 UTC (rev 589)
+++ pkg/CHNOSZ/inst/NEWS.Rd	2020-07-28 08:02:07 UTC (rev 590)
@@ -14,6 +14,14 @@
   \subsection{MAJOR CHANGES}{
     \itemize{
 
+      \item An \strong{add} argument has been added to \code{species()}.
+      \emph{With the default of \code{add = FALSE}, loading new species now
+        causes any existing species definition to be \strong{deleted}.} To add
+      species to an existing system, use \samp{add = TRUE}. With this change,
+      scripts can be made more concise because \code{species(delete =
+        TRUE)} is no longer needed to clear the species definition in a series
+      of calculations for different systems. 
+
       \item The naming convention for methane has changed. The name
       \strong{methane} now applies exclusively to the gas; the formula
       \strong{CH4} without a state continues to represent the aqueous species.
@@ -32,13 +40,6 @@
       \code{add.OBIGT()} and \code{mod.OBIGT()} replace the previous
       \code{add.obigt()} and \code{mod.obigt()}.
 
-      \item An \strong{add} argument has been added to \code{species()}. With
-      the default of \code{FALSE}, loading new species now causes any previous species
-      definition to be removed first. Therefore, \code{species(delete = TRUE)}
-      is no longer needed to clear the species definition in a series of
-      calculations for different species. To add new species to an existing
-      system, use \samp{add = TRUE}.
-
       \item The new default of \code{NULL} for \strong{limit.water} in
       \code{diagram()} causes the main diagram to be overlaid on the fields of
       water stability (white) and instability (gray). Change this to
@@ -238,6 +239,8 @@
       different units (cal, J) in OBIGT can be used in subcrt, diagrams, etc.
       in CHNOSZ.
 
+      \item TODO: comment out data modifications in demos/mosaic.R
+
     }
   }
 

Modified: pkg/CHNOSZ/vignettes/multi-metal.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/multi-metal.Rmd	2020-07-27 11:44:09 UTC (rev 589)
+++ pkg/CHNOSZ/vignettes/multi-metal.Rmd	2020-07-28 08:02:07 UTC (rev 590)
@@ -267,7 +267,7 @@
 ```
 
 In these diagrams, changing the Fe:V ratio affects the fully reduced metallic species.
-In the 1:1 mixture, the FeV~3~ + Fe~3~V assemblage is stable instead of FeV.
+In the 1:1 mixture, the FeV~3~ + Fe~3~V assemblage is predicted to be stable instead of FeV.
 This result is unlike Figure 1 of @SZS_17 but is consistent with the [MP page for FeV](https://doi.org/10.17188/1189535) where it shown to decompose to this assemblage.
 On the other hand, [FeV~3~ is stable](https://materialsproject.org/materials/mp-1079399/) in the 1:3 mixture.
 For an even higher proportion of V, the V + FeV~3~ assemblage is stable, which can be seen for instance in the Pourbaix diagram linked from the [MP page for FeV~5~O~12~](https://doi.org/10.17188/1305091).
@@ -319,7 +319,7 @@
 ```
 
 We then compute the affinity for formation of a metastable material, in this case triclinic FeVO~4~, from the same basis species used to make the previous diagrams.
-Given the previous diagrams for the stable Fe-, V- and bimetallic materials *mixed with the same stoichiometry* as FeVO~4~ (1:1 Fe:V), the difference between their affinities of formation and that of FeVO~4~ corresponds to the Pourbaix energy difference (-Δ*G*~pbx~).
+Given the diagram for the stable Fe-, V- and bimetallic materials *mixed with the same stoichiometry* as FeVO~4~ (1:1 Fe:V), the difference between their affinities of formation and that of FeVO~4~ corresponds to the Pourbaix energy difference (-Δ*G*~pbx~).
 This is plotted as a color map in the second diagram.
 
 ```{r FeVO4, echo = 22:34, message = FALSE, results = "hide", fig.width = 10, fig.height = 5, out.width = "100%", pngquant = pngquant}



More information about the CHNOSZ-commits mailing list