[CHNOSZ-commits] r300 - in pkg/CHNOSZ: . R inst tests/testthat

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Dec 14 04:54:38 CET 2017


Author: jedick
Date: 2017-12-14 04:54:37 +0100 (Thu, 14 Dec 2017)
New Revision: 300

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/subcrt.R
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/tests/testthat/test-subcrt.R
Log:
subcrt(): fix output of reaction$coeffs for minerals with phase transitions


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2017-12-13 06:42:35 UTC (rev 299)
+++ pkg/CHNOSZ/DESCRIPTION	2017-12-14 03:54:37 UTC (rev 300)
@@ -1,6 +1,6 @@
-Date: 2017-12-13
+Date: 2017-12-14
 Package: CHNOSZ
-Version: 1.1.3-6
+Version: 1.1.3-7
 Title: Thermodynamic Calculations for Geobiochemistry
 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	2017-12-13 06:42:35 UTC (rev 299)
+++ pkg/CHNOSZ/R/subcrt.R	2017-12-14 03:54:37 UTC (rev 300)
@@ -466,11 +466,7 @@
     } else {
       # multiple phases aren't involved ... things stay the same
       out.new[[i]] <- out[[iphases]]
-      # hmm.. this could mess up our coefficients 20091103
-      #reaction.new[i,] <- reaction[iphases,]
-      coeff.orig <- reaction$coeff
-      reaction.new[i,] <- reaction[iphases,]
-      reaction.new$coeff <- coeff.orig
+      reaction.new[i, ] <- reaction[iphases, ]
       rs <- as.character(reaction.new$state)
       rs[i] <- as.character(reaction$state[iphases])
       reaction.new$state <- rs

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2017-12-13 06:42:35 UTC (rev 299)
+++ pkg/CHNOSZ/inst/NEWS	2017-12-14 03:54:37 UTC (rev 300)
@@ -1,12 +1,12 @@
-CHANGES IN CHNOSZ 1.1.3-6 (2017-12-13)
+CHANGES IN CHNOSZ 1.1.3-7 (2017-12-14)
 --------------------------------------
 
 - Lines in 1-D diagram()s can optionally be drawn as splines using the
   method for splinefun() given in the 'spline.method' argument (the
   default of NULL means no splines).
 
-- Add dumpdata() for returning/writing all packaged data (including
-  default database and optional data files).
+- Add dumpdata() for returning/writing all packaged thermodynamic data
+  (including default database and optional data files).
 
 - Add 'srt' argument to diagram() (rotation of line labels).
 
@@ -15,6 +15,9 @@
 
 - Correct swapped v1 <-> v3 and v2 <-> v4 in extdata/Berman/DS10.csv.
 
+- Fix a bug where subcrt()$reaction$coeffs was incorrect for reactions
+  involving minerals with phase transitions.
+
 CHANGES IN CHNOSZ 1.1.3 (2017-11-13)
 ------------------------------------
 

Modified: pkg/CHNOSZ/tests/testthat/test-subcrt.R
===================================================================
--- pkg/CHNOSZ/tests/testthat/test-subcrt.R	2017-12-13 06:42:35 UTC (rev 299)
+++ pkg/CHNOSZ/tests/testthat/test-subcrt.R	2017-12-14 03:54:37 UTC (rev 300)
@@ -65,6 +65,8 @@
   #expect_message(subcrt(iacanthite), "subcrt: some points below transition temperature for acanthite cr2 \\(using NA for G\\)")
   expect_message(subcrt(iacanthite), "subcrt: some points above temperature limit for acanthite cr2 \\(using NA for G\\)")
   expect_equal(subcrt("acanthite")$out$acanthite$polymorph, c(1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3))
+  # the reaction coefficients in the output should be unchanged 20171214
+  expect_equal(subcrt(c("bunsenite", "nickel", "oxygen"), c(-1, 1, 0.5))$reaction$coeff, c(-1, 1, 0.5)) 
 })
 
 test_that("calculations for K-feldspar are consistent with SUPCRT92", {
@@ -156,7 +158,7 @@
   #expect_equal(as.numeric(a$values[[1]]), c(0, 0))
 })
 
-test_that("warning is produced for reaction with Helgeson and Berman minerals", {
+test_that("warning is produced for reaction combining Helgeson and Berman minerals", {
   expect_warning(subcrt(c("quartz", "quartz"), c(-1, 1), c("cr", "cr_Berman")), "data may not be internally consistent")
 })
 



More information about the CHNOSZ-commits mailing list