[CHNOSZ-commits] r555 - in pkg/CHNOSZ: . inst inst/extdata/OBIGT tests/testthat vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jul 11 10:14:53 CEST 2020


Author: jedick
Date: 2020-07-11 10:14:53 +0200 (Sat, 11 Jul 2020)
New Revision: 555

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/inst/CHECKLIST
   pkg/CHNOSZ/inst/NEWS.Rd
   pkg/CHNOSZ/inst/extdata/OBIGT/DEW.csv
   pkg/CHNOSZ/inst/extdata/OBIGT/refs.csv
   pkg/CHNOSZ/tests/testthat/test-DEW.R
   pkg/CHNOSZ/vignettes/OBIGT.Rmd
   pkg/CHNOSZ/vignettes/equilibrium.Rmd
   pkg/CHNOSZ/vignettes/mklinks.sh
Log:
Add tests for DEW 2019 data


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2020-07-10 02:17:08 UTC (rev 554)
+++ pkg/CHNOSZ/DESCRIPTION	2020-07-11 08:14:53 UTC (rev 555)
@@ -1,6 +1,6 @@
-Date: 2020-07-10
+Date: 2020-07-11
 Package: CHNOSZ
-Version: 1.3.6-28
+Version: 1.3.6-29
 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/inst/CHECKLIST
===================================================================
--- pkg/CHNOSZ/inst/CHECKLIST	2020-07-10 02:17:08 UTC (rev 554)
+++ pkg/CHNOSZ/inst/CHECKLIST	2020-07-11 08:14:53 UTC (rev 555)
@@ -1,6 +1,6 @@
 ****************************
 Release checklist for CHNOSZ
-    (updated 2020-07-06)
+    (updated 2020-07-11)
 ****************************
 
 - Run examples() and demos() and inspect their output (especially plots)
@@ -48,10 +48,7 @@
 
 - Customize rmarkdown installation (in R local library)
 
-  - to reduce size of vignettes: replace files in
-    rmd/h/bootstrap/fonts/ with empty files
-
-  - to enable offset anchor position in OBIGT.Rmd:
+  - to enable page offset from anchor position in OBIGT.Rmd:
     remove padding-top: 10px; from h2 in
     rmarkdown/templates/html_vignette/resources/vignette.css
 

Modified: pkg/CHNOSZ/inst/NEWS.Rd
===================================================================
--- pkg/CHNOSZ/inst/NEWS.Rd	2020-07-10 02:17:08 UTC (rev 554)
+++ pkg/CHNOSZ/inst/NEWS.Rd	2020-07-11 08:14:53 UTC (rev 555)
@@ -136,6 +136,10 @@
 
       \item TODO: add hotspring.Rmd to JMDplots package.
 
+      \item TODO: move protein.equil() example (previously in equilibrium.Rnw) to JMDplots.
+
+      \item TODO: change add.obigt --> add.OBIGT on website (Fe-O-H-S example) when package is submitted to CRAN.
+
     }
   }
 

Modified: pkg/CHNOSZ/inst/extdata/OBIGT/DEW.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/OBIGT/DEW.csv	2020-07-10 02:17:08 UTC (rev 554)
+++ pkg/CHNOSZ/inst/extdata/OBIGT/DEW.csv	2020-07-11 08:14:53 UTC (rev 555)
@@ -56,7 +56,7 @@
 Fe(HCOO)+,Fe(HCOO)+,Fe(HCOO)+,aq,HS19,DEW19.1,30.Jun.20,cal,-111800,-112263,59,30,27,6.6001,2.0008,3.1604,-2.8617,20.5995,3.0764,-0.3418,1
 Fe(HSiO3)+,Fe(HSiO3)+,Fe(HSiO3)+,aq,HS19,DEW19.1,30.Jun.20,cal,-277500,-298539,14,77,38.2,9.1022,4.383,1.163,-2.9602,54.4228,12.6503,0.3397,1
 FeOH+,FeOH(+),FeOH+,aq,SSWS97,DEW17.13,26.Sep.17,cal,-65850,NA,-10,15,2,2.2461,-2.1446,6.6364,-2.6903,21.4354,0.0209,0.7031,1
-Fe+2,Fe(+2),Fe+2,aq,SSWS97,DEW17.2,26.Sep.17,cal,-21870,NA,-25.3,-7.9,-22.2,-0.9153,-9.3356,9.6131,-2.3931,14.9634,-4.6439,1.4574,2
+Fe+2,Fe(+2),Fe+2,aq,SSWS97,DEW19.6,11.Jul.20,cal,-21870,NA,-25.3,-7.9,-22.2,-1.0416,-9.0072,9.6653,-2.4066,14.9634,-4.6439,1.4574,2
 Fe+3,Fe(+3),Fe+3,aq,SSWS97,DEW17.2,26.Sep.17,cal,-4120,-11850,-66.3,-18.6,-37,-6.3271,-3.5568,12.7493,-2.632,19.0461,-6.8234,2.5812,3
 FeCl+,FeCl(+),FeCl+,aq,SSWS97,DEW17.6,26.Sep.17,cal,-53030,-61260,-10.06,20.57,5.8,2.9827,-1.4433,6.0483,-2.7193,24.6737,1.1555,0.7003,1
 FeCl+2,FeCl(++),FeCl+2,aq,TDDZ00,DEW17.14,26.Sep.17,cal,-37573,-50875,-28.7,3.3,-19,-1.4537,-5.6672,9.59,-2.5447,21.8511,-2.3624,1.4925,2
@@ -128,7 +128,7 @@
 MgCO3,MgCO3(0),MgCO3,aq,SSWS97,DEW17.27,26.Sep.17,cal,-238760,-270570,-24,-24.8,17.9,5.1407,0.6113,4.3256,-2.8043,-5.6039,-8.0864,0.3,0
 MgO,MgO,MgO,aq,HS19,DEW19.1,30.Jun.20,cal,-137500,-139804,24.6,-24.5,6.2,2.8684,-1.5521,6.1396,-2.7148,-5.4281,-8.0252,0.3,0
 MgOH+,MgOH(+),MgOH+,aq,SSWS97,DEW19.2,30.Jun.20,cal,-149225,-152955,-18,40,2,2.3141,-2.0799,6.5821,-2.693,37.393,5.1134,0.8449,1
-Mg(SiO2)(HCO3)+,Mg(SiO2)(HCO3)+,MgSiC+,aq,HS19,DEW19.1,30.Jun.20,cal,-454300,-479123,48,78.5,53.5,11.8266,6.977,-1.012,-3.0674,50.5582,12.9558,-0.1752,1
+Mg(SiO2)(HCO3)+,Mg(SiO2)(HCO3)+,Mg(SiO2)(HCO3)+,aq,HS19,DEW19.1,30.Jun.20,cal,-454300,-479123,48,78.5,53.5,11.8266,6.977,-1.012,-3.0674,50.5582,12.9558,-0.1752,1
 MgSO4,MgSO4,MgSO4,aq,ARHB06,DEW17.29,26.Sep.17,cal,-289449,-327449,-1,20,35,8.3417,3.659,1.77,-2.9303,18.3485,1.0394,0.05,0
 Mn+2,Mn(+2),Mn+2,aq,SSWS97,DEW17.2,26.Sep.17,cal,-54500,-52724,-17.6,-4.1,-17.1,-1.1288,-5.3578,9.3306,-2.5575,16.6673,-3.8698,1.4006,2
 MnCl+,MnCl(+),MnCl+,aq,SSWS97,DEW17.4,26.Sep.17,cal,-86290,-88280,12,24.63,6.3,2.9207,-1.5023,6.0978,-2.7169,23.9969,1.9824,0.3686,1

Modified: pkg/CHNOSZ/inst/extdata/OBIGT/refs.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/OBIGT/refs.csv	2020-07-10 02:17:08 UTC (rev 554)
+++ pkg/CHNOSZ/inst/extdata/OBIGT/refs.csv	2020-07-11 08:14:53 UTC (rev 555)
@@ -245,11 +245,11 @@
 DEW17.18,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","Revised 1/22/15 based on fitting Cp and V vs T data from @HDM+94 + revised correlation for a<sub>1</sub> from @SHA14; omega from delCPr above 100 °C [@ZW07]; G, H, and S from @AH97b",http://www.dewcommunity.org
 DEW17.19,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","Regression of @RS87 & @TZA97 with new full correlations",http://www.dewcommunity.org
 DEW17.21,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","HSO<sub>3</sub><sup>-</sup>: revised using published estimated V and pred. a<sub>1</sub> from new correlation",http://www.dewcommunity.org
-DEW17.22,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","isobutane: G, H, S, Cp, V from @SH90; a<sub>1</sub> estimated with @SHA14; c2 estimated with a new hydrocarbon correlation.",http://www.dewcommunity.org
+DEW17.22,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","isobutane: G, H, S, Cp, V from @SH90; a<sub>1</sub> estimated with @SHA14; c<sub>2</sub> estimated with a new hydrocarbon correlation.",http://www.dewcommunity.org
 DEW17.23,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","May, 2017 Fitted to logKs from @OH88 + retrieved logKs from Hemley experiments at 1.0 kb using the HCl referred to above",http://www.dewcommunity.org
 DEW17.25,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","Revised G, S and Cp to fit @Noy07 & @SGX+06 with a<sub>1</sub> of the complex equal to the sum of the a<sub>1</sub> values of the ions",http://www.dewcommunity.org
 DEW17.26,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","Fit to @SBS14 & @SH77; plus revised V increased so that a<sub>1</sub> of the complex is the sum of the a<sub>1</sub> values of the ions",http://www.dewcommunity.org
-DEW17.27,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","MgCO<sub>3</sub>: @SSH97 revised volume increased in order that a<sub>1</sub> of the complex is the sum of the a<sub>1</sub> values of the ions; and Cp revised using isocoulombic reln with CaCO3,aq; also omega is set to +0.3 as for all neutral metal complexes.",http://www.dewcommunity.org
+DEW17.27,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","MgCO<sub>3</sub>: @SSH97 revised volume increased in order that a<sub>1</sub> of the complex is the sum of the a<sub>1</sub> values of the ions; and Cp revised using isocoulombic reln with CaCO<sub>3</sub>,aq; also omega is set to +0.3 as for all neutral metal complexes.",http://www.dewcommunity.org
 DEW17.29,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","S, Cp, V, omega from fit to @ARHB06 and @FDM94",http://www.dewcommunity.org
 DEW17.30,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","NaCO<sub>3</sub><sup>-</sup>: Fit to @SBS13 (80 to 200 C) & @GTS61 (at 25 C) to get G, S and Cp;  with a<sub>1</sub> pred. from the sum of the ions and used to predict the volume",http://www.dewcommunity.org
 DEW17.32,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","NaOH: Fitted to @HP97 data with a<sub>1</sub> pred. from the sum of the ions and used to predict the volume",http://www.dewcommunity.org
@@ -260,7 +260,7 @@
 DEW17.37,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","fit to Raman speciation and quartz solubility data",http://www.dewcommunity.org
 DEW17.38,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","SO<sub>2</sub>: @SHS89 with revised a<sub>1</sub> predicted as a complex from delVn",http://www.dewcommunity.org
 DEW17.39,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","toluene: @PS01 with new a<sub>1</sub> to a<sub>4</sub> predicted with revised a<sub>1</sub> consistent with @SHA14",http://www.dewcommunity.org
-DEW17.40,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","urea: Revised Feb. 2015 by Dimitri: c1, c2, and omega from PS01 based on Stokes (1967) data; V from Cabani et al. (1981) with a<sub>1</sub>-a<sub>4</sub> predicted.",http://www.dewcommunity.org
+DEW17.40,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","urea: Revised Feb. 2015 by Dimitri: c<sub>1</sub>, c<sub>2</sub>, and omega from PS01 based on Stokes (1967) data; V from Cabani et al. (1981) with a<sub>1</sub>-a<sub>4</sub> predicted.",http://www.dewcommunity.org
 DEW17.101,"D. A. Sverjensky et al.",2017,"Deep Earth Water (DEW) spreadsheet","formate and lactate: revised with new predicted a<sub>1</sub> for ions",https://doi.org/10.1016/0016-7037(90)90429-O
 BDat17.1,"D. A. Sverjensky et al.",2017,"berman.dat file in SUPCRT92b.zip on the DEW website","antigorite: "Oct. 21, 2016: Revised volume coefficients consistent with @HDR06 and @YIY+14 "",http://www.dewcommunity.org/resources.html
 AKAE19,"M. R. Azadi et al.",2019,"Fluid Phase Equilib. 480, 25-40","metal-glycinate complexes",https://doi.org/10.1016/j.fluid.2018.10.002
@@ -267,8 +267,9 @@
 DEW19,"D. A. Sverjensky et al.",2019,"Deep Earth Water (DEW) spreadsheet","(values listed in DEW spreadsheet)",http://www.dewcommunity.org
 DEW19.1,"D. A. Sverjensky et al.",2019,"Deep Earth Water (DEW) spreadsheet","(values from @HS19 listed in DEW spreadsheet)",http://www.dewcommunity.org
 DEW19.2,"D. A. Sverjensky et al.",2019,"Deep Earth Water (DEW) spreadsheet","MgOH<sup>+</sup>: Revised by Dimitri, January, 2019; with minimum volume needed",http://www.dewcommunity.org
-DEW19.3,"D. A. Sverjensky et al.",2019,"Deep Earth Water (DEW) spreadsheet","CaO: Fitted by Dimitri to high PT retrieval's from Fang",http://www.dewcommunity.org
+DEW19.3,"D. A. Sverjensky et al.",2019,"Deep Earth Water (DEW) spreadsheet","CaO: Fitted by Dimitri to high PT retrievals from Fang",http://www.dewcommunity.org
 DEW19.4,"D. A. Sverjensky et al.",2019,"Deep Earth Water (DEW) spreadsheet","glycinate: @AH97b for the G, H, S, Cp, V",http://www.dewcommunity.org
 DEW19.5,"D. A. Sverjensky et al.",2019,"Deep Earth Water (DEW) spreadsheet","(Ca<sup>+2</sup>: values listed in DEW spreadsheet)",http://www.dewcommunity.org
+DEW19.6,"D. A. Sverjensky et al.",2019,"Deep Earth Water (DEW) spreadsheet","(Fe<sup>+2</sup>: take HKF a<sub>1</sub>-a<sub>4</sub> parameters from @HS19, which are different from 2019 DEW spreadsheet)",http://www.dewcommunity.org
 HS19,"F. Huang and D. A. Sverjensky",2019,"Geochim. Cosmochim. Acta 254, 192-230","ions and metal complexes",https://doi.org/10.1016/j.gca.2019.03.027
 LA19,"D. E. LaRowe and J. P. Amend",2019,"Geomicrobiol. J. 36, 492-505","dimethylamine, trimethylamine, resorcinol, phloroglucinol, cyclohexane carboxylate, and cyclohexane carboxylic acid",https://doi.org/10.1080/01490451.2019.1573278

Modified: pkg/CHNOSZ/tests/testthat/test-DEW.R
===================================================================
--- pkg/CHNOSZ/tests/testthat/test-DEW.R	2020-07-10 02:17:08 UTC (rev 554)
+++ pkg/CHNOSZ/tests/testthat/test-DEW.R	2020-07-11 08:14:53 UTC (rev 555)
@@ -3,6 +3,10 @@
 # since this is alphabetically the first test,
 # we need to load the 'thermo' object (for running tests in R CMD check)
 suppressMessages(reset())
+# get properties of water from DEW implementation in CHNOSZ
+water("DEW")
+# use DEW species parameters in OBIGT database
+add.OBIGT("DEW")
 
 test_that("density of water is calculated correctly", {
   pressure <- c(5000, 5000, 10000, 10000, 20000, 20000, 50000, 50000)
@@ -49,8 +53,6 @@
 test_that("g function is calculated correctly", {
   pressure <- c(1000, 1000, 5000, 5000, 10000)
   temperature <- c(100, 1000, 100, 1000, 100)
-  # properties of water from DEW implementation in CHNOSZ
-  oldwat <- water("DEW")
   # note that values returned for alpha, daldT, beta are NA
   w <- water(c("rho", "alpha", "daldT", "beta", "Psat"), T=convert(temperature, "K"), P=pressure)
   # g from CHNOSZ functions
@@ -58,14 +60,11 @@
   # g from R translation of DEW macro functions (not used in CHNOSZ)
   DEWg <- calculateG(pressure, temperature, w$rho/1000)
   expect_equal(Rg, DEWg)
-  water(oldwat)
 })
 
 test_that("Gibbs energies of species are calculated correctly", {
   P <- c(5000, 5000, 10000, 10000, 20000, 20000, 50000, 50000)
   T <- c(100, 1000, 100, 1000, 100, 1000, 100, 1000)
-  oldwat <- water("DEW")
-  add.OBIGT("DEW")
   RG_HCl <- subcrt("HCl", P=P, T=T)$out[[1]]$G
   DEWG_HCl <- c(-28784.99, -58496.85, -26520.94, -55276.92, -21928.89, -50337.19, -8014.34, -36746.87)
   expect_equal(RG_HCl, DEWG_HCl, tolerance = 1e-5)
@@ -72,7 +71,6 @@
   RG_Cl <- subcrt("Cl-", P=P, T=T)$out[[1]]$G
   DEWG_Cl <- c(-30054.59, -22839.35, -27910.68, -28094.07, -23568.45, -27959.67, -10443.07, -18744.93)
   expect_equal(RG_Cl, DEWG_Cl, tolerance = 1e-7)
-  water(oldwat)
 })
 
 test_that("Delta G, logK, and Delta V of reactions are calculated correctly", {
@@ -79,8 +77,6 @@
   # These are reactions corresponding to Fig. 1b of Sverjensky et al., 2014 (Nat. Geosci.).
   # The properties are calculated using parameters from the DEW spreadsheet,
   # which are not necessarily identical those that were used for the paper.
-  oldwat <- water("DEW")
-  add.OBIGT("DEW", c("CO2", "HCO3-", "CO3-2", "acetic acid", "acetate", "CH4"))
   T <- 600
   P <- c(5000, 50000)
   R1 <- subcrt(c("H2O", "CO2", "HCO3-", "H+"), c(-1, -1, 1, 1), T=T, P=P)$out
@@ -120,7 +116,46 @@
   expect_equal(c(R1$V, R2$V, R3$V), DEW_DV[1:6], tolerance=1e-15)
   # TODO: why does DEW spreadsheet use V (O2,g) == 24.465?
   #expect_equal(c(R4$V, R5$V), DEW_DV[7:10])
+})
 
-  # reset computational option for water
-  water(oldwat)
+test_that("calculated logK values are consistent with Extended Deep Earth Water paper", {
+  # Reference logK values are from Appendix D of Huang and Sverjensky, 2019 (doi:10.1016/j.gca.2019.03.027)
+  # Select T and P for comparisons
+  T <- c(300, 1100)
+  P <- c(10000, 60000)
+  # Adjust calculated logKs for different values of the
+  # gas constant used in the DEW spreadsheet and CHNOSZ
+  RoverR <- 1.9858775 / 1.9872
+  # Calculate logK for each reaction
+  logK1 <- subcrt(c("H2O", "CO2", "H2CO3"), c(-1, -1, 1), T = T, P = P)$out$logK / RoverR
+  logK2 <- subcrt(c("AlO2(SiO2)-", "H+", "Al+3", "H2O", "SiO2"), c(-1, -4, 1, 2, 1), T = T, P = P)$out$logK / RoverR
+  logK3 <- subcrt(c("Ca(HCO3)+", "Ca+2", "HCO3-"), c(-1, 1, 1), T = T, P = P)$out$logK / RoverR
+  logK4 <- subcrt(c("Ca(HCOO)+", "Ca+2", "HCOO-"), c(-1, 1, 1), T = T, P = P)$out$logK / RoverR
+  logK5 <- subcrt(c("Ca(HSiO3)+", "H+", "Ca+2", "H2O", "SiO2"), c(-1, -1, 1, 1, 1), T = T, P = P)$out$logK / RoverR
+  logK6 <- subcrt(c("Fe(HCOO)+", "Fe+2", "HCOO-"), c(-1, 1, 1), T = T, P = P)$out$logK / RoverR
+  logK7 <- subcrt(c("Fe(HSiO3)+", "H+", "Fe+2", "H2O", "SiO2"), c(-1, -1, 1, 1, 1), T = T, P = P)$out$logK / RoverR
+  logK8 <- subcrt(c("H2O", "SiO2", "HSiO3-", "H+"), c(-1, -1, 1, 1), T = T, P = P)$out$logK / RoverR
+  logK9 <- subcrt(c("MgO", "H+", "Mg+2", "H2O"), c(-1, -2, 1, 1), T = T, P = P)$out$logK / RoverR
+  logK10 <- subcrt(c("Mg(SiO2)(HCO3)+", "Mg+2", "SiO2", "HCO3-"), c(-1, 1, 1, 1), T = T, P = P)$out$logK / RoverR
+  logK11 <- subcrt(c("NaHCO3", "Na+", "HCO3-"), c(-1, 1, 1), T = T, P = P)$out$logK / RoverR
+  logK12 <- subcrt(c("Si3O6", "SiO2"), c(-1, 3), T = T, P = P)$out$logK / RoverR
+  # Make the comparisons:
+  # - Reference logK values are from Appendix D of Huang and Sverjensky, 2019 (doi:10.1016/j.gca.2019.03.027)
+  # - Tolerance (tol) is added if there are differences between the reference and calculated values after rounding
+  #   (scale = 1 is used to compare absolute differences)
+  expect_equal(round(logK1,  2), c(-0.76, 1.34))
+  expect_equal(round(logK2,  4), c( 6.7755,  0.9413), tol = 0.003,  scale = 1)
+  expect_equal(round(logK3,  4), c(-2.3759, -5.6840))
+  expect_equal(round(logK4,  4), c(-2.2837, -5.5822), tol = 0.0001, scale = 1)
+  expect_equal(round(logK5,  4), c( 4.0349,  0.1797), tol = 0.002,  scale = 1)
+  expect_equal(round(logK6,  4), c(-7.5354, -8.0238))
+  expect_equal(round(logK7,  4), c(-0.6883, -1.6363), tol = 0.002,  scale = 1)
+  expect_equal(round(logK8,  4), c(-7.0651, -5.5067), tol = 0.002,  scale = 1)
+  expect_equal(round(logK9,  4), c( 8.2759,  4.3493), tol = 0.002,  scale = 1)
+  expect_equal(round(logK10, 4), c(-6.8106, -8.5888), tol = 0.0001, scale = 1)
+  expect_equal(round(logK11, 4), c(-0.2447, -2.9235))
+  expect_equal(round(logK12, 4), c( 3.3283,  0.4527))
 })
+
+# Restore the default water model and OBIGT database
+suppressMessages(reset())

Modified: pkg/CHNOSZ/vignettes/OBIGT.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/OBIGT.Rmd	2020-07-10 02:17:08 UTC (rev 554)
+++ pkg/CHNOSZ/vignettes/OBIGT.Rmd	2020-07-11 08:14:53 UTC (rev 555)
@@ -18,8 +18,8 @@
 a.anchor::before {
   display: block;
   content: " ";
-  margin-top: -190px;
-  height: 190px;
+  margin-top: -220px;
+  height: 220px;
   visibility: hidden;
   pointer-events: none;
 }
@@ -31,13 +31,9 @@
     // close all divs then open this one
     CloseAllDivs();
     OpenDiv(ID);
-    // hide the message about nothing open
-    document.getElementById("nothing-open").style.display = "none";
   } else {
     // close all divs
     CloseAllDivs();
-    // hide the message about nothing open
-    document.getElementById("nothing-open").style.display = "block";
   }
 }
 function OpenDiv(ID) {
@@ -77,6 +73,8 @@
   OpenDiv("optional-OldAA");
   OpenDiv("optional-AS04");
   OpenDiv("optional-AkDi");
+  // change the footer message
+  document.getElementById("footer").style.display = "none";
   document.getElementById("all-open").style.display = "block";
 }
 function CloseAllDivs() {
@@ -96,6 +94,8 @@
   CloseDiv("optional-OldAA");
   CloseDiv("optional-AS04");
   CloseDiv("optional-AkDi");
+  // change the footer message
+  document.getElementById("footer").style.display = "block";
   document.getElementById("all-open").style.display = "none";
 }
 </script>
@@ -207,6 +207,13 @@
 ### Gases <button id="B-gas-inorganic" onclick='ToggleDiv("gas-inorganic")'>Inorganic</button> <button id="B-gas-organic" onclick='ToggleDiv("gas-organic")'>Organic</button>    Liquids <button id="B-liquid-organic" onclick='ToggleDiv("liquid-organic")'>Organic</button>
 ### Optional Data <button id="B-optional-DEW" onclick='ToggleDiv("optional-DEW")'>DEW</button> <button id="B-optional-SUPCRT92" onclick='ToggleDiv("optional-SUPCRT92")'>SUPCRT92</button> <button id="B-optional-SLOP98" onclick='ToggleDiv("optional-SLOP98")'>SLOP98</button> <button id="B-optional-OldAA" onclick='ToggleDiv("optional-OldAA")'>OldAA</button> <button id="B-optional-AS04" onclick='ToggleDiv("optional-AS04")'>AS04</button> <button id="B-optional-AkDi" onclick='ToggleDiv("optional-AkDi")'>AkDi</button>
 
+<!-- normal or "all open" footer message --> 
+
+<div id="footer" style="display: block">
+*Press a button above to show the citations in that data file.*
+*Or, <a href = "#showall" onclick='OpenAllDivs()'>click here</a> to show all citations.*
+</div>
+
 <div id="all-open" style="display: none">
 *Showing citations in all data files.*
 *Press any button above to hide them.*
@@ -325,7 +332,7 @@
 Besides using `add.OBIGT("DEW")` to load these data, you should also run `water("DEW")` to activate the DEW equations in CHNOSZ.
 See `demo(DEW)` for some examples.
 
-Most of the comments below were transcribed from the DEW spreadsheet.
+Most of the comments below were transcribed from the DEW spreadsheet. (Comments in parentheses were added by JMD.)
 
 ```{r optreflist, results="asis", echo=FALSE}
 optused <- c(optused, filerefs(csvfile))
@@ -385,14 +392,9 @@
 ```
 </div>
 
-<!-- "all" or "nothing" divs --> 
+<hr>
 
-<div id="nothing-open" style="display: block">
-*Press a button above to show the citations in that data file.*
-*Or, <a href = "#showall" onclick='OpenAllDivs()'>click here</a> to show all citations.*
-
 <b>Total count of species</b>: References were found for `r length(used)` of `r nrow(thermo()$OBIGT)` species in the default OBIGT database and `r length(optused)` optional species.
-</div>
 
 # References
 
@@ -405,6 +407,8 @@
     var activeButton = url.substring(url.indexOf("#") + 1);
     if(activeButton == "showall") {
       OpenAllDivs();
+      // hide the footer message
+      document.getElementById("footer").style.display = "none";
     } else {
       OpenDiv(activeButton);
     }

Modified: pkg/CHNOSZ/vignettes/equilibrium.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/equilibrium.Rmd	2020-07-10 02:17:08 UTC (rev 554)
+++ pkg/CHNOSZ/vignettes/equilibrium.Rmd	2020-07-11 08:14:53 UTC (rev 555)
@@ -70,7 +70,7 @@
 ```
 
 This vignette was compiled on `r Sys.Date()` with CHNOSZ version `r sessionInfo()$otherPkgs$CHNOSZ$Version`.
-This document defines the concepts, explains the organization of functions, and provides examples of equilibrium calculations in CHNOSZ.
+This document defines the concepts and provides examples of equilibrium calculations in CHNOSZ.
 
 First, some limitations.
 CHNOSZ is not a general-purpose speciation code.
@@ -502,4 +502,11 @@
        legend = as.expression(leg), y.intersp = 1.3)
 ```
 
+## Document history
+
+* 2009-11-29 Initial version with CSG example, titled "Calculating relative abundances of proteins"
+* 2012-09-30 Renamed to "Equilibrium in CHNOSZ"; remove activity comparisons and add maximum affinity method.
+* 2015-11-08 Move previous material to Appendix and add sections on concepts, organization, examples, and applications; use knitr vignette engine.
+* 2020-07-10 Simplify to concepts and examples (amino acids, proteins, normalization); convert document from LaTeX (Rnw) to Rmarkdown (Rmd).
+
 ## References

Modified: pkg/CHNOSZ/vignettes/mklinks.sh
===================================================================
--- pkg/CHNOSZ/vignettes/mklinks.sh	2020-07-10 02:17:08 UTC (rev 554)
+++ pkg/CHNOSZ/vignettes/mklinks.sh	2020-07-11 08:14:53 UTC (rev 555)
@@ -96,7 +96,7 @@
 sed -i '120,$s/browseURL()/<a href="..\/..\/utils\/html\/browseURL.html" style="background-image:none;">browseURL()<\/a>/g' anintro.html
 
 # add links to OBIGT.html
-sed -i 's/reset()/<a href="..\/html\/thermo.html"">reset()<\/a>/g' OBIGT.html
+sed -i 's/reset()/<a href="..\/html\/thermo.html">reset()<\/a>/g' OBIGT.html
 sed -i 's/OBIGT()/<a href="..\/html\/thermo.html">OBIGT()<\/a>/g' OBIGT.html
 sed -i 's/thermo()/<a href="..\/html\/thermo.html">thermo()<\/a>/g' OBIGT.html
 sed -i 's/add.OBIGT(/<a href="..\/html\/add.OBIGT.html">add.OBIGT<\/a>(/g' OBIGT.html



More information about the CHNOSZ-commits mailing list