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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Nov 16 04:14:05 CET 2019


Author: jedick
Date: 2019-11-16 04:14:04 +0100 (Sat, 16 Nov 2019)
New Revision: 516

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/berman.R
   pkg/CHNOSZ/tests/testthat/test-berman.R
Log:
berman(): initialize values correctly for disorder calculations


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2019-11-11 14:50:14 UTC (rev 515)
+++ pkg/CHNOSZ/DESCRIPTION	2019-11-16 03:14:04 UTC (rev 516)
@@ -1,6 +1,6 @@
-Date: 2019-11-11
+Date: 2019-11-16
 Package: CHNOSZ
-Version: 1.3.3-12
+Version: 1.3.3-13
 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/berman.R
===================================================================
--- pkg/CHNOSZ/R/berman.R	2019-11-11 14:50:14 UTC (rev 515)
+++ pkg/CHNOSZ/R/berman.R	2019-11-16 03:14:04 UTC (rev 516)
@@ -143,7 +143,7 @@
   ### disorder thermodynamic properties ###
   if(!is.na(Tmin) & !is.na(Tmax) & any(T > Tmin) & calc.disorder) {
     # starting disorder contributions are 0
-    Cpds <- Hds <- Sds <- Vds <- Gds <- 0
+    Cpds <- Hds <- Sds <- Vds <- Gds <- numeric(ncond)
     # the lower integration limit is Tmin
     iTds <- T > Tmin
     Tds <- T[iTds]

Modified: pkg/CHNOSZ/tests/testthat/test-berman.R
===================================================================
--- pkg/CHNOSZ/tests/testthat/test-berman.R	2019-11-11 14:50:14 UTC (rev 515)
+++ pkg/CHNOSZ/tests/testthat/test-berman.R	2019-11-16 03:14:04 UTC (rev 516)
@@ -99,3 +99,8 @@
   # this also now works (producing the same NA values)
   #subcrt("quartz", T = seq(0, 500, 100))
 })
+
+test_that("NAs don't creep into calculations below 298.15 K for minerals with disorder parameters", {
+  # 20191116
+  expect_false(any(is.na(subcrt("K-feldspar", P = 1, T = seq(273.15, 303.15, 5), convert = FALSE)$out[[1]]$G)))
+})



More information about the CHNOSZ-commits mailing list