[CHNOSZ-commits] r238 - in pkg/CHNOSZ: . R data inst inst/extdata/Berman inst/extdata/OBIGT tests/testthat

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Oct 3 04:31:20 CEST 2017


Author: jedick
Date: 2017-10-03 04:31:15 +0200 (Tue, 03 Oct 2017)
New Revision: 238

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/berman.R
   pkg/CHNOSZ/data/OBIGT.R
   pkg/CHNOSZ/data/refs.csv
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/inst/extdata/Berman/Ber90.csv
   pkg/CHNOSZ/inst/extdata/Berman/SHD91.csv
   pkg/CHNOSZ/inst/extdata/Berman/ZS92.csv
   pkg/CHNOSZ/inst/extdata/OBIGT/Berman_cr.csv.xz
   pkg/CHNOSZ/tests/testthat/test-berman.R
   pkg/CHNOSZ/tests/testthat/test-util.data.R
Log:
test that data(thermo) and data(OBIGT) make the same database


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2017-10-02 14:42:02 UTC (rev 237)
+++ pkg/CHNOSZ/DESCRIPTION	2017-10-03 02:31:15 UTC (rev 238)
@@ -1,6 +1,6 @@
-Date: 2017-10-02
+Date: 2017-10-03
 Package: CHNOSZ
-Version: 1.1.0-36
+Version: 1.1.0-37
 Title: Thermodynamic Calculations for Geobiochemistry
 Author: Jeffrey Dick
 Maintainer: Jeffrey Dick <j3ffdick at gmail.com>

Modified: pkg/CHNOSZ/R/berman.R
===================================================================
--- pkg/CHNOSZ/R/berman.R	2017-10-02 14:42:02 UTC (rev 237)
+++ pkg/CHNOSZ/R/berman.R	2017-10-03 02:31:15 UTC (rev 238)
@@ -91,7 +91,7 @@
     iTtr <- T > Tref
     Ttr <- T[iTtr]
     # the upper integration limit is Tlambda_P
-    Ttr[Ttr > Tlambda_P] <- Tlambda_P
+    Ttr[Ttr >= Tlambda_P] <- Tlambda_P[Ttr >= Tlambda_P]
     # derived variables
     tref <- Tref - Td
     x1 <- l1^2 * Td + 2 * l1 * l2 * Td^2 + l2^2 * Td^3

Modified: pkg/CHNOSZ/data/OBIGT.R
===================================================================
--- pkg/CHNOSZ/data/OBIGT.R	2017-10-02 14:42:02 UTC (rev 237)
+++ pkg/CHNOSZ/data/OBIGT.R	2017-10-03 02:31:15 UTC (rev 238)
@@ -9,7 +9,7 @@
   local({
     # create obigt data frame
     sources_aq <- paste0(c("H2O", "inorganic", "organic", "biotic"), "_aq")
-    sources_cr <- paste0(c("inorganic", "organic"), "_cr")
+    sources_cr <- paste0(c("inorganic", "organic", "Berman"), "_cr")
     sources_liq <- paste0(c("organic"), "_liq")
     sources_gas <- paste0(c("inorganic", "organic"), "_gas")
     OBIGTdir <- system.file("extdata/OBIGT/", package="CHNOSZ")

Modified: pkg/CHNOSZ/data/refs.csv
===================================================================
--- pkg/CHNOSZ/data/refs.csv	2017-10-02 14:42:02 UTC (rev 237)
+++ pkg/CHNOSZ/data/refs.csv	2017-10-03 02:31:15 UTC (rev 238)
@@ -21,15 +21,15 @@
 SH88,"E. L. Shock and H. C. Helgeson",1988,"Geochim. Cosmochim. Acta 52, 2009-2036","ionic species",https://doi.org/10.1016/0016-7037(88)90181-0
 SHS89,"E. L. Shock, H. C. Helgeson and D. A. Sverjensky",1989,"Geochim. Cosmochim. Acta 53, 2157-2183","inorganic neutral species",https://doi.org/10.1016/0016-7037(89)90341-4
 Ber90,"R. G. Berman",1990,"Am. Mineral. 75, 328-344","annite",http://ammin.geoscienceworld.org/content/75/3-4/328
-Ber90.1,"R. G. Berman",1990,"Am. Mineral. 75, 328-344","almandine and ilmenite: revised H and/or S",http://ammin.geoscienceworld.org/content/75/3-4/328
+Ber90.1,"R. G. Berman",1990,"Am. Mineral. 75, 328-344","almandine and ilmenite: modified H and/or S",http://ammin.geoscienceworld.org/content/75/3-4/328
 SH90,"E. L. Shock and H. C. Helgeson",1990,"Geochim. Cosmochim. Acta 54, 915-945","organic species",https://doi.org/10.1016/0016-7037(90)90429-O
-SHD91,"D. A. Sverjensky, J. J. Hemley and W. M. D'Angelo",1991,"Geochim. Cosmochim. Acta 55, 989-1004","G and H corrections for K- and Al-bearing silicates",https://doi.org/10.1016/0016-7037(89)90341-4
+SHD91,"D. A. Sverjensky, J. J. Hemley and W. M. D'Angelo",1991,"Geochim. Cosmochim. Acta 55, 989-1004","G and H revisions for K- and Al-bearing silicates",https://doi.org/10.1016/0016-7037(89)90341-4
+SHD91.1,"D. A. Sverjensky, J. J. Hemley and W. M. D'Angelo",1991,"Geochim. Cosmochim. Acta 55, 989-1004","phlogopite: H and S modified by @Ber90, followed by G and H revision for K-bearing silicates [after @SHD91]",https://doi.org/10.1016/0016-7037(89)90341-4
+SHD91.2,"D. A. Sverjensky, J. J. Hemley and W. M. D'Angelo",1991,"Geochim. Cosmochim. Acta 55, 989-1004","annite: G and H revision for K-bearing silicates [after @SHD91]",https://doi.org/10.1016/0016-7037(89)90341-4
 SPRONS92.1,"H. C. Helgeson et al.",1992,"sprons92.dat computer data file","titanite: @BH83 + "Gibbs free energies and enthalpies were corrected to be consistent with updated values of Gibbs free energies of Ca<sup>2+</sup> and CO<sub>3</sub><sup>2-</sup> [@SH88] together with the solubilities of calcite and aragonite reported by @PB82 "",
 SPRONS92.2,"H. C. Helgeson et al.",1992,"sprons92.dat computer data file","Ca-bearing minerals; "Gibbs free energies and enthalpies were corrected to be consistent with updated values of Gibbs free energies of Ca<sup>2+</sup> and CO<sub>3</sub><sup>2-</sup> [@SH88] together with the solubilities of calcite and aragonite reported by @PB82 "",
 Sho92,"E. L. Shock",1992,"Geochim. Cosmochim. Acta 56, 3481-3491","diglycine, alanylglycine, leucylglycine, and diketopiperazine",https://doi.org/10.1016/0016-7037(92)90392-V
 ZS92,"C. Zhu and D. A. Sverjensky",1982,"Geochim. Cosmochim. Acta 56, 3435-3467","F,Cl,OH biotite and apatite endmembers. GHS and V were taken from Table 6 of @ZS92; heat capacity and volume parameters from `berman.dat` in SUPCRT92b.zip file on the [DEW website](http://www.dewcommunity.org/resources.html).",https://doi.org/10.1016/0016-7037(92)90390-5
-ZS92.1,"C. Zhu and D. A. Sverjensky",1982,"Geochim. Cosmochim. Acta 56, 3435-3467","phlogopite: updated by @Ber90, then revised G and H using correction for K-bearing silicates [@SHD91]",https://doi.org/10.1016/0016-7037(92)90390-5
-ZS92.2,"C. Zhu and D. A. Sverjensky",1982,"Geochim. Cosmochim. Acta 56, 3435-3467","annite: revised G and H",https://doi.org/10.1016/0016-7037(92)90390-5
 Sho93,"E. L. Shock",1993,"Geochim. Cosmochim. Acta 57, 3341-3349","ethylacetate and acetamide",https://doi.org/10.1016/0016-7037(93)90542-5
 Sho93.1,"E. L. Shock",1993,"Geochim. Cosmochim. Acta 57, 3341-3349","carbon monoxide and ethylene",https://doi.org/10.1016/0016-7037(93)90542-5
 SK93,"E. L. Shock and C. M. Koretsky",1993,"Geochim. Cosmochim. Acta 57, 4899-4922","metal-acetate complexes",https://doi.org/10.1016/0016-7037(93)90128-J

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2017-10-02 14:42:02 UTC (rev 237)
+++ pkg/CHNOSZ/inst/NEWS	2017-10-03 02:31:15 UTC (rev 238)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.1.0-35 (2017-10-02)
+CHANGES IN CHNOSZ 1.1.0-37 (2017-10-03)
 ---------------------------------------
 
 MAJOR CHANGES:

Modified: pkg/CHNOSZ/inst/extdata/Berman/Ber90.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/Berman/Ber90.csv	2017-10-02 14:42:02 UTC (rev 237)
+++ pkg/CHNOSZ/inst/extdata/Berman/Ber90.csv	2017-10-03 02:31:15 UTC (rev 238)
@@ -1,5 +1,5 @@
 name,GfPrTr,HfPrTr,SPrTr,VPrTr,k0,k1,k2,k3,v1,v2,v3,v4,Tlambda,Tref,dTdP,l1,l2,DtH,Tmax,Tmin,d0,d1,d2,d3,d4,d5
-almandine,-4941728,-5267216,340.007,11.511,573.96,-14.831,-292.92,502.208,-0.558,0.321,18.613,74.539,,,,,,,,,,,,,,
-annite,,-5142800,420,15.408,727.21,-47.7504,-138.319,211.906,-1.697,0,34.447,0,,,,,,,,,,,,,,
-ilmenite,-1155320,-1232448,108.628,3.17,150,-4.416,-33.237,34.815,-0.584,1.23,27.248,29.968,,,,,,,,,,,,,,
-phlogopite,-5827224,-6210391,334.346,14.977,610.38,-20.838,-215.33,284.104,-1.697,0,34.447,0,,,,,,,,,,,,,,
+almandine,-4943492,-5267216,340.007,11.511,573.96,-14.831,-292.92,502.208,-0.558,0.321,18.613,74.539,,,,,,,,,,,,,,
+annite,-4793115,-5142800,420,15.408,727.21,-47.7504,-138.319,211.906,-1.697,0,34.447,0,,,,,,,,,,,,,,
+ilmenite,-1155794,-1232448,108.628,3.17,150,-4.416,-33.237,34.815,-0.584,1.23,27.248,29.968,,,,,,,,,,,,,,
+phlogopite,-5830350,-6210391,334.346,14.977,610.38,-20.838,-215.33,284.104,-1.697,0,34.447,0,,,,,,,,,,,,,,

Modified: pkg/CHNOSZ/inst/extdata/Berman/SHD91.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/Berman/SHD91.csv	2017-10-02 14:42:02 UTC (rev 237)
+++ pkg/CHNOSZ/inst/extdata/Berman/SHD91.csv	2017-10-03 02:31:15 UTC (rev 238)
@@ -1,6 +1,6 @@
 name,GfPrTr,HfPrTr,SPrTr,VPrTr,k0,k1,k2,k3,v1,v2,v3,v4,Tlambda,Tref,dTdP,l1,l2,DtH,Tmax,Tmin,d0,d1,d2,d3,d4,d5
 muscovite,-5603417,-5983434,293.157,14.087,651.49,-38.732,-185.232,274.247,-1.717,4.295,33.527,0,,,,,,,,,,,,,,
-phlogopite,-5833918,-6214036,334.158,14.977,610.38,-20.838,-215.33,284.104,-1.697,0,34.447,0,,,,,,,,,,,,,,
+phlogopite,-5837044,-6217085,334.346,14.977,610.38,-20.838,-215.33,284.104,-1.697,0,34.447,0,,,,,,,,,,,,,,
 K-feldspar,-3752109,-3977485,214.145,10.869,381.37,-19.41,-120.373,183.643,-1.805,5.112,15.145,54.85,,,,,,,1436,298,282.98,-4.83,36.21,-15.733,34.77,41.063
 "K-feldspar,high",-3745498,-3966398,229.157,10.896,381.37,-19.41,-120.373,183.643,-1.805,5.112,15.145,54.85,,,,,,,,,,,,,,
 "K-feldspar,low",-3752109,-3977485,214.145,10.869,381.37,-19.41,-120.373,183.643,-1.805,5.112,15.145,54.85,,,,,,,,,,,,,,
@@ -9,3 +9,4 @@
 "albite,high",-3710096,-3928421,224.412,10.083,393.64,-24.155,-78.928,107.064,-1.945,4.861,26.307,32.407,,,,,,,,,,,,,,
 "albite,low",-3718518,-3941903,207.443,10.043,393.64,-24.155,-78.928,107.064,-1.945,4.861,26.307,32.407,,,,,,,,,,,,,,
 jadeite,-2853285,-3031921,133.574,6.034,311.29,-20.051,-53.503,66.257,-0.86,2.149,23.118,25.785,,,,,,,,,,,,,,
+annite,-4799809,-5149494,420,15.408,727.21,-47.7504,-138.319,211.906,-1.697,0,34.447,0,,,,,,,,,,,,,,

Modified: pkg/CHNOSZ/inst/extdata/Berman/ZS92.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/Berman/ZS92.csv	2017-10-02 14:42:02 UTC (rev 237)
+++ pkg/CHNOSZ/inst/extdata/Berman/ZS92.csv	2017-10-03 02:31:15 UTC (rev 238)
@@ -1,6 +1,4 @@
 name,GfPrTr,HfPrTr,SPrTr,VPrTr,k0,k1,k2,k3,v1,v2,v3,v4,Tlambda,Tref,dTdP,l1,l2,DtH,Tmax,Tmin,d0,d1,d2,d3,d4,d5
-annite,-4799801,-5151031,420,15.408,727.208,-47.7504,-138.319,211.906,-1.6969784,0,34.4473262,0,NA,NA,NA,NA,NA,NA,NA,NA,,,,,,
-phlogopite,-5836969,-6218621,334.346,14.977,610.38,-20.838,-215.33,284.104,-1.697,0,34.447,0,,,,,,,,,,,,,,
 fluormuscovite,-5772803,-6111401,299.03,14.087,680.36024,-65.15743,0,11.058312,-1.7169021,4.2947,33.5273302,0,NA,NA,NA,NA,NA,NA,NA,NA,,,,,,
 fluorphlogopite,-6063382,-6403168,336.394,14.637,653.70816,-51.7519,0,-32.459472,-1.6969784,0,34.4473262,0,NA,NA,NA,NA,NA,NA,NA,NA,,,,,,
 fluorannite,-4983910,-5293254,422.291,15.075,742.82736,-68.1741,0,41.844184,-1.6969784,0,34.4473262,0,NA,NA,NA,NA,NA,NA,NA,NA,,,,,,

Modified: pkg/CHNOSZ/inst/extdata/OBIGT/Berman_cr.csv.xz
===================================================================
(Binary files differ)

Modified: pkg/CHNOSZ/tests/testthat/test-berman.R
===================================================================
--- pkg/CHNOSZ/tests/testthat/test-berman.R	2017-10-02 14:42:02 UTC (rev 237)
+++ pkg/CHNOSZ/tests/testthat/test-berman.R	2017-10-03 02:31:15 UTC (rev 238)
@@ -20,7 +20,7 @@
   #expect_silent(properties <- lapply(mineral, berman, check.G=TRUE))
   # - warnings are produced for 3 minerals with GfPrTr(calc) >= 1000 J/cal different from GfPrTr(table)
   expect_warning(properties <- lapply(mineral, berman, check.G=TRUE),
-                 "almandine|annite|phlogopite|fluortremolite", all=TRUE)
+                 "fluortremolite", all=TRUE)
   # save the results so we can use them in the next tests
   assign("prop_Berman", properties, inherits=TRUE)
   

Modified: pkg/CHNOSZ/tests/testthat/test-util.data.R
===================================================================
--- pkg/CHNOSZ/tests/testthat/test-util.data.R	2017-10-02 14:42:02 UTC (rev 237)
+++ pkg/CHNOSZ/tests/testthat/test-util.data.R	2017-10-03 02:31:15 UTC (rev 238)
@@ -48,6 +48,14 @@
   expect_true(all(newdat$name %in% thermo$obigt$name[isp]))
 })
 
+test_that("data(thermo) and data(OBIGT) produce the same database", {
+  data(thermo)
+  d1 <- get("thermo")$obigt
+  data(OBIGT)
+  d2 <- get("thermo")$obigt
+  expect_equal(d1, d2)
+})
+
 # reference
 
 # Richard, L. and Helgeson, H. C. (1998) Calculation of the thermodynamic properties at elevated 



More information about the CHNOSZ-commits mailing list