From noreply at r-forge.r-project.org Mon Jan 7 07:10:07 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 7 Jan 2019 07:10:07 +0100 (CET) Subject: [CHNOSZ-commits] r352 - in pkg/CHNOSZ: . inst vignettes Message-ID: <20190107061007.AAE2D18BA6C@r-forge.r-project.org> Author: jedick Date: 2019-01-07 07:10:01 +0100 (Mon, 07 Jan 2019) New Revision: 352 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/vignettes/anintro.Rmd Log: anintro.Rmd: add cuprite to mosaic diagram and note about balance = 1 Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2018-12-21 15:03:57 UTC (rev 351) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-07 06:10:01 UTC (rev 352) @@ -1,6 +1,6 @@ -Date: 2018-12-21 +Date: 2019-01-07 Package: CHNOSZ -Version: 1.1.3-59 +Version: 1.1.3-60 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2018-12-21 15:03:57 UTC (rev 351) +++ pkg/CHNOSZ/inst/NEWS 2019-01-07 06:10:01 UTC (rev 352) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 1.1.3-59 (2018-12-21) +CHANGES IN CHNOSZ 1.1.3-60 (2019-01-07) --------------------------------------- NEW FEATURES @@ -126,6 +126,11 @@ coordinates of lines (field boundaries) on 2-D diagrams (these are taken from the output of contourLines()). +DOCUMENTATION + +- anintro.Rmd: add cuprite to mosaic diagram example, and note about + implications of changing balance to 1. + BUG FIXES - Fix a bug where subcrt()$reaction$coeffs was incorrect for reactions Modified: pkg/CHNOSZ/vignettes/anintro.Rmd =================================================================== --- pkg/CHNOSZ/vignettes/anintro.Rmd 2018-12-21 15:03:57 UTC (rev 351) +++ pkg/CHNOSZ/vignettes/anintro.Rmd 2019-01-07 06:10:01 UTC (rev 352) @@ -61,16 +61,14 @@ ## use pngquant to optimize PNG images knit_hooks$set(pngquant = hook_pngquant) +pngquant <- "--speed=1 --quality=0-25" # pngquant isn't available on R-Forge ... -if (!nzchar(Sys.which("pngquant"))) { - pngquant <- NULL - # save space by using a lower resolution - dpi <- 50 -} else { - pngquant <- "--speed=1 --quality=0-25" - dpi <- 50 -} +if (!nzchar(Sys.which("pngquant"))) pngquant <- NULL +## use a low resolution to save space in the package +# change this to 72 to make higher-resolution images for the CHNOSZ web page +dpi <- 50 + ## http://stackoverflow.com/questions/23852753/knitr-with-gridsvg ## Set up a chunk hook for manually saved plots. knit_hooks$set(custom.plot = hook_plot_custom) @@ -661,7 +659,7 @@ These diagrams are made by constructing individual diagrams for the possible basis species. The individual diagrams are then combined, each one contributing to the final diagram only in the range of stability of the corresponding basis species. -Let's use `mosaic()` to make a diagram for aqueous species and minerals in the Cu-S-Cl-`r h2o` system, similar to Figure 5a of @CPCC17. +Let's use `mosaic()` to make a diagram for aqueous species and minerals in the Cu-S-Cl-`r h2o` system. To know what aqueous copper chloride complexes are available in the database, we can use a fuzzy search: ```{r info_CuCl, results="hide"} info(" CuCl") @@ -677,12 +675,12 @@ Next we define the basis, and set the activities of the H2S and Cl- basis species. These represent the total activity of S and Cl in the system, which are distributed among the minerals and aqueous species. -Three minerals and the aqueous copper chloride species are included: +Four minerals and the aqueous copper chloride species are included: ```{r copper_setup, echo=TRUE, results="hide"} basis(c("Cu", "H2S", "Cl-", "H2O", "H+", "e-")) basis("H2S", -6) basis("Cl-", -0.7) -species(c("copper", "tenorite")) +species(c("copper", "cuprite", "tenorite")) species("chalcocite", "cr2") species(c("CuCl", "CuCl2-", "CuCl3-2", "CuCl+", "CuCl2", "CuCl3-", "CuCl4-2")) ``` @@ -708,6 +706,13 @@ The smooth transitions between basis species cause the appearance of curved lines on the plot. Without that argument, the diagrams would be combined using the dominant basis species, and all of the line segments would be straight. +Note that this diagram is balanced on Cu, so that no Cu appears in reactions between any two other species (minerals or aqueous species). +If `diagram()` is run with `balance = 1`, then the reactions are written for one mole of the mineral formulas on each side of the reaction, with the possibility of Cu appearing as an additional species to conserve the elements. +This may be problematic, as Cu would be be present in some reactions in Eh-pH space where it is not a stable phase. +However, it is common in low-temperature aqueous geochemical calculations to "turn off" particular redox reactions that are not thought to attain equilibrium, so decoupling a species from equilibrium may be justified in some circumstances. +Therefore, while changing the balance constraints has important implications that should be carefully considered, it can present a possibly useful view of the system if certain assumptions are met. +Changing the balance to 1 results in the loss of the tenorite stability field and extension of chalcocite stability to pH < 0, as shown in Figure 5a of @CPCC17. + We have seen the effects of speciation of S in the basis species. However, the choice of other basis species can also affect the diagram. From noreply at r-forge.r-project.org Tue Jan 8 05:44:06 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 8 Jan 2019 05:44:06 +0100 (CET) Subject: [CHNOSZ-commits] r353 - in pkg/CHNOSZ: . R inst Message-ID: <20190108044406.891BD18B9D2@r-forge.r-project.org> Author: jedick Date: 2019-01-08 05:44:05 +0100 (Tue, 08 Jan 2019) New Revision: 353 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/util.affinity.R pkg/CHNOSZ/R/util.plot.R pkg/CHNOSZ/R/util.units.R pkg/CHNOSZ/inst/NEWS Log: water.lines(): reduce message clutter Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-07 06:10:01 UTC (rev 352) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-08 04:44:05 UTC (rev 353) @@ -1,6 +1,6 @@ -Date: 2019-01-07 +Date: 2019-01-08 Package: CHNOSZ -Version: 1.1.3-60 +Version: 1.1.3-61 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/R/util.affinity.R =================================================================== --- pkg/CHNOSZ/R/util.affinity.R 2019-01-07 06:10:01 UTC (rev 352) +++ pkg/CHNOSZ/R/util.affinity.R 2019-01-08 04:44:05 UTC (rev 353) @@ -264,12 +264,12 @@ } # report non-variables to user if(!T.is.var) - message('energy.args: temperature is ',outvert(T,'K'),' ',T.units()) + message('affinity: temperature is ',outvert(T,'K'),' ',T.units()) if(!P.is.var) { - if(identical(P,"Psat")) message("energy.args: pressure is Psat") - else message('energy.args: pressure is ',outvert(P,'bar'),' ',P.units()) + if(identical(P,"Psat")) message("affinity: pressure is Psat") + else message('affinity: pressure is ',outvert(P,'bar'),' ',P.units()) } - if(!IS.is.var & !identical(IS,0)) message('energy.args: ionic strength is ',IS) + if(!IS.is.var & !identical(IS,0)) message('affinity: ionic strength is ',IS) # default values for resolution res <- 128 # where we store the output @@ -299,12 +299,12 @@ if(transect) args[[i]] <- -args[[i]] else args[[i]][1:2] <- -args[[i]][1:2] if(!'H+' %in% rownames(thermo$basis)) - message('energy.args: pH requested, but no H+ in the basis') + message('affinity: pH requested, but no H+ in the basis') } if(names(args)[i]=="pe") { names(args)[i] <- "e-" if(!'e-' %in% rownames(thermo$basis)) - message('energy.args: pe requested, but no e- in the basis') + message('affinity: pe requested, but no e- in the basis') if(transect) args[[i]] <- -args[[i]] else args[[i]][1:2] <- -args[[i]][1:2] } @@ -332,7 +332,7 @@ if(nametxt=="T") unittxt <- " K" if(nametxt=="P") unittxt <- " bar" if(nametxt=="Eh") unittxt <- " V" - message("energy.args: variable ", length(vars), " is ", nametxt, + message("affinity: variable ", length(vars), " is ", nametxt, " at ", n, " values from ", lims.orig[1], " to ", lims.orig[2], unittxt) } } Modified: pkg/CHNOSZ/R/util.plot.R =================================================================== --- pkg/CHNOSZ/R/util.plot.R 2019-01-07 06:10:01 UTC (rev 352) +++ pkg/CHNOSZ/R/util.plot.R 2019-01-08 04:44:05 UTC (rev 353) @@ -127,12 +127,12 @@ if('reduction' %in% which) { logfH2 <- logaH2O # usually 0 if(yaxis=="H2") { - logK <- subcrt(c("H2", "H2"), c(-1, 1), c("gas", H2state), T=T, P=P, convert=FALSE)$out$logK + logK <- suppressMessages(subcrt(c("H2", "H2"), c(-1, 1), c("gas", H2state), T=T, P=P, convert=FALSE))$out$logK # this is logfH2 if H2state=="gas", or logaH2 if H2state=="aq" logfH2 <- logfH2 + logK y.reduction <- rep(logfH2, length.out=length(xpoints)) } else { - logK <- subcrt(c("H2O", "O2", "H2"), c(-1, 0.5, 1), c("liq", O2state, "gas"), T=T, P=P, convert=FALSE)$out$logK + logK <- suppressMessages(subcrt(c("H2O", "O2", "H2"), c(-1, 0.5, 1), c("liq", O2state, "gas"), T=T, P=P, convert=FALSE))$out$logK # this is logfO2 if O2state=="gas", or logaO2 if O2state=="aq" logfO2 <- 2 * (logK - logfH2 + logaH2O) if(yaxis=="O2") y.reduction <- rep(logfO2, length.out=length(xpoints)) @@ -143,12 +143,12 @@ if('oxidation' %in% which) { logfO2 <- logaH2O # usually 0 if(yaxis=="H2") { - logK <- subcrt(c("H2O", "O2", "H2"), c(-1, 0.5, 1), c("liq", "gas", H2state), T=T, P=P, convert=FALSE)$out$logK + logK <- suppressMessages(subcrt(c("H2O", "O2", "H2"), c(-1, 0.5, 1), c("liq", "gas", H2state), T=T, P=P, convert=FALSE))$out$logK # this is logfH2 if H2state=="gas", or logaH2 if H2state=="aq" logfH2 <- logK - 0.5*logfO2 + logaH2O y.oxidation <- rep(logfH2, length.out=length(xpoints)) } else { - logK <- subcrt(c("O2", "O2"), c(-1, 1), c("gas", O2state), T=T, P=P, convert=FALSE)$out$logK + logK <- suppressMessages(subcrt(c("O2", "O2"), c(-1, 1), c("gas", O2state), T=T, P=P, convert=FALSE))$out$logK # this is logfO2 if O2state=="gas", or logaO2 if O2state=="aq" logfO2 <- logfO2 + logK if(yaxis=="O2") y.oxidation <- rep(logfO2, length.out=length(xpoints)) Modified: pkg/CHNOSZ/R/util.units.R =================================================================== --- pkg/CHNOSZ/R/util.units.R 2019-01-07 06:10:01 UTC (rev 352) +++ pkg/CHNOSZ/R/util.units.R 2019-01-08 04:44:05 UTC (rev 353) @@ -86,7 +86,7 @@ } else if(units %in% c('e0','logfo2')) { # convert between Eh and logfO2 - supcrt.out <- subcrt(c("H2O", "oxygen", "H+", "e-"), c(-1, 0.5, 2, 2), T=T, P=P, convert=FALSE) + supcrt.out <- suppressMessages(subcrt(c("H2O", "oxygen", "H+", "e-"), c(-1, 0.5, 2, 2), T=T, P=P, convert=FALSE)) if(units=='logfo2') value <- 2*(supcrt.out$out$logK + logaH2O + 2*pH + 2*(convert(value,'pe',T=T))) if(units=='e0') value <- convert(( -supcrt.out$out$logK - 2*pH + value/2 - logaH2O )/2, 'Eh',T=T) } Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2019-01-07 06:10:01 UTC (rev 352) +++ pkg/CHNOSZ/inst/NEWS 2019-01-08 04:44:05 UTC (rev 353) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 1.1.3-60 (2019-01-07) +CHANGES IN CHNOSZ 1.1.3-61 (2019-01-08) --------------------------------------- NEW FEATURES @@ -186,6 +186,8 @@ - The arguments in expr.species() have been reorganized for more flexible and concise usage. +- Reduce message clutter for diagrams showing water stability limits. + CHANGES IN CHNOSZ 1.1.3 (2017-11-13) ------------------------------------ From noreply at r-forge.r-project.org Tue Jan 15 05:03:20 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 15 Jan 2019 05:03:20 +0100 (CET) Subject: [CHNOSZ-commits] r354 - in pkg/CHNOSZ: . data inst inst/extdata/OBIGT vignettes Message-ID: <20190115040320.462E618B1C0@r-forge.r-project.org> Author: jedick Date: 2019-01-15 05:03:19 +0100 (Tue, 15 Jan 2019) New Revision: 354 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/data/refs.csv pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_cr.csv.xz pkg/CHNOSZ/vignettes/obigt.bib Log: update GHS for celestite Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-08 04:44:05 UTC (rev 353) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-15 04:03:19 UTC (rev 354) @@ -1,6 +1,6 @@ -Date: 2019-01-08 +Date: 2019-01-15 Package: CHNOSZ -Version: 1.1.3-61 +Version: 1.1.3-62 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/data/refs.csv =================================================================== --- pkg/CHNOSZ/data/refs.csv 2019-01-08 04:44:05 UTC (rev 353) +++ pkg/CHNOSZ/data/refs.csv 2019-01-15 04:03:19 UTC (rev 354) @@ -8,6 +8,7 @@ FSR76,"M. J. Ferrante et al.",1976,"U. S. Bureau of Mines Report of Investigations 8129","dawsonite Cp (value at 25 °C as listed by @BPAH07; not present in spronsbl.dat)",http://www.worldcat.org/oclc/932914138 HDNB78,"H. C. Helgeson, J. M. Delany et al.",1978,"Am. J. Sci. 278A, 1-229","data for minerals and phase transitions",http://www.worldcat.org/oclc/13594862 HDNB78.1,"H. C. Helgeson, J. M. Delany et al.",1978,"Am. J. Sci. 278A, 1-229","litharge S, V, and Cp parameters",http://www.worldcat.org/oclc/13594862 +HDNB78.2,"H. C. Helgeson, J. M. Delany et al.",1978,"Am. J. Sci. 278A, 1-229","celestite V and Cp parameters",http://www.worldcat.org/oclc/13594862 RHF78,"R. A. Robie, B. S. Hemingway and J. R. Fisher",1978,"U. S. Geological Survey Bull. 1452","chlorargyrite",http://pubs.er.usgs.gov/publication/b1452 RHF78.1,"R. A. Robie, B. S. Hemingway and J. R. Fisher",1978,"U. S. Geological Survey Bull. 1452","dickite, fluorphlogopite, halloysite, and pyrope",http://pubs.er.usgs.gov/publication/b1452 RHF78.2,"R. A. Robie, B. S. Hemingway and J. R. Fisher",1978,"U. S. Geological Survey Bull. 1452",iron,http://pubs.er.usgs.gov/publication/b1452 @@ -20,6 +21,7 @@ BH83,"T. S. Bowers and H. C. Helgeson",1983,"Geochim. Cosmochim. Acta 47, 1247-1275",rutile,https://doi.org/10.1016/0016-7037(83)90066-2 Hel85,"H. C. Helgeson",1985,"Am. J. Sci. 285, 845-855","ferrosilite and siderite",https://doi.org/10.2475/ajs.285.9.845 JH85,"K. J. Jackson and H. C. Helgeson",1985,"Econ. Geol. 80, 1365-1378","Sn minerals",https://doi.org/10.2113/gsecongeo.80.5.1365 +RA87,"E. J. Reardon and D. K. Armstrong",1987,"Geochim. Cosmochim. Acta 51, 63-72","celestite GHS",https://doi.org/10.1016/0016-7037(87)90007-X Ber88,"R. G. Berman",1988,"J. Petrol. 29, 445-522",minerals,https://doi.org/10.1093/petrology/29.2.445 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 Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2019-01-08 04:44:05 UTC (rev 353) +++ pkg/CHNOSZ/inst/NEWS 2019-01-15 04:03:19 UTC (rev 354) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 1.1.3-61 (2019-01-08) +CHANGES IN CHNOSZ 1.1.3-62 (2019-01-15) --------------------------------------- NEW FEATURES @@ -92,6 +92,9 @@ H-succinate and succinate-2 for the -1 and -2 charged ions. Remove duplicated entries for H-succinate and succinate-2 from biotic_aq.csv. +- Update G, H, and S of celestite using properties of the dissolution + reaction given by Reardon and Armstrong, 1987. + DIAGRAMS - Lines in 1-D diagram()s can optionally be drawn as splines using the Modified: pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_cr.csv.xz =================================================================== --- pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_cr.csv.xz 2019-01-08 04:44:05 UTC (rev 353) +++ pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_cr.csv.xz 2019-01-15 04:03:19 UTC (rev 354) @@ -1,34 +1,36 @@ -?7zXZ???F!t/???.?)]7I??b???9??????TB;q?"?q???cL;?"????Q???7?.42&l{?3???a???Z?r??Xe?(?4?k?].'Y&\?CrZ???Wn???^? ?? ??Q?q??n?? %i??F??.??%.?? l??4?4 -7a,???;8S??)??2??:V?)s?u??x;???@????xk???w??#/?n{b[?\|"?5zU\*??v?x??%????us??P??4??a}?]???m???{? -?9??sp?,/??nF??>v??????za?d???0?).?A\?b??_???????}g?n??\?3?l???z?)??)?f? -?G{??I=?%???8\t?X\?????"???-s???k4Jx??2.?M??(??_??XX?? -?X'5??h?y????b,-???d??/VT????E?_x???j?QjvT?6?C"_????A???{m??#?/j?3??5?k -?#?sD?-?0? ?k???2cP??o}V??Q}?? Z???? ???'Tc??F?St?' ??u^????l"?I???I@??#????K?Oy??,?9????????S??(e!?`?S?????????C??-F?nzy?!?qB?8??u?????v~?k??T???'??????3?w?????kD/?Q?`a9??}1W????%???C/????e?I&?O?`?P-??,??X?+?"???YJ?*O??b?w??Wy?{?? -?0?A ??J???3? ??0D??6??(&??y??? F ?b??ej??<]:???? -?{??z_^????~Z???;Hi.??s0 } -?i??N?w?m??VE*?=??~N??_?Y?W?????????Xe???T0?'??e??+??.??3?D??x?u8?4?]?A -~?8?*?.?Z?y?/? B???v?0?????y???U?? ?df?C?3 ??7??/???I??|?g;?????b???N}p$5?? -z??8m?-Y?0??????%???7??/? -+1?]9? ?"z?d??]??A?? W?8?ti9Os?H_?????:?cf]??? ??Zx??Xc?%??]????\?'?kp??3?(-??.?D6m??F???b?? ???Z???(g?Q??2???? -o?Y`?? n?? x?{????Y?????G????n]???????Y?Z?,u???{a?>?@?f ???g]??_?o?|????rY??zkM@? -A?7\>2;?|?B\Ou?K?o???? -???{.??B??????c??@?a?V??@K? -? @???aQ??&???U?5???eZa?a?0"d@???s??a??v???r???CnC?Ge??3????r??:sNF????J_??q???? ???$Yr??c]?'??????T?d=y????????g8AHb???????(X8??*Y?GW??]?2?g?C??5??E?Z?(???@??N -??~?V2? -?`??????????d+?xom??W?B?????#0 (?(??G????????\???Q,??B?????K?l???A?~,?n?????6K????t??!?K??r??F>?l???"]?N?7}4?CQ??????8l)?!}?$ ??l??("$%?u??~??a????W???? -??j?m? -???? -???)V~iU??_?]K?{l?HC1????B??v?3?)????xO@),??! -?F??3)f?????a??R?(?4?k?].'Y&\?CrZ???Wn???^? ?? ??Q?q??n?? %i??/??x???r?S?*vo?3}?z?R?UTR9???y??*6??,???2?=?J?9?WH?R\??|M??L=~?vh%???f?dH?h23??/??{A?r"!?x}??n?8????? ?;??}?????VG <4cW?5?g? Q43?????;??Q7*?~??.??(e#|??Z?9???k?m?y'??|??????z??1J????4?_??_??U???}=??3+?3?????N?I?????n??\bRk???????%????????X ???? +T?7x;????? +???o??RGx?U?????N?@s|???/??{<9U?F-??:I,?p?H*I#?*??}yek?#??2ED|:??K???7??\??? +?Q?????????D?[G??z??R????d??y}4?0w?%?S??=???Yk9?0?T -?????uR???C?'x_r???j??k?,??k21?$\?[ [??o???E /??1x?j??~??????K???????{bzt?p?{2S??2C???u????Up?"<Bl +????Y??9????????+rb?;/?PC??O?!kj(0?\/?b??_ ???6uO6?Z&?Y?????k????B_A???l??YF??M]"????K{qAZ#??t,??????????8??*W =G;t?8?nQ??.I=??/?@???F?&i?!,?S??!$:Xg?" "qq?l?9_??. +aRA ??t???????Zb??)LUYZE??y?8?????n?o,Ow[??????3?"??;?}?`5k?q?cJ2??bZ?&?{YGY??c?+???\Ua;??c??? k??@h?h6??b????&?; 'M?6l2X`?Y y?L+7?U??;???/X??f?bpI0?????Ipy?HF???6,????? ????Yl?????PI???q? ??xs\i??? +???ab=??c?r?#0????{?a????9S????c4? +f?G?U??-=u?L??????kR?*KK???????0?????v??Y??+?i?? +?nm?$m|??????r7/{???? s??x~K18k??????C??6Xf?w?7?"???k]?? +~^X??D???NM?????????e?&?#???rdz???S?G'?^??`jm???S?)YJD??X|Z?c???(?k???j??#5??VmX?? ?|P?? ?6G?????0? ??.??em???}????S????~?%R?"a??5???&)?H????A???ZLf??TF??/??????+1???2n????U??-???FGyn?d&k?????[????[G?#&?K???=PYIc??w?[Q?*a}!?h?#e????gH?,0-?$??Id???\j????R??/pZa??||??r??a\??^?t????g?YZ \ No newline at end of file Modified: pkg/CHNOSZ/vignettes/obigt.bib =================================================================== --- pkg/CHNOSZ/vignettes/obigt.bib 2019-01-08 04:44:05 UTC (rev 353) +++ pkg/CHNOSZ/vignettes/obigt.bib 2019-01-15 04:03:19 UTC (rev 354) @@ -120,14 +120,14 @@ } @Article{DLH06, - author = {Dick, Jeffrey M. and LaRowe, Douglas E. and Helgeson, Harold C.}, - journal = {Biogeosciences}, - title = {{T}emperature, pressure, and electrochemical constraints on protein speciation: {G}roup additivity calculation of the standard molal thermodynamic properties of ionized unfolded proteins}, - year = {2006}, - volume = {3}, - number = {3}, - pages = {311--336}, - doi = {10.5194/bg-3-311-2006}, + author = {Dick, Jeffrey M. and LaRowe, Douglas E. and Helgeson, Harold C.}, + journal = {Biogeosciences}, + title = {{T}emperature, pressure, and electrochemical constraints on protein speciation: {G}roup additivity calculation of the standard molal thermodynamic properties of ionized unfolded proteins}, + year = {2006}, + volume = {3}, + number = {3}, + pages = {311--336}, + doi = {10.5194/bg-3-311-2006}, } @Book{HGK84, @@ -477,16 +477,16 @@ } @Article{RG11, - author = {Richard, Laurent and Gaona, Xavier}, - journal = {Geochimica et Cosmochimica Acta}, - title = {{T}hermodynamic properties of organic iodine compounds}, - year = {2011}, - volume = {75}, - number = {22}, - pages = {7304--7350}, - doi = {10.1016/j.gca.2011.07.030}, - sn = {0016-7037}, - z9 = {0}, + author = {Richard, Laurent and Gaona, Xavier}, + journal = {Geochimica et Cosmochimica Acta}, + title = {{T}hermodynamic properties of organic iodine compounds}, + year = {2011}, + volume = {75}, + number = {22}, + pages = {7304--7350}, + doi = {10.1016/j.gca.2011.07.030}, + sn = {0016-7037}, + z9 = {0}, } @Article{RH98, @@ -506,6 +506,7 @@ title = {{T}hermodynamic {P}roperties of {M}inerals and {R}elated {S}ubstances at 298.15 {K} and 1 {B}ar ($10^5$ {P}ascals) {P}ressure and at {H}igher {T}emperatures}, year = {1995}, series = {Bulletin 2131}, + address = {Washington, D. C.}, pages = {461}, url = {https://pubs.er.usgs.gov/publication/b2131}, } @@ -599,15 +600,15 @@ } @Article{Sho95, - author = {Shock, Everett L.}, - journal = {American Journal of Science}, - title = {{O}rganic acids in hydrothermal solutions: {S}tandard molal thermodynamic properties of carboxylic acids and estimates of dissociation constants at high temperatures and pressures}, - year = {1995}, - volume = {295}, - number = {5}, - pages = {496--580}, - doi = {10.2475/ajs.295.5.496}, - size = {85 p.}, + author = {Shock, Everett L.}, + journal = {American Journal of Science}, + title = {{O}rganic acids in hydrothermal solutions: {S}tandard molal thermodynamic properties of carboxylic acids and estimates of dissociation constants at high temperatures and pressures}, + year = {1995}, + volume = {295}, + number = {5}, + pages = {496--580}, + doi = {10.2475/ajs.295.5.496}, + size = {85 p.}, } @Article{Sho09, @@ -1129,6 +1130,7 @@ editor = {Welch, Alan H. and Stollenwerk, Kenneth G.}, pages = {1--25}, address = {New York}, + doi = {10.1007/0-306-47956-7_1}, } @TechReport{BN91, @@ -1143,15 +1145,15 @@ } @Article{LMR06, - author = {Langmuir, Donald and Mahoney, John and Rowson, John}, - journal = {Geochimica et Cosmochimica Acta}, - title = {{S}olubility products of amorphous ferric arsenate and crystalline scorodite ({F}e{A}s{O}4??2{H}2{O}) and their application to arsenic behavior in buried mine tailings}, - year = {2006}, - volume = {70}, - number = {12}, - pages = {2942--2956}, - doi = {10.1016/j.gca.2006.03.006}, - issn = {0016-7037}, + author = {Langmuir, Donald and Mahoney, John and Rowson, John}, + journal = {Geochimica et Cosmochimica Acta}, + title = {{S}olubility products of amorphous ferric arsenate and crystalline scorodite ({F}e{A}s{O}$_4$??2{H}$_2${O}) and their application to arsenic behavior in buried mine tailings}, + year = {2006}, + volume = {70}, + number = {12}, + pages = {2942--2956}, + doi = {10.1016/j.gca.2006.03.006}, + issn = {0016-7037}, } @Article{ZZX+05, @@ -1225,3 +1227,15 @@ url = {http://www.ingentaconnect.com/content/10.1127/0935-1221/2010/0022-2021}, } + at Article{RA87, + author = {Reardon, E. J. and Armstrong, D. K.}, + journal = {Geochimica et Cosmochimica Acta}, + title = {{C}elestite ({S}r{SO}$_{4(s)}$) solubility in water, seawater and {N}a{C}l solution}, + year = {1987}, + volume = {51}, + number = {1}, + pages = {63--72}, + doi = {10.1016/0016-7037(87)90007-X}, + issn = {0016-7037}, +} + From noreply at r-forge.r-project.org Thu Jan 17 00:10:36 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 17 Jan 2019 00:10:36 +0100 (CET) Subject: [CHNOSZ-commits] r355 - in pkg/CHNOSZ: . R inst tests/testthat Message-ID: <20190116231036.1EA221851FE@r-forge.r-project.org> Author: jedick Date: 2019-01-17 00:10:35 +0100 (Thu, 17 Jan 2019) New Revision: 355 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/subcrt.R pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/tests/testthat/test-subcrt.R Log: subcrt(): improve error message for invalid property names Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-15 04:03:19 UTC (rev 354) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-16 23:10:35 UTC (rev 355) @@ -1,6 +1,6 @@ Date: 2019-01-15 Package: CHNOSZ -Version: 1.1.3-62 +Version: 1.1.3-63 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry 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 2019-01-15 04:03:19 UTC (rev 354) +++ pkg/CHNOSZ/R/subcrt.R 2019-01-16 23:10:35 UTC (rev 355) @@ -51,8 +51,8 @@ # property checking calcprop <- property notprop <- property[!calcprop %in% properties] - if(length(notprop) > 0) stop(paste(notprop, - "are not valid properties\ntry rho, logK, G, H, S, V, Cp, kT, or E")) + if(length(notprop) == 1) stop(paste("invalid property name:", paste(notprop, collapse=" "))) + if(length(notprop) > 1) stop(paste("invalid property names:", paste(notprop, collapse=" "))) # length checking if(do.reaction & length(species)!=length(coeff)) stop('coeff must be same length as the number of species.') Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2019-01-15 04:03:19 UTC (rev 354) +++ pkg/CHNOSZ/inst/NEWS 2019-01-16 23:10:35 UTC (rev 355) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 1.1.3-62 (2019-01-15) +CHANGES IN CHNOSZ 1.1.3-63 (2019-01-17) --------------------------------------- NEW FEATURES @@ -191,6 +191,8 @@ - Reduce message clutter for diagrams showing water stability limits. +- In subcrt(), improve error message for invalid property names. + CHANGES IN CHNOSZ 1.1.3 (2017-11-13) ------------------------------------ Modified: pkg/CHNOSZ/tests/testthat/test-subcrt.R =================================================================== --- pkg/CHNOSZ/tests/testthat/test-subcrt.R 2019-01-15 04:03:19 UTC (rev 354) +++ pkg/CHNOSZ/tests/testthat/test-subcrt.R 2019-01-16 23:10:35 UTC (rev 355) @@ -203,6 +203,12 @@ c("T", "P", "rho", "logK", "G", "H", "S", "V", "Cp", "polymorph"))) }) +test_that("argument checking handles some types of invalid input", { + expect_error(subcrt("H2O", -1, "liq", "xxx"), "invalid property name: xxx") + # before version 1.1.3-63, having more than one invalid property gave a mangled error message + expect_error(subcrt("H2O", -1, "liq", c(1, 2)), "invalid property names: 1 2") +}) + # references # Amend, J. P. and Shock, E. L. (2001) From noreply at r-forge.r-project.org Thu Jan 17 08:32:58 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 17 Jan 2019 08:32:58 +0100 (CET) Subject: [CHNOSZ-commits] r356 - in pkg/CHNOSZ: . R inst man tests/testthat Message-ID: <20190117073258.AA235187F87@r-forge.r-project.org> Author: jedick Date: 2019-01-17 08:32:56 +0100 (Thu, 17 Jan 2019) New Revision: 356 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/affinity.R pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/man/affinity.Rd pkg/CHNOSZ/tests/testthat/test-affinity.R Log: affinity(): implement argument recall Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-16 23:10:35 UTC (rev 355) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-17 07:32:56 UTC (rev 356) @@ -1,6 +1,6 @@ -Date: 2019-01-15 +Date: 2019-01-17 Package: CHNOSZ -Version: 1.1.3-63 +Version: 1.1.3-64 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/R/affinity.R =================================================================== --- pkg/CHNOSZ/R/affinity.R 2019-01-16 23:10:35 UTC (rev 355) +++ pkg/CHNOSZ/R/affinity.R 2019-01-17 07:32:56 UTC (rev 356) @@ -28,8 +28,27 @@ # this is where energy.args() used to sit # this is where energy() used to sit + # argument recall 20190117 + # if the first argument is the result from a previous affinity() calculation, + # just update the remaining arguments + args.orig <- list(...) + # we can only do anything with at least one argument + if(length(args.orig) > 0) { + if(identical(args.orig[[1]][1], list(fun="affinity"))) { + aargs <- args.orig[[1]]$args + # we can only update arguments given after the first argument + if(length(args.orig) > 1) { + for(i in 2:length(args.orig)) { + if(names(args.orig)[i] %in% names(aargs)) aargs[[names(args.orig)[i]]] <- args.orig[[i]] + else aargs <- c(aargs, args.orig[i]) + } + } + return(do.call(affinity, aargs)) + } + } + # the argument list - args <- energy.args(list(...)) + args <- energy.args(args.orig) args <- c(args, list(sout=sout, exceed.Ttr=exceed.Ttr, exceed.rhomin=exceed.rhomin)) # the species we're given @@ -219,7 +238,6 @@ vals[[iP]] <- outvert(vals[[iP]], "bar") } # get Eh - args.orig <- list(...) iEh <- match("Eh", names(args.orig)) if(!is.na(iEh)) { vars[[iEh]] <- "Eh" @@ -247,11 +265,16 @@ # content of return value depends on buffer request if(return.buffer) return(c(tb, list(vars=vars, vals=vals))) + # for argument recall, include all arguments (except sout) in output 20190117 + allargs <- c(args.orig, list(property=property, exceed.Ttr=exceed.Ttr, exceed.rhomin=exceed.rhomin, + return.buffer=return.buffer, balance=balance, iprotein=iprotein, loga.protein=loga.protein)) # add IS value only if it given as an argument 20171101 # (even if its value is 0, the presence of IS will trigger diagram() to use "m" instead of "a" in axis labels) iIS <- match("IS", names(args.orig)) - if(!is.na(iIS)) a <- list(sout=sout, property=property, basis=mybasis, species=myspecies, T=T, P=P, IS=args$IS, vars=vars, vals=vals, values=a) - else a <- list(sout=sout, property=property, basis=mybasis, species=myspecies, T=T, P=P, vars=vars, vals=vals, values=a) + if(!is.na(iIS)) a <- list(fun="affinity", args=allargs, sout=sout, property=property, + basis=mybasis, species=myspecies, T=T, P=P, IS=args$IS, vars=vars, vals=vals, values=a) + else a <- list(fun="affinity", args=allargs, sout=sout, property=property, + basis=mybasis, species=myspecies, T=T, P=P, vars=vars, vals=vals, values=a) if(buffer) a <- c(a, list(buffer=tb)) return(a) } Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2019-01-16 23:10:35 UTC (rev 355) +++ pkg/CHNOSZ/inst/NEWS 2019-01-17 07:32:56 UTC (rev 356) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 1.1.3-63 (2019-01-17) +CHANGES IN CHNOSZ 1.1.3-64 (2019-01-17) --------------------------------------- NEW FEATURES @@ -43,6 +43,9 @@ - Add demo/bison.R (average oxidation state of carbon of metagenome- derived proteins in different microbial phyla at Bison Pool) +- affinity(): implement argument recall, to re-run a calculation with + the same settings except for particular additions or modifications. + THERMODYNAMIC DATA - The Berman data (Berman, 1988 and later additions) have replaced the Modified: pkg/CHNOSZ/man/affinity.Rd =================================================================== --- pkg/CHNOSZ/man/affinity.Rd 2019-01-16 23:10:35 UTC (rev 355) +++ pkg/CHNOSZ/man/affinity.Rd 2019-01-17 07:32:56 UTC (rev 356) @@ -12,7 +12,7 @@ } \arguments{ - \item{...}{numeric, zero or more named arguments, used to identify the variables of interest in the calculations} + \item{...}{numeric, zero or more named arguments, used to identify the variables of interest in the calculations. For argument recall, pass the output from a previous calculation of \code{affinity} as an unnamed first argument.} \item{property}{character, the property to be calculated. Default is \samp{A}, for chemical affinity of formation reactions of species of interest} \item{sout}{list, output from \code{\link{subcrt}}} \item{exceed.Ttr}{logical, allow \code{\link{subcrt}} to compute properties for phases beyond their transition temperature?} @@ -54,10 +54,13 @@ The properties returned are those of the formation reactions of the species of interest from the basis species. It is also possible to calculate the properties of the species of interest themselves (not their formation reactions) by setting the \code{property} to \samp{G.species}, \samp{Cp.species}, etc. Except for \samp{A}, the properties of proteins or their reactions calculated in this manner are restricted to nonionized proteins. + +Argument recall is invoked by passing a previous result of \code{affinity} as the first argument. +The function then calls itself using the settings from the previous calculation, with additions or modifications indicated by the remaining arguments in the current function call. } \value{ -A list, elements of which are \code{sout} output from \code{\link{subcrt}}, \code{property} name of the calculated property (\samp{A} for chemical affinity), \code{basis} and \code{species} definition of basis species and species of interest in effect at runtime, \code{T} and \code{P} temperature and pressure, in the system units of Kelvin and bar, set to \code{numeric()} (length=0) if either one is a variable, \code{vars} the names of the variables, \code{vals} the values of the variables (a list, one element for each variable), \code{values} the result of the calculation (a list, one element for each species, with names taken from the species index in \code{\link{thermo}$obigt}). +A list, elements of which are \code{fun} the name of the function (\samp{affinity}), \code{args} all of the arguments except for \samp{sout} (these are used for argument recall), \code{sout} output from \code{\link{subcrt}}, \code{property} name of the calculated property (\samp{A} for chemical affinity), \code{basis} and \code{species} definition of basis species and species of interest in effect at runtime, \code{T} and \code{P} temperature and pressure, in the system units of Kelvin and bar, set to \code{numeric()} (length=0) if either one is a variable, \code{vars} the names of the variables, \code{vals} the values of the variables (a list, one element for each variable), \code{values} the result of the calculation (a list, one element for each species, with names taken from the species index in \code{\link{thermo}$obigt}). The elements of the lists in \code{vals} and \code{values} are arrays of \eqn{n}{n} dimensions, where \eqn{n}{n} is the number of variables. The values of chemical affinity of formation reactions of the species are returned in dimensionless units (for use with decimal logarithms, i.e., \emph{A}/\eqn{2.303RT}). Modified: pkg/CHNOSZ/tests/testthat/test-affinity.R =================================================================== --- pkg/CHNOSZ/tests/testthat/test-affinity.R 2019-01-16 23:10:35 UTC (rev 355) +++ pkg/CHNOSZ/tests/testthat/test-affinity.R 2019-01-17 07:32:56 UTC (rev 356) @@ -165,3 +165,15 @@ expect_equal(unlist(lapply(a2$values, tail, 1)), unlist(a1$values)) nonideal(oldnon) }) + +test_that("argument recall is usable", { + basis("CHNOS") + species(c("CO2", "CH4")) + a0 <- affinity(O2=c(-80, -60)) + a1 <- affinity(O2=c(-80, -60), T=100) + a2 <- affinity(a0, T=100) + a3 <- affinity(a1, T=25) + expect_identical(a1, a2) + # we don't test entire output here becuase a0 doesn't have a "T" argument + expect_identical(a0$values, a3$values) +}) From noreply at r-forge.r-project.org Thu Jan 17 16:40:18 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 17 Jan 2019 16:40:18 +0100 (CET) Subject: [CHNOSZ-commits] r357 - in pkg/CHNOSZ: . R demo inst man tests/testthat Message-ID: <20190117154018.25DE318BC14@r-forge.r-project.org> Author: jedick Date: 2019-01-17 16:40:17 +0100 (Thu, 17 Jan 2019) New Revision: 357 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/solubility.R pkg/CHNOSZ/demo/solubility.R pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/man/solubility.Rd pkg/CHNOSZ/tests/testthat/test-solubility.R Log: solubility(): detect dissolution reactions and preliminary implementation of find.IS Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-17 07:32:56 UTC (rev 356) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-17 15:40:17 UTC (rev 357) @@ -1,6 +1,6 @@ Date: 2019-01-17 Package: CHNOSZ -Version: 1.1.3-64 +Version: 1.1.3-65 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/R/solubility.R =================================================================== --- pkg/CHNOSZ/R/solubility.R 2019-01-17 07:32:56 UTC (rev 356) +++ pkg/CHNOSZ/R/solubility.R 2019-01-17 15:40:17 UTC (rev 357) @@ -1,51 +1,97 @@ # solubility.R: vectorized solubility calculations without uniroot # 20181031 jmd # 20181106 work on the output from affinity(); no "equilibrate()" needed! +# 20190117 add find.IS and test for dissociation reaction ## if this file is interactively sourced, the following are also needed to provide unexported functions: #source("equilibrate.R") #source("util.misc.R") -solubility <- function(aout, balance=NULL, split=FALSE) { +solubility <- function(aout, dissociation=NULL, find.IS=FALSE) { ## concept: the logarithms of activities of species at equilibrium are equal to ## Astar, the affinities calculated for unit activities of species - - ## however, the values in aout can be calculated for other than - ## unit activities of species, so we have to take away the activites - Astar <- function(i) aout$values[[i]] + aout$species$logact[i] - loga.equil <- lapply(1:length(aout$values), Astar) - ## for a dissociation (split) on a *per reaction* (not system) basis, - ## apply the divisor here and skip the if(split){} part below - ## (can be used to reproduce Fig. 4 of Manning et al., 2013) - if(is.numeric(split)) loga.equil <- lapply(loga.equil, "/", split) + ## does the system involve a dissociation reaction? + if(is.null(dissociation)) { + # assume FALSE unless determined otherwise + dissociation <- FALSE + # react the first basis species to form the first species + sres <- suppressMessages(subcrt(c(rownames(aout$basis)[1], aout$species$name[1]), c(-1, 1))) + # note that the reaction is auto-balanced using all the basis species + # if the reaction involves the second basis species, we consider it to be a dissociation reaction + if(rownames(aout$basis)[2] %in% sres$reaction$formula) { + # however, if the second basis species is H2O, H+, e-, O2 (or others?), we don't have enough information, so stop + if(rownames(aout$basis)[2] %in% c("H2O", "H+", "e-", "O2")) { + print(sres$reaction) + stop("unsure whether this is a dissociation reaction. if it is, redefine the basis to put a product ion second") + } + dissociation <- TRUE + } + message("solubility: test for dissociation reaction returns ", dissociation) + } else message("solubility: argument for dissociation reaction is ", dissociation) + # get starting ionic strength (probably zero, but could be anything set by user) + IS <- aout$IS + if(is.null(IS)) IS <- 0 + ## to output loga.balance we need the balancing coefficients - bout <- balance(aout, balance) + bout <- balance(aout) n.balance <- bout$n.balance balance <- bout$balance # get logarithm of total activity of the balancing basis species logabfun <- function(loga.equil, n.balance) { # exponentiate, multiply by n.balance, sum, logarithm a.equil <- mapply("^", 10, loga.equil, SIMPLIFY = FALSE) - a.balance <- mapply("*", a.equil, n.balance, SIMPLIFY=FALSE) + a.balance <- mapply("*", a.equil, n.balance, SIMPLIFY = FALSE) a.balance <- Reduce("+", a.balance) log10(a.balance) } - loga.balance <- logabfun(loga.equil, bout$n.balance) + + # for find.IS=TRUE, iterate to converge on ionic strength + niter <- 1 + while(TRUE) { + ## the values in aout can be calculated for other than + ## unit activities of species, so we have to take away the activites + Astar <- function(i) aout$values[[i]] + aout$species$logact[i] + loga.equil <- lapply(1:length(aout$values), Astar) - # recalculate things for a 1:1 split species (like CaCO3 = Ca+2 + CO3+2) - if(isTRUE(split)) { - # the multiplicity becomes the exponent in the reaction quotient - loga.split <- loga.balance / 2 - # the contribution to affinity - Asplit <- lapply(n.balance, "*", loga.split) - # adjust the affinity and get new equilibrium activities - aout$values <- mapply("-", aout$values, Asplit, SIMPLIFY=FALSE) - loga.equil <- lapply(1:length(aout$values), Astar) - # check that the new loga.balance == loga.split; this might not work for non-1:1 species - loga.balance <- logabfun(loga.equil, n.balance) - stopifnot(all.equal(loga.balance, loga.split)) + ## for a dissociation on a *per reaction* (not system) basis, + ## apply the divisor here and skip the if(dissociation){} part below + ## (can be used to reproduce Fig. 4 of Manning et al., 2013) + if(is.numeric(dissociation)) loga.equil <- lapply(loga.equil, "/", dissociation) + + loga.balance <- logabfun(loga.equil, bout$n.balance) + + # recalculate things for a dissociation reaction (like CaCO3 = Ca+2 + CO3+2) + if(isTRUE(dissociation)) { + # the multiplicity becomes the exponent in the reaction quotient + loga.split <- loga.balance / 2 + # the contribution to affinity + Asplit <- lapply(n.balance, "*", loga.split) + # adjust the affinity and get new equilibrium activities + aout$values <- mapply("-", aout$values, Asplit, SIMPLIFY=FALSE) + loga.equil <- lapply(1:length(aout$values), Astar) + # check that the new loga.balance == loga.split + # TODO: does this work for non-1:1 species? + loga.balance <- logabfun(loga.equil, n.balance) + stopifnot(all.equal(loga.balance, loga.split)) + } + + # get the old IS + IS.old <- rep(IS, length.out = length(aout$values[[1]])) + # calculate the ionic strength (assuming no ion pairing) + # i.e. for Sr+2 and SO4-2 + # TODO: determine the correct values for the actual species in the system + mol.cation <- mol.anion <- 10^loga.balance + Z <- 2 + IS <- (mol.cation * Z^2 + mol.anion * Z^2) / 2 + # report the current ionic strength + if(find.IS) message("solubility: (iteration ", niter, ") ionic strength range is ", paste(round(range(IS), 4), collapse=" ")) + # stop iterating if we reached the tolerance (or find.IS=FALSE) + if(!find.IS | all(IS - IS.old < 1e-4)) break + # recalculate the affinity using the new IS + aout <- suppressMessages(do.call(aout$fun, list(aout, IS = IS))) + niter <- niter + 1 } # make the output Modified: pkg/CHNOSZ/demo/solubility.R =================================================================== --- pkg/CHNOSZ/demo/solubility.R 2019-01-17 07:32:56 UTC (rev 356) +++ pkg/CHNOSZ/demo/solubility.R 2019-01-17 15:40:17 UTC (rev 357) @@ -51,7 +51,7 @@ basis(c("calcite", "Ca+2", "H2O", "O2", "H+")) species(c("CO2", "HCO3-", "CO3-2")) a <- affinity(pH = c(pH, res), T = T1, IS = IS) -s <- solubility(a, split = TRUE) +s <- solubility(a) diagram(s, ylim = c(-10, 4), type = "loga.balance", lwd = 4, col = "green2") diagram(s, add = TRUE, dy = 1) legend("topright", lty = c(1, 1:3), lwd = c(4, 2, 2, 2), @@ -64,6 +64,6 @@ # calcite T-pH plot a <- affinity(pH = c(pH, res), T = c(T, res), IS = IS) -s <- solubility(a, split = TRUE) +s <- solubility(a) diagram(s, type = "loga.balance") title(main = "Solubility of calcite", font.main = 1) Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2019-01-17 07:32:56 UTC (rev 356) +++ pkg/CHNOSZ/inst/NEWS 2019-01-17 15:40:17 UTC (rev 357) @@ -1,10 +1,14 @@ -CHANGES IN CHNOSZ 1.1.3-64 (2019-01-17) +CHANGES IN CHNOSZ 1.1.3-65 (2019-01-17) --------------------------------------- NEW FEATURES - Add solubility(). Run this after affinity() to calculate the - solubility of the conserved basis species. + solubility of a solid or gas defined as the conserved basis species, + which is involved in the formation of one or more dissolved species. + Features in development include automatic detection of dissociation + reactions and finding the final ionic strength for dissolution of a + mineral into pure water. - Revise demo/solubility.R to show solubility calculations for CO2(gas) and calcite as a function of T and pH. Modified: pkg/CHNOSZ/man/solubility.Rd =================================================================== --- pkg/CHNOSZ/man/solubility.Rd 2019-01-17 07:32:56 UTC (rev 356) +++ pkg/CHNOSZ/man/solubility.Rd 2019-01-17 15:40:17 UTC (rev 357) @@ -7,29 +7,48 @@ } \usage{ - solubility(aout, balance = NULL, split = FALSE) + solubility(aout, dissociation = NULL, find.IS = FALSE) } \arguments{ \item{aout}{list, output from \code{\link{affinity}}} - \item{balance}{character, basis species to conserve in reactions} - \item{split}{logical, does the mineral undergo a dissociation reaction?} + \item{dissociation}{logical, does the mineral undergo a dissociation reaction?} + \item{find.IS}{logical, find the equilibrium ionic strength by iteration?} } \details{ This function performs a simple task: from the values of \code{\link{affinity}} of formation reactions of species at given activity, it works backward to find the activities of species that make the affinities zero. This corresponds to complete equilibrium with all of the basis species. -For solubility calculations, the basis species should be set up so that formation reactions of species are balanced on the thing being dissolved (a mineral such as CaCO\s3 or gas such as CO\s2). -This is usually identified as the first basis species, but if there is any ambiguity, use \code{balance} to indicate the conserved basis species. +Usually, the basis species should be set up so that the first basis species represents the substance being dissolved (a mineral such as CaCO\s3 or gas such as CO\s2). +Internally, this is treated as the conserved basis species, so it must be present in all of the formation reactions of the species. +It is also possible to set the conserved basis species as other than the first one (see \code{demo(gold)}), but this implies that dissociation reactions are not occurring (see below). -\code{split} should be set when calculating the solubility of something that dissociates (not just dissolves). -For example, to calculate the solubility of calcite (CaCO\s3), each form of carbonate is represented by a different reaction, but all of these reactions also release calcium ions. -The equilibrium calculation must take account of the \emph{total} activity of the shared ion (Ca\S{+2}); naturally, that value was unknown for the calculation of \code{\link{affinity}}. -The solution is accomplished by setting \code{split} to TRUE to recalculate the affinities (working backward, as if the split didn't occur). -Then, the resulting activities correspond to equilibrium considering the system-wide activity of Ca\S{+2}. -A \emph{not recommended} alternative is to set \code{split} to a numeric value (probably 2) to calculate activities on a per-reaction basis, where each reaction has its own activity of Ca\S{+2}. -That does not give a complete equilibrium, but may be required to reproduce some published diagrams. +The \code{\link{species}} should be defined to represent one set of ions (anions or cations or their complexes) formed in solution, all involving the conserved basis species. +For a dissociation reaction, the second basis species should be used to represent the counterion (cation or anion). +The function perfoms some additional steps to calculate the solubility of something that dissociates (not just dissolves). +For example, the dissolution of calcite (CaCO\s3), involves the release of both calcium ions and different forms of carbonate in solution, depending on the pH. +The equilibrium calculation must take account of the \emph{total} activity of the shared ion (Ca\S{+2}), which is unknown at the start of the calculation. +The solution is accomplished by recalculating the affinities, essentially working backward from the assumption that the dissociation didn't occur. +The resulting activities correspond to equilibrium considering the system-wide activity of Ca\S{+2}. + +The function attempts to automatically detect whether dissociation reactions are involved by looking at the first species. +If the formation reaction of that species includes \emph{both} the first and second basis species, the \code{dissociation} flag is set to TRUE. +An example reaction of this type can be found in demo(solubility): CaCO3 (first basis species) = Ca+2 (second basis species) + CO3-2 (first species). +Note that if the conserved basis species is not the first basis species, then the automatic detection of \code{dissociation} will always return FALSE. +Therefore, a reaction corresponding to Au (fourth basis species) + ... = ... gives \code{dissociation} = FALSE (see \code{demo(gold)}). +This algorithm for determining whether dissociation occurs is prone to error, so \code{dissociation} can be explicitly set in the arguments. +A \emph{not recommended} alternative is to set \code{dissociation} to a numeric value corresponding to the stoichiometry of released species (i.e. 2 for a 1:1 electrolyte). +This setting indicates to calculate activities on a per-reaction basis, where each reaction has its own (independent) activity of Ca\S{+2}. +That does not give a complete equilibrium in the system, but may be required to reproduce some published diagrams. + +Note that other variables (pH, ionic strength, activities of other basis species) should be defined in the preceding call to \code{\link{affinity}}. +However, for dissolving a substance in pure water, \code{find.IS} can be set to TRUE to determine the final ionic strength. +This works by calculating the ionic strength from the equilibrium solubility calculation, then re-running \code{affinity} with those values. +Note that for dissociation reactions, the ionic strength is calculated from both the ions present in the species definition and the counter ion, which should be the second basis species. +TODO: Speciation of counterions (e.g. ionized forms of carbonate or sulfate) can be accomplished by using the \code{\link{mosaic}} function instead of \code{affinity}. +The calculation is iterated until the ionic strength deviation at every point is lower than a preset tolerance (1e-4). + The output of \code{solubility} has the same format as that of \code{equilibrate}, and can be used by \code{\link{diagram}} with \code{type = "loga.balance"} to plot the solubilities, or with \code{type = NULL} to plot the activities of species. } @@ -54,7 +73,7 @@ T <- 25 IS <- 0 -# start with CO2 +# start with CO2 (not a dissociation reaction) basis(c("carbon dioxide", "H2O", "O2", "H+")) # ca. atmospheric PCO2 basis("CO2", -3.5) @@ -74,11 +93,11 @@ list(what = expr.species("CO2"), T = T)), line = 1.5) mtext("cf. Fig. 4.5 of Stumm and Morgan, 1996") -# now do calcite +# now do calcite (a dissociation reaction) basis(c("calcite", "Ca+2", "H2O", "O2", "H+")) species(c("CO2", "HCO3-", "CO3-2")) a <- affinity(pH = c(pH, res), T = T, IS = IS) -s <- solubility(a, split = TRUE) +s <- solubility(a) diagram(s, ylim = c(-10, 4), type = "loga.balance", lwd = 4, col = "green2") diagram(s, add = TRUE, dy = 1) legend("topright", lty = c(1, 1:3), lwd = c(4, 2, 2, 2), Modified: pkg/CHNOSZ/tests/testthat/test-solubility.R =================================================================== --- pkg/CHNOSZ/tests/testthat/test-solubility.R 2019-01-17 07:32:56 UTC (rev 356) +++ pkg/CHNOSZ/tests/testthat/test-solubility.R 2019-01-17 15:40:17 UTC (rev 357) @@ -30,7 +30,7 @@ basis(c("calcite", "Ca+2", "H2O", "O2", "H+")) species(c("CO2", "HCO3-", "CO3-2")) a <- affinity(pH = c(pH, res), T = T, IS = IS) - s <- solubility(a, split = TRUE) + s <- solubility(a) # here we need to also set the activity of Ca+2 checkfun <- function(i) { logact <- sapply(s$loga.equil, "[", i) @@ -42,3 +42,11 @@ expect_equal(max(abs(unlist(checkfun(33)$values))), 0) expect_equal(max(abs(unlist(checkfun(99)$values))), 0) }) + +test_that("solubility() catches some error conditions", { + # demo(solubility) has basis(c("calcite", "Ca+2", "H2O", "O2", "H+")), but what if the user puts H2O second? + basis(c("calcite", "H2O", "Ca+2", "O2", "H+")) + species(c("CO2", "HCO3-", "CO3-2")) + a <- affinity() + expect_error(solubility(a), "unsure whether this is a dissociation reaction") +}) From noreply at r-forge.r-project.org Sun Jan 20 09:24:28 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 20 Jan 2019 09:24:28 +0100 (CET) Subject: [CHNOSZ-commits] r358 - in pkg/CHNOSZ: . R inst Message-ID: <20190120082429.22D3018B901@r-forge.r-project.org> Author: jedick Date: 2019-01-20 09:24:26 +0100 (Sun, 20 Jan 2019) New Revision: 358 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/solubility.R pkg/CHNOSZ/inst/NEWS Log: solubility(): calculate ionic strength for ions in basis and species Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-17 15:40:17 UTC (rev 357) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-20 08:24:26 UTC (rev 358) @@ -1,6 +1,6 @@ -Date: 2019-01-17 +Date: 2019-01-20 Package: CHNOSZ -Version: 1.1.3-65 +Version: 1.1.3-66 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/R/solubility.R =================================================================== --- pkg/CHNOSZ/R/solubility.R 2019-01-17 15:40:17 UTC (rev 357) +++ pkg/CHNOSZ/R/solubility.R 2019-01-20 08:24:26 UTC (rev 358) @@ -38,7 +38,7 @@ bout <- balance(aout) n.balance <- bout$n.balance balance <- bout$balance - # get logarithm of total activity of the balancing basis species + # get logarithm of total activity of the conserved basis species logabfun <- function(loga.equil, n.balance) { # exponentiate, multiply by n.balance, sum, logarithm a.equil <- mapply("^", 10, loga.equil, SIMPLIFY = FALSE) @@ -79,16 +79,36 @@ # get the old IS IS.old <- rep(IS, length.out = length(aout$values[[1]])) - # calculate the ionic strength (assuming no ion pairing) - # i.e. for Sr+2 and SO4-2 - # TODO: determine the correct values for the actual species in the system - mol.cation <- mol.anion <- 10^loga.balance - Z <- 2 - IS <- (mol.cation * Z^2 + mol.anion * Z^2) / 2 + # calculate the ionic strength for unpaired ions: IS = sum(molality * Z^2) / 2 + sum.mZ2 <- 0 + ion.names <- character() + # is there an ion in the basis species? + if(dissociation) { + basis.ion <- rownames(aout$basis)[2] + Z.basis.ion <- makeup(basis.ion)["Z"] + if(!is.na(Z.basis.ion)) { + sum.mZ2 <- sum.mZ2 + 10^loga.balance * Z.basis.ion^2 + ion.names <- c(ion.names, basis.ion) + } + } + # add ions present in the species of interest + for(i in 1:length(loga.equil)) { + species.ion <- aout$species$name[i] + Z.species.ion <- makeup(species.ion)["Z"] + if(!is.na(Z.species.ion)) { + sum.mZ2 <- sum.mZ2 + 10^loga.equil[[i]] * Z.species.ion^2 + ion.names <- c(ion.names, species.ion) + } + } + IS <- sum.mZ2 / 2 + # report ions used in the ionic strength calculation + if(find.IS & niter==1) message("solubility: ionic strength calculated for ", paste(ion.names, collapse=" ")) # report the current ionic strength if(find.IS) message("solubility: (iteration ", niter, ") ionic strength range is ", paste(round(range(IS), 4), collapse=" ")) # stop iterating if we reached the tolerance (or find.IS=FALSE) if(!find.IS | all(IS - IS.old < 1e-4)) break + # expand argument values for affinity() + for(i in 1:length(aout$vals)) aout$args[[i]] <- aout$vals[[i]] # recalculate the affinity using the new IS aout <- suppressMessages(do.call(aout$fun, list(aout, IS = IS))) niter <- niter + 1 Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2019-01-17 15:40:17 UTC (rev 357) +++ pkg/CHNOSZ/inst/NEWS 2019-01-20 08:24:26 UTC (rev 358) @@ -1,23 +1,24 @@ -CHANGES IN CHNOSZ 1.1.3-65 (2019-01-17) +CHANGES IN CHNOSZ 1.1.3-66 (2019-01-20) --------------------------------------- -NEW FEATURES +NEW FEATURE: SOLUBILITY CALCULATIONS - Add solubility(). Run this after affinity() to calculate the solubility of a solid or gas defined as the conserved basis species, which is involved in the formation of one or more dissolved species. - Features in development include automatic detection of dissociation - reactions and finding the final ionic strength for dissolution of a - mineral into pure water. +- Features include automatic detection of dissociation reactions and + finding the final ionic strength for dissolution of a mineral into + pure water (find.IS argument). + +- find.IS depends on the new argument recall feature of affinity(). + This allows a calculation to be re-run with the same settings except + for particular additions or modifications. + - Revise demo/solubility.R to show solubility calculations for CO2(gas) and calcite as a function of T and pH. -- Add demo/gold.R for calculations of Au solubility in hydrothermal - chloride and sulfide solutions (based on diagrams from Akinfiev and - Zotov, 2001, Stef?nsson and Seward, 2004, and Williams-Jones et al., - 2009). This depends on the revised nonideal() and new NaCl() functions - described next. +NEW FEATURE: EXPANDED ACTIVITY COEFFICIENT CALCULATIONS - Reorganize and expand options for activity coefficient calculations (set in thermo$opt$nonideal: Bdot, Bdot0, bgamma, bgamma0, or Alberty). @@ -41,17 +42,26 @@ of NaCl in water, taking account of activity coefficients and the reaction Na+ + Cl- = NaCl(aq). -- Add dumpdata() for returning/writing all packaged thermodynamic data - (including default database and optional data files). +DOCUMENTATION +- Add demo/gold.R for calculations of Au solubility in hydrothermal + chloride and sulfide solutions (based on diagrams from Akinfiev and + Zotov, 2001, Stef?nsson and Seward, 2004, and Williams-Jones et al., + 2009). This depends on the revised nonideal() and new NaCl() functions + described above. + +- anintro.Rmd: add cuprite to mosaic diagram example, and note about + implications of changing balance to 1. + - Add demo/bison.R (average oxidation state of carbon of metagenome- derived proteins in different microbial phyla at Bison Pool) -- affinity(): implement argument recall, to re-run a calculation with - the same settings except for particular additions or modifications. - THERMODYNAMIC DATA +- Add dumpdata() for returning/writing all packaged thermodynamic data + (including default database and optional data files). The file is + also available on the website (chnosz.net/download/alldata.csv). + - The Berman data (Berman, 1988 and later additions) have replaced the SUPCRT92 data (based on Helgeson et al., 1978) for most minerals in the default database (i.e. the one loaded by data(thermo)). Only @@ -136,11 +146,6 @@ coordinates of lines (field boundaries) on 2-D diagrams (these are taken from the output of contourLines()). -DOCUMENTATION - -- anintro.Rmd: add cuprite to mosaic diagram example, and note about - implications of changing balance to 1. - BUG FIXES - Fix a bug where subcrt()$reaction$coeffs was incorrect for reactions @@ -178,7 +183,7 @@ USABILITY ENHANCEMENTS -- To provide better diagnostics for potential web apps, warning +- To provide better diagnostics for other apps using CHNOSZ, warning messages produced by subcrt() are now available in the output of affinity(), under 'sout$warnings'. From noreply at r-forge.r-project.org Sun Jan 20 19:53:03 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 20 Jan 2019 19:53:03 +0100 (CET) Subject: [CHNOSZ-commits] r359 - in pkg/CHNOSZ: . R inst Message-ID: <20190120185303.35BEF18BCD2@r-forge.r-project.org> Author: jedick Date: 2019-01-20 19:53:02 +0100 (Sun, 20 Jan 2019) New Revision: 359 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/mosaic.R pkg/CHNOSZ/R/solubility.R pkg/CHNOSZ/inst/NEWS Log: mosaic(): implement argument recall Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-20 08:24:26 UTC (rev 358) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-20 18:53:02 UTC (rev 359) @@ -1,6 +1,6 @@ Date: 2019-01-20 Package: CHNOSZ -Version: 1.1.3-66 +Version: 1.1.3-67 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/R/mosaic.R =================================================================== --- pkg/CHNOSZ/R/mosaic.R 2019-01-20 08:24:26 UTC (rev 358) +++ pkg/CHNOSZ/R/mosaic.R 2019-01-20 18:53:02 UTC (rev 359) @@ -4,6 +4,25 @@ # function to calculate affinities with mosaic of basis species mosaic <- function(bases, bases2=NULL, blend=FALSE, ...) { + + # argument recall 20190120 + # if the first argument is the result from a previous mosaic() calculation, + # just update the remaining arguments + if(is.list(bases)) { + if(identical(bases[1], list(fun="mosaic"))) { + aargs <- bases$args + # we can only update arguments given in ... + ddd <- list(...) + if(length(ddd) > 0) { + for(i in 1:length(ddd)) { + if(names(ddd)[i] %in% names(aargs)) aargs[[names(ddd)[i]]] <- ddd[[i]] + else aargs <- c(aargs, ddd[i]) + } + } + return(do.call(mosaic, aargs)) + } + } + if(is.null(bases2)) { # the arguments for affinity() myargs <- list(...) @@ -13,11 +32,13 @@ # the arguments for mosaic() (second set of basis species; inner loop) myargs <- list(bases=bases2, blend=blend, ...) } + # are the swapped basis species on the plot? # (the first one should be present in the starting basis set) iswap <- match(bases[1], names(myargs)) # the log activity of the starting basis species logact.swap <- basis()$logact[ibasis(bases[1])] + # a list where we'll keep the affinity calculations affs <- list() for(i in seq_along(bases)) { @@ -46,6 +67,7 @@ basis(bformula, logact.swap) } } + # calculate affinities of formation of basis species message(paste("mosaic: combining diagrams for", paste(bases, collapse=" "), sep=" ")) ispecies <- species()$ispecies @@ -57,6 +79,7 @@ # restore original species with original activities species(delete=TRUE) species(ispecies, species.logact) + # affinities calculated using the first basis species A.species <- affs[[1]] if(blend) { @@ -88,7 +111,10 @@ } } } + + # for argument recall, include all arguments in output 20190120 + allargs <- c(list(bases=bases, bases2=bases2, blend=blend), list(...)) # return the affinities for the species and basis species - if(is.null(bases2)) return(list(A.species=A.species, A.bases=A.bases)) - else return(list(A.species=A.species, A.bases=A.bases, A.bases2=A.bases2)) + if(is.null(bases2)) return(list(fun="mosaic", args=allargs, A.species=A.species, A.bases=A.bases)) + else return(list(fun="mosaic", args=allargs, A.species=A.species, A.bases=A.bases, A.bases2=A.bases2)) } Modified: pkg/CHNOSZ/R/solubility.R =================================================================== --- pkg/CHNOSZ/R/solubility.R 2019-01-20 08:24:26 UTC (rev 358) +++ pkg/CHNOSZ/R/solubility.R 2019-01-20 18:53:02 UTC (rev 359) @@ -11,6 +11,11 @@ ## concept: the logarithms of activities of species at equilibrium are equal to ## Astar, the affinities calculated for unit activities of species + ## is aout the output from mosaic() instead of affinity()? + aout.save <- aout + thisfun <- aout$fun + if(thisfun=="mosaic") aout <- aout$A.species + ## does the system involve a dissociation reaction? if(is.null(dissociation)) { # assume FALSE unless determined otherwise @@ -107,10 +112,21 @@ if(find.IS) message("solubility: (iteration ", niter, ") ionic strength range is ", paste(round(range(IS), 4), collapse=" ")) # stop iterating if we reached the tolerance (or find.IS=FALSE) if(!find.IS | all(IS - IS.old < 1e-4)) break - # expand argument values for affinity() - for(i in 1:length(aout$vals)) aout$args[[i]] <- aout$vals[[i]] + # on the first iteration, expand argument values for affinity() or mosaic() + if(niter==1) { + if(thisfun=="affinity") for(i in 1:length(aout$vals)) { + aout.save$args[[i]] <- aout$vals[[i]] + } + else if(thisfun=="mosaic") { + for(i in 1:length(aout$vals)) { + argname <- names(aout$args)[i] + aout.save$args[[argname]] <- aout$vals[[i]] + } + } + } # recalculate the affinity using the new IS - aout <- suppressMessages(do.call(aout$fun, list(aout, IS = IS))) + aout <- suppressMessages(do.call(thisfun, list(aout.save, IS = IS))) + if(thisfun=="mosaic") aout <- aout$A.species niter <- niter + 1 } Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2019-01-20 08:24:26 UTC (rev 358) +++ pkg/CHNOSZ/inst/NEWS 2019-01-20 18:53:02 UTC (rev 359) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 1.1.3-66 (2019-01-20) +CHANGES IN CHNOSZ 1.1.3-67 (2019-01-20) --------------------------------------- NEW FEATURE: SOLUBILITY CALCULATIONS @@ -11,9 +11,10 @@ finding the final ionic strength for dissolution of a mineral into pure water (find.IS argument). -- find.IS depends on the new argument recall feature of affinity(). - This allows a calculation to be re-run with the same settings except - for particular additions or modifications. +- find.IS depends on the new argument recall feature of affinity() (or + mosaic() if that is used instead). This allows a calculation to be + re-run with the same settings except for particular additions or + modifications, in this case modified values of ionic strength. - Revise demo/solubility.R to show solubility calculations for CO2(gas) and calcite as a function of T and pH. From noreply at r-forge.r-project.org Mon Jan 21 04:48:18 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 21 Jan 2019 04:48:18 +0100 (CET) Subject: [CHNOSZ-commits] r360 - in pkg/CHNOSZ: . R inst man tests/testthat Message-ID: <20190121034818.B06DE18C190@r-forge.r-project.org> Author: jedick Date: 2019-01-21 04:48:17 +0100 (Mon, 21 Jan 2019) New Revision: 360 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/mosaic.R pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/man/solubility.Rd pkg/CHNOSZ/tests/testthat/test-mosaic.R Log: mosaic(): with blend=TRUE, include Gibbs energy of mixing Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-20 18:53:02 UTC (rev 359) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-21 03:48:17 UTC (rev 360) @@ -1,6 +1,6 @@ -Date: 2019-01-20 +Date: 2019-01-21 Package: CHNOSZ -Version: 1.1.3-67 +Version: 1.1.3-68 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/R/mosaic.R =================================================================== --- pkg/CHNOSZ/R/mosaic.R 2019-01-20 18:53:02 UTC (rev 359) +++ pkg/CHNOSZ/R/mosaic.R 2019-01-21 03:48:17 UTC (rev 360) @@ -93,8 +93,10 @@ for(i in seq_along(A.species$values)) { # start with zero affinity if(j==1) A.species$values[[i]][] <- 0 - # add affinity scaled by __relative__ abundance of this basis species - A.species$values[[i]] <- A.species$values[[i]] + affs[[j]]$values[[i]] * 10^e$loga.equil[[j]]/a.tot + # add affinity scaled by relative abundance of this basis species + # and include mixing term (-x*log10(x)) 20190121 + x <- 10^e$loga.equil[[j]]/a.tot + A.species$values[[i]] <- A.species$values[[i]] + affs[[j]]$values[[i]] * x - x * log10(x) } } } Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2019-01-20 18:53:02 UTC (rev 359) +++ pkg/CHNOSZ/inst/NEWS 2019-01-21 03:48:17 UTC (rev 360) @@ -1,6 +1,25 @@ -CHANGES IN CHNOSZ 1.1.3-67 (2019-01-20) +CHANGES IN CHNOSZ 1.1.3-68 (2019-01-21) --------------------------------------- +BUG FIXES + +- Fix a bug where subcrt()$reaction$coeffs was incorrect for reactions + involving minerals with phase transitions. Also ensure that the output + reaction stoichiometry is correct for duplicated species in reactions. + Thanks to Grayson Boyer for the bug report. + +- Fix bug in nonideal() where "Zn" in formula was identified as charge. + Thanks to Feng Lai for reporting the incorrect behavior caused by + this bug. + +- For species in the revised HKF model, subcrt() now sets properties to + NA where the density of H2O is less than 0.35 g/cm3, avoiding the + output of bogus values in this region. Thanks to Evgeniy Bastrakov. + +- In mosaic() with blend = TRUE, add a previously missing term for + Gibbs energy of mixing. An example using mosaic() to calculate the + pH-dependent solubility of calcite has been added to solubility.Rd. + NEW FEATURE: SOLUBILITY CALCULATIONS - Add solubility(). Run this after affinity() to calculate the @@ -147,21 +166,6 @@ coordinates of lines (field boundaries) on 2-D diagrams (these are taken from the output of contourLines()). -BUG FIXES - -- Fix a bug where subcrt()$reaction$coeffs was incorrect for reactions - involving minerals with phase transitions. Also ensure that the output - reaction stoichiometry is correct for duplicated species in reactions. - Thanks to Grayson Boyer for the bug report. - -- Fix bug in nonideal() where "Zn" in formula was identified as charge. - Thanks to Feng Lai for reporting the incorrect behavior caused by - this bug. - -- For species in the revised HKF model, subcrt() now sets properties to - NA where the density of H2O is less than 0.35 g/cm3, avoiding the - output of bogus values in this region. Thanks to Evgeniy Bastrakov. - COMPUTATIONAL OPTIONS - Add 'exceed.rhomin' argument to subcrt() and affinity() to enable Modified: pkg/CHNOSZ/man/solubility.Rd =================================================================== --- pkg/CHNOSZ/man/solubility.Rd 2019-01-20 18:53:02 UTC (rev 359) +++ pkg/CHNOSZ/man/solubility.Rd 2019-01-21 03:48:17 UTC (rev 360) @@ -64,16 +64,14 @@ } \examples{\dontshow{data(thermo)} -# solubility of CO2 and calcite as a function of pH +## solubility of CO2 and calcite as a function of pH opar <- par(mfrow = c(1, 2)) - -# set pH range and resolution, constant temperature and ionic strength +## set pH range and resolution, constant temperature and ionic strength pH <- c(0, 14) res <- 100 T <- 25 IS <- 0 - -# start with CO2 (not a dissociation reaction) +## start with CO2 (not a dissociation reaction) basis(c("carbon dioxide", "H2O", "O2", "H+")) # ca. atmospheric PCO2 basis("CO2", -3.5) @@ -92,8 +90,7 @@ title(main = substitute("Solubility of"~what~"at"~T~degree*"C", list(what = expr.species("CO2"), T = T)), line = 1.5) mtext("cf. Fig. 4.5 of Stumm and Morgan, 1996") - -# now do calcite (a dissociation reaction) +## now do calcite (a dissociation reaction) basis(c("calcite", "Ca+2", "H2O", "O2", "H+")) species(c("CO2", "HCO3-", "CO3-2")) a <- affinity(pH = c(pH, res), T = T, IS = IS) @@ -105,8 +102,38 @@ title(main = substitute("Solubility of"~what~"at"~T~degree*"C", list(what = "calcite", T = T))) mtext("cf. Fig. 4A of Manning et al., 2013") +par(opar) -par(opar) +## two ways to calculate pH-dependent solubility of calcite +## with ionic strength determination +## method 1: CO2 and carbonate species as formed species +basis(c("calcite", "Ca+2", "H2O", "O2", "H+")) +species(c("CO2", "HCO3-", "CO3-2")) +# ionic strength calculations don't converge below around pH=3 +a <- affinity(pH = c(3, 14)) +sa0 <- solubility(a) +saI <- solubility(a, find.IS = TRUE) +## method 2: CO2 and carbonate species as basis species +basis(c("calcite", "CO2", "H2O", "O2", "H+")) +species(c("Ca+2")) +m <- mosaic(c("CO2", "HCO3-", "CO3-2"), pH = c(3, 14), blend = TRUE) +sm0 <- solubility(m) +smI <- solubility(m, find.IS = TRUE) +## plot the results +plot(0, 0, xlab="pH", ylab="solubility, log mol", xlim = c(3, 14), ylim = c(-5, 2)) +# method 1 with/without ionic strength +lines(a$vals[[1]], saI$loga.balance, lwd=5, col="lightblue") +lines(a$vals[[1]], sa0$loga.balance, lwd=5, col="pink") +# method 2 with/without ionic strength +lines(a$vals[[1]], smI$loga.balance, lty=2) +lines(a$vals[[1]], sm0$loga.balance, lty=2) +legend("topright", c("I = 0", "I = calculated", "mosaic method"), + col = c("pink", "lightblue", "black"), lwd = c(5, 5, 1), lty = c(1, 1, 2)) +# the two methods give nearly equivalent results +stopifnot(all.equal(sa0$loga.balance, sm0$loga.balance)) +stopifnot(all.equal(saI$loga.balance, smI$loga.balance, tolerance = 0.003)) +## NOTE: the second method (using mosaic) takes longer, but is +## more flexible; complexes with Ca+2 could be included } \references{ Modified: pkg/CHNOSZ/tests/testthat/test-mosaic.R =================================================================== --- pkg/CHNOSZ/tests/testthat/test-mosaic.R 2019-01-20 18:53:02 UTC (rev 359) +++ pkg/CHNOSZ/tests/testthat/test-mosaic.R 2019-01-21 03:48:17 UTC (rev 360) @@ -36,10 +36,13 @@ pH <- c(0, 14, 29) m1 <- mosaic(bases, pH=pH) m2 <- mosaic(bases, pH=pH, blend=TRUE) - # these species have no S so the results should be the same - expect_equal(m1$A.species$values, m2$A.species$values) + # these species have no S so the results should be similar, + # 20190121 except for a negative free energy of mixing (positive affinity) + expect_true(all(m2$A.species$values[[1]] - m1$A.species$values[[1]] > 0)) + # the differences increase, then decrease + expect_equal(unique(sign(diff(as.numeric(m2$A.species$values[[1]] - m1$A.species$values[[1]])))), c(1, -1)) + # now with S-bearing species ... species(c("pyrrhotite", "pyrite")) - # now with S-bearing species ... m3 <- mosaic(bases, pH=pH) m4 <- mosaic(bases, pH=pH, blend=TRUE) # the results are different ... From noreply at r-forge.r-project.org Mon Jan 21 16:40:26 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 21 Jan 2019 16:40:26 +0100 (CET) Subject: [CHNOSZ-commits] r361 - in pkg/CHNOSZ: . R inst man tests/testthat Message-ID: <20190121154027.08B7C1888CD@r-forge.r-project.org> Author: jedick Date: 2019-01-21 16:40:26 +0100 (Mon, 21 Jan 2019) New Revision: 361 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/info.R pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/man/solubility.Rd pkg/CHNOSZ/tests/testthat/test-info.R Log: info(): messages display mineral names instead of "cr" Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-21 03:48:17 UTC (rev 360) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-21 15:40:26 UTC (rev 361) @@ -1,6 +1,6 @@ Date: 2019-01-21 Package: CHNOSZ -Version: 1.1.3-68 +Version: 1.1.3-69 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/R/info.R =================================================================== --- pkg/CHNOSZ/R/info.R 2019-01-21 03:48:17 UTC (rev 360) +++ pkg/CHNOSZ/R/info.R 2019-01-21 15:40:26 UTC (rev 361) @@ -136,6 +136,8 @@ mystate <- thermo$obigt$state[ispecies.out] ispecies.other <- ispecies[!ispecies %in% ispecies.out] otherstates <- thermo$obigt$state[ispecies.other] + # substitute the mineral name for "cr" 20190121 + otherstates[otherstates=="cr"] <- thermo$obigt$name[ispecies.other[otherstates=="cr"]] transtext <- othertext <- "" # we count, but don't show the states for phase transitions (cr2, cr3, etc) istrans <- otherstates %in% c("cr2", "cr3", "cr4", "cr5", "cr6", "cr7", "cr8", "cr9") @@ -144,9 +146,12 @@ ntrans <- sum(istrans) if(ntrans == 1) transtext <- paste(" with", ntrans, "phase transition") else if(ntrans > 1) transtext <- paste(" with", ntrans, "phase transitions") + # substitute the mineral name for "cr" 20190121 + mystate <- thermo$obigt$name[ispecies.out] } otherstates <- otherstates[!istrans] - if(length(otherstates) > 0) othertext <- paste0(", also available in ", paste(otherstates, collapse=", ")) + if(length(otherstates) == 1) othertext <- paste0("; other available phase is ", otherstates) + if(length(otherstates) > 1) othertext <- paste0("; other available phases are ", paste(otherstates, collapse=", ")) if(transtext != "" | othertext != "") { starttext <- paste0("info.character: found ", species, "(", mystate, ")") message(starttext, transtext, othertext) Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2019-01-21 03:48:17 UTC (rev 360) +++ pkg/CHNOSZ/inst/NEWS 2019-01-21 15:40:26 UTC (rev 361) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 1.1.3-68 (2019-01-21) +CHANGES IN CHNOSZ 1.1.3-69 (2019-01-21) --------------------------------------- BUG FIXES @@ -195,7 +195,8 @@ - Change internal variable names in subcrt() for better readability (sinfo -> ispecies, inpho -> iphases, sinph -> phasespecies). -- TODO: fix overly long message for info("SiO2"). +- info(): display mineral names instead of just "cr" in messages (e.g. + with info("SiO2")). - Add C implementation of counting occurrences of all letters in a string (src/count_letters.c) to speed up operation of count.aa(). Modified: pkg/CHNOSZ/man/solubility.Rd =================================================================== --- pkg/CHNOSZ/man/solubility.Rd 2019-01-21 03:48:17 UTC (rev 360) +++ pkg/CHNOSZ/man/solubility.Rd 2019-01-21 15:40:26 UTC (rev 361) @@ -129,11 +129,12 @@ lines(a$vals[[1]], sm0$loga.balance, lty=2) legend("topright", c("I = 0", "I = calculated", "mosaic method"), col = c("pink", "lightblue", "black"), lwd = c(5, 5, 1), lty = c(1, 1, 2)) +title(main = "Solubility of calcite: Ionic strength and mosaic method") # the two methods give nearly equivalent results stopifnot(all.equal(sa0$loga.balance, sm0$loga.balance)) stopifnot(all.equal(saI$loga.balance, smI$loga.balance, tolerance = 0.003)) ## NOTE: the second method (using mosaic) takes longer, but is -## more flexible; complexes with Ca+2 could be included +## more flexible; e.g. complexes with Ca+2 could be included } \references{ Modified: pkg/CHNOSZ/tests/testthat/test-info.R =================================================================== --- pkg/CHNOSZ/tests/testthat/test-info.R 2019-01-21 03:48:17 UTC (rev 360) +++ pkg/CHNOSZ/tests/testthat/test-info.R 2019-01-21 15:40:26 UTC (rev 361) @@ -4,7 +4,7 @@ expect_equal(info.character("acetate", "cr"), NA) expect_message(info.character("acetate", "cr"), "only 'aq' is available") expect_message(info.character("methane", "cr"), "only 'aq' 'liq' 'gas' are available") - expect_message(info.character("methane"), "also available in liq, gas") + expect_message(info.character("methane"), "other available phases are liq, gas") # H2O is a special case expect_equal(info.character("H2O", "aq"), info.character("H2O", "liq")) }) From noreply at r-forge.r-project.org Tue Jan 22 09:56:26 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 22 Jan 2019 09:56:26 +0100 (CET) Subject: [CHNOSZ-commits] r362 - in pkg/CHNOSZ: . demo Message-ID: <20190122085626.C5B0918C451@r-forge.r-project.org> Author: jedick Date: 2019-01-22 09:56:26 +0100 (Tue, 22 Jan 2019) New Revision: 362 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/demo/DEW.R pkg/CHNOSZ/demo/Shh.R pkg/CHNOSZ/demo/TCA.R pkg/CHNOSZ/demo/activity_ratios.R pkg/CHNOSZ/demo/adenine.R pkg/CHNOSZ/demo/bison.R pkg/CHNOSZ/demo/go-IU.R pkg/CHNOSZ/demo/gold.R pkg/CHNOSZ/demo/lambda.R pkg/CHNOSZ/demo/solubility.R pkg/CHNOSZ/demo/yeastgfp.R Log: demos: clean up par() settings Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-21 15:40:26 UTC (rev 361) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-22 08:56:26 UTC (rev 362) @@ -1,6 +1,6 @@ -Date: 2019-01-21 +Date: 2019-01-22 Package: CHNOSZ -Version: 1.1.3-69 +Version: 1.1.3-70 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/demo/DEW.R =================================================================== --- pkg/CHNOSZ/demo/DEW.R 2019-01-21 15:40:26 UTC (rev 361) +++ pkg/CHNOSZ/demo/DEW.R 2019-01-22 08:56:26 UTC (rev 362) @@ -1,7 +1,7 @@ # demo for the Deep Earth Water (DEW) model in CHNOSZ 20170927 # set up subplots -par(mfrow = c(2, 2), mar=c(3.0, 3.5, 2.5, 1.0), mgp=c(1.7, 0.3, 0), las=1, tcl=0.3, xaxs="i", yaxs="i") +opar <- par(mfrow = c(2, 2), mar=c(3.0, 3.5, 2.5, 1.0), mgp=c(1.7, 0.3, 0), las=1, tcl=0.3, xaxs="i", yaxs="i") # activate DEW model oldwat <- water("DEW") @@ -213,3 +213,5 @@ data(OBIGT) water(oldwat) ########### + +par(opar) Modified: pkg/CHNOSZ/demo/Shh.R =================================================================== --- pkg/CHNOSZ/demo/Shh.R 2019-01-21 15:40:26 UTC (rev 361) +++ pkg/CHNOSZ/demo/Shh.R 2019-01-22 08:56:26 UTC (rev 362) @@ -45,6 +45,7 @@ ylab <- expression(bold(A)/2.303*italic(RT)*" vs Shh") xlab <- expression(log*italic(a)[H[2]][O]) # set up normal plot, or plot with interpretive drawings +opar <- par(no.readonly = TRUE) if(interp) { if(pdf) pdf("tfactor_interp.pdf", width=6, height=6) plot.new() @@ -194,4 +195,5 @@ mtext(expression(log*italic(f)[O[2]]), line=2) } # all done! +par(opar) if(pdf) dev.off() Modified: pkg/CHNOSZ/demo/TCA.R =================================================================== --- pkg/CHNOSZ/demo/TCA.R 2019-01-21 15:40:26 UTC (rev 361) +++ pkg/CHNOSZ/demo/TCA.R 2019-01-22 08:56:26 UTC (rev 362) @@ -69,7 +69,7 @@ substitute(3*co2 + 4*nred + 2*hplus + atp + h2 * " ", sublist)) ) # set up plot -par(mfrow=c(3, 3)) +opar <- par(mfrow=c(3, 3)) ylims <- list( c(-10, 45), c(1, 6), c(-2.5, 7.5), c(-35, 5), c(-9, 5), c(5, 28), @@ -92,6 +92,7 @@ else mtitle(as.expression(rtitle[[i]]), line=0.4, cex=0.8) } # make an overall title -opar <- par(xpd=NA) +par(xpd=NA) text(-70, 284, "Citric Acid Cycle, after Canovas and Shock, 2016", font=2, cex=1.5) +par(xpd=FALSE) par(opar) Modified: pkg/CHNOSZ/demo/activity_ratios.R =================================================================== --- pkg/CHNOSZ/demo/activity_ratios.R 2019-01-21 15:40:26 UTC (rev 361) +++ pkg/CHNOSZ/demo/activity_ratios.R 2019-01-22 08:56:26 UTC (rev 362) @@ -2,7 +2,7 @@ ## These are made with pH = 0 (activity of H+ = 1), so (activity of the ion) is equal to ## (activity of the ion) / [(activity of H+) ^ (charge of the ion)] -par(mfrow = c(2, 2)) +opar <- par(mfrow = c(2, 2)) res <- 200 fill <- "terrain" @@ -62,3 +62,5 @@ diagram(a, add = TRUE, col = "blue", col.names = "blue") title(main = syslab(c("CaO", "Al2O3", "MgO", "SiO2", "H2O"))) legend("topright", describe.property(c("T", "P"), c(300, 500)), bty = "n") + +par(opar) Modified: pkg/CHNOSZ/demo/adenine.R =================================================================== --- pkg/CHNOSZ/demo/adenine.R 2019-01-21 15:40:26 UTC (rev 361) +++ pkg/CHNOSZ/demo/adenine.R 2019-01-22 08:56:26 UTC (rev 362) @@ -39,6 +39,7 @@ TK <- seq(275, 425) P <- water("Psat", TK)$Psat # set up plots +opar <- par(no.readonly = TRUE) layout(matrix(1:3), heights=c(1, 8, 8)) # title at top par(mar=c(0, 0, 0, 0), cex=1) @@ -116,3 +117,5 @@ ) # reset database and computational settings data(thermo) + +par(opar) Modified: pkg/CHNOSZ/demo/bison.R =================================================================== --- pkg/CHNOSZ/demo/bison.R 2019-01-21 15:40:26 UTC (rev 361) +++ pkg/CHNOSZ/demo/bison.R 2019-01-22 08:56:26 UTC (rev 362) @@ -2,7 +2,8 @@ # average oxidation state of carbon (ZC) of metagenome-derived # proteins in different microbial phyla at Bison Pool 20171217 -par(mar=c(3.5, 4, 2.5, 2), las=1, mgp=c(2.2, 0.8, 0)) +# set default xaxs, yaxs, and tcl here becuase they are affected by previous demos +par(mar=c(3.5, 4, 2.5, 2), las=1, mgp=c(2.2, 0.8, 0), xaxs="r", yaxs="r", tcl=-0.5) # read the amino acid compositions aa.annot <- read.csv(system.file("extdata/protein/DS11.csv", package="CHNOSZ"), as.is=TRUE) aa.phyla <- read.csv(system.file("extdata/protein/DS13.csv", package="CHNOSZ"), as.is=TRUE) Modified: pkg/CHNOSZ/demo/go-IU.R =================================================================== --- pkg/CHNOSZ/demo/go-IU.R 2019-01-21 15:40:26 UTC (rev 361) +++ pkg/CHNOSZ/demo/go-IU.R 2019-01-22 08:56:26 UTC (rev 362) @@ -3,7 +3,7 @@ # (BL = Bloomington campus of Indiana University) ## set up plotting area -par(mfrow=c(2, 2)) +opar <- par(mfrow=c(2, 2)) ## start with default database data(thermo) @@ -153,3 +153,5 @@ ### clean up: restore thermodynamic database to default ########### data(thermo) + +par(opar) Modified: pkg/CHNOSZ/demo/gold.R =================================================================== --- pkg/CHNOSZ/demo/gold.R 2019-01-21 15:40:26 UTC (rev 361) +++ pkg/CHNOSZ/demo/gold.R 2019-01-22 08:56:26 UTC (rev 362) @@ -201,8 +201,9 @@ } # make plots -par(mfrow=c(2, 2)) +opar <- par(mfrow=c(2, 2)) Au_pH1() Au_pH2() Au_T1() Au_T2() +par(opar) Modified: pkg/CHNOSZ/demo/lambda.R =================================================================== --- pkg/CHNOSZ/demo/lambda.R 2019-01-21 15:40:26 UTC (rev 361) +++ pkg/CHNOSZ/demo/lambda.R 2019-01-22 08:56:26 UTC (rev 362) @@ -1,11 +1,12 @@ # plot effects of lambda transition in quartz # after Berman 1988 Figs. 1 and 2 +opar <- par(no.readonly = TRUE) layout(matrix(c(1, 4:2, 1, 7:5), nrow=4), heights=c(0.7, 3, 3, 3)) # plot title first par(mar=c(0, 0, 0, 0)) plot.new() text(0.5, 0.5, "Effects of lambda transition in quartz, after Berman (1988) Figs. 1 and 2", cex=1.8) -opar <- par(mar=c(4, 4.5, 1, 0.5), cex=0.8) +par(mar=c(4, 4.5, 1, 0.5), cex=0.8) TC <- 0:1200 T <- convert(TC, "K") Modified: pkg/CHNOSZ/demo/solubility.R =================================================================== --- pkg/CHNOSZ/demo/solubility.R 2019-01-21 15:40:26 UTC (rev 361) +++ pkg/CHNOSZ/demo/solubility.R 2019-01-22 08:56:26 UTC (rev 362) @@ -10,6 +10,7 @@ # Manning et al., 2013, Reviews in Mineralogy & Geochemistry, v. 75, pp. 109-148 # (doi: 10.2138/rmg.2013.75.5) +opar <- par(no.readonly = TRUE) layout(matrix(1:4, nrow = 2)) # set pH and T range and resolution, constant temperature and ionic strength @@ -67,3 +68,5 @@ s <- solubility(a) diagram(s, type = "loga.balance") title(main = "Solubility of calcite", font.main = 1) + +par(opar) Modified: pkg/CHNOSZ/demo/yeastgfp.R =================================================================== --- pkg/CHNOSZ/demo/yeastgfp.R 2019-01-21 15:40:26 UTC (rev 361) +++ pkg/CHNOSZ/demo/yeastgfp.R 2019-01-22 08:56:26 UTC (rev 362) @@ -27,8 +27,9 @@ species(names, "Sce") a <- affinity(H2O=c(-5, 0, 256), O2=c(-80, -66, 256)) # setup the plot +opar <- par(no.readonly = TRUE) layout(matrix(c(1, 1,2:7), byrow=TRUE, nrow=4), heights=c(0.7, 3, 3, 3)) -opar <- par(mar=c(0, 0, 0, 0)) +par(mar=c(0, 0, 0, 0)) plot.new() text(0.5, 0.7, expression("Proteins in subcellular locations of"~italic("S. cerevisiae")~"(Dick, 2009)"), cex=1.5) text(0.5, 0.2, describe.basis(ibasis=c(1, 3, 4, 6), oneline=TRUE), cex=1.5) From noreply at r-forge.r-project.org Wed Jan 23 05:37:48 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 23 Jan 2019 05:37:48 +0100 (CET) Subject: [CHNOSZ-commits] r363 - in pkg/CHNOSZ: . data inst inst/extdata/OBIGT vignettes Message-ID: <20190123043748.412D518C48A@r-forge.r-project.org> Author: jedick Date: 2019-01-23 05:37:46 +0100 (Wed, 23 Jan 2019) New Revision: 363 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/data/refs.csv pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_cr.csv.xz pkg/CHNOSZ/vignettes/obigt.bib Log: OBIGT/inorganic_cr.csv: add data for scheelite and ferberite Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-22 08:56:26 UTC (rev 362) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-23 04:37:46 UTC (rev 363) @@ -1,6 +1,6 @@ -Date: 2019-01-22 +Date: 2019-01-23 Package: CHNOSZ -Version: 1.1.3-70 +Version: 1.1.3-71 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/data/refs.csv =================================================================== --- pkg/CHNOSZ/data/refs.csv 2019-01-22 08:56:26 UTC (rev 362) +++ pkg/CHNOSZ/data/refs.csv 2019-01-23 04:37:46 UTC (rev 363) @@ -14,6 +14,8 @@ RHF78.2,"R. A. Robie, B. S. Hemingway and J. R. Fisher",1978,"U. S. Geological Survey Bull. 1452",iron,http://pubs.er.usgs.gov/publication/b1452 RHF78.3,"R. A. Robie, B. S. Hemingway and J. R. Fisher",1978,"U. S. Geological Survey Bull. 1452","gibbsite GHS",http://pubs.er.usgs.gov/publication/b1452 RHF78.4,"R. A. Robie, B. S. Hemingway and J. R. Fisher",1978,"U. S. Geological Survey Bull. 1452","rutile and titanite",http://pubs.er.usgs.gov/publication/b1452 +RHF78.5,"R. A. Robie, B. S. Hemingway and J. R. Fisher",1978,"U. S. Geological Survey Bull. 1452","scheelite GHS and V",http://pubs.er.usgs.gov/publication/b1452 +RHF78.6,"R. A. Robie, B. S. Hemingway and J. R. Fisher",1978,"U. S. Geological Survey Bull. 1452","ferberite V",http://pubs.er.usgs.gov/publication/b1452 PB82,"L. N. Plummer and E. Busenberg",1982,"Geochim. Cosmochim. Acta 46, 1011-1040","aragonite and calcite",https://doi.org/10.1016/0016-7037(82)90056-4 WEP+82,"D. D. Wagman, W. H. Evans et al.",1982,"J. Phys. Chem. Ref. Data 11, Suppl. 2, 1-392","gases GHS",https://srd.nist.gov/JPCRD/jpcrdS2Vol11.pdf WEP+82.1,"D. D. Wagman, W. H. Evans et al.",1982,"J. Phys. Chem. Ref. Data 11, Suppl. 2, 1-392",manganosite,https://srd.nist.gov/JPCRD/jpcrdS2Vol11.pdf @@ -81,6 +83,7 @@ MS99,"W. M. Murphy and E. L. Shock",1999,"Rev. Mineral. Geochem. 38, 221-253",actinides,http://rimg.geoscienceworld.org/content/38/1/221 PSK99,"P. Prapaipong, E. L. Shock and C. M. Koretsky",1999,"Geochim. Cosmochim. Acta 63, 2547-2577","metal-dicarboxylate complexes",https://doi.org/10.1016/S0016-7037(99)00146-5 SAJ00,"R. E. Stoffregen, C. N. Alpers and J. L. Jambor",2000,"Rev. Mineral. Geochem. 40, 453-479","jarosite, natroalunite, and natrojarosite",https://doi.org/10.2138/rmg.2000.40.9 +WS00,"S. A. Wood and I. M. Samson",2000,"Econ. Geol. 95, 143-182","scheelite and ferberite; adopted values include Cp parameters for scheelite from @BK73 and GHS and Cp parameters for ferberite from @Pol90",https://doi.org/10.2113/gsecongeo.95.1.143 AP01,"J. P. Amend and A. V. Plyasunov",2001,"Geochim. Cosmochim. Acta 65, 3901-3917",carbohydrates,https://doi.org/10.1016/S0016-7037(01)00707-4 AS01,"J. P. Amend and E. L. Shock",2001,"FEMS Microbiol. Rev. 25, 175-243","NO and N2O",https://doi.org/10.1111/j.1574-6976.2001.tb00576.x AS01.1,"J. P. Amend and E. L. Shock",2001,"FEMS Microbiol. Rev. 25, 175-243","selenium and molybdenite",https://doi.org/10.1111/j.1574-6976.2001.tb00576.x Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2019-01-22 08:56:26 UTC (rev 362) +++ pkg/CHNOSZ/inst/NEWS 2019-01-23 04:37:46 UTC (rev 363) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 1.1.3-69 (2019-01-21) +CHANGES IN CHNOSZ 1.1.3-71 (2019-01-23) --------------------------------------- BUG FIXES @@ -132,6 +132,9 @@ - Update G, H, and S of celestite using properties of the dissolution reaction given by Reardon and Armstrong, 1987. +- Add scheelite (CaWO4) and ferberite (FeWO4) using data adopted by + Wood and Samson, 2000. + DIAGRAMS - Lines in 1-D diagram()s can optionally be drawn as splines using the Modified: pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_cr.csv.xz =================================================================== --- pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_cr.csv.xz 2019-01-22 08:56:26 UTC (rev 362) +++ pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_cr.csv.xz 2019-01-23 04:37:46 UTC (rev 363) @@ -1,4 +1,4 @@ -?7zXZ???F!t/???/ @]7I??b???9??????TB;q?"?q???cL;?"????Q???7?.42&l{?3???a???Z?r??Xe?i?? ?nm?$m|??????r7/{???? s??x~K18k??????C??6Xf?w?7?"???k]?? -~^X??D???NM?????????e?&?#???rdz???S?G'?^??`jm???S?)YJD??X|Z?c???(?k???j??#5??VmX?? ?|P?? ?6G?????0? ??.??em???}????S????~?%R?"a??5???&)?H????A???ZLf??TF??/??????+1???2n????U??-???FGyn?d&k?????[????[G?#&?K???=PYIc??w?[Q?*a}!?h?#e????gH?,0-?$??Id???\j????R??/pZa??||??r??a\??^?t????g?YZ \ No newline at end of file +~^X??D???NM?????????e?&?#???rdz???S?G'?^??`jm???S?)YJD??X|Z?c???(?k???j??#5??VmX?? ?|P?? ?6G?????0? ??.??em???}????S????~?%R?"a??5???&)?H????A???ZLf??TF??/??????+1???2n????U??-???FGyn?d&k?????[????[G?#&?K???=PYIc??w?[Q?*a}!?h?#e????gH?,0-?$??Id???\j????R??/pZa???h)??7@?]O????N????6????????]?#I(lF?;??un$??S??X&?4????k???Z[4?-?E?????R ?????_?(????g?YZ \ No newline at end of file Modified: pkg/CHNOSZ/vignettes/obigt.bib =================================================================== --- pkg/CHNOSZ/vignettes/obigt.bib 2019-01-22 08:56:26 UTC (rev 362) +++ pkg/CHNOSZ/vignettes/obigt.bib 2019-01-23 04:37:46 UTC (rev 363) @@ -1227,15 +1227,47 @@ url = {http://www.ingentaconnect.com/content/10.1127/0935-1221/2010/0022-2021}, } + at Article{WS00, + author = {Wood, Scott A. and Samson, Iain M.}, + journal = {Economic Geology}, + title = {{T}he hydrothermal geochemistry of tungsten in granitoid environments: {I}. {R}elative solubilities of ferberite and scheelite as a function of {T}, {P}, p{H}, and m{N}a{C}l}, + year = {2000}, + volume = {95}, + number = {1}, + pages = {143-182}, + doi = {10.2113/gsecongeo.95.1.143}, + issn = {0361-0128}, + publisher = {Society of Economic Geologists}, + source = {Crossref}, +} + @Article{RA87, - author = {Reardon, E. J. and Armstrong, D. K.}, - journal = {Geochimica et Cosmochimica Acta}, - title = {{C}elestite ({S}r{SO}$_{4(s)}$) solubility in water, seawater and {N}a{C}l solution}, - year = {1987}, - volume = {51}, - number = {1}, - pages = {63--72}, - doi = {10.1016/0016-7037(87)90007-X}, - issn = {0016-7037}, + author = {Reardon, E. J. and Armstrong, D. K.}, + journal = {Geochimica et Cosmochimica Acta}, + title = {{C}elestite ({S}r{SO}$_{4(s)}$) solubility in water, seawater and {N}a{C}l solution}, + year = {1987}, + volume = {51}, + number = {1}, + pages = {63--72}, + doi = {10.1016/0016-7037(87)90007-X}, + issn = {0016-7037}, } + at Book{BK73, + author = {Barin, Ihsan and Knacke, Ottmar}, + publisher = {Springer-Verlag}, + title = {{T}hermochemical {P}roperties of {I}norganic {S}ubstances}, + year = {1973}, + address = {Berlin}, + url = {http://www.worldcat.org/oclc/695258}, +} + + at Article{Pol90, + author = {Polya, D. A.}, + journal = {Transactions of the Institutions of Mining and Metallurgy, Section B: Applied Earth Science}, + title = {{P}ressure-dependence of wolframite solubility for hydrothermal vein formation}, + year = {1990}, + volume = {99}, + pages = {B120--B124}, +} + From noreply at r-forge.r-project.org Wed Jan 23 10:10:18 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 23 Jan 2019 10:10:18 +0100 (CET) Subject: [CHNOSZ-commits] r364 - in pkg/CHNOSZ: . R inst tests/testthat Message-ID: <20190123091018.1B63118B527@r-forge.r-project.org> Author: jedick Date: 2019-01-23 10:10:17 +0100 (Wed, 23 Jan 2019) New Revision: 364 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/equilibrate.R pkg/CHNOSZ/R/solubility.R pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/tests/testthat/test-equilibrate.R pkg/CHNOSZ/tests/testthat/test-solubility.R pkg/CHNOSZ/tests/testthat/test-water.lines.R Log: balance(): produce error if no basis species is present in all formation reactions Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-23 04:37:46 UTC (rev 363) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-23 09:10:17 UTC (rev 364) @@ -1,6 +1,6 @@ Date: 2019-01-23 Package: CHNOSZ -Version: 1.1.3-71 +Version: 1.1.3-72 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/R/equilibrate.R =================================================================== --- pkg/CHNOSZ/R/equilibrate.R 2019-01-23 04:37:46 UTC (rev 363) +++ pkg/CHNOSZ/R/equilibrate.R 2019-01-23 09:10:17 UTC (rev 364) @@ -271,8 +271,8 @@ # try to automatically find a balance if(is.null(balance)) { ibalance <- which.balance(aout$species) - # no shared basis species - balance on one mole of species - if(length(ibalance) == 0) balance <- 1 + # no shared basis species and balance not specified by user - an error + if(length(ibalance) == 0) stop("no basis species is present in all formation reactions") } # change "1" to 1 (numeric) 20170206 if(identical(balance, "1")) balance <- 1 Modified: pkg/CHNOSZ/R/solubility.R =================================================================== --- pkg/CHNOSZ/R/solubility.R 2019-01-23 04:37:46 UTC (rev 363) +++ pkg/CHNOSZ/R/solubility.R 2019-01-23 09:10:17 UTC (rev 364) @@ -20,15 +20,11 @@ if(is.null(dissociation)) { # assume FALSE unless determined otherwise dissociation <- FALSE - # react the first basis species to form the first species - sres <- suppressMessages(subcrt(c(rownames(aout$basis)[1], aout$species$name[1]), c(-1, 1))) - # note that the reaction is auto-balanced using all the basis species - # if the reaction involves the second basis species, we consider it to be a dissociation reaction - if(rownames(aout$basis)[2] %in% sres$reaction$formula) { + # if the reaction to form the first species involves the second basis species, we consider it to be a dissociation reaction + if(aout$species[1, 2] != 0) { # however, if the second basis species is H2O, H+, e-, O2 (or others?), we don't have enough information, so stop - if(rownames(aout$basis)[2] %in% c("H2O", "H+", "e-", "O2")) { - print(sres$reaction) - stop("unsure whether this is a dissociation reaction. if it is, redefine the basis to put a product ion second") + if(colnames(aout$species)[2] %in% c("H2O", "H+", "e-", "O2")) { + stop("Unsure whether the first formation reaction is a dissociation reaction.\nSet the 'dissociation' argument to TRUE or FALSE, or redefine the basis to put a product ion second.") } dissociation <- TRUE } Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2019-01-23 04:37:46 UTC (rev 363) +++ pkg/CHNOSZ/inst/NEWS 2019-01-23 09:10:17 UTC (rev 364) @@ -1,17 +1,16 @@ -CHANGES IN CHNOSZ 1.1.3-71 (2019-01-23) +CHANGES IN CHNOSZ 1.1.3-72 (2019-01-23) --------------------------------------- BUG FIXES +- Fix bug in nonideal() where "Zn" in formula was identified as charge. + Thanks to Feng Lai for the bug report. + - Fix a bug where subcrt()$reaction$coeffs was incorrect for reactions involving minerals with phase transitions. Also ensure that the output reaction stoichiometry is correct for duplicated species in reactions. Thanks to Grayson Boyer for the bug report. -- Fix bug in nonideal() where "Zn" in formula was identified as charge. - Thanks to Feng Lai for reporting the incorrect behavior caused by - this bug. - - For species in the revised HKF model, subcrt() now sets properties to NA where the density of H2O is less than 0.35 g/cm3, avoiding the output of bogus values in this region. Thanks to Evgeniy Bastrakov. @@ -20,6 +19,14 @@ Gibbs energy of mixing. An example using mosaic() to calculate the pH-dependent solubility of calcite has been added to solubility.Rd. +- For systems where no basis species is present in all formation + reactions, and the user hasn't provided balance coefficients, stop + with an error instead of setting the balance cofficients to 1. + Thanks to Shuang Kong for an example calculation and Tucker Ely for + a previous request to produce an error here. The affected code is in + balance(), an unexported function used in equilibrate() and + diagram() (and now also solubility()). + NEW FEATURE: SOLUBILITY CALCULATIONS - Add solubility(). Run this after affinity() to calculate the Modified: pkg/CHNOSZ/tests/testthat/test-equilibrate.R =================================================================== --- pkg/CHNOSZ/tests/testthat/test-equilibrate.R 2019-01-23 04:37:46 UTC (rev 363) +++ pkg/CHNOSZ/tests/testthat/test-equilibrate.R 2019-01-23 09:10:17 UTC (rev 364) @@ -24,9 +24,10 @@ expect_message(equilibrate(aacid), "loga.balance is -2.221848") expect_message(equilibrate(aacid, loga.balance=-3), "loga.balance is -3") expect_error(equilibrate(aacid, balance="length"), "some species are not proteins") - expect_message(equilibrate(aacidS), "balance: from numeric argument value") - expect_message(equilibrate(aacidS), "n.balance is 1 1 1 1 1") - expect_message(equilibrate(aacidS), "loga.balance is -2.301029") + expect_error(equilibrate(aacidS), "no basis species is present in all formation reactions") + expect_message(equilibrate(aacidS, balance=1), "balance: from numeric argument value") + expect_message(equilibrate(aacidS, balance=1), "n.balance is 1 1 1 1 1") + expect_message(equilibrate(aacidS, balance=1), "loga.balance is -2.301029") expect_error(equilibrate(aacidS, balance="CO2"), "some species have no CO2 in the formation reaction") expect_message(equilibrate(aprot), "balance: from protein length") expect_message(equilibrate(aprot), "n.balance is 129 153 124 104") Modified: pkg/CHNOSZ/tests/testthat/test-solubility.R =================================================================== --- pkg/CHNOSZ/tests/testthat/test-solubility.R 2019-01-23 04:37:46 UTC (rev 363) +++ pkg/CHNOSZ/tests/testthat/test-solubility.R 2019-01-23 09:10:17 UTC (rev 364) @@ -48,5 +48,5 @@ basis(c("calcite", "H2O", "Ca+2", "O2", "H+")) species(c("CO2", "HCO3-", "CO3-2")) a <- affinity() - expect_error(solubility(a), "unsure whether this is a dissociation reaction") + expect_error(solubility(a), "Unsure whether the first formation reaction is a dissociation reaction.") }) Modified: pkg/CHNOSZ/tests/testthat/test-water.lines.R =================================================================== --- pkg/CHNOSZ/tests/testthat/test-water.lines.R 2019-01-23 04:37:46 UTC (rev 363) +++ pkg/CHNOSZ/tests/testthat/test-water.lines.R 2019-01-23 09:10:17 UTC (rev 364) @@ -7,7 +7,7 @@ limit.water <- TRUE # function to count the number of species on a diagram (not including NA fields) -nspecies <- function(a) length(na.omit(unique(as.numeric(diagram(a, limit.water=limit.water, plot.it=plot.it)$predominant)))) +nspecies <- function(a) length(na.omit(unique(as.numeric(diagram(a, limit.water=limit.water, plot.it=plot.it, balance=1)$predominant)))) res <- 25 From noreply at r-forge.r-project.org Wed Jan 23 11:43:19 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 23 Jan 2019 11:43:19 +0100 (CET) Subject: [CHNOSZ-commits] r365 - in pkg/CHNOSZ: . vignettes Message-ID: <20190123104320.0A4DC18B60E@r-forge.r-project.org> Author: jedick Date: 2019-01-23 11:43:19 +0100 (Wed, 23 Jan 2019) New Revision: 365 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/vignettes/CHNOSZ.dia pkg/CHNOSZ/vignettes/CHNOSZ.png Log: anintro.Rmd: update CHNOSZ flowchart with mosaic and solubility functions Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-23 09:10:17 UTC (rev 364) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-23 10:43:19 UTC (rev 365) @@ -1,6 +1,6 @@ Date: 2019-01-23 Package: CHNOSZ -Version: 1.1.3-72 +Version: 1.1.3-73 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/vignettes/CHNOSZ.dia =================================================================== (Binary files differ) Modified: pkg/CHNOSZ/vignettes/CHNOSZ.png =================================================================== (Binary files differ) From noreply at r-forge.r-project.org Thu Jan 24 02:45:17 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 24 Jan 2019 02:45:17 +0100 (CET) Subject: [CHNOSZ-commits] r366 - in pkg/CHNOSZ: . R man Message-ID: <20190124014517.DDF4F18B619@r-forge.r-project.org> Author: jedick Date: 2019-01-24 02:45:17 +0100 (Thu, 24 Jan 2019) New Revision: 366 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/solubility.R pkg/CHNOSZ/man/solubility.Rd Log: solubility(): add 'in.terms.of' argument Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-23 10:43:19 UTC (rev 365) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-24 01:45:17 UTC (rev 366) @@ -1,6 +1,6 @@ Date: 2019-01-23 Package: CHNOSZ -Version: 1.1.3-73 +Version: 1.1.3-74 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/R/solubility.R =================================================================== --- pkg/CHNOSZ/R/solubility.R 2019-01-23 10:43:19 UTC (rev 365) +++ pkg/CHNOSZ/R/solubility.R 2019-01-24 01:45:17 UTC (rev 366) @@ -6,8 +6,9 @@ ## if this file is interactively sourced, the following are also needed to provide unexported functions: #source("equilibrate.R") #source("util.misc.R") +#source("species.R") -solubility <- function(aout, dissociation=NULL, find.IS=FALSE) { +solubility <- function(aout, dissociation=NULL, find.IS=FALSE, in.terms.of=NULL) { ## concept: the logarithms of activities of species at equilibrium are equal to ## Astar, the affinities calculated for unit activities of species @@ -22,11 +23,17 @@ dissociation <- FALSE # if the reaction to form the first species involves the second basis species, we consider it to be a dissociation reaction if(aout$species[1, 2] != 0) { - # however, if the second basis species is H2O, H+, e-, O2 (or others?), we don't have enough information, so stop - if(colnames(aout$species)[2] %in% c("H2O", "H+", "e-", "O2")) { - stop("Unsure whether the first formation reaction is a dissociation reaction.\nSet the 'dissociation' argument to TRUE or FALSE, or redefine the basis to put a product ion second.") + # 20190123 (corundum calculation): if there are only H2O, H+, and e- + # besides the first basis species, it's not a dissociation reaction + nbasis <- nrow(aout$basis) + nH2O <- sum(rownames(aout$basis) %in% c("H2O", "H+", "e-", "O2", "H2")) + if(nbasis > (nH2O + 1)) { + # if we got here, and the second basis species is H2O, H+, e-, O2 (or others?), we don't have enough information, so stop + if(colnames(aout$species)[2] %in% c("H2O", "H+", "e-", "O2", "H2")) { + stop("Unsure whether the first formation reaction is a dissociation reaction.\nSet the 'dissociation' argument to TRUE or FALSE, or redefine the basis to put a product ion second.") + } + dissociation <- TRUE } - dissociation <- TRUE } message("solubility: test for dissociation reaction returns ", dissociation) } else message("solubility: argument for dissociation reaction is ", dissociation) @@ -126,6 +133,17 @@ niter <- niter + 1 } + # do we want the solubility expressed in terms of + # something other than the first basis species? 20190123 + if(!is.null(in.terms.of)) { + # write the reaction between the basis species and the new species + sbasis <- species.basis(in.terms.of) + # divide the activity of the conserved basis species by the coefficient in the formation reaction + ibalance <- which.balance(aout$species) + coeff <- sbasis[, ibalance][1] + loga.balance <- loga.balance - log10(coeff) + } + # make the output # (we don't deal with normalized formulas yet, so for now m.balance==n.balance) c(aout, list(balance=bout$balance, m.balance=bout$n.balance, n.balance=bout$n.balance, Modified: pkg/CHNOSZ/man/solubility.Rd =================================================================== --- pkg/CHNOSZ/man/solubility.Rd 2019-01-23 10:43:19 UTC (rev 365) +++ pkg/CHNOSZ/man/solubility.Rd 2019-01-24 01:45:17 UTC (rev 366) @@ -7,13 +7,14 @@ } \usage{ - solubility(aout, dissociation = NULL, find.IS = FALSE) + solubility(aout, dissociation = NULL, find.IS = FALSE, in.terms.of = NULL) } \arguments{ \item{aout}{list, output from \code{\link{affinity}}} \item{dissociation}{logical, does the mineral undergo a dissociation reaction?} \item{find.IS}{logical, find the equilibrium ionic strength by iteration?} + \item{in.terms.of}{character, express the total solubility in terms of moles of this species} } \details{ @@ -46,10 +47,14 @@ However, for dissolving a substance in pure water, \code{find.IS} can be set to TRUE to determine the final ionic strength. This works by calculating the ionic strength from the equilibrium solubility calculation, then re-running \code{affinity} with those values. Note that for dissociation reactions, the ionic strength is calculated from both the ions present in the species definition and the counter ion, which should be the second basis species. -TODO: Speciation of counterions (e.g. ionized forms of carbonate or sulfate) can be accomplished by using the \code{\link{mosaic}} function instead of \code{affinity}. The calculation is iterated until the ionic strength deviation at every point is lower than a preset tolerance (1e-4). +Alternatively, speciation of counterions (e.g. ionized forms of carbonate or sulfate) can also be accomplished by using the \code{\link{mosaic}} function instead of \code{affinity}. +See the second example for this method. The output of \code{solubility} has the same format as that of \code{equilibrate}, and can be used by \code{\link{diagram}} with \code{type = "loga.balance"} to plot the solubilities, or with \code{type = NULL} to plot the activities of species. +The value of \code{loga.balance} reflects the activity (or molality) of the conserved basis species, i.e. the thing being dissolved. +Use \code{in.terms.of} to express this value in terms of another species. +For example, the solubility of corundum (Al\s{2}O\s{3}) can be expressed in terms of the moles of Al\S{+3} in solution (see the vignette \code{anintro.Rmd}). } \section{Warning}{ From noreply at r-forge.r-project.org Thu Jan 24 13:36:38 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 24 Jan 2019 13:36:38 +0100 (CET) Subject: [CHNOSZ-commits] r367 - in pkg/CHNOSZ: . R inst man vignettes Message-ID: <20190124123638.DEEA718BEBD@r-forge.r-project.org> Author: jedick Date: 2019-01-24 13:36:38 +0100 (Thu, 24 Jan 2019) New Revision: 367 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/diagram.R pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/man/mosaic.Rd pkg/CHNOSZ/vignettes/anintro.Rmd pkg/CHNOSZ/vignettes/vig.bib Log: anintro.Rmd: add section on solubility calculations Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-24 01:45:17 UTC (rev 366) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-24 12:36:38 UTC (rev 367) @@ -1,6 +1,6 @@ -Date: 2019-01-23 +Date: 2019-01-24 Package: CHNOSZ -Version: 1.1.3-74 +Version: 1.1.3-75 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/R/diagram.R =================================================================== --- pkg/CHNOSZ/R/diagram.R 2019-01-24 01:45:17 UTC (rev 366) +++ pkg/CHNOSZ/R/diagram.R 2019-01-24 12:36:38 UTC (rev 367) @@ -325,6 +325,11 @@ myvals <- as.numeric(plotvals[[i]]) # don't take values that lie close to or above the top of plot myvals[myvals > ylim[1] + 0.95*diff(ylim)] <- ylim[1] + # if we're adding to a plot, don't take values that are above the top of this plot + if(add) { + this.ylim <- par("usr")[3:4] + myvals[myvals > this.ylim[1] + 0.95*diff(this.ylim)] <- this.ylim[1] + } # the starting x-adjustment thisadj <- alladj[i] # if this line has any of the overall maximum values, use only those values Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2019-01-24 01:45:17 UTC (rev 366) +++ pkg/CHNOSZ/inst/NEWS 2019-01-24 12:36:38 UTC (rev 367) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 1.1.3-72 (2019-01-23) +CHANGES IN CHNOSZ 1.1.3-75 (2019-01-24) --------------------------------------- BUG FIXES @@ -77,8 +77,9 @@ 2009). This depends on the revised nonideal() and new NaCl() functions described above. -- anintro.Rmd: add cuprite to mosaic diagram example, and note about - implications of changing balance to 1. +- anintro.Rmd: add section on solubility calculations. Also, add + cuprite to mosaic diagram example, and note about implications of + changing balance to 1. - Add demo/bison.R (average oxidation state of carbon of metagenome- derived proteins in different microbial phyla at Bison Pool) Modified: pkg/CHNOSZ/man/mosaic.Rd =================================================================== --- pkg/CHNOSZ/man/mosaic.Rd 2019-01-24 01:45:17 UTC (rev 366) +++ pkg/CHNOSZ/man/mosaic.Rd 2019-01-24 12:36:38 UTC (rev 367) @@ -28,8 +28,8 @@ The first species listed in \code{bases} should be in the current basis definition. The arguments in \code{...} are passed to \code{affinity} to specify the conditions. If \code{blend} is FALSE (the default), the function returns the affinities calculated using the single predominant basis species in \code{bases} at each condition. -If \code{blend} is TRUE, the function combines the affinities of the formation reactions weighted by the relative abundances of the basis species at each condition. -This tends to produce curved boundaries. +If \code{blend} is TRUE, the function combines the affinities of the formation reactions in proportion to the relative abundances of the basis species at each condition, including a term to account for the Gibbs energy of mixing. +See the second example in \code{\link{solubility}} for a numerical test of the calculations using \code{blend}. The basis species listed in \code{bases} should all be related to the first basis species there (i.e. all share the same element). A second, independent set of basis species can be provided in \code{bases2} (for example \samp{CO3-2}, \samp{HCO3-}, \samp{CO2}, if the first set of basis species are the sulfur-bearing ones listed above). Modified: pkg/CHNOSZ/vignettes/anintro.Rmd =================================================================== --- pkg/CHNOSZ/vignettes/anintro.Rmd 2019-01-24 01:45:17 UTC (rev 366) +++ pkg/CHNOSZ/vignettes/anintro.Rmd 2019-01-24 12:36:38 UTC (rev 367) @@ -390,7 +390,7 @@ Here we calculate properties for the dissolution of CO2: ```{marginfigure} Because of aqueous speciation, this doesn't give the _solubility_ of CO2. -For an example of a solubility calculation, see [`demo(solubility)`](../demo), which is based on a figure in Manning et al. (2013). +Some examples of solubility calculations are in [`demo(solubility)`](../demo) ([see below](#complete-equilibrium-solubility)). ``` ```{r subcrt_CO2} subcrt(c("CO2", "CO2"), c("gas", "aq"), c(-1, 1), T = seq(0, 250, 50)) @@ -926,12 +926,41 @@ ```{r bjerrum_diagram, echo=12:13, eval=FALSE} ``` -The possible reactions between species are all balanced on 1 C. -Therefore, although pH alters the total activity of C, in a system with ideal mixing the total activity of C doesn't affect the relative activities of these species. -```{marginfigure} -See [`demo(solubility)`](../demo) for calculations of the total activity of C in equilibrium with either CO2(gas) or calcite. +## Complete equilibrium: Solubility + +It is important to remember that `equilibrate()` calculates an equilibrium distribution of species for a given total activity of the conserved basis species. +For instance, the previous diagram shows the relative abundances of CO2, HCO3-, and CO3-2 as a function of pH assuming that the possible reactions between species are all balanced on 1 C and the total activity of C is constant. +Although this assumption of metastable equilibrium is useful for making many types of diagrams for aqueous species, the aqueous solutions would not be in equilibrium with other phases, including gases or solids such as carbon dioxide or calcite. + +Moving away from metastable equilibrium to complete equilibrium actually involves a simplification of the computations. +Instead of finding the activities of aqueous species where the affinities of formation reactions are equal to each other, equilibrium corresponds to the configuration where the affinities are equal to zero. +However, this simplification comes with a different constraint: the reactions should be balanced on something that anchors them to a real quantity. +It makes sense to think of this quantity as a conserved basis species (one that is present in the formation reactions of all species considered), which corresponds to a pure substance that is being dissolved. + +The `solubility()` function provides a way to compute activities of aqueous species in equilibrium with a solid or gas, which is usually defined as the first basis species. +The following example for corundum (Al2O3) is based on Figure 15 of @Man13. +Corundum is set as the first basis species, and the formed species all contain Al. +The affinities of the formation reactions, for any given activities of the species, but unit activity of the solid basis species (corundum), are input to `solubility()`. +An additional argument, `in.terms.of`, is used to compute the total molality of Al in solution, that is, twice the number of moles of Al2O3 that are dissolved. +`diagram()` is used twice, first to plot the total molality of Al, then the concentrations of the individual species, using `adj` and `dy` to adjust the positions of labels in the *x*- and *y*-directions. +Note that setting `IS` to 0 in `affinity()` has no effect on the calculations, but signals `diagram()` to label the *y* axis with logarithm of molality instead of logarithm of activity. + +```{r corundum, fig.margin=TRUE, fig.width=4, fig.height=4, dpi=dpi, out.width="100%", results="hide", message=FALSE, cache=TRUE, fig.cap="Solubility of corundum (green line) and equilibrium concentrations of aqueous species (black lines).", pngquant=pngquant, timeit=timeit} +basis(c("corundum", "H2O", "H+", "O2")) +species(c("Al+3", "AlO2-", "AlOH+2", "AlO+", "HAlO2")) +a <- affinity(pH = c(0, 10), IS = 0) +s <- solubility(a, in.terms.of = "Al+3") +diagram(s, type = "loga.balance", ylim = c(-10, 0), lwd = 4, col = "green3") +diagram(s, add = TRUE, adj = c(0, 1, 2.1, -0.2, -1.5), dy = c(0, 0, 4, -0.3, 0.1)) +legend("topright", c("25 ?C", "1 bar"), text.font = 2, bty = "n") ``` +Other examples of using `solubility()` are available in CHNOSZ. +See [`demo(solubility)`](../demo) for calculations of the solubility of CO2(gas) and calcite as a function of pH and temperature. +The calculation assumes the stoichiometric dissolution of calcite, in which CaCO3 dissociates to form equal quantities of Ca+2 and CO3-2 ions. +Adding in activity coefficients, a different example in `?solubility` uses the `find.IS` option to find the final ionic strength for dissolving calcite into pure water. +[`demo(gold)`](../demo) shows calculations of the solubility of gold as a function of pH and *T* as well as oxygen fugacity set by diferent mineral buffers, and considers ionic strength effects on activity coefficients, so that activities are transformed to molalities ([see below](#transformation-of-variables)). + ## Groups of species Sometimes it is helpful to look at the summed activities of species as groups on species distribution diagrams. @@ -2165,9 +2194,10 @@ ```{marginfigure} `browse.refs()` was renamed to `thermo.refs()` in 2017. ``` -* 2012-06-16 Add ?More activity diagrams?. +* 2012-06-16 Add "More activity diagrams". * 2015-05-14 Add warning about internal consistency of thermodynamic data. * 2017-02-15 Completely rewritten; switch from Sweave to knitr (Tufte style). +* 2019-01-24 Add section on solubility calculations. View the R Markdown source of this document [on R-Forge](https://r-forge.r-project.org/scm/viewvc.php/pkg/CHNOSZ/vignettes/anintro.Rmd?view=markup&root=chnosz) or in R: Modified: pkg/CHNOSZ/vignettes/vig.bib =================================================================== --- pkg/CHNOSZ/vignettes/vig.bib 2019-01-24 01:45:17 UTC (rev 366) +++ pkg/CHNOSZ/vignettes/vig.bib 2019-01-24 12:36:38 UTC (rev 367) @@ -21,23 +21,23 @@ } @Article{AH00, - author = {Amend, Jan P. and Helgeson, Harold C.}, - journal = {Biophysical Chemistry}, - title = {{C}alculation of the standard molal thermodynamic properties of aqueous biomolecules at elevated temperatures and pressures. {II}. {U}nfolded proteins}, - year = {2000}, - volume = {84}, - number = {2}, - pages = {105--136}, - doi = {10.1016/S0301-4622(00)00116-2}, + author = {Amend, Jan P. and Helgeson, Harold C.}, + journal = {Biophysical Chemistry}, + title = {{C}alculation of the standard molal thermodynamic properties of aqueous biomolecules at elevated temperatures and pressures. {II}. {U}nfolded proteins}, + year = {2000}, + volume = {84}, + number = {2}, + pages = {105--136}, + doi = {10.1016/S0301-4622(00)00116-2}, } @Book{BPJ85, - author = {Bard, A. J. and Parsons, R. and Jordan, J.}, - publisher = {M. Dekker}, - title = {Standard Potentials in Aqueous Solution}, - year = {1985}, - address = {New York}, - url = {http://www.worldcat.org/oclc/12106344}, + author = {Bard, A. J. and Parsons, R. and Jordan, J.}, + publisher = {M. Dekker}, + title = {{S}tandard {P}otentials in {A}queous {S}olution}, + year = {1985}, + address = {New York}, + url = {http://www.worldcat.org/oclc/12106344}, } @Article{DLE64, @@ -78,7 +78,7 @@ @Article{Dic09, author = {Dick, Jeffrey M.}, journal = {BMC Systems Biology}, - title = {Calculation of the relative metastabilities of proteins in subcellular compartments of \emph{{S}accharomyces cerevisiae}}, + title = {{C}alculation of the relative metastabilities of proteins in subcellular compartments of \emph{Saccharomyces cerevisiae}}, year = {2009}, volume = {3}, pages = {75}, @@ -117,7 +117,7 @@ @Article{DS11, author = {Dick, Jeffrey M. and Shock, Everett L.}, journal = {PLoS ONE}, - title = {Calculation of the relative chemical stabilities of proteins as a function of temperature and redox chemistry in a hot spring}, + title = {{C}alculation of the relative chemical stabilities of proteins as a function of temperature and redox chemistry in a hot spring}, year = {2011}, volume = {6}, number = {8}, @@ -203,14 +203,14 @@ } @Article{JOH92, - author = {Johnson, James W. and Oelkers, Eric H. and Helgeson, Harold C.}, - journal = {Computers \& Geosciences}, - title = {{SUPCRT}92: {A} software package for calculating the standard molal thermodynamic properties of minerals, gases, aqueous species, and reactions from 1 to 5000 bar and 0 to 1000?{C}}, - year = {1992}, - volume = {18}, - number = {7}, - pages = {899--947}, - doi = {10.1016/0098-3004(92)90029-Q}, + author = {Johnson, James W. and Oelkers, Eric H. and Helgeson, Harold C.}, + journal = {Computers \& Geosciences}, + title = {{SUPCRT}92: {A} software package for calculating the standard molal thermodynamic properties of minerals, gases, aqueous species, and reactions from 1 to 5000 bar and 0 to 1000?{C}}, + year = {1992}, + volume = {18}, + number = {7}, + pages = {899--947}, + doi = {10.1016/0098-3004(92)90029-Q}, } @Article{LD12, @@ -224,36 +224,36 @@ } @Article{LH06a, - author = {LaRowe, Douglas E. and Helgeson, Harold C.}, - journal = {Geochimica et Cosmochimica Acta}, - title = {{B}iomolecules in hydrothermal systems: {C}alculation of the standard molal thermodynamic properties of nucleic-acid bases, nucleosides, and nucleotides at elevated temperatures and pressures}, - year = {2006}, - volume = {70}, - number = {18}, - pages = {4680--4724}, - doi = {10.1016/j.gca.2006.04.010}, + author = {LaRowe, Douglas E. and Helgeson, Harold C.}, + journal = {Geochimica et Cosmochimica Acta}, + title = {{B}iomolecules in hydrothermal systems: {C}alculation of the standard molal thermodynamic properties of nucleic-acid bases, nucleosides, and nucleotides at elevated temperatures and pressures}, + year = {2006}, + volume = {70}, + number = {18}, + pages = {4680--4724}, + doi = {10.1016/j.gca.2006.04.010}, } @Article{LH06b, - author = {LaRowe, Douglas E. and Helgeson, Harold C.}, - journal = {Thermochimica Acta}, - title = {{T}he energetics of metabolism in hydrothermal systems: {C}alculation of the standard molal thermodynamic properties of magnesium-complexed adenosine nucleotides and {NAD} and {NADP} at elevated temperatures and pressures}, - year = {2006}, - volume = {448}, - number = {2}, - pages = {82--106}, - doi = {10.1016/j.tca.2006.06.008}, + author = {LaRowe, Douglas E. and Helgeson, Harold C.}, + journal = {Thermochimica Acta}, + title = {{T}he energetics of metabolism in hydrothermal systems: {C}alculation of the standard molal thermodynamic properties of magnesium-complexed adenosine nucleotides and {NAD} and {NADP} at elevated temperatures and pressures}, + year = {2006}, + volume = {448}, + number = {2}, + pages = {82--106}, + doi = {10.1016/j.tca.2006.06.008}, } @Article{MSS13, - author = {Manning, Craig E. and Shock, Everett L. and Sverjensky, Dimitri A.}, - journal = {Reviews in Mineralogy and Geochemistry}, - title = {{T}he chemistry of carbon in aqueous fluids at crustal and upper-mantle conditions: {E}xperimental and theoretical constraints}, - year = {2013}, - volume = {75}, - number = {1}, - pages = {109--148}, - doi = {10.2138/rmg.2013.75.5}, + author = {Manning, Craig E. and Shock, Everett L. and Sverjensky, Dimitri A.}, + journal = {Reviews in Mineralogy and Geochemistry}, + title = {{T}he chemistry of carbon in aqueous fluids at crustal and upper-mantle conditions: {E}xperimental and theoretical constraints}, + year = {2013}, + volume = {75}, + number = {1}, + pages = {109--148}, + doi = {10.2138/rmg.2013.75.5}, } @InProceedings{NPW_79, @@ -428,14 +428,14 @@ } @Article{SOJSH92, - author = {Shock, Everett L. and Oelkers, Eric H. and Johnson, James W. and Sverjensky, Dimitri A. and Helgeson, Harold C.}, - journal = {Journal of the Chemical Society, Faraday Transactions}, - title = {Calculation of the thermodynamic properties of aqueous species at high pressures and temperatures: {E}ffective electrostatic radii, dissociation constants, and standard partial molal properties to 1000 ?{C} and 5 kbar}, - year = {1992}, - volume = {88}, - number = {6}, - pages = {803--826}, - doi = {10.1039/FT9928800803}, + author = {Shock, Everett L. and Oelkers, Eric H. and Johnson, James W. and Sverjensky, Dimitri A. and Helgeson, Harold C.}, + journal = {Journal of the Chemical Society, Faraday Transactions}, + title = {{C}alculation of the thermodynamic properties of aqueous species at high pressures and temperatures: {E}ffective electrostatic radii, dissociation constants, and standard partial molal properties to 1000 ?{C} and 5 kbar}, + year = {1992}, + volume = {88}, + number = {6}, + pages = {803--826}, + doi = {10.1039/FT9928800803}, } @Article{SS98, @@ -483,14 +483,14 @@ } @Article{TH88, - author = {Tanger, IV, John C. and Helgeson, Harold C.}, - journal = {American Journal of Science}, - title = {{C}alculation of the thermodynamic and transport properties of aqueous species at high pressures and temperatures: {R}evised equations of state for the standard partial molal properties of ions and electrolytes}, - year = {1988}, - volume = {288}, - number = {1}, - pages = {19--98}, - doi = {10.2475/ajs.288.1.19}, + author = {Tanger, IV, John C. and Helgeson, Harold C.}, + journal = {American Journal of Science}, + title = {{C}alculation of the thermodynamic and transport properties of aqueous species at high pressures and temperatures: {R}evised equations of state for the standard partial molal properties of ions and electrolytes}, + year = {1988}, + volume = {288}, + number = {1}, + pages = {19--98}, + doi = {10.2475/ajs.288.1.19}, } @Article{WP02, @@ -517,15 +517,15 @@ } @Article{WE08, - author = {Wu, Martin and Eisen, Jonathan A.}, - journal = {Genome Biology}, - title = {A simple, fast, and accurate method of phylogenomic inference}, - year = {2008}, - volume = {9}, - number = {10}, - pages = {R151}, - doi = {10.1186/gb-2008-9-10-r151}, - issn = {1474-760X}, + author = {Wu, Martin and Eisen, Jonathan A.}, + journal = {Genome Biology}, + title = {{A} simple, fast, and accurate method of phylogenomic inference}, + year = {2008}, + volume = {9}, + number = {10}, + pages = {R151}, + doi = {10.1186/gb-2008-9-10-r151}, + issn = {1474-760X}, } @Article{ZZL_16, @@ -650,6 +650,18 @@ doi = {10.2172/138894}, } + at Article{Man13, + author = {Manning, Craig E.}, + journal = {Reviews in Mineralogy and Geochemistry}, + title = {{T}hermodynamic modeling of fluid-rock interaction at mid-crustal to upper-mantle conditions}, + year = {2013}, + volume = {76}, + number = {1}, + pages = {135--164}, + doi = {10.2138/rmg.2013.76.5}, + issn = {1529-6466}, +} + @Article{Ber88, author = {Berman, R. G.}, journal = {Journal of Petrology}, From noreply at r-forge.r-project.org Fri Jan 25 06:07:31 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 25 Jan 2019 06:07:31 +0100 (CET) Subject: [CHNOSZ-commits] r368 - in pkg/CHNOSZ: . inst vignettes Message-ID: <20190125050731.0BF3F18C4E9@r-forge.r-project.org> Author: jedick Date: 2019-01-25 06:07:29 +0100 (Fri, 25 Jan 2019) New Revision: 368 Added: pkg/CHNOSZ/vignettes/.install_extras pkg/CHNOSZ/vignettes/mklinks.sh Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/inst/CHECKLIST pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/vignettes/anintro.Rmd Log: anintro.Rmd: add 'mklinks.sh' script to add CHNOSZ and R documentation links Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-24 12:36:38 UTC (rev 367) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-25 05:07:29 UTC (rev 368) @@ -1,6 +1,6 @@ -Date: 2019-01-24 +Date: 2019-01-25 Package: CHNOSZ -Version: 1.1.3-75 +Version: 1.1.3-76 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/inst/CHECKLIST =================================================================== --- pkg/CHNOSZ/inst/CHECKLIST 2019-01-24 12:36:38 UTC (rev 367) +++ pkg/CHNOSZ/inst/CHECKLIST 2019-01-25 05:07:29 UTC (rev 368) @@ -26,6 +26,9 @@ - check reverse dependencies: ecipex and canprot packages +- documentation links: after installation, run doc/mklinks.sh + and insert the modified anintro.html in the package + OTHER THINGS TO CHECK: - remove all "<<-" from sources (leftover from debugging) Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2019-01-24 12:36:38 UTC (rev 367) +++ pkg/CHNOSZ/inst/NEWS 2019-01-25 05:07:29 UTC (rev 368) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 1.1.3-75 (2019-01-24) +CHANGES IN CHNOSZ 1.1.3-76 (2019-01-25) --------------------------------------- BUG FIXES @@ -77,9 +77,10 @@ 2009). This depends on the revised nonideal() and new NaCl() functions described above. -- anintro.Rmd: add section on solubility calculations. Also, add - cuprite to mosaic diagram example, and note about implications of - changing balance to 1. +- anintro.Rmd: add section on solubility calculations. Add cuprite to + mosaic diagram example, and note about implications of changing + balance coefficients to 1. Add 'mklinks.sh' script for adding links + to CHNOSZ and R documentation. - Add demo/bison.R (average oxidation state of carbon of metagenome- derived proteins in different microbial phyla at Bison Pool) Added: pkg/CHNOSZ/vignettes/.install_extras =================================================================== --- pkg/CHNOSZ/vignettes/.install_extras (rev 0) +++ pkg/CHNOSZ/vignettes/.install_extras 2019-01-25 05:07:29 UTC (rev 368) @@ -0,0 +1 @@ +mklinks.sh Modified: pkg/CHNOSZ/vignettes/anintro.Rmd =================================================================== --- pkg/CHNOSZ/vignettes/anintro.Rmd 2019-01-24 12:36:38 UTC (rev 367) +++ pkg/CHNOSZ/vignettes/anintro.Rmd 2019-01-25 05:07:29 UTC (rev 368) @@ -1215,7 +1215,7 @@ ``` Adding the `IS` argument to `affinity()`, we can now plot *N*H+ at the given ionic strength. -Here we set `plot.it = FALSE` in `diagram()` because we use the computed ? to make our own plot. +Here we set `plot.it = FALSE` in `diagram()` because we use the computed ? to make our own plot. This is similar to Figure 1.3 of Alberty (2003), but at higher temperature: ```{r ATP, eval=FALSE, echo=12:17} ``` @@ -1302,7 +1302,7 @@ Let's compare experimental values of heat capacity of four proteins, from @PM90, with those calculated using group additivity. After dividing Privalov and Makhatadze's experimental values by the lengths of the proteins to get per-residue values, we convert those to calories, then plot them. -```{r protein_Cp, fig.margin=TRUE, fig.width=4, fig.height=4, small.mar=TRUE, dpi=dpi, out.width="100%", echo=FALSE, message=FALSE, fig.cap='The heat capacity calculated by group additivity closely approximates experimental values for aqueous proteins. For a related figure showing the effects of ionization in the calculations, see ?ionize.aa.', cache=TRUE, pngquant=pngquant, timeit=timeit} +```{r protein_Cp, fig.margin=TRUE, fig.width=4, fig.height=4, small.mar=TRUE, dpi=dpi, out.width="100%", echo=FALSE, message=FALSE, fig.cap='The heat capacity calculated by group additivity closely approximates experimental values for aqueous proteins. For a related figure showing the effects of ionization in the calculations, see `?ionize.aa`.', cache=TRUE, pngquant=pngquant, timeit=timeit} PM90 <- read.csv(system.file("extdata/cpetc/PM90.csv", package = "CHNOSZ")) plength <- protein.length(colnames(PM90)[2:5]) Cp_expt <- t(t(PM90[, 2:5]) / plength) @@ -2190,14 +2190,16 @@ # Document history * 2010-09-30 Initial version. + +* 2012-06-16 Add "More activity diagrams" (section no longer exists). +* 2015-05-14 Add warning about [internal consistency of thermodynamic data](#thermodynamic-database). +* 2017-02-15 Completely rewritten; switch from Sweave to [knitr](https://yihui.name/knitr/) ([Tufte style](https://rstudio.github.io/tufte/)). +* 2019-01-24 Add [section on solubility calculations](#complete-equilibrium-solubility). View the R Markdown source of this document [on R-Forge](https://r-forge.r-project.org/scm/viewvc.php/pkg/CHNOSZ/vignettes/anintro.Rmd?view=markup&root=chnosz) or in R: Added: pkg/CHNOSZ/vignettes/mklinks.sh =================================================================== --- pkg/CHNOSZ/vignettes/mklinks.sh (rev 0) +++ pkg/CHNOSZ/vignettes/mklinks.sh 2019-01-25 05:07:29 UTC (rev 368) @@ -0,0 +1,97 @@ +# CHNOSZ/vignettes/mklinks.sh +# add documentation links to anintro.html +# 20190125 jmd + +# add links to help topics +# set background-image:none to remove underlines (from bootstrap theme) +sed -i 's/?`CHNOSZ-package`<\/code>/?`CHNOSZ-package`<\/a><\/code>/g' anintro.html +sed -i 's/?basis<\/code>/?basis<\/a><\/code>/g' anintro.html +sed -i 's/?buffer<\/code>/?buffer<\/a><\/code>/g' anintro.html +sed -i 's/?solubility<\/code>/?solubility<\/a><\/code>/g' anintro.html +sed -i 's/?ionize.aa<\/code>/?ionize.aa<\/a><\/code>/g' anintro.html +sed -i 's/?count.aa<\/code>/?count.aa<\/a><\/code>/g' anintro.html +sed -i 's/?objective<\/code>/?objective<\/a><\/code>/g' anintro.html +sed -i 's/?thermo<\/code>/?thermo<\/a><\/code>/g' anintro.html +sed -i 's/?hkf<\/code>/?hkf<\/a><\/code>/g' anintro.html +sed -i 's/?cgl<\/code>/?cgl<\/a><\/code>/g' anintro.html +sed -i 's/?water<\/code>/?water<\/a><\/code>/g' anintro.html +sed -i 's/?subcrt<\/code>/?subcrt<\/a><\/code>/g' anintro.html +sed -i 's/?EOSregress<\/code>/?EOSregress<\/a><\/code>/g' anintro.html +sed -i 's/?wjd<\/code>/?wjd<\/a><\/code>/g' anintro.html +sed -i 's/?taxonomy<\/code>/?taxonomy<\/a><\/code>/g' anintro.html + +# add links to function names +# start at line 120 (below the TOC) +sed -i '120,$s/info()<\/code>/info()<\/a><\/code>/g' anintro.html +sed -i '120,$s/ZC()<\/code>/ZC()<\/a><\/code>/g' anintro.html +sed -i '120,$s/affinity()<\/code>/affinity()<\/a><\/code>/g' anintro.html +sed -i '120,$s/thermo.refs()<\/code>/thermo.refs()<\/a><\/code>/g' anintro.html +sed -i '120,$s/makeup()<\/code>/makeup()<\/a><\/code>/g' anintro.html +sed -i '120,$s/as.chemical.formula()<\/code>/as.chemical.formula()<\/a><\/code>/g' anintro.html +sed -i '120,$s/subcrt()<\/code>/subcrt()<\/a><\/code>/g' anintro.html +sed -i '120,$s/T.units()<\/code>/T.units()<\/a><\/code>/g' anintro.html +sed -i '120,$s/E.units()<\/code>/E.units()<\/a><\/code>/g' anintro.html +sed -i '120,$s/P.units()<\/code>/P.units()<\/a><\/code>/g' anintro.html +sed -i '120,$s/equilibrate()<\/code>/equilibrate()<\/a><\/code>/g' anintro.html +sed -i '120,$s/diagram()<\/code>/diagram()<\/a><\/code>/g' anintro.html +sed -i '120,$s/basis()<\/code>/basis()<\/a><\/code>/g' anintro.html +sed -i '120,$s/species()<\/code>/species()<\/a><\/code>/g' anintro.html +sed -i '120,$s/data(thermo)<\/code>/data(thermo)<\/a><\/code>/g' anintro.html +sed -i '120,$s/describe.reaction()<\/code>/describe.reaction()<\/a><\/code>/g' anintro.html +sed -i '120,$s/swap.basis()<\/code>/swap.basis()<\/a><\/code>/g' anintro.html +sed -i '120,$s/water.lines()<\/code>/water.lines()<\/a><\/code>/g' anintro.html +sed -i '120,$s/ratlab()<\/code>/ratlab()<\/a><\/code>/g' anintro.html +sed -i '120,$s/mosaic()<\/code>/mosaic()<\/a><\/code>/g' anintro.html +sed -i '120,$s/convert()<\/code>/convert()<\/a><\/code>/g' anintro.html +sed -i '120,$s/mod.buffer()<\/code>/mod.buffer()<\/a><\/code>/g' anintro.html +sed -i '120,$s/thermo\$/thermo<\/a>\$/g' anintro.html +sed -i '120,$s/solubility()<\/code>/solubility()<\/a><\/code>/g' anintro.html +sed -i '120,$s/ZC.col()<\/code>/ZC.col()<\/a><\/code>/g' anintro.html +sed -i '120,$s/aminoacids(\"\")<\/code>/aminoacids(\"\")<\/a><\/code>/g' anintro.html +sed -i '120,$s/expr.species()<\/code>/expr.species()<\/a><\/code>/g' anintro.html +sed -i '120,$s/nonideal()<\/code>/nonideal()<\/a><\/code>/g' anintro.html +sed -i '120,$s/pinfo()<\/code>/pinfo()<\/a><\/code>/g' anintro.html +sed -i '120,$s/protein.length()<\/code>/protein.length()<\/a><\/code>/g' anintro.html +sed -i '120,$s/protein.formula()<\/code>/protein.formula()<\/a><\/code>/g' anintro.html +sed -i '120,$s/ionize.aa()<\/code>/ionize.aa()<\/a><\/code>/g' anintro.html +sed -i '120,$s/read.fasta()<\/code>/read.fasta()<\/a><\/code>/g' anintro.html +sed -i '120,$s/protein.basis()<\/code>/protein.basis()<\/a><\/code>/g' anintro.html +sed -i '120,$s/yeastgfp()<\/code>/yeastgfp()<\/a><\/code>/g' anintro.html +sed -i '120,$s/unitize()<\/code>/unitize()<\/a><\/code>/g' anintro.html +sed -i '120,$s/revisit()<\/code>/revisit()<\/a><\/code>/g' anintro.html +sed -i '120,$s/axis.label()<\/code>/axis.label()<\/a><\/code>/g' anintro.html +sed -i '120,$s/yeast.aa()<\/code>/yeast.aa()<\/a><\/code>/g' anintro.html +sed -i '120,$s/seq2aa()<\/code>/seq2aa()<\/a><\/code>/g' anintro.html +sed -i '120,$s/uniprot.aa()<\/code>/uniprot.aa()<\/a><\/code>/g' anintro.html +sed -i '120,$s/add.protein()<\/code>/add.protein()<\/a><\/code>/g' anintro.html +sed -i '120,$s/aminoacids()<\/code>/aminoacids()<\/a><\/code>/g' anintro.html +sed -i '120,$s/findit()<\/code>/findit()<\/a><\/code>/g' anintro.html +sed -i '120,$s/add.obigt()<\/code>/add.obigt()<\/a><\/code>/g' anintro.html +sed -i '120,$s/mod.obigt()<\/code>/mod.obigt()<\/a><\/code>/g' anintro.html +sed -i '120,$s/today()<\/code>/today()<\/a><\/code>/g' anintro.html +sed -i '120,$s/checkGHS()<\/code>/checkGHS()<\/a><\/code>/g' anintro.html +sed -i '120,$s/checkEOS()<\/code>/checkEOS()<\/a><\/code>/g' anintro.html +sed -i '120,$s/equil.reaction()<\/code>/equil.reaction()<\/a><\/code>/g' anintro.html +sed -i '120,$s/EOSregress()<\/code>/EOSregress()<\/a><\/code>/g' anintro.html +sed -i '120,$s/wjd()<\/code>/wjd()<\/a><\/code>/g' anintro.html +sed -i '120,$s/RH2obigt()<\/code>/RH2obigt()<\/a><\/code>/g' anintro.html +sed -i '120,$s/eqdata()<\/code>/eqdata()<\/a><\/code>/g' anintro.html + +# functions from R base packages +sed -i '120,$s/install.packages/install.packages<\/a>/g' anintro.html +sed -i '120,$s/library/library<\/a>/g' anintro.html +sed -i '120,$s/help()/help()<\/a>/g' anintro.html +sed -i '120,$s/help.start()/help.start()<\/a>/g' anintro.html +sed -i '120,$s/write.table/write.table<\/a>/g' anintro.html +sed -i '120,$s/plot()<\/code>/plot()<\/a><\/code>/g' anintro.html +sed -i '120,$s/lapply()/lapply()<\/a>/g' anintro.html +sed -i '120,$s/do.call()/do.call()<\/a>/g' anintro.html +sed -i '120,$s/rbind()/rbind()<\/a>/g' anintro.html +sed -i '120,$s/matplot()/matplot()<\/a>/g' anintro.html +sed -i '120,$s/unlist()/unlist()<\/a>/g' anintro.html +sed -i '120,$s/heat.colors()/heat.colors()<\/a>/g' anintro.html +sed -i '120,$s/read.csv()/read.csv()<\/a>/g' anintro.html +sed -i '120,$s/seq()/seq()<\/a>/g' anintro.html +sed -i '120,$s/substitute()/substitute()<\/a>/g' anintro.html +sed -i '120,$s/for()/for()<\/a>/g' anintro.html +sed -i '120,$s/browseURL()/browseURL()<\/a>/g' anintro.html Property changes on: pkg/CHNOSZ/vignettes/mklinks.sh ___________________________________________________________________ Added: svn:executable + * From noreply at r-forge.r-project.org Fri Jan 25 07:54:37 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 25 Jan 2019 07:54:37 +0100 (CET) Subject: [CHNOSZ-commits] r369 - in pkg/CHNOSZ: . inst vignettes Message-ID: <20190125065437.EA7991869D5@r-forge.r-project.org> Author: jedick Date: 2019-01-25 07:54:35 +0100 (Fri, 25 Jan 2019) New Revision: 369 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/inst/CHECKLIST pkg/CHNOSZ/vignettes/anintro.Rmd Log: DESCRIPTION: remove Suggests: RSVGTipsDevice Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-25 05:07:29 UTC (rev 368) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-25 06:54:35 UTC (rev 369) @@ -1,6 +1,6 @@ Date: 2019-01-25 Package: CHNOSZ -Version: 1.1.3-76 +Version: 1.1.3-77 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), @@ -12,7 +12,7 @@ R Core Team [ctb] (code derived from R's pmax()) Maintainer: Jeffrey Dick Depends: R (>= 3.1.0) -Suggests: limSolve, testthat, knitr, rmarkdown, tufte, RSVGTipsDevice +Suggests: limSolve, testthat, knitr, rmarkdown, tufte Imports: grDevices, graphics, stats, utils Description: An integrated set of tools for thermodynamic calculations in geochemistry and compositional biology. The thermodynamic properties of liquid water are calculated using Fortran code from Modified: pkg/CHNOSZ/inst/CHECKLIST =================================================================== --- pkg/CHNOSZ/inst/CHECKLIST 2019-01-25 05:07:29 UTC (rev 368) +++ pkg/CHNOSZ/inst/CHECKLIST 2019-01-25 06:54:35 UTC (rev 369) @@ -29,6 +29,9 @@ - documentation links: after installation, run doc/mklinks.sh and insert the modified anintro.html in the package +- reduce size of vignettes: after upgrading rmarkdown, replace files in + rmarkdown/rmd/h/bootstrap/fonts/ with empty files + OTHER THINGS TO CHECK: - remove all "<<-" from sources (leftover from debugging) Modified: pkg/CHNOSZ/vignettes/anintro.Rmd =================================================================== --- pkg/CHNOSZ/vignettes/anintro.Rmd 2019-01-25 05:07:29 UTC (rev 368) +++ pkg/CHNOSZ/vignettes/anintro.Rmd 2019-01-25 06:54:35 UTC (rev 369) @@ -21,8 +21,6 @@ bibliography: vig.bib link-citations: yes csl: elementa.csl -# note: this may be needed for margin references in next version of tufte: -#tufte_features: ["background", "margin_references"] --- ```{r options, include=FALSE} From noreply at r-forge.r-project.org Sat Jan 26 04:35:10 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 26 Jan 2019 04:35:10 +0100 (CET) Subject: [CHNOSZ-commits] r370 - in pkg/CHNOSZ: . vignettes Message-ID: <20190126033510.6CB1618AE65@r-forge.r-project.org> Author: jedick Date: 2019-01-26 04:35:08 +0100 (Sat, 26 Jan 2019) New Revision: 370 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/vignettes/anintro.Rmd pkg/CHNOSZ/vignettes/mklinks.sh Log: anintro.Rmd: use auto-detected phase transitions for chalcocite Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-25 06:54:35 UTC (rev 369) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-26 03:35:08 UTC (rev 370) @@ -1,6 +1,6 @@ -Date: 2019-01-25 +Date: 2019-01-26 Package: CHNOSZ -Version: 1.1.3-77 +Version: 1.1.3-78 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/vignettes/anintro.Rmd =================================================================== --- pkg/CHNOSZ/vignettes/anintro.Rmd 2019-01-25 06:54:35 UTC (rev 369) +++ pkg/CHNOSZ/vignettes/anintro.Rmd 2019-01-26 03:35:08 UTC (rev 370) @@ -663,14 +663,6 @@ info(" CuCl") ``` -We wish to include chalcocite (Cu2S) in the system. -This mineral undergoes phase transitions; to find out the temperatures of the phase transitions, we can also use `info()`: -```{r info_chalcocite, message=FALSE} -info(info("chalcocite", c("cr", "cr2", "cr3")))$T -``` - -Those are temperatures in Kelvin (regardless of the `T.units()`); at 200 ?C we should use the second phase. - Next we define the basis, and set the activities of the H2S and Cl- basis species. These represent the total activity of S and Cl in the system, which are distributed among the minerals and aqueous species. Four minerals and the aqueous copper chloride species are included: @@ -678,11 +670,17 @@ basis(c("Cu", "H2S", "Cl-", "H2O", "H+", "e-")) basis("H2S", -6) basis("Cl-", -0.7) -species(c("copper", "cuprite", "tenorite")) -species("chalcocite", "cr2") species(c("CuCl", "CuCl2-", "CuCl3-2", "CuCl+", "CuCl2", "CuCl3-", "CuCl4-2")) +species(c("chalcocite", "tenorite", "cuprite", "copper")) ``` +Note that chalcocite (Cu2S) undergoes phase transitions. +To get the temperatures of the phase transitions from `thermo$obigt` (in Kelvin, regardless of the `T.units()`), we can use `info()`. +We see that at 200 ?C (473.15 K) the second phase is stable; this one is automatially used by CHNOSZ for this diagram. +```{r info_chalcocite, message=FALSE} +info(info("chalcocite", c("cr", "cr2", "cr3")))$T +``` + We use `mosaic()` to generate and combine diagrams for each candidate basis species (H2S, HS-, HSO4-, or SO4-2) as a function of Eh and pH. The key argument is `bases`, which identifies the candidate basis species, starting with the one in the current basis. The other arguments, like those of `affinity()`, specify the ranges of the variables; `res` indicates the grid resolution to use for each variable (the default is 128). @@ -691,25 +689,24 @@ ```{r copper_mosaic, fig.margin=TRUE, fig.width=4, fig.height=4, dpi=dpi, out.width="100%", message=FALSE, cache=TRUE, fig.cap="Copper minerals and aqueous complexes with chloride, 200 ?C.", pngquant=pngquant, timeit=timeit} T <- 200 -res <- 200 +res <- 300 bases <- c("H2S", "HS-", "HSO4-", "SO4-2") m1 <- mosaic(bases, blend = TRUE, pH = c(0, 12, res), Eh=c(-1.2, 0.75, res), T=T) diagram(m1$A.species, lwd = 2, fill = NA, limit.water = FALSE) -diagram(m1$A.bases, add = TRUE, col = "blue", col.names = "blue", lty = 2, - limit.water = FALSE) -water.lines(m1$A.species, col = "red", lwd = 2, lty = 3) +diagram(m1$A.bases, add = TRUE, col = "red1", col.names = "red1", lty = 2, + limit.water = FALSE, italic = TRUE) +water.lines(m1$A.species, col = "blue1", lty = 3) ``` -The argument `blend = TRUE` is used to combine the diagrams according to the equilibrium activities of the basis species by themselves ([see below](#equilibration)). -The smooth transitions between basis species cause the appearance of curved lines on the plot. +The argument `blend = TRUE` is used to combine the diagrams according to the relative abundances of the basis species along with a mixing term (see `?mosaic`). +The smooth transitions between basis species can result in curved field boundaries, in this case around the chalcocite field. Without that argument, the diagrams would be combined using the dominant basis species, and all of the line segments would be straight. -Note that this diagram is balanced on Cu, so that no Cu appears in reactions between any two other species (minerals or aqueous species). +The reactions used to make this diagram are balanced on Cu, so that no Cu appears in reactions between any two other species (minerals or aqueous species). If `diagram()` is run with `balance = 1`, then the reactions are written for one mole of the mineral formulas on each side of the reaction, with the possibility of Cu appearing as an additional species to conserve the elements. This may be problematic, as Cu would be be present in some reactions in Eh-pH space where it is not a stable phase. However, it is common in low-temperature aqueous geochemical calculations to "turn off" particular redox reactions that are not thought to attain equilibrium, so decoupling a species from equilibrium may be justified in some circumstances. -Therefore, while changing the balance constraints has important implications that should be carefully considered, it can present a possibly useful view of the system if certain assumptions are met. -Changing the balance to 1 results in the loss of the tenorite stability field and extension of chalcocite stability to pH < 0, as shown in Figure 5a of @CPCC17. +Changing the balance to 1 results in the loss of the tenorite stability field and extension of chalcocite stability to lower pH, as shown in Figure 5a of @CPCC17. We have seen the effects of speciation of S in the basis species. @@ -723,11 +720,11 @@ if (names(newvar) == "O2") basis("O2", "gas") mosaicargs <- c(list(bases), blend=TRUE, pH=list(c(-2, 12, res)), newvar, T=T) m1 <- do.call(mosaic, mosaicargs) - diagram(m1$A.species, lwd = 2, fill = rev(topo.colors(10)), + diagram(m1$A.species, lwd = 2, fill = "terrain", limit.water = FALSE) - diagram(m1$A.bases, add = TRUE, col = "blue", col.names = "blue", lty = 3, - limit.water = FALSE) - water.lines(m1$A.species, col = "red", lwd = 2, lty = 3) + diagram(m1$A.bases, add = TRUE, col = "red1", col.names = "red1", lty = 2, + limit.water = FALSE, italic = TRUE) + water.lines(m1$A.species, col = "blue1", lty = 3) swap.basis(names(newvar), "e-") } par(mfrow = c(1, 3)) Modified: pkg/CHNOSZ/vignettes/mklinks.sh =================================================================== --- pkg/CHNOSZ/vignettes/mklinks.sh 2019-01-25 06:54:35 UTC (rev 369) +++ pkg/CHNOSZ/vignettes/mklinks.sh 2019-01-26 03:35:08 UTC (rev 370) @@ -6,6 +6,7 @@ # set background-image:none to remove underlines (from bootstrap theme) sed -i 's/?`CHNOSZ-package`<\/code>/?`CHNOSZ-package`<\/a><\/code>/g' anintro.html sed -i 's/?basis<\/code>/?basis<\/a><\/code>/g' anintro.html +sed -i 's/?mosaic<\/code>/?mosaic<\/a><\/code>/g' anintro.html sed -i 's/?buffer<\/code>/?buffer<\/a><\/code>/g' anintro.html sed -i 's/?solubility<\/code>/?solubility<\/a><\/code>/g' anintro.html sed -i 's/?ionize.aa<\/code>/?ionize.aa<\/a><\/code>/g' anintro.html From noreply at r-forge.r-project.org Sun Jan 27 03:35:07 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 27 Jan 2019 03:35:07 +0100 (CET) Subject: [CHNOSZ-commits] r371 - in pkg/CHNOSZ: . R inst tests/testthat Message-ID: <20190127023508.65CA618BBCB@r-forge.r-project.org> Author: jedick Date: 2019-01-27 03:35:05 +0100 (Sun, 27 Jan 2019) New Revision: 371 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/affinity.R pkg/CHNOSZ/R/util.affinity.R pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/tests/testthat/test-affinity.R pkg/CHNOSZ/tests/testthat/test-util.affinity.R Log: affinity(): invalid variable names give error Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-26 03:35:08 UTC (rev 370) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-27 02:35:05 UTC (rev 371) @@ -1,6 +1,6 @@ -Date: 2019-01-26 +Date: 2019-01-27 Package: CHNOSZ -Version: 1.1.3-78 +Version: 1.1.3-79 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/R/affinity.R =================================================================== --- pkg/CHNOSZ/R/affinity.R 2019-01-26 03:35:08 UTC (rev 370) +++ pkg/CHNOSZ/R/affinity.R 2019-01-27 02:35:05 UTC (rev 371) @@ -56,11 +56,6 @@ mybasis <- thermo$basis myspecies <- thermo$species - # stop if Eh or pe is requested but e- isn't in the basis - if(any(c("Eh", "pe") %in% names(args$lims))) { - if(!"e-" %in% rownames(mybasis)) stop("variable Eh or pe requested but e- isn't in the basis") - } - if(!is.null(property)) { # the user just wants an energy property buffer <- FALSE Modified: pkg/CHNOSZ/R/util.affinity.R =================================================================== --- pkg/CHNOSZ/R/util.affinity.R 2019-01-26 03:35:08 UTC (rev 370) +++ pkg/CHNOSZ/R/util.affinity.R 2019-01-27 02:35:05 UTC (rev 371) @@ -1,6 +1,9 @@ # CHNOSZ/util-affinity.R # helper functions for affinity() +## if this file is interactively sourced, the following are also needed to provide unexported functions: +#source("util.units.R") + slice.affinity <- function(affinity,d=1,i=1) { # take a slice of affinity along one dimension a <- affinity @@ -276,7 +279,7 @@ what <- "A" vars <- character() vals <- list(NA) - # this needs to have 1 as the third component b/c + # this needs to have 1 as the third component because # energy() uses it to build an array with the given dimension lims <- list(c(NA, NA, 1)) # clean out non-variables @@ -298,13 +301,9 @@ names(args)[i] <- "H+" if(transect) args[[i]] <- -args[[i]] else args[[i]][1:2] <- -args[[i]][1:2] - if(!'H+' %in% rownames(thermo$basis)) - message('affinity: pH requested, but no H+ in the basis') } if(names(args)[i]=="pe") { names(args)[i] <- "e-" - if(!'e-' %in% rownames(thermo$basis)) - message('affinity: pe requested, but no e- in the basis') if(transect) args[[i]] <- -args[[i]] else args[[i]][1:2] <- -args[[i]][1:2] } @@ -325,8 +324,15 @@ # physical state ibasis <- match(nametxt, rownames(thermo$basis)) if(isTRUE(as.logical(ibasis))) { - if(thermo$basis$state[ibasis]=="gas") nametxt <- paste("log_f(", nametxt, ")", sep="") - else nametxt <- paste("log_a(", nametxt, ")", sep="") + if(thermo$basis$state[ibasis]=="gas") nametxt <- paste("log10(f_", nametxt, ")", sep="") + else nametxt <- paste("log10(a_", nametxt, ")", sep="") + } else { + # stop if the argument doesn't correspond to a basis species, T, P, or IS + if(!nametxt %in% c("T", "P", "IS")) { + if(! (nametxt=="pH" & 'H+' %in% rownames(thermo$basis) | nametxt %in% c("pe", "Eh") & 'e-' %in% rownames(thermo$basis))) { + stop(nametxt, " is not one of T, P, or IS, and does not match any basis species") + } + } } # temperature and pressure and Eh if(nametxt=="T") unittxt <- " K" Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2019-01-26 03:35:08 UTC (rev 370) +++ pkg/CHNOSZ/inst/NEWS 2019-01-27 02:35:05 UTC (rev 371) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 1.1.3-76 (2019-01-25) +CHANGES IN CHNOSZ 1.1.3-79 (2019-01-27) --------------------------------------- BUG FIXES @@ -208,7 +208,7 @@ (sinfo -> ispecies, inpho -> iphases, sinph -> phasespecies). - info(): display mineral names instead of just "cr" in messages (e.g. - with info("SiO2")). + for info("SiO2")). - Add C implementation of counting occurrences of all letters in a string (src/count_letters.c) to speed up operation of count.aa(). @@ -223,6 +223,8 @@ - In subcrt(), improve error message for invalid property names. +- In affinity(), make invalid variable names an error. + CHANGES IN CHNOSZ 1.1.3 (2017-11-13) ------------------------------------ Modified: pkg/CHNOSZ/tests/testthat/test-affinity.R =================================================================== --- pkg/CHNOSZ/tests/testthat/test-affinity.R 2019-01-26 03:35:08 UTC (rev 370) +++ pkg/CHNOSZ/tests/testthat/test-affinity.R 2019-01-27 02:35:05 UTC (rev 371) @@ -3,12 +3,19 @@ # clear out any previous basis definition or database alterations suppressMessages(data(thermo)) -test_that("errors come as expected, and output gives T and P in user's units", { +test_that("errors come as expected", { expect_error(affinity(iprotein=7), "basis species are not defined") expect_error(affinity(iprotein=NA), "has some NA values") expect_error(affinity(iprotein=0), "are not rownumbers") basis("CHNOS") expect_error(affinity(), "species have not been defined") + species("CO2") + expect_error(affinity(pe=c(-10, 10), pH=c(0, 14)), "pe.*does not match any basis species") + expect_error(affinity(O2=c(-80, -60), pH=c(0, 14)), "pH.*does not match any basis species") +}) + +test_that("output gives T and P in user's units", { + basis("CHNOS") species("5a(H),14b(H)-cholestane") a.C_bar <- affinity(T=c(0, 100, 10), P=c(10, 1000, 10)) expect_equal(range(a.C_bar$vals[[1]]), c(0, 100)) Modified: pkg/CHNOSZ/tests/testthat/test-util.affinity.R =================================================================== --- pkg/CHNOSZ/tests/testthat/test-util.affinity.R 2019-01-26 03:35:08 UTC (rev 370) +++ pkg/CHNOSZ/tests/testthat/test-util.affinity.R 2019-01-27 02:35:05 UTC (rev 371) @@ -17,8 +17,7 @@ # (because the conversion from Eh is a function of temperature) # here, the original length of the Eh variable is 3, so that should be retained by A.ionization # we need a basis() for the function to poke around in - # (no e- or H+ needed at this time though) - basis("CHNOS") + basis("CHNOSe") ea <- energy.args(list(CO2=c(-5, 0, 6), pH=c(0, 14, 2), Eh=c(-1, 0, 3), T=c(25, 28, 4))) A <- A.ionization(1, ea$vars, ea$vals) expect_equal(dim(A[[1]]), c(6, 2, 3, 4)) From noreply at r-forge.r-project.org Sun Jan 27 06:50:12 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 27 Jan 2019 06:50:12 +0100 (CET) Subject: [CHNOSZ-commits] r372 - in pkg/CHNOSZ: . R demo inst man vignettes Message-ID: <20190127055012.71B6A18C510@r-forge.r-project.org> Author: jedick Date: 2019-01-27 06:50:10 +0100 (Sun, 27 Jan 2019) New Revision: 372 Added: pkg/CHNOSZ/demo/saturation.R Removed: pkg/CHNOSZ/demo/activity_ratios.R Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/diagram.R pkg/CHNOSZ/R/examples.R pkg/CHNOSZ/demo/00Index pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/man/diagram.Rd pkg/CHNOSZ/man/examples.Rd pkg/CHNOSZ/man/util.expression.Rd pkg/CHNOSZ/vignettes/anintro.Rmd pkg/CHNOSZ/vignettes/eos-regress.Rmd pkg/CHNOSZ/vignettes/vig.bib Log: replace demo/activity_ratios.R with demo/saturation.R Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-27 02:35:05 UTC (rev 371) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-27 05:50:10 UTC (rev 372) @@ -1,6 +1,6 @@ Date: 2019-01-27 Package: CHNOSZ -Version: 1.1.3-79 +Version: 1.1.3-80 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/R/diagram.R =================================================================== --- pkg/CHNOSZ/R/diagram.R 2019-01-27 02:35:05 UTC (rev 371) +++ pkg/CHNOSZ/R/diagram.R 2019-01-27 05:50:10 UTC (rev 372) @@ -578,6 +578,7 @@ } # colors and curves (predominance), or contours (properties) if(identical(predominant, NA)) { + contour.method <- rep(contour.method, length.out=length(plotvals)) if(type=="saturation") { # for saturation plot, contour affinity=0 for all species for(i in 1:length(plotvals)) { @@ -591,15 +592,15 @@ message("diagram: beyond range for saturation line of ", names[i]) next } - if(identical(contour.method, NULL) | identical(contour.method, NA) | identical(contour.method, "")) + if(identical(contour.method, NULL) | identical(contour.method[1], NA) | identical(contour.method[1], "")) contour(xs, ys, zs, add=TRUE, col=col, lty=lty, lwd=lwd, labcex=cex, levels=0, labels=names[i], drawlabels=FALSE) - else contour(xs, ys, zs, add=TRUE, col=col, lty=lty, lwd=lwd, labcex=cex, levels=0, labels=names[i], method=contour.method) + else contour(xs, ys, zs, add=TRUE, col=col, lty=lty, lwd=lwd, labcex=cex, levels=0, labels=names[i], method=contour.method[i]) } } else { # contour solubilities (loga.balance), or properties using first species only if(length(plotvals) > 1) warning("showing only first species in 2-D property diagram") zs <- plotvals[[1]] - contour(xs, ys, zs, add=TRUE, col=col, lty=lty, lwd=lwd, labcex=cex, method=contour.method) + contour(xs, ys, zs, add=TRUE, col=col, lty=lty, lwd=lwd, labcex=cex, method=contour.method[1]) } pn <- list(namesx=NULL, namesy=NULL, inames=NULL) } else { Modified: pkg/CHNOSZ/R/examples.R =================================================================== --- pkg/CHNOSZ/R/examples.R 2019-01-27 02:35:05 UTC (rev 371) +++ pkg/CHNOSZ/R/examples.R 2019-01-27 05:50:10 UTC (rev 372) @@ -28,7 +28,7 @@ demos <- function(which=c("sources", "protein.equil", "affinity", "NaCl", "density", "ORP", "revisit", "findit", "ionize", "buffer", "protbuff", "yeastgfp", "mosaic", - "copper", "solubility", "gold", "wjd", "bugstab", "Shh", "activity_ratios", + "copper", "solubility", "gold", "wjd", "bugstab", "Shh", "saturation", "adenine", "DEW", "lambda", "TCA", "go-IU", "bison"), save.png=FALSE) { # run one or more demos from CHNOSZ with ask=FALSE, and return the value of the last one for(i in 1:length(which)) { Modified: pkg/CHNOSZ/demo/00Index =================================================================== --- pkg/CHNOSZ/demo/00Index 2019-01-27 02:35:05 UTC (rev 371) +++ pkg/CHNOSZ/demo/00Index 2019-01-27 05:50:10 UTC (rev 372) @@ -18,7 +18,7 @@ dehydration log K of dehydration reactions; SVG file contains tooltips and links bugstab Formation potential of microbial proteins in colorectal cancer Shh Affinities of transcription factors relative to Sonic hedgehog -activity_ratios Mineral stability plots with activity ratios on the axes +saturation Equilibrium activity diagram showing activity ratios and mineral saturation limits adenine HKF parameters regressed from heat capacity and volume of aqueous adenine DEW Deep Earth Water (DEW) model for high pressures lambda Thermodynamic properties of lambda transition in quartz Deleted: pkg/CHNOSZ/demo/activity_ratios.R =================================================================== --- pkg/CHNOSZ/demo/activity_ratios.R 2019-01-27 02:35:05 UTC (rev 371) +++ pkg/CHNOSZ/demo/activity_ratios.R 2019-01-27 05:50:10 UTC (rev 372) @@ -1,66 +0,0 @@ -## Equilibrium activity diagrams for minerals using activity ratios as variables -## These are made with pH = 0 (activity of H+ = 1), so (activity of the ion) is equal to -## (activity of the ion) / [(activity of H+) ^ (charge of the ion)] - -opar <- par(mfrow = c(2, 2)) -res <- 200 -fill <- "terrain" - -data(thermo) -## get data for gibbsite from the SUPCRT92 database, without loading minerals that -## have been superseded by the Berman dataset (the default in CHNOSZ) -add.obigt("SUPCRT92", "gibbsite") -## or, get data for gibbsite and Al-bearing aqueous species from the SUPCRTBL database -#add.obigt("SUPCRTBL") - -## K2O-Al2O3-SiO2-H2O, 25 degree C, 1 bar -## Steinmann et al., 1994 (http://ccm.geoscienceworld.org/content/42/2/197) -## Garrels and Christ, p. 361 (http://www.worldcat.org/oclc/517586) -## https://wwwbrr.cr.usgs.gov/projects/GWC_coupled/phreeqc/html/final-75.html -basis(c("Al+3", "pseudo-H4SiO4", "K+", "H2O", "H+", "O2")) -species(c("gibbsite", "muscovite", "kaolinite", "pyrophyllite", "K-feldspar")) -a <- affinity(H4SiO4 = c(-6, -2, res), `K+` = c(-3, 6, res)) -diagram(a, ylab = ratlab("K+"), fill = fill, yline = 1.7) -title(main = syslab(c("K2O", "Al2O3", "SiO2", "H2O"))) -legend("bottomleft", describe.property(c("T", "P"), c(25, 1)), bty = "n") - -## H2O-CaO-MgO-SiO2 at 300 degree C and 1000 bar -## Helgeson et al., 1969, p. 136 (http://www.worldcat.org/oclc/902423149) -## Bowers et al., 1984, p. 246 (http://www.worldcat.org/oclc/224591948) -basis(c("H2O", "Ca+2", "Mg+2", "SiO2", "O2", "H+")) -species(c("quartz", "talc", "chrysotile", "forsterite", "tremolite", - "diopside", "wollastonite", "monticellite", "merwinite")) -# calculate the chemical affinities of formation reactions -a <- affinity("Mg+2" = c(4, 9, res), "Ca+2" = c(5, 14, res), T = 300, P = 1000) -diagram(a, xlab = ratlab("Mg+2"), ylab = ratlab("Ca+2"), fill = fill, yline = 1.7) -title(main = syslab(c("H2O", "CaO", "MgO", "SiO2"))) -legend("bottomright", describe.property(c("T", "P"), c(300, 1000)), bty = "n") -# note: Bowers et al. use more complicated variables -# (involving the hydration numbers of H2O and the ion) -# with accordingly different axis ranges - -## MgO-CaO-SiO2-H2O at 300 degree C and Psat -## Russell et al., 2010 (https://doi.org/10.1111/j.1472-4669.2010.00249.x) -basis(c("Mg+2", "Ca+2", "SiO2", "H2O", "O2", "H+")) -species(c("brucite", "chrysotile", "talc", "tremolite", "diopside", "akermanite")) -a <- affinity(SiO2 = c(-10, 0, res), `Ca+2` = c(0, 20, res), T = 300) -diagram(a, ylab = ratlab("Ca+2"), fill = fill, yline = 1.7) -title(main = syslab(c("MgO", "CaO", "SiO2", "H2O"))) -legend("topright", describe.property(c("T", "P"), c(300, 85.84)), bty = "n") - -## CaO-MgO-SiO2-H2O and -## CaO-Al2O3-MgO-SiO2-H2O at 300 degree C and 500 bar -## Bach and Klein, 2009 (https://doi.org/10.1016/j.lithos.2008.10.022) -basis(c("Ca+2", "Al+3", "Mg+2", "SiO2", "H2O", "O2", "H+")) -species(c("clinochlore", "clinozoisite", "prehnite", "grossular")) -a <- affinity(SiO2 = c(-5, 0, res), `Ca+2` = c(6, 11, res), T = 300, P = 500) -diagram(a, ylab = ratlab("Ca+2"), balance = "Al+3", fill = fill, yline = 1.7) -# (Hmmm... where is clinochlore? it doesn't appear on our diagram) -species(delete = TRUE) -species(c("brucite", "chrysotile", "talc", "tremolite", "diopside")) -a <- affinity(SiO2 = c(-5, 0, res), `Ca+2` = c(6, 11, res), T = 300, P = 500) -diagram(a, add = TRUE, col = "blue", col.names = "blue") -title(main = syslab(c("CaO", "Al2O3", "MgO", "SiO2", "H2O"))) -legend("topright", describe.property(c("T", "P"), c(300, 500)), bty = "n") - -par(opar) Copied: pkg/CHNOSZ/demo/saturation.R (from rev 371, pkg/CHNOSZ/demo/activity_ratios.R) =================================================================== --- pkg/CHNOSZ/demo/saturation.R (rev 0) +++ pkg/CHNOSZ/demo/saturation.R 2019-01-27 05:50:10 UTC (rev 372) @@ -0,0 +1,37 @@ +# CHNOSZ/demo/saturation.R +# first version (activity_ratios.R) 20170217 +# keep one diagram and add saturation lines 20190127 + +## Make equilibrium activity diagrams including saturation limits +## and using activity ratios as variables + +# The ratios are calculated with pH = 0 (activity of H+ = 1), so (activity of the ion) is equal to +# (activity of the ion) / [(activity of H+) ^ (charge of the ion)] + +# NOTE: Bowers et al. use more complicated variables +# (involving the hydration numbers of H2O and the ion) +# with subsequently different axis ranges + +## H2O-CaO-MgO-SiO2 at 300 degree C and 1000 bar +## Helgeson et al., 1969, p. 136 (http://www.worldcat.org/oclc/902423149) +## Bowers et al., 1984, p. 246 (http://www.worldcat.org/oclc/224591948) +par(cex = 1.4) +basis(c("H2O", "carbon dioxide", "Ca+2", "Mg+2", "SiO2", "O2", "H+")) +species(c("quartz", "talc", "chrysotile", "forsterite", "tremolite", + "diopside", "wollastonite", "monticellite", "merwinite")) +# calculate the chemical affinities of formation reactions +a <- affinity("Mg+2" = c(4, 10, 500), "Ca+2" = c(5, 15, 500), T = 300, P = 1000) +diagram(a, xlab = ratlab("Mg+2"), ylab = ratlab("Ca+2"), fill = "terrain", yline = 1.7) + +# add saturation limits for specified CO2 fugacity +basis("CO2", -1) +species(delete = TRUE) +species(c("calcite", "dolomite", "magnesite", "brucite")) +a <- affinity("Mg+2" = c(4, 10, 500), "Ca+2" = c(5, 15, 500), T = 300, P = 1000) +diagram(a, type = "saturation", add = TRUE, contour.method = c("edge", "edge", "flattest", "flattest"), lty = 2, cex = 1.4, col = "blue3") + +# add title and legend +title(main = syslab(c("H2O", "CO2", "CaO", "MgO", "SiO2"))) +dprop <- describe.property(c("T", "P"), c(300, 1000)) +dbasis <- describe.basis(ibasis = 2) +legend("bottomright", c(dprop, dbasis), bty = "n", cex = 0.9) Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2019-01-27 02:35:05 UTC (rev 371) +++ pkg/CHNOSZ/inst/NEWS 2019-01-27 05:50:10 UTC (rev 372) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 1.1.3-79 (2019-01-27) +CHANGES IN CHNOSZ 1.1.3-80 (2019-01-27) --------------------------------------- BUG FIXES @@ -85,6 +85,11 @@ - Add demo/bison.R (average oxidation state of carbon of metagenome- derived proteins in different microbial phyla at Bison Pool) +- demo/saturation.R replaces the previous activity_ratios.R, and + includes not only activity ratios on the axes but also saturation + limits for calcite, dolomite, magnesite, and brucite in the + H2O-CO2-CaO-MgO-SiO2 system. + THERMODYNAMIC DATA - Add dumpdata() for returning/writing all packaged thermodynamic data Modified: pkg/CHNOSZ/man/diagram.Rd =================================================================== --- pkg/CHNOSZ/man/diagram.Rd 2019-01-27 02:35:05 UTC (rev 371) +++ pkg/CHNOSZ/man/diagram.Rd 2019-01-27 05:50:10 UTC (rev 372) @@ -156,10 +156,10 @@ If \code{type} is \samp{auto}, and the number of dimensions is 2, then equilibrium predominance (maximum affinity) fields are plotted. This algorithm is based on a comparison of the affinities of the formation reactions scaled by the balancing coefficients that are determined by the \code{balance} argument. -If \code{type} is \samp{saturation}, the function plots the line for each species where the affinity of formation equals zero. +If \code{type} is \samp{saturation}, the function plots the line for each species where the affinity of formation equals zero; see \code{demo("saturation")} for an example. If for a given species no saturation line is possible or the range of the diagram is beyond the saturation line, the function prints a message instead. -If \code{type} is the name of a basis species, the equilibrium activity of the selected basis species in each of the formation reactions is plotted. -In the case of 2-D diagrams, both of these options use \code{\link{contour}} to draw the lines (see the \CO2-acetic acid example in \code{\link{buffer}}). +If \code{type} is the name of a basis species, the equilibrium activity of the selected basis species in each of the formation reactions is plotted (see the \CO2-acetic acid example in \code{\link{buffer}}). +In the case of 2-D diagrams, both of these options use \code{\link{contour}} to draw the lines, using the method specified in \code{contour.method}. The \samp{saturation} diagram can handle multiple species, but if \code{type} is the name a basis species, then only the first species of interest is used in the calculation, and a warning is produced if there is more than one. } Modified: pkg/CHNOSZ/man/examples.Rd =================================================================== --- pkg/CHNOSZ/man/examples.Rd 2019-01-27 02:35:05 UTC (rev 371) +++ pkg/CHNOSZ/man/examples.Rd 2019-01-27 05:50:10 UTC (rev 372) @@ -16,7 +16,7 @@ demos(which = c("sources", "protein.equil", "affinity", "NaCl", "density", "ORP", "revisit", "findit", "ionize", "buffer", "protbuff", "yeastgfp", "mosaic", "copper", "solubility", - "gold", "wjd", "bugstab", "Shh", "activity_ratios", + "gold", "wjd", "bugstab", "Shh", "saturation", "adenine", "DEW", "lambda", "TCA", "go-IU", "bison"), save.png=FALSE) } @@ -51,7 +51,7 @@ \code{dehydration} \tab * \logK of dehydration reactions; SVG file contains tooltips and links \cr \code{bugstab} \tab * Formation potential of microbial proteins in colorectal cancer (Dick, 2016) \cr \code{Shh} \tab * Affinities of transcription factors relative to Sonic hedgehog (Dick, 2015) \cr - \code{activity_ratios} \tab * Mineral stability plots with activity ratios on the axes \cr + \code{saturation} \tab * Equilibrium activity diagram showing activity ratios and mineral saturation limits (Bowers et al., 1984) \cr \code{adenine} \tab * HKF regression of heat capacity and volume of aqueous adenine (Lowe et al., 2017) \cr \code{DEW} \tab * Deep Earth Water (DEW) model for high pressures (Sverjensky et al., 2014a and 2014b) \cr \code{lambda} \tab * Effects of lambda transition on thermodynamic properties of quartz (Berman, 1988) \cr @@ -90,6 +90,8 @@ Berman, R. G. (1988) Internally-consistent thermodynamic data for minerals in the system Na{\s2}O-K{\s2}O-CaO-MgO-FeO-Fe{\s2}O{\s3}-Al{\s2}O{\s3}-SiO{\s2}-TiO{\s2}-H{\s2}O-CO{\s2}. \emph{J. Petrol.} \bold{29}, 445-522. \url{https://doi.org/10.1093/petrology/29.2.445} +Bowers, T. S., Jackson, K. J. and Helgeson, H. C. (1984) \emph{Equilibrium Activity Diagrams for Coexisting Minerals and Aqueous Solutions at Pressures and Temperatures to 5 kb and 600\degC}, Springer-Verlag, Berlin, 397 p. \url{http://www.worldcat.org/oclc/11133620} + Canovas, P. A., III and Shock, E. L. (2016) Geobiochemistry of metabolism: Standard state thermodynamic properties of the citric acid cycle. \emph{Geochim. Cosmochim. Acta} \bold{195}, 293--322. \url{https://doi.org/10.1016/j.gca.2016.08.028} Dayhoff, M. O. and Lippincott, E. R. and Eck, R. V. (1964) Thermodynamic Equilibria In Prebiological Atmospheres. \emph{Science} \bold{146}, 1461--1464. \url{https://doi.org/10.1126/science.146.3650.1461} Modified: pkg/CHNOSZ/man/util.expression.Rd =================================================================== --- pkg/CHNOSZ/man/util.expression.Rd 2019-01-27 02:35:05 UTC (rev 371) +++ pkg/CHNOSZ/man/util.expression.Rd 2019-01-27 05:50:10 UTC (rev 372) @@ -121,7 +121,7 @@ } \seealso{ -\code{demo("activity_ratios")} for examples of \code{syslab} and \code{ratlab}. +\code{demo("saturation")} for examples of \code{syslab} and \code{ratlab}. } \examples{\dontshow{data(thermo)} Modified: pkg/CHNOSZ/vignettes/anintro.Rmd =================================================================== --- pkg/CHNOSZ/vignettes/anintro.Rmd 2019-01-27 02:35:05 UTC (rev 371) +++ pkg/CHNOSZ/vignettes/anintro.Rmd 2019-01-27 05:50:10 UTC (rev 372) @@ -633,7 +633,7 @@ In systems where equilibrium is attainable, it makes sense to call this a *predominance diagram*, showing regions of maximum activity. ```{r EhpH_plot_color, fig.margin=TRUE, fig.width=4, fig.height=4, smallish.mar=TRUE, dpi=dpi, out.width="100%", echo=FALSE, message=FALSE, cache=TRUE, fig.cap="The same plot, with different colors and labels.", pngquant=pngquant, timeit=timeit} -diagram(a, fill = "terrain", lwd = 3, lty = 3, +diagram(a, fill = "terrain", lwd = 2, lty = 3, names = c("hydrogen sulfide", "bisulfide", "bisulfate", "sulfate"), tplot = FALSE, main = "sulfur species, 25 ?C", bty = "n") ``` @@ -648,7 +648,9 @@ Mineral stability diagrams often depict activity ratios, e.g. log (*a*Ca+2/*a*H+2), on one or both axes. The variables used for potential calculations in CHNOSZ include only a single chemical activity, e.g. log *a*Ca+2. However, you can set pH = 0 to generate diagrams that are geometrically equivalent to those calculated using activity ratios, and use `ratlab()` to make the axes labels for the ratios. -See [`demo(activity_ratios)`](../demo) for some examples. +Moreover, `diagram()` has a "saturation" option that can be used to draw saturation limits for minerals that do not contain the conserved basis species. +See [`demo(saturation)`](../demo) for an example that uses activity ratios on the axes and plots saturation limits for calcite, magnesite, dolomite, and brucite on a diagram for the H2O–CO2–CaO–MgO–SiO2 system. +That demo can be used as a template to produce a wide range of diagrams similar to those in @BJH84. ## Mosaic diagrams @@ -693,9 +695,9 @@ bases <- c("H2S", "HS-", "HSO4-", "SO4-2") m1 <- mosaic(bases, blend = TRUE, pH = c(0, 12, res), Eh=c(-1.2, 0.75, res), T=T) diagram(m1$A.species, lwd = 2, fill = NA, limit.water = FALSE) -diagram(m1$A.bases, add = TRUE, col = "red1", col.names = "red1", lty = 2, +diagram(m1$A.bases, add = TRUE, col = "red1", col.names = "red1", lty = 3, limit.water = FALSE, italic = TRUE) -water.lines(m1$A.species, col = "blue1", lty = 3) +water.lines(m1$A.species, col = "blue1") ``` The argument `blend = TRUE` is used to combine the diagrams according to the relative abundances of the basis species along with a mixing term (see `?mosaic`). @@ -722,9 +724,9 @@ m1 <- do.call(mosaic, mosaicargs) diagram(m1$A.species, lwd = 2, fill = "terrain", limit.water = FALSE) - diagram(m1$A.bases, add = TRUE, col = "red1", col.names = "red1", lty = 2, + diagram(m1$A.bases, add = TRUE, col = "red1", col.names = "red1", lty = 3, limit.water = FALSE, italic = TRUE) - water.lines(m1$A.species, col = "blue1", lty = 3) + water.lines(m1$A.species, col = "blue1") swap.basis(names(newvar), "e-") } par(mfrow = c(1, 3)) Modified: pkg/CHNOSZ/vignettes/eos-regress.Rmd =================================================================== --- pkg/CHNOSZ/vignettes/eos-regress.Rmd 2019-01-27 02:35:05 UTC (rev 371) +++ pkg/CHNOSZ/vignettes/eos-regress.Rmd 2019-01-27 05:50:10 UTC (rev 372) @@ -55,7 +55,7 @@ options(htmltools.dir.version = FALSE) # adjust plot margins knit_hooks$set(small.mar = function(before, options, envir) { - if (before) par(mar = c(4.2, 4.2, .1, .1)) # smaller margin on top and right + if (before) par(mar = c(4.2, 4.2, .3, .3)) # smaller margin on top and right }) # use pngquant to optimize PNG images knit_hooks$set(pngquant = hook_pngquant) @@ -420,13 +420,19 @@ ```{r subcrt_H4SiO4, eval=FALSE} ``` -The large differences for `H4SiO4` at low temperature agree with the comparison to Shock et al. (1989) shown in Figure 3 of Stef?nsson (2001). +The large differences for `r h4sio4` at low temperature agree with the comparison to Shock et al. (1989) shown in Figure 3 of Stef?nsson (2001). Therefore, Stef?nsson's `r h4sio4` should not be used with the _default_ database in CHNOSZ for making mineral activity diagrams. -Instead, the pseudospecies with properties calculated here, `pseudo-H4SiO4`, is preferable for use with the _default_ database in CHNOSZ---see `?transfer` and [`demo(activity_ratios)`](../demo). +Instead, the pseudospecies with properties calculated here, `pseudo-H4SiO4`, is preferable for use with the _default_ database in CHNOSZ. + On the other hand, Stef?nsson's `r h4sio4` is compatible with `r sio2` in the _optional_ SUPCRTBL data file [@ZZL_16]. +The following example uses these data together with values for gibbsite from [Robie et al., 1978](http://pubs.er.usgs.gov/publication/b1452) (as recommended by Zimmer et al., 2016) to make an activity diagram for the K2O-Al2O3-SiO2-H2O system. +This is similar to diagrams found, for example, on p. 361 of [Garrels and Christ, 1965](http://www.worldcat.org/oclc/517586) and Figure 3 of [Steinmann et al., 1994](http://ccm.geoscienceworld.org/content/42/2/197), but is quantitatively a closer match to the diagram in the [User's Guide to PHREEQC](https://wwwbrr.cr.usgs.gov/projects/GWC_coupled/phreeqc/html/final-75.html). -# Other possibilities - -These functions are limited to treatment of calorimetric and volumetric data. -Other software tools have been described recently for deriving HKF parameters and other thermodynamic properties from different types of experimental data [@MKDW15; @Shv15]. - +```{r activity_diagram, fig.margin=TRUE, fig.width=4, fig.height=4, small.mar=TRUE, echo=TRUE, results="hide", message=FALSE, dpi=dpi, out.width="100%", cache=TRUE, fig.cap="Activity diagram for K2O-Al2O3-SiO2-H2O.", pngquant=pngquant} +add.obigt("SUPCRTBL") +basis(c("Al+3", "H4SiO4", "K+", "H2O", "H+", "O2")) +species(c("gibbsite", "muscovite", "kaolinite", "pyrophyllite", "K-feldspar")) +a <- affinity(H4SiO4 = c(-8, 0, 300), `K+` = c(-1, 8, 300)) +diagram(a, ylab = ratlab("K+"), fill = "terrain", yline = 1.7) +legend("bottomleft", describe.property(c("T", "P"), c(25, 1)), bty = "n") +``` Modified: pkg/CHNOSZ/vignettes/vig.bib =================================================================== --- pkg/CHNOSZ/vignettes/vig.bib 2019-01-27 02:35:05 UTC (rev 371) +++ pkg/CHNOSZ/vignettes/vig.bib 2019-01-27 05:50:10 UTC (rev 372) @@ -40,6 +40,16 @@ url = {http://www.worldcat.org/oclc/12106344}, } + at Book{BJH84, + author = {Bowers, Teresa S. and Jackson, Kenneth J. and Helgeson, Harold C.}, + publisher = {Springer-Verlag}, + title = {{E}quilibrium {A}ctivity {D}iagrams for {C}oexisting {M}inerals and {A}queous {S}olutions at {P}ressures and {T}emperatures to 5 kb and 600$^\circ${C}}, + year = {1984}, + address = {Heidelberg}, + pages = {397}, + url = {http://www.worldcat.org/oclc/11133620}, +} + @Article{DLE64, author = {Dayhoff, M. O. and Lippincott, E. R. and Eck, R. V.}, journal = {Science}, @@ -561,30 +571,6 @@ issn = {0021-9614}, } - at Article{MKDW15, - author = {Miron, George D. and Kulik, Dmitrii A. and Dmytrieva, Svitlana V. and Wagner, Thomas}, - journal = {Applied Geochemistry}, - title = {{GEMSFITS}: {C}ode package for optimization of geochemical model parameters and inverse modeling}, - year = {2015}, - volume = {55}, - pages = {28--45}, - note = {Geochemical Speciation Codes and Databases}, - doi = {10.1016/j.apgeochem.2014.10.013}, - issn = {0883-2927}, -} - - at Article{Shv15, - author = {Shvarov, Yuri}, - journal = {Applied Geochemistry}, - title = {A suite of programs, {O}ptim{A}, {O}ptim{B}, {O}ptim{C}, and {O}ptim{S} compatible with the {U}nitherm database, for deriving the thermodynamic properties of aqueous species from solubility, potentiometry and spectroscopy measurements}, - year = {2015}, - volume = {55}, - pages = {17--27}, - note = {Geochemical Speciation Codes and Databases}, - doi = {10.1016/j.apgeochem.2014.11.021}, - issn = {0883-2927}, -} - @Article{HWM96, author = {Hn\v{e}dkovsk\'y, Lubom\'ir and Wood, Robert H. and Majer, Vladimir}, journal = {Journal of Chemical Thermodynamics}, From noreply at r-forge.r-project.org Sun Jan 27 07:23:34 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 27 Jan 2019 07:23:34 +0100 (CET) Subject: [CHNOSZ-commits] r373 - in pkg/CHNOSZ: . R inst tests/testthat Message-ID: <20190127062335.57C1218B602@r-forge.r-project.org> Author: jedick Date: 2019-01-27 07:23:19 +0100 (Sun, 27 Jan 2019) New Revision: 373 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/info.R pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/tests/testthat/test-info.R Log: info(): search for species in optional data files (SUPCRTBL, SUPCRT92) Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-27 05:50:10 UTC (rev 372) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-27 06:23:19 UTC (rev 373) @@ -1,6 +1,6 @@ Date: 2019-01-27 Package: CHNOSZ -Version: 1.1.3-80 +Version: 1.1.3-81 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), Modified: pkg/CHNOSZ/R/info.R =================================================================== --- pkg/CHNOSZ/R/info.R 2019-01-27 05:50:10 UTC (rev 372) +++ pkg/CHNOSZ/R/info.R 2019-01-27 06:23:19 UTC (rev 373) @@ -242,6 +242,14 @@ return(approx.species) } # if we got here there were no approximate matches + # 20190127 look for the species in optional data files + for(opt in c("SUPCRTBL", "SUPCRT92")) { + optdat <- read.csv(system.file(paste0("extdata/OBIGT/", opt, ".csv"), package="CHNOSZ"), as.is=TRUE) + if(species %in% optdat$name) { + message('info.approx: ', species, ' is in an optional database; use add.obigt("', opt, '", "', species, '") to load it') + return(NA) + } + } message("info.approx: '", species, "' has no approximate matches") return(NA) } Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2019-01-27 05:50:10 UTC (rev 372) +++ pkg/CHNOSZ/inst/NEWS 2019-01-27 06:23:19 UTC (rev 373) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 1.1.3-80 (2019-01-27) +CHANGES IN CHNOSZ 1.1.3-81 (2019-01-27) --------------------------------------- BUG FIXES @@ -215,6 +215,9 @@ - info(): display mineral names instead of just "cr" in messages (e.g. for info("SiO2")). +- info(): species with no matches in default database are also + searched in optional data files (SUPCRTBL, SUPCRT92). + - Add C implementation of counting occurrences of all letters in a string (src/count_letters.c) to speed up operation of count.aa(). Modified: pkg/CHNOSZ/tests/testthat/test-info.R =================================================================== --- pkg/CHNOSZ/tests/testthat/test-info.R 2019-01-27 05:50:10 UTC (rev 372) +++ pkg/CHNOSZ/tests/testthat/test-info.R 2019-01-27 06:23:19 UTC (rev 373) @@ -20,8 +20,10 @@ test_that("info.approx() produces expected messages", { expect_message(info.approx("lactic"), "is similar to lactic acid") expect_message(info.approx("lactic acid"), "is ambiguous") - # note though that info("lactic acid") finds a match b/c info.character is used first... + # note though that info("lactic acid") finds a match because info.character is used first... expect_equal(info("lactic acid"), grep("lactic acid", thermo$obigt$name)) + # looking in optional databases 20190127 + expect_message(info("gibbsite"), "is in an optional database") }) test_that("info() can be used for cr and aq descriptions of the same species and proteins", { From noreply at r-forge.r-project.org Sun Jan 27 09:31:43 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 27 Jan 2019 09:31:43 +0100 (CET) Subject: [CHNOSZ-commits] r374 - in pkg/CHNOSZ: . man tests/testthat vignettes Message-ID: <20190127083143.9CE5B18C01D@r-forge.r-project.org> Author: jedick Date: 2019-01-27 09:31:35 +0100 (Sun, 27 Jan 2019) New Revision: 374 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/man/data.Rd pkg/CHNOSZ/man/extdata.Rd pkg/CHNOSZ/tests/testthat/test-equilibrate.R pkg/CHNOSZ/vignettes/anintro.Rmd pkg/CHNOSZ/vignettes/obigt.bib Log: remove broken links to geopig and g3data websites Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-27 06:23:19 UTC (rev 373) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-27 08:31:35 UTC (rev 374) @@ -1,7 +1,7 @@ Date: 2019-01-27 Package: CHNOSZ -Version: 1.1.3-81 -Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry +Version: 1.1.3-82 +Title: Thermodynamic Calculations and Diagrams for Geochemistry Authors at R: c( person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-0687-5890")), Modified: pkg/CHNOSZ/man/data.Rd =================================================================== --- pkg/CHNOSZ/man/data.Rd 2019-01-27 06:23:19 UTC (rev 373) +++ pkg/CHNOSZ/man/data.Rd 2019-01-27 08:31:35 UTC (rev 374) @@ -243,7 +243,7 @@ Johnson, J. W., Oelkers, E. H. and Helgeson, H. C. (1992) SUPCRT92: A software package for calculating the standard molal thermodynamic properties of minerals, gases, aqueous species, and reactions from 1 to 5000 bar and 0 to 1000\degC. \emph{Comp. Geosci.} \bold{18}, 899--947. \url{https://doi.org/10.1016/0098-3004(92)90029-Q} -Shock, E. L. et al. {1998} \emph{SLOP98.dat} (computer data file). http://geopig.asu.edu/supcrt92_data/slop98.dat, accessed on 2005-11-05. Current location: \url{http://geopig.asu.edu/?q=tools}. +Shock, E. L. et al. {1998} \emph{SLOP98.dat} (computer data file). http://geopig.asu.edu/supcrt92_data/slop98.dat, accessed on 2005-11-05; moved to http://geopig.asu.edu/?q=tools. Wagman, D. D., Evans, W. H., Parker, V. B., Schumm, R. H., Halow, I., Bailey, S. M., Churney, K. L. and Nuttall, R. L. (1982) The NBS tables of chemical thermodynamic properties. Selected values for inorganic and C\eqn{_1}{1} and C\eqn{_2}{2} organic substances in SI units. \emph{J. Phys. Chem. Ref. Data} \bold{11} (supp. 2), 1--392. \url{https://srd.nist.gov/JPCRD/jpcrdS2Vol11.pdf} } Modified: pkg/CHNOSZ/man/extdata.Rd =================================================================== --- pkg/CHNOSZ/man/extdata.Rd 2019-01-27 06:23:19 UTC (rev 373) +++ pkg/CHNOSZ/man/extdata.Rd 2019-01-27 08:31:35 UTC (rev 374) @@ -39,7 +39,7 @@ \item \code{PM90.csv} Heat capacities of four unfolded aqueous proteins taken from Privalov and Makhatadze, 1990. Temperature in \degC is in the first column, and heat capacities of the proteins in J mol\eqn{^{-1}}{^-1} K\eqn{^{-1}}{^-1} in the remaining columns. See \code{\link{ionize.aa}} and the vignette \code{anintro.Rmd} for examples that uses this file. \item \code{RH95.csv} Heat capacity data for iron taken from Robie and Hemingway, 1995. Temperature in Kelvin is in the first column, heat capacity in J K\eqn{^{-1}}{^-1} mol\eqn{^{-1}}{^-1} in the second. See \code{\link{subcrt}} for an example that uses this file. \item \code{RT71.csv} pH titration measurements for unfolded lysozyme (\samp{LYSC_CHICK}) taken from Roxby and Tanford, 1971. pH is in the first column, net charge in the second. See \code{\link{ionize.aa}} for an example that uses this file. - \item \code{SOJSH.csv} Experimental equilibrium constants for the reaction NaCl(aq) = Na+ + Cl- as a function of temperature and pressure taken from Fig. 1 of Shock et al., 1992. Data were extracted from the figure using g3data (\url{http://www.frantz.fi/software/g3data.php}). See \code{demo("NaCl")} for an example that uses this file. + \item \code{SOJSH.csv} Experimental equilibrium constants for the reaction NaCl(aq) = Na+ + Cl- as a function of temperature and pressure taken from Fig. 1 of Shock et al., 1992. See \code{demo("NaCl")} for an example that uses this file. \item \code{Cp.CH4.HW97.csv}, \code{V.CH4.HWM96.csv} Apparent molar heat capacities and volumes of CH4 in dilute aqueous solutions reported by Hn?dkovsk? and Wood, 1997 and Hn?dkovsk? et al., 1996. See \code{\link{EOSregress}} and the vignette \code{eos-regress.Rmd} for examples that use these files. \item \code{SC10_Rainbow.csv} Values of temperature (\degC, pH and logarithms of activity of \CO2, \H2, \NH4plus, \H2S and \CH4 for mixing of seawater and hydrothermal fluid at Rainbow field (Mid-Atlantic Ridge), taken from Shock and Canovas, 2010. See the vignette \code{anintro.Rmd} for an example that uses this file. \item \code{SS98_Fig5a.csv}, \code{SS98_Fig5b.csv} Values of logarithm of fugacity of \O2 and pH as a function of temperature for mixing of seawater and hydrothermal fluid, digitized from Figs. 5a and b of Shock and Schulte, 1998. See the vignette \code{anintro.Rmd} for an example that uses this file. Modified: pkg/CHNOSZ/tests/testthat/test-equilibrate.R =================================================================== --- pkg/CHNOSZ/tests/testthat/test-equilibrate.R 2019-01-27 06:23:19 UTC (rev 373) +++ pkg/CHNOSZ/tests/testthat/test-equilibrate.R 2019-01-27 08:31:35 UTC (rev 374) @@ -62,7 +62,7 @@ # we name them here because S5O6-2 isn't on the plot at logfO2=-30, # and to get them in order species.ref <- c("S3O6-2", "S2O6-2", "S2O4-2", "S3-2", "S2-2", "S2O3-2", "HSO3-", "SO2", "HSO4-", "H2S") - # these values were read from the plot using g3data (http://www.frantz.fi/software/g3data.php) + # these values were read from the plot using g3data loga.ref <- c(-28.82, -24.70, -22.10, -14.19, -12.12, -11.86, -8.40, -7.40, -6.54, -1.95) # set up the system - see ?diagram for an example showing the entire plot basis("CHNOS+") Modified: pkg/CHNOSZ/vignettes/anintro.Rmd =================================================================== --- pkg/CHNOSZ/vignettes/anintro.Rmd 2019-01-27 06:23:19 UTC (rev 373) +++ pkg/CHNOSZ/vignettes/anintro.Rmd 2019-01-27 08:31:35 UTC (rev 374) @@ -2057,7 +2057,6 @@ Without additional information, there is often no clear strategy for "fixing" these entries, and they are provided as is. ```{marginfigure} -See the [Numerical Tools from GEOPIG](http://geopig.asu.edu/?q=tools) for SUPCRT updates (slop files), including corrections that have not yet been ported to CHNOSZ. ``` ## Water: SUPCRT92 or IAPWS-95 or DEW Modified: pkg/CHNOSZ/vignettes/obigt.bib =================================================================== --- pkg/CHNOSZ/vignettes/obigt.bib 2019-01-27 06:23:19 UTC (rev 373) +++ pkg/CHNOSZ/vignettes/obigt.bib 2019-01-27 08:31:35 UTC (rev 374) @@ -626,9 +626,8 @@ @Misc{SLOP98, author = {slop98.dat}, title = {{S}equential-access thermodynamic datafile used by {PROGRAM} supcrt92}, - howpublished = {Last updated on 1998-08-20. Accessed on 2017-03-01.}, + howpublished = {Last updated on 1998-08-20. Accessed from http://geopig.asu.edu/?q=tools on 2017-03-01.}, year = {1998}, - url = {http://geopig.asu.edu/?q=tools}, } @Article{SH88, @@ -907,17 +906,15 @@ @Misc{SLOP07, author = {slop07.dat}, title = {{S}equential-access thermodynamic datafile used by {PROGRAM} supcrt92}, - howpublished = {Last updated on 2008-04-17. Accessed on 2017-03-02.}, + howpublished = {Last updated on 2008-04-17. Accessed from http://geopig.asu.edu/?q=tools on 2017-03-02.}, year = {2007}, - url = {http://geopig.asu.edu/?q=tools}, } @Misc{SLOP15, author = {slop15.dat}, title = {{S}equential-access thermodynamic datafile used by {PROGRAM} supcrt92}, - howpublished = {Last updated on 2015-03-03. Accessed on 2017-03-03.}, + howpublished = {Last updated on 2015-03-03. Accessed from http://geopig.asu.edu/?q=tools on 2017-03-03.}, year = {2015}, - url = {http://geopig.asu.edu/?q=tools}, } @Article{MS99, From noreply at r-forge.r-project.org Sun Jan 27 17:54:59 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 27 Jan 2019 17:54:59 +0100 (CET) Subject: [CHNOSZ-commits] r375 - in pkg/CHNOSZ: . data demo inst inst/extdata/OBIGT man Message-ID: <20190127165459.50FA3183A48@r-forge.r-project.org> Author: jedick Date: 2019-01-27 17:54:58 +0100 (Sun, 27 Jan 2019) New Revision: 375 Added: pkg/CHNOSZ/inst/extdata/OBIGT/SLOP98.csv Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/data/refs.csv pkg/CHNOSZ/demo/gold.R pkg/CHNOSZ/demo/sources.R pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_aq.csv.xz pkg/CHNOSZ/inst/extdata/OBIGT/organic_aq.csv.xz pkg/CHNOSZ/man/CHNOSZ-package.Rd pkg/CHNOSZ/man/util.data.Rd Log: update aqueous Au species and move superseded data to extdata/OBIGT/SLOP98.csv Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-27 08:31:35 UTC (rev 374) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-27 16:54:58 UTC (rev 375) @@ -1,6 +1,6 @@ Date: 2019-01-27 Package: CHNOSZ -Version: 1.1.3-82 +Version: 1.1.3-83 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/data/refs.csv =================================================================== --- pkg/CHNOSZ/data/refs.csv 2019-01-27 08:31:35 UTC (rev 374) +++ pkg/CHNOSZ/data/refs.csv 2019-01-27 16:54:58 UTC (rev 375) @@ -9,7 +9,7 @@ HDNB78,"H. C. Helgeson, J. M. Delany et al.",1978,"Am. J. Sci. 278A, 1-229","data for minerals and phase transitions",http://www.worldcat.org/oclc/13594862 HDNB78.1,"H. C. Helgeson, J. M. Delany et al.",1978,"Am. J. Sci. 278A, 1-229","litharge S, V, and Cp parameters",http://www.worldcat.org/oclc/13594862 HDNB78.2,"H. C. Helgeson, J. M. Delany et al.",1978,"Am. J. Sci. 278A, 1-229","celestite V and Cp parameters",http://www.worldcat.org/oclc/13594862 -RHF78,"R. A. Robie, B. S. Hemingway and J. R. Fisher",1978,"U. S. Geological Survey Bull. 1452","chlorargyrite",http://pubs.er.usgs.gov/publication/b1452 +RHF78,"R. A. Robie, B. S. Hemingway and J. R. Fisher",1978,"U. S. Geological Survey Bull. 1452",chlorargyrite,http://pubs.er.usgs.gov/publication/b1452 RHF78.1,"R. A. Robie, B. S. Hemingway and J. R. Fisher",1978,"U. S. Geological Survey Bull. 1452","dickite, fluorphlogopite, halloysite, and pyrope",http://pubs.er.usgs.gov/publication/b1452 RHF78.2,"R. A. Robie, B. S. Hemingway and J. R. Fisher",1978,"U. S. Geological Survey Bull. 1452",iron,http://pubs.er.usgs.gov/publication/b1452 RHF78.3,"R. A. Robie, B. S. Hemingway and J. R. Fisher",1978,"U. S. Geological Survey Bull. 1452","gibbsite GHS",http://pubs.er.usgs.gov/publication/b1452 @@ -33,7 +33,7 @@ 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 SH90.1,"E. L. Shock and H. C. Helgeson",1990,"Geochim. Cosmochim. Acta 54, 915-945","formic acid, formate, and propanoate",https://doi.org/10.1016/0016-7037(90)90429-O BN91,"J. W. Ball and D. K. Nordstrom",1991,"User's manual for WATEQ4F, with revised thermodynamic data base and text cases for calculating speciation of major, trace, and redox elements in natural waters. USGS Open-File Report 91-183","arsenopyrite: G",https://pubs.er.usgs.gov/publication/ofr91183 -HRA91,"B. S. Hemingway et al.",1991,"Am. Mineral. 76, 445-457","bohemite",http://pubs.er.usgs.gov/publication/70016664 +HRA91,"B. S. Hemingway et al.",1991,"Am. Mineral. 76, 445-457",bohemite,http://pubs.er.usgs.gov/publication/70016664 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 @@ -45,6 +45,7 @@ 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 +SK93.1,"E. L. Shock and C. M. Koretsky",1993,"Geochim. Cosmochim. Acta 57, 4899-4922","Au-acetate complexes",https://doi.org/10.1016/0016-7037(93)90128-J SM93,"E. L. Shock and W. B. McKinnon",1993,"Icarus 106, 464-477","CO, HCN, urea",https://doi.org/10.1006/icar.1993.1185 SS93,"M. D. Schulte and E. L. Shock",1993,"Geochim. Cosmochim. Acta 57, 3835-3846",aldehydes,https://doi.org/10.1016/0016-7037(93)90337-V HSS95,"J. R. Haas, E. L. Shock and D. C. Sassani",1995,"Geochim. Cosmochim. Acta 59, 4329-4350","complexes of rare earth elements",https://doi.org/10.1016/0016-7037(95)00314-P @@ -65,8 +66,10 @@ SSB97,"E. L. Shock, D. C. Sassani and H. Betz",1997,"Geochim. Cosmochim. Acta 61, 4245-4266","uranium species",https://doi.org/10.1016/S0016-7037(97)00240-8 SSB97.1,"E. L. Shock, D. C. Sassani and H. Betz",1997,"Geochim. Cosmochim. Acta 61, 4245-4266",uraninite,https://doi.org/10.1016/S0016-7037(97)00240-8 SSH97,"D. A. Sverjensky, E. L. Shock and H. C. Helgeson",1997,"Geochim. Cosmochim. Acta 61, 1359-1412","metal complexes",https://doi.org/10.1016/S0016-7037(97)00009-4 +SSH97.1,"D. A. Sverjensky, E. L. Shock and H. C. Helgeson",1997,"Geochim. Cosmochim. Acta 61, 1359-1412","Au(HS)2- and Au-chloride complexes",https://doi.org/10.1016/S0016-7037(97)00009-4 SSWS97,"E. L. Shock, D. C. Sassani et al.",1997,"Geochim. Cosmochim. Acta 61, 907-950","inorganic ions and hydroxide complexes",https://doi.org/10.1016/S0016-7037(96)00339-0 SSWS97.1,"E. L. Shock, D. C. Sassani et al.",1997,"Geochim. Cosmochim. Acta 61, 907-950","zincite and litharge",https://doi.org/10.1016/S0016-7037(96)00339-0 +SSWS97.2,"E. L. Shock, D. C. Sassani et al.",1997,"Geochim. Cosmochim. Acta 61, 907-950","Au+ and Au+3",https://doi.org/10.1016/S0016-7037(96)00339-0 TSD97,"Y. Tardy, R. Schaul, J. Duplay",1997,"C. R. Acad. Sci. Paris 324, 969-976","humic acid, microflora, and plants",https://doi.org/10.1016/S1251-8050(97)83981-X HOKR98,"H. C. Helgeson, C. E. Owens et al.",1998,"Geochim. Cosmochim. Acta 62, 985-1081","organic molecules and groups",https://doi.org/10.1016/S0016-7037(97)00219-6 HOKR98.1,"H. C. Helgeson, C. E. Owens et al.",1998,"Geochim. Cosmochim. Acta 62, 985-1081","amino acids",https://doi.org/10.1016/S0016-7037(97)00219-6 @@ -78,7 +81,7 @@ SLOP98.11,"E. L. Shock et al.",1998,"slop98.dat computer data file",""Data and parameters as used by @MS97. "",http://geopig.asu.edu/?q=tools SS98a,"D. C. Sassani and E. L. Shock",1998,"Geochim. Cosmochim. Acta 62, 2643-2671","platinum-group ions and complexes",https://doi.org/10.1016/S0016-7037(98)00049-0 SS98a.1,"D. C. Sassani and E. L. Shock",1998,"Geochim. Cosmochim. Acta 62, 2643-2671","platinum-group solids",https://doi.org/10.1016/S0016-7037(98)00049-0 -SS98a.2,"D. C. Sassani and E. L. Shock",1998,"Geochim. Cosmochim. Acta 62, 2643-2671",Rh+3,https://doi.org/10.1016/S0016-7037(98)00049-0 +SS98a.2,"D. C. Sassani and E. L. Shock",1998,"Geochim. Cosmochim. Acta 62, 2643-2671",Rh+3,https://doi.org/10.1016/S0016-7037(98)00049-0 HS99,"J. R. Haas and E. L. Shock",1998,"Geochim. Cosmochim. Acta 63, 3429-3441","chloroethylene species",https://doi.org/10.1016/S0016-7037(99)00276-8 MS99,"W. M. Murphy and E. L. Shock",1999,"Rev. Mineral. Geochem. 38, 221-253",actinides,http://rimg.geoscienceworld.org/content/38/1/221 PSK99,"P. Prapaipong, E. L. Shock and C. M. Koretsky",1999,"Geochim. Cosmochim. Acta 63, 2547-2577","metal-dicarboxylate complexes",https://doi.org/10.1016/S0016-7037(99)00146-5 @@ -87,18 +90,19 @@ AP01,"J. P. Amend and A. V. Plyasunov",2001,"Geochim. Cosmochim. Acta 65, 3901-3917",carbohydrates,https://doi.org/10.1016/S0016-7037(01)00707-4 AS01,"J. P. Amend and E. L. Shock",2001,"FEMS Microbiol. Rev. 25, 175-243","NO and N2O",https://doi.org/10.1111/j.1574-6976.2001.tb00576.x AS01.1,"J. P. Amend and E. L. Shock",2001,"FEMS Microbiol. Rev. 25, 175-243","selenium and molybdenite",https://doi.org/10.1111/j.1574-6976.2001.tb00576.x +AZ01,"N. N. Akinfiev and A. V. Zotov",2001,"Geochem. Int. 39, 990-1006",AuCl2-,http://pleiades.online/cgi-perl/search.pl?type=abstract&name=geochem&number=10&year=1&page=990 MVT01,"L. Mercury, P. Vieillard. and Y. Tardy",2001,"Appl. Geochem. 16, 161-181","polymorphs of ice",https://doi.org/10.1016/S0883-2927(00)00025-1 PS01,"A. V. Plyasunov and E. L. Shock",2001,"Geochim. Cosmochim. Acta 65, 3879-3900","aqueous nonelectrolytes",https://doi.org/10.1016/S0016-7037(01)00678-0 PS01.1,"A. V. Plyasunov and E. L. Shock",2001,"Geochim. Cosmochim. Acta 65, 3879-3900","acetic acid, propanoic acid, and methane",https://doi.org/10.1016/S0016-7037(01)00678-0 Ric01,"L. Richard",2001,"Geochim. Cosmochim. Acta 65, 3827-3877","organic sulfur compounds",https://doi.org/10.1016/S0016-7037(01)00761-X -Ste01,"A. Stefansson",2001,"Chem. Geol. 172, 225-250",aqueous H4SiO4,http://dx.doi.org/10.1016/S0009-2541(00)00263-1 +Ste01,"A. Stefansson",2001,"Chem. Geol. 172, 225-250","aqueous H4SiO4",http://dx.doi.org/10.1016/S0009-2541(00)00263-1 SSW01,"M. D. Schulte, E. L. Shock and R. H. Wood",2001,"Geochim. Cosmochim. Acta 65, 3919-3930","AsH3, CF4, CH3F, Cl2, ClO2, N2O, NF3, NO, PH3, and SF6",https://doi.org/10.1016/S0016-7037(01)00717-7 TS01,"B. Tagirov and J. Schott",2001,"Geochim. Cosmochim. Acta 65, 3965-3992","aqueous Al species",http://dx.doi.org/10.1016/S0016-7037(01)00705-0 MGN03,"J. Majzlan, K.-D. Grevel and A. Navrotsky",2003,"Am. Mineral. 88, 855-859","goethite, lepidocrocite, and maghemite GHS",https://doi.org/10.2138/am-2003-5-614 NA03,"D. K. Nordstrom and D. G. Archer",2003,"Arsenic thermodynamic data and environmental geochemistry. In Arsenic in Groundwater, eds. Welch and Stollenwerk, Kluwer","As oxide and sulfide minerals", NA03.1,"D. K. Nordstrom and D. G. Archer",2003,"Arsenic thermodynamic data and environmental geochemistry. In Arsenic in Groundwater, eds. Welch and Stollenwerk, Kluwer","aqueous As oxides and sulfides", MLS+03,"J. Majzlan, B. E. Lang et al.",2003,"Am. Mineral. 88, 846-854","goethite, lepidocrocite, and maghemite Cp",https://doi.org/10.2138/am-2003-5-613 -AS04,"J. Apps and N. Spycher",2004,"Data qualification for thermodynamic data used to support THC calculations. Bechtel SAIC Company, LLC. ANL-NBS-HS-000043 REV 00 (DOC.20041118.0004)",aqueous SiO2, +AS04,"J. Apps and N. Spycher",2004,"Data qualification for thermodynamic data used to support THC calculations. Bechtel SAIC Company, LLC. ANL-NBS-HS-000043 REV 00 (DOC.20041118.0004)","aqueous SiO2", MSB+04,"J. Majzlan, R. Stevens et al.",2004,"Phys. Chem. Mineral. 31, 518-531","hydronium jarosite",https://doi.org/10.1007/s00269-004-0405-z SR04,"M. D. Schulte and K. L. Rogers",2004,"Geochim. Cosmochim. Acta 68, 1087-1097","alkane thiols",https://doi.org/10.1016/j.gca.2003.06.001 ZZX+05,"Y. Zhu et al.",2005,"J. Hazard. Mater. A120, 37-44","barium arsenate and barium hydrogen arsenate: G",https://doi.org/10.1016/j.jhazmat.2004.12.025 @@ -114,12 +118,13 @@ MNM+06,"J. Majzlan, A. Navrotsky et al.",2006,"Eur. J. Mineral. 18, 175-186","coquimbite, ferricopiapite, and rhomboclase",https://doi.org/10.1127/0935-1221/2006/0018-0175 Dic07,"J. M. Dick",2007,"Ph.D. Dissertation, Univ. of California","glutathione, cystine, and cystine sidechain", MA07,"L. Marini and M. Accornero",2007,"Environ. Geol. 52, 1343-1363","metal-arsenate and metal-arsenite complexes",https://doi.org/10.1007/s00254-006-0578-5 -SLOP07.1,"E. L. Shock et al.",2007,"slop07.dat computer data file","corrected charge of Pu(Oxal)+2",http://geopig.asu.edu/?q=tools +SLOP07.1,"E. L. Shock et al.",2007,"slop07.dat computer data file","corrected charge of Pu(Oxal)+2",http://geopig.asu.edu/?q=tools SLOP07.2,"E. L. Shock et al.",2007,"slop07.dat computer data file","high-temperature HKF parameters from @AP01",http://geopig.asu.edu/?q=tools Ric08,"L. Richard",2008,"personal communication",alkenes, GM09,"K.-D. Grevel and J. Majzlan",2009,"Geochim. Cosmochim. Acta 73, 6805 - 6815","kieserite, starkeyite, hexahydrite, and epsomite",https://doi.org/10.1016/j.gca.2009.08.005 HRMNS09,"H. C. Helgeson, L. Richard et al.",2009,"Geochim. Cosmochim. Acta 73, 594-695",kerogens,https://doi.org/10.1016/j.gca.2008.03.004 AML10,"M. Accornero, L. Marini and M. Lelli",2010,"Appl. Geochem. 25, 242-260","metal-chromate complexes",https://doi.org/10.1016/j.apgeochem.2009.11.010 +AZ10,"N. N. Akinfiev and A. V. Zotov",2010,"Geochem. Int. 48, 714-720","AuHS and Au(HS)2-",https://doi.org/10.1134/S0016702910070074 DS10,"J. Delgado Martin and A. Soler i Gil",2010,"Eur. J. Mineral. 22, 363-380","hedenbergite, andradite, ferro-actinolite, grunerite, and ilvaite",https://doi.org/10.1127/0935-1221/2010/0022-2021 MA10,"L. Marini and M. Accornero",2010,"Environ. Earth Sci. 59, 1601-1606","corrected values",https://doi.org/10.1007/s12665-009-0369-x Sch10,"M. Schulte",2010,"Aquat. Geochem. 16, 621-637","organic sulfides",https://doi.org/10.1007/s10498-010-9102-3 @@ -131,6 +136,8 @@ DEH+13,"J. M. Dick, K. A. Evans et al.",2013,"Geochim. Cosmochim. Acta 122, 247-266","phenanthrene and methylphenanthrene isomers",https://doi.org/10.1016/j.gca.2013.08.020 FDM+14,"S. Facq et al.",2014,"Geochim. Cosmochim. Acta 132, 375-390","CO2, CO3-2, and HCO3-",https://doi.org/10.1016/j.gca.2014.01.030 FDM+14.1,"S. Facq et al.",2014,"Geochim. Cosmochim. Acta 132, 375-390","aragonite; source of data: `berman.dat`",https://doi.org/10.1016/j.gca.2014.01.030 +PAB+14,"G. S. Pokrovski, N. N. Akinfiev et al., 2014",2014,"Geol. Soc. Spec. Publ. 402, 9-70","Au+, Au(OH)2-, AuCl, and AuOH",https://doi.org/10.1144/SP402.4 +PAB+14.1,"G. S. Pokrovski, N. N. Akinfiev et al., 2014",2014,"Geol. Soc. Spec. Publ. 402, 9-70","corrected H of AuHS",https://doi.org/10.1144/SP402.4 SHA14,"D. A. Sverjensky et al.",2014,"Geochim. Cosmochim. Acta 129, 125-145","SiO2 and Si2O4",https://doi.org/10.1016/j.gca.2013.12.019 SHA14.1,"D. A. Sverjensky et al.",2014,"Geochim. Cosmochim. Acta 129, 125-145","revisions for AlO2- and HAlO2",https://doi.org/10.1016/j.gca.2013.12.019 SHA14.2,"D. A. Sverjensky et al.",2014,"Geochim. Cosmochim. Acta 129, 125-145","revisions for BO(OH) and BO2-",https://doi.org/10.1016/j.gca.2013.12.019 Modified: pkg/CHNOSZ/demo/gold.R =================================================================== --- pkg/CHNOSZ/demo/gold.R 2019-01-27 08:31:35 UTC (rev 374) +++ pkg/CHNOSZ/demo/gold.R 2019-01-27 16:54:58 UTC (rev 375) @@ -1,35 +1,8 @@ # CHNOSZ/demo/gold.R: Au solubility calculations # 20181101 jmd first version # 20181109 add calculation of K+ molality +# 20190127 update Au species in OBIGT, not here -## additions to OBIGT: -# Au(HS) from Akinfiev and Zotov, 2010 -# (doi:10.1134/S0016702910070074) -# corrected H taken from Pokrovski et al., 2014 -# (doi:10.1144/SP402.4) -mod.obigt("Au(HS)", formula = "Au(HS)", state = "aq", ref1 = "AZ10", date = today(), - G = 8344, H = 13193, S = 50.86, Cp = 1.8, V = 56.5, - a1 = 9.4965, a2 = 15.4057, a3 = -0.3052, a4 = -3.1459, - c1 = -38.1356, c2 = 19.6524, omega = 0, z = 0) -# AuOH from Pokrovski et al., 2014 -mod.obigt("AuOH", formula = "AuOH", state = "aq", ref1 = "PAB+14", date = today(), - G = -32716, H = -41533, S = 21.89, Cp = -11.1, V = 32.4, - a1 = 6.1937, a2 = 7.3415, a3 = 2.8644, a4 = -3.0825, - c1 = -3.0370, c2 = -3.9635, omega = 0, z = 0) - -## modifications to OBIGT: -# AuCl2- from Akinfiev and Zotov, 2001 (reported in AZ10) -# (http://pleiades.online/cgi-perl/search.pl/?type=abstract&name=geochem&number=10&year=1&page=990) -mod.obigt("AuCl2-", ref1 = "AZ01", date = today(), - G = -36795, H = -46664, S = 47.16, Cp = -26.4, V = 68.6, - a1 = 11.4774, a2 = 20.2425, a3 = -2.2063, a4 = -3.6158, - c1 = 27.0677, c2 = -22.240, omega = 0.8623, z = -1) -# Au(HS)2- from Pokrovski et al., 2014 -mod.obigt("Au(HS)2-", ref1 = "PAB+14", date = today(), - G = 3487, H = 4703, S = 77.46, Cp = 3.3, V = 75.1, - a1 = 12.3373, a2 = 22.3421, a3 = 3.0317, a4 = -3.7026, - c1 = -53.6010, c2 = 31.4030, omega = 0.7673, z = -1) - # set up system # use H2S here: it's the predominant species at the pH of the QMK buffer -- see sulfur() basis(c("Al2O3", "quartz", "Fe", "Au", "K+", "Cl-", "H2S", "H2O", "oxygen", "H+")) @@ -41,7 +14,7 @@ # create a pH buffer mod.buffer("QMK", c("quartz", "muscovite", "K-feldspar"), "cr", 0) -# define colors for Au(HS)2-, Au(HS), AuOH, AuCl2- +# define colors for Au(HS)2-, AuHS, AuOH, AuCl2- # after Williams-Jones et al., 2009 # (doi:10.2113/gselements.5.5.281) col <- c("#ED4037", "#F58645", "#0F9DE2", "#22CC88") @@ -78,7 +51,7 @@ # log(m_Au)-pH diagram like Fig. 7 of Akinfiev and Zotov, 2001 # (http://pleiades.online/cgi-perl/search.pl/?type=abstract&name=geochem&number=10&year=1&page=990) Au_pH1 <- function() { - species(c("Au(HS)2-", "Au(HS)", "AuOH")) + species(c("Au(HS)2-", "AuHS", "AuOH")) # apply PPM buffer for fO2 and aH2S basis("O2", "PPM") basis("H2S", "PPM") @@ -103,7 +76,7 @@ # log(m_Au)-pH diagram similar to Fig. 12b of Stefansson and Seward, 2004 # (doi:10.1016/j.gca.2004.04.006) Au_pH2 <- function() { - species(c("Au(HS)2-", "Au(HS)", "AuOH", "AuCl2-")) + species(c("Au(HS)2-", "AuHS", "AuOH", "AuCl2-")) # apply PPM buffer for fO2 and aH2S basis("O2", "PPM") basis("H2S", "PPM") @@ -140,7 +113,7 @@ # log(m_Au)-T diagram like Fig. 2B of Williams-Jones et al., 2009 # (doi:10.2113/gselements.5.5.281) Au_T1 <- function() { - species(c("Au(HS)2-", "Au(HS)", "AuOH", "AuCl2-")) + species(c("Au(HS)2-", "AuHS", "AuOH", "AuCl2-")) # apply PPM buffer for fO2 and aH2S basis("O2", "PPM") basis("H2S", "PPM") @@ -170,7 +143,7 @@ # (doi:10.2113/gselements.5.5.281) # (doi:10.1144/SP402.4) Au_T2 <- function() { - species(c("Au(HS)2-", "Au(HS)", "AuOH", "AuCl2-")) + species(c("Au(HS)2-", "AuHS", "AuOH", "AuCl2-")) # total S = 0.01 m basis("H2S", -2) # apply HM buffer for fO2 @@ -201,7 +174,7 @@ } # make plots -opar <- par(mfrow=c(2, 2)) +opar <- par(mfrow = c(2, 2)) Au_pH1() Au_pH2() Au_T1() Modified: pkg/CHNOSZ/demo/sources.R =================================================================== --- pkg/CHNOSZ/demo/sources.R 2019-01-27 08:31:35 UTC (rev 374) +++ pkg/CHNOSZ/demo/sources.R 2019-01-27 16:54:58 UTC (rev 375) @@ -13,8 +13,14 @@ tdata <- read.csv(system.file("extdata/OBIGT/SUPCRTBL.csv", package="CHNOSZ"), as.is=TRUE) os3 <- gsub("\ .*", "", tdata$ref1) os4 <- gsub("\ .*", "", tdata$ref2) +tdata <- read.csv(system.file("extdata/OBIGT/SUPCRT92.csv", package="CHNOSZ"), as.is=TRUE) +os5 <- gsub("\ .*", "", tdata$ref1) +os6 <- gsub("\ .*", "", tdata$ref2) +tdata <- read.csv(system.file("extdata/OBIGT/SLOP98.csv", package="CHNOSZ"), as.is=TRUE) +os7 <- gsub("\ .*", "", tdata$ref1) +os8 <- gsub("\ .*", "", tdata$ref2) # all of the thermodynamic data sources - some of them might be NA -obigt.source <- unique(c(ps1, ps2, os1, os2, os3, os4)) +obigt.source <- unique(c(ps1, ps2, os1, os2, os3, os4, os5, os6, os7, os8)) obigt.source <- obigt.source[!is.na(obigt.source)] # these all produce character(0) if the sources are all accounted for print("missing these sources for thermodynamic properties:") Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2019-01-27 08:31:35 UTC (rev 374) +++ pkg/CHNOSZ/inst/NEWS 2019-01-27 16:54:58 UTC (rev 375) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 1.1.3-81 (2019-01-27) +CHANGES IN CHNOSZ 1.1.3-83 (2019-01-27) --------------------------------------- BUG FIXES @@ -149,6 +149,11 @@ - Add scheelite (CaWO4) and ferberite (FeWO4) using data adopted by Wood and Samson, 2000. +- Update aqueous Au species with data from Akinfiev and Zotov, 2001 + and 2010, and Pokrovski et al., 2014. + +- Move superseded data for aqueous Au species to SLOP98.csv. + DIAGRAMS - Lines in 1-D diagram()s can optionally be drawn as splines using the Added: pkg/CHNOSZ/inst/extdata/OBIGT/SLOP98.csv =================================================================== --- pkg/CHNOSZ/inst/extdata/OBIGT/SLOP98.csv (rev 0) +++ pkg/CHNOSZ/inst/extdata/OBIGT/SLOP98.csv 2019-01-27 16:54:58 UTC (rev 375) @@ -0,0 +1,10 @@ +name,abbrv,formula,state,ref1,ref2,date,G,H,S,Cp,V,a1.a,a2.b,a3.c,a4.d,c1.e,c2.f,omega.lambda,z.T +AuCl,AuCl,AuCl,aq,"SSH97.1 [S98]",NA,2.Oct.97,-3184,-2140,41.47,-9.83,38.61,7.0357,9.4008,2.0481,-3.1676,0.0551,-5.0371,-0.038,0 +AuCl2-,AuCl2-,AuCl2-,aq,"SSH97.1 [S98]",NA,2.Oct.97,-36781,-44725,53.6,-24.52,69.26,11.5192,20.3482,-2.2547,-3.6201,-0.6764,-8.03,0.8173,-1 +AuCl3-2,AuCl3-2,AuCl3-2,aq,"SSH97.1 [S98]",NA,2.Oct.97,-67811,-86023,61.39,-43.48,103.42,16.6878,32.9687,-7.2151,-4.1419,1.7155,-11.891,2.2827,-2 +AuCl4-3,AuCl4-3,AuCl4-3,aq,"SSH97.1 [S98]",CHNOSZ.5,2.Oct.97,-35332,23573,-32.72,-1.36,-20.66,-0.5361,-9.0876,9.3148,-2.4033,19.7251,-3.3107,1.5579,-3 +Au(HS)2-,Au(HS)2-,Au(HS)2-,aq,"SSH97.1 [S98]",NA,9.Oct.97,2429,-2509,56.77,6.06,75.39,12.342,22.3572,-3.0443,-3.7032,16.8038,-1.8007,0.7693,-1 +Au+,Au+,Au+,aq,"SSWS97.2 [S98]",NA,13.Nov.97,39000,47900,25.6,-0.3,12.5,3.5312,0.8428,5.4139,-2.8137,7.5089,-3.0956,0.1648,1 +Au+3,Au+3,Au+3,aq,"SSWS97.2 [S98]",NA,13.Nov.97,103600,97800,-54.8,-8.2,-31.4,-1.7167,-11.9654,10.4352,-2.2843,23.5775,-4.7048,2.4115,3 +Au(Ac),NA,AuCH3COO,aq,"SK93.1 [S98]",NA,10.Sep.92,-49870,-68310,48,56.1,61.8,10.213,17.1576,-0.9969,-3.4882,38.7432,8.3843,-0.03,0 +Au(Ac)2-,NA,Au(CH3COO)2-,aq,"SK93.1 [S98]",NA,10.Sep.92,-138240,-186750,61.3,132.8,118.3,18.1917,36.6392,-8.6534,-4.2936,90.461,24.0193,0.701,-1 Modified: pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_aq.csv.xz =================================================================== --- pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_aq.csv.xz 2019-01-27 08:31:35 UTC (rev 374) +++ pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_aq.csv.xz 2019-01-27 16:54:58 UTC (rev 375) @@ -1,4 +1,4 @@ -?7zXZ???F!t/????)?q]7I??b???9??????TB;q?"?q???cL;?"???L6??? Vz ???<??.????4? ~?;??Gp? ??<;dMR???? EG??????0????'??O??S8?N??2r??T??u??t?6rL?v???"??CM???J?(??AO?c9?i3f?T>?IG????A??*????N+D.;Pqm??I?????h?? -.???I 8M?C?T??,cR???????]?={e?&? E;k-D|??????D?7?mqfGK??t;?-?$?{??`?^xj -???A??q? - ?????Q????cK?g?w6^f?u??}yrk?r?WO??????C??8?_ U???hmI? ???a}KZ0A/4-(h9?x???^?I??"???;??O?^#?lmX??7??????? -Q?b?5?1?FVr$??B???;_+??? -*?po?L??`??BV??????5 l?nf???:??g?]????o?]?^uuG?>*]?? -d@8? 49)uU?M?9?Z????????*?_????D?(?Yg*X ????@????2?j??????U?!Hc???+V????a?+?^U???z?9??b\? Mq?G???j??s?;P5???=???F?6yS?7 -C~????k+"br?h%?~?m_????CS?4??g1vqf|????????Cs?R?f??&9??Y??m{K6??a??????????Ad??_J!Nc?m??2f9Tu?T ?Ib?? ?q ??e???????LP ??t????G?'??i5ET???????? {??PnU?LO????@V?5????q'??????????\?t ?[?;????4| ??Cxv7b??%C???????v??q??}??-?\??G?}KDh??? -?.8?,?np??7?u>uH??j,??S??}?j??A???k?;r?? mQ???tc?@?e??SO??????s????&{ ?N???9??9?>9P64^b??1?b4??e?f]?N?[??_{]?>?????"?Mo? -???q/:? "?????q HG??]J??L?S??????Iq=???5?'?+b?8 ?k>????K?????b2?????"??L4o?HaQ$????bXBf?Ss?\Y] ?s??????$:?? -*???u??N?k2 -? ??[??+?Tp5nbk'?_???d???Fg?$??P6X??,???y? -?l??Z??s?{j??b???YX??+?i??O?=~M"????G??7????_Kw??U??s?hgp_?cO???????>Q?>????q???Wm8s#??4?Z??????pT???=??!??%?Q???w??D??W? ? -U~??E?}??W_?l???Eg??4???%???Gc???????f|$? -^???>?????4?[?????? ??i -? nJ???? -????????????X?% ??$?????S??r??????oRRMk??3]Z?T???V? -&8??'???"???{/??%???mb&f?b??????H-?ex?Hl???>??.c?????J????Nw??KY?@6q?]?^iy6Q??tP??????}U???8?[?????)?^??GN??????f?????d'D?????Nf^nB?#????W=?@'L?a?Q?????CI B???? G??-????)\9????%? ???i???B??(fS?$?+, 4???*1???)?????B?\?g??u?2??\?5?z??f?#5??rBQ8???/?zi?????D??SJ??W?D7???7?q??????'???.^??]aC??j??????1??`#????K?????8C?????9?8?t???,???1?f???C'????G?M2?(?8?2tqL??a???g?!xvV(A@???q??Y?v???D?lt??z"`?6.?1?K????pb???b??pE????I?????id?V?`_|?f?r?]9?iD??dC???_??I:??????J8?!A??????" ?(???Rz?;?W}}?"??l?????? ?/@??u? ???Dq?L????C??&??to????Yp -???'P?N?)?4|??U S{?? ?s5wVn?lx4???Mu?J???? -T?fK?Z,????+L??)??1??._o ?5gE?N?7????????x??W3?p/?L????~??I??VB}?Z|_J]?????*LT???6??T:M#??;d?????????\??????a?*?????H?-???8nv?-EgHB2?N?.? d??r?????S??)?{???????}9?-????d???.??|??A????in?Za????g?>a!????EiXu??;?T????????YL?.d? ?m{&D??\C?q??M?????X0o??Q6F$??Du:?? NL? -o?J?hIE??g???P?`U????M?J?"N??=ey?).???{???Q,^?????l-???H?l ????D?qzE0L?\t??U?????Rg?P?j?R?Rt(??$ -?????F?G|??{%? ]??????t???MK???a???n?Vcp???????k?!K?o??d???H?`?l?W????pZ -?yZPr at EYI?E???b> ?[l??????6t?P9???!U??Tj9 ?????HN??????~n(d-???c???[?\??%[?=Qk"?????? -?????O?;?!?d2frNk?? ???'q@?k??gB?1ZM?????hO? v?-??=BLh??K????!????]????? X???~?u?G?j???VjPy?a?8a?e0q?{???d(x~t[F?????????<&&R{@9.)??8?G?Xd w????3?? $C]@?f?xH?k??????,?Rv? T?c???P?ST?y??????_f????y??r????.cK????%?|???#r~sS?F?? ??B>?"?H?? -??a???????? ?(?rP????8?^?&?????Y -??*!(@?P[x?G?????pF?$? w???)}????????? -?N??:M?`w?i???^KC7?Ss????? ?Kh6G ???5? ?fwp??A??????Y5?(????Ues????e??G_ ??/Q???Pf -'J?q???W/?"?B???1C ??_?????Ub??`??_!?X?????x??TE???Z???O????3?(?N|4????(??=qS????????r??{^#??:9??5Y??U?Q??&l?~???????T@?y?7??0?????wX6?y5?;?9R??b_?2H??P??~??10pg\r!???N%?,?9? -?w??6?if?8 q?????mt?I Mj???Lc????I??X??f??^?????K?!???]j??f??wt??3?f ??@#[x6?>??Ng?j?3????r/@?{b?C'??f????Q?a?ud>UPT?B? ???6?$????]v???0}X??}T???5XMoR???? ?????O?n???t?3'my???9?y???_??*}01?X??q?YE????:0??[??x???#????w??5?s?WC)LN5??????0? !???J??P:????yaZu???&??c???- N?,?????fB??????????8h??????????Z??"N??u? ???FUW??og???Y>?????-n?',?y??? y?l????C,????????%6??W??RU`??<,/%8??O???Q?? -?QMLv)????????b??J\?>D1 yu????w1E??bb?T?????????o?b ?%2???m??h??J?%K??>?????d?4???V??aX>>}~M?U?4?p?t?s*?;C??ZS 0??8)?????E???1l??????{?>???F???o?????g.???y???/T???#????IV)??4 -?4??w?w???+l???l??%?{?&??h??bj???",T??lb??2f?????X?????$??-%??Y?????>??D0c??]?0??>??(??4?w ?;?9\7??F?d?f?Q??y??Z3? ?? -??YF?FKE?]/,?????N?6f????????f{???&???j -?0???????#~58h ?i??????l"?PN????MG???f?4?iy??? -?????:?&e?m???i???ne???? -??.v?Ai?????[0?2??_p??????????8????NZ8?5h?????4???????}Y\=????????_??Z1NYi???????RC_n>?????? -z??K?_L??4,3??Y?!HHh\????SzX#?P4? -?x?;;H???A??e???? ??qK?Ja???0B??5?:!??)? -~M??i??1???m?' ;E?Z???u??g?PWpyw?Q?[D ?O?,??^<?%h????W?J??`?{?x??;tF?!??Yc?i??(????Fo???&?#?b?3?&t?_?s/!? I?5????)???c7n??XoaJ???Np+?O8G?=?~+????v??eY?????5? ??w -/???I?*??????(??G????? J???'-???J??(?????3?R????Z!5.??\??? E^??"w -,I7L#??'hp??????ey?{?S[?d?c0??^???s{erE?.S??W???7ZM?5????B????i?eQ??dL??re????? -y)?Y2??=??4??? ?g-?^K?z5?W?Ko1(???s.????eM 1`d????? -????i?bru4?3???????nzsJ?M?n?W???vz????+???hj0?o??????!????h?Az??}FRzK]?F2Y??;Q7?c?2z??]p???&DV3???Z:r????v{[?;c??????????3???? [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/chnosz -r 375 From noreply at r-forge.r-project.org Mon Jan 28 09:53:04 2019 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 28 Jan 2019 09:53:04 +0100 (CET) Subject: [CHNOSZ-commits] r376 - in pkg/CHNOSZ: . R data demo inst inst/extdata/OBIGT man tests/testthat vignettes Message-ID: <20190128085304.4A0FF18BFD4@r-forge.r-project.org> Author: jedick Date: 2019-01-28 09:53:03 +0100 (Mon, 28 Jan 2019) New Revision: 376 Removed: pkg/CHNOSZ/inst/extdata/OBIGT/SUPCRTBL.csv Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/info.R pkg/CHNOSZ/R/util.data.R pkg/CHNOSZ/data/refs.csv pkg/CHNOSZ/demo/go-IU.R pkg/CHNOSZ/demo/sources.R pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/inst/extdata/OBIGT/SLOP98.csv pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_aq.csv.xz pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_cr.csv.xz pkg/CHNOSZ/inst/extdata/OBIGT/organic_aq.csv.xz pkg/CHNOSZ/man/util.data.Rd pkg/CHNOSZ/tests/testthat/test-info.R pkg/CHNOSZ/tests/testthat/test-util.data.R pkg/CHNOSZ/vignettes/anintro.Rmd pkg/CHNOSZ/vignettes/eos-regress.Rmd pkg/CHNOSZ/vignettes/obigt.Rmd pkg/CHNOSZ/vignettes/obigt.bib pkg/CHNOSZ/vignettes/vig.bib Log: move SUPCRTBL updates into default database Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2019-01-27 16:54:58 UTC (rev 375) +++ pkg/CHNOSZ/DESCRIPTION 2019-01-28 08:53:03 UTC (rev 376) @@ -1,6 +1,6 @@ -Date: 2019-01-27 +Date: 2019-01-28 Package: CHNOSZ -Version: 1.1.3-83 +Version: 1.1.3-84 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/info.R =================================================================== --- pkg/CHNOSZ/R/info.R 2019-01-27 16:54:58 UTC (rev 375) +++ pkg/CHNOSZ/R/info.R 2019-01-28 08:53:03 UTC (rev 376) @@ -243,7 +243,7 @@ } # if we got here there were no approximate matches # 20190127 look for the species in optional data files - for(opt in c("SUPCRTBL", "SUPCRT92")) { + for(opt in c("SLOP98", "SUPCRT92")) { optdat <- read.csv(system.file(paste0("extdata/OBIGT/", opt, ".csv"), package="CHNOSZ"), as.is=TRUE) if(species %in% optdat$name) { message('info.approx: ', species, ' is in an optional database; use add.obigt("', opt, '", "', species, '") to load it') Modified: pkg/CHNOSZ/R/util.data.R =================================================================== --- pkg/CHNOSZ/R/util.data.R 2019-01-27 16:54:58 UTC (rev 375) +++ pkg/CHNOSZ/R/util.data.R 2019-01-28 08:53:03 UTC (rev 376) @@ -261,7 +261,7 @@ # looking at thermo$obigt if(what=="OBIGT") tdata <- get("thermo")$obigt else if(what=="DEW") tdata <- read.csv(system.file("extdata/OBIGT/DEW_aq.csv", package="CHNOSZ"), as.is=TRUE) - else if(what=="SUPCRTBL") tdata <- read.csv(system.file("extdata/OBIGT/SUPCRTBL.csv", package="CHNOSZ"), as.is=TRUE) + else if(what=="SLOP98") tdata <- read.csv(system.file("extdata/OBIGT/SLOP98.csv", package="CHNOSZ"), as.is=TRUE) else if(what=="SUPCRT92") tdata <- read.csv(system.file("extdata/OBIGT/SUPCRT92.csv", package="CHNOSZ"), as.is=TRUE) ntot <- nrow(tdata) # where to keep the results @@ -294,7 +294,7 @@ out <- checkfun("OBIGT") # check optional data out <- rbind(out, checkfun("DEW")) - out <- rbind(out, checkfun("SUPCRTBL")) + out <- rbind(out, checkfun("SLOP98")) out <- rbind(out, checkfun("SUPCRT92")) # set differences within a tolerance to NA out$DCp[abs(out$DCp) < 1] <- NA @@ -369,12 +369,12 @@ # optional data dat <- read.csv(system.file("extdata/OBIGT/DEW_aq.csv", package="CHNOSZ"), as.is=TRUE) DEW <- cbind(source="DEW", dat) - dat <- read.csv(system.file("extdata/OBIGT/SUPCRTBL.csv", package="CHNOSZ"), as.is=TRUE) - SUPCRTBL <- cbind(source="SUPCRTBL", dat) + dat <- read.csv(system.file("extdata/OBIGT/SLOP98.csv", package="CHNOSZ"), as.is=TRUE) + SLOP98 <- cbind(source="SLOP98", dat) dat <- read.csv(system.file("extdata/OBIGT/SUPCRT92.csv", package="CHNOSZ"), as.is=TRUE) SUPCRT92 <- cbind(source="SUPCRT92", dat) # put it all together - out <- rbind(OBIGT, DEW, SUPCRTBL, SUPCRT92) + out <- rbind(OBIGT, DEW, SLOP98, SUPCRT92) # quote columns 2 (name) and 3 (abbrv) because they have commas for some entries if(!is.null(file)) write.csv(out, file, row.names=FALSE, quote=c(2, 3)) else(return(out)) Modified: pkg/CHNOSZ/data/refs.csv =================================================================== --- pkg/CHNOSZ/data/refs.csv 2019-01-27 16:54:58 UTC (rev 375) +++ pkg/CHNOSZ/data/refs.csv 2019-01-28 08:53:03 UTC (rev 376) @@ -26,7 +26,9 @@ RA87,"E. J. Reardon and D. K. Armstrong",1987,"Geochim. Cosmochim. Acta 51, 63-72","celestite GHS",https://doi.org/10.1016/0016-7037(87)90007-X Ber88,"R. G. Berman",1988,"J. Petrol. 29, 445-522",minerals,https://doi.org/10.1093/petrology/29.2.445 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 +SH88.1,"E. L. Shock and H. C. Helgeson",1988,"Geochim. Cosmochim. Acta 52, 2009-2036","H2AsO3-",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 +SHS89.1,"E. L. Shock, H. C. Helgeson and D. A. Sverjensky",1989,"Geochim. Cosmochim. Acta 53, 2157-2183","aqueous SiO2",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: modified H and/or S",http://ammin.geoscienceworld.org/content/75/3-4/328 Eva90,"B. W. Evans",1990,"Lithos 25, 3-23","glaucophane and pumpellyite",https://doi.org/10.1016/0024-4937(90)90003-J @@ -46,6 +48,7 @@ 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 SK93.1,"E. L. Shock and C. M. Koretsky",1993,"Geochim. Cosmochim. Acta 57, 4899-4922","Au-acetate complexes",https://doi.org/10.1016/0016-7037(93)90128-J +SK93.2,"E. L. Shock and C. M. Koretsky",1993,"Geochim. Cosmochim. Acta 57, 4899-4922","Al-acetate complexes",https://doi.org/10.1016/0016-7037(93)90128-J SM93,"E. L. Shock and W. B. McKinnon",1993,"Icarus 106, 464-477","CO, HCN, urea",https://doi.org/10.1006/icar.1993.1185 SS93,"M. D. Schulte and E. L. Shock",1993,"Geochim. Cosmochim. Acta 57, 3835-3846",aldehydes,https://doi.org/10.1016/0016-7037(93)90337-V HSS95,"J. R. Haas, E. L. Shock and D. C. Sassani",1995,"Geochim. Cosmochim. Acta 59, 4329-4350","complexes of rare earth elements",https://doi.org/10.1016/0016-7037(95)00314-P @@ -70,6 +73,8 @@ SSWS97,"E. L. Shock, D. C. Sassani et al.",1997,"Geochim. Cosmochim. Acta 61, 907-950","inorganic ions and hydroxide complexes",https://doi.org/10.1016/S0016-7037(96)00339-0 SSWS97.1,"E. L. Shock, D. C. Sassani et al.",1997,"Geochim. Cosmochim. Acta 61, 907-950","zincite and litharge",https://doi.org/10.1016/S0016-7037(96)00339-0 SSWS97.2,"E. L. Shock, D. C. Sassani et al.",1997,"Geochim. Cosmochim. Acta 61, 907-950","Au+ and Au+3",https://doi.org/10.1016/S0016-7037(96)00339-0 +SSWS97.3,"E. L. Shock, D. C. Sassani et al.",1997,"Geochim. Cosmochim. Acta 61, 907-950","arsenate and arsenite species",https://doi.org/10.1016/S0016-7037(96)00339-0 +SSWS97.4,"E. L. Shock, D. C. Sassani et al.",1997,"Geochim. Cosmochim. Acta 61, 907-950","aqueous Al species",https://doi.org/10.1016/S0016-7037(96)00339-0 TSD97,"Y. Tardy, R. Schaul, J. Duplay",1997,"C. R. Acad. Sci. Paris 324, 969-976","humic acid, microflora, and plants",https://doi.org/10.1016/S1251-8050(97)83981-X HOKR98,"H. C. Helgeson, C. E. Owens et al.",1998,"Geochim. Cosmochim. Acta 62, 985-1081","organic molecules and groups",https://doi.org/10.1016/S0016-7037(97)00219-6 HOKR98.1,"H. C. Helgeson, C. E. Owens et al.",1998,"Geochim. Cosmochim. Acta 62, 985-1081","amino acids",https://doi.org/10.1016/S0016-7037(97)00219-6 @@ -85,6 +90,7 @@ HS99,"J. R. Haas and E. L. Shock",1998,"Geochim. Cosmochim. Acta 63, 3429-3441","chloroethylene species",https://doi.org/10.1016/S0016-7037(99)00276-8 MS99,"W. M. Murphy and E. L. Shock",1999,"Rev. Mineral. Geochem. 38, 221-253",actinides,http://rimg.geoscienceworld.org/content/38/1/221 PSK99,"P. Prapaipong, E. L. Shock and C. M. Koretsky",1999,"Geochim. Cosmochim. Acta 63, 2547-2577","metal-dicarboxylate complexes",https://doi.org/10.1016/S0016-7037(99)00146-5 +PSK99.1,"P. Prapaipong, E. L. Shock and C. M. Koretsky",1999,"Geochim. Cosmochim. Acta 63, 2547-2577","Al(Mal)+ and Al(Oxal)+",https://doi.org/10.1016/S0016-7037(99)00146-5 SAJ00,"R. E. Stoffregen, C. N. Alpers and J. L. Jambor",2000,"Rev. Mineral. Geochem. 40, 453-479","jarosite, natroalunite, and natrojarosite",https://doi.org/10.2138/rmg.2000.40.9 WS00,"S. A. Wood and I. M. Samson",2000,"Econ. Geol. 95, 143-182","scheelite and ferberite; adopted values include Cp parameters for scheelite from @BK73 and GHS and Cp parameters for ferberite from @Pol90",https://doi.org/10.2113/gsecongeo.95.1.143 AP01,"J. P. Amend and A. V. Plyasunov",2001,"Geochim. Cosmochim. Acta 65, 3901-3917",carbohydrates,https://doi.org/10.1016/S0016-7037(01)00707-4 @@ -158,7 +164,6 @@ CHNOSZ.1,"J. M. Dick",2017,"CHNOSZ package documentation","GHS (Tr) of the phase that is stable at 298.15 K was combined with Htr and the Cp coefficients to calculate the metastable GHS (Tr) of the phases that are stable at higher temperatures.",http://chnosz.net CHNOSZ.2,"J. M. Dick",2017,"CHNOSZ package documentation","alanate and glycinate: GHS as used by @DLH06",http://chnosz.net CHNOSZ.3,"J. M. Dick",2017,"CHNOSZ package documentation","metal-amino acid complexes: GHS were recalculated by adding the differences between values from @AH97b and @DLH06 for alanate or glycinate to the properties of the complexes reported by @SK95.",http://chnosz.net -CHNOSZ.4,"J. M. Dick",2017,"CHNOSZ package documentation","pseudo-H4SiO4; GHS and HKF parameters calculated as shown in the vignette, [*Regressing thermodynamic data*](eos-regress.html)",http://chnosz.net CHNOSZ.5,"J. M. Dick",2017,"CHNOSZ package documentation","AuCl4- renamed to AuCl4-3",http://chnosz.net CHNOSZ.6,"J. M. Dick",2017,"CHNOSZ package documentation","dipeptides not included in slop files after slop98.dat",http://chnosz.net CHNOSZ.7,"J. M. Dick",2017,"CHNOSZ package documentation","charge of NpO2(Oxal), La(Succ)+, NH4(Succ)-, and NpO2(Succ) as listed by @PSK99",http://chnosz.net Modified: pkg/CHNOSZ/demo/go-IU.R =================================================================== --- pkg/CHNOSZ/demo/go-IU.R 2019-01-27 16:54:58 UTC (rev 375) +++ pkg/CHNOSZ/demo/go-IU.R 2019-01-28 08:53:03 UTC (rev 376) @@ -21,35 +21,26 @@ thermo.plot.new(xlim=range(T), ylim=c(-3.5, -1.5), xlab = axis.label("T"), ylab=axis.label("SiO2")) points(xT, xlogaSiO2) basis(delete=TRUE) -## first calculation: after SUPCRT92 (SiO2(aq) from SHS89) +## first calculation: after SUPCRT92 and SLOP98 add.obigt("SUPCRT92") # gets kaolinite and boehmite from HDNB78 +add.obigt("SLOP98") # SiO2(aq) from SHS89 r1 <- subcrt(c("boehmite", "H2O", "SiO2", "kaolinite"), c(-1, -0.5, -1, 0.5), T=T, P=1000, exceed.Ttr = TRUE) # we need exceed.Ttr = TRUE because the T limit for boehmite is 500 K (Helgeson et al., 1978) -## second calculation: kaolinite from Berman, 1988 +## second calculation: CHNOSZ default +# kaolinite from Berman, 1988 +# boehmite from Hemingway et al., 1991 +# SiO2 from Apps and Spycher, 2004 data(thermo) -add.obigt("SUPCRT92", "boehmite") # gets only boehmite from HDNB78 r2 <- subcrt(c("boehmite", "H2O", "SiO2", "kaolinite"), c(-1, -0.5, -1, 0.5), T=T, P=1000, exceed.Ttr = TRUE) -## third calculation: boehmite from Hemingway et al., 1991 -add.obigt("SUPCRTBL", "boehmite") -r3 <- subcrt(c("boehmite", "H2O", "SiO2", "kaolinite"), c(-1, -0.5, -1, 0.5), T=T, P=1000) -## fourth calculation: SiO2 from Apps and Spycher, 2004 -add.obigt("SUPCRTBL", "SiO2") -r4 <- subcrt(c("boehmite", "H2O", "SiO2", "kaolinite"), c(-1, -0.5, -1, 0.5), T=T, P=1000) ## log activity of SiO2 is -ve logK lines(T, -r1$out$logK) -lines(T, -r2$out$logK, lty=2) -lines(T, -r3$out$logK, lty=2, col="red") -lines(T, -r4$out$logK, col="red") +lines(T, -r2$out$logK, col="red") ## add points calculated using the SUPCRTBL package points(seq(125, 350, 25), -c(3.489, 3.217, 2.967, 2.734, 2.517, 2.314, 2.124, 1.946, 1.781, 1.628), pch=4, col="red") -## add labels, legend, and title -text(182.5, -3.17, "SUPCRT92", srt=48, cex=0.7, font=2) -text(154, -3.04, "circa SUPCRTBL", srt=45, cex=0.7, font=2, col="red") -legend("topleft", lty=c(1, 2, 2, 1, 0), pch=c(NA, NA, NA, NA, 4), - col=c("black", "black", "red", "red", "red"), bty="n", cex=0.9, - legend=c("Kln,Bhm:HDNB78; SiO2(aq):SHS89", "Kln:Ber88 (SUPCRTBL uses HP11)", - "+ Bhm:HRA91", "+ SiO2(aq):AS04", "SUPCRTBL")) -legend("bottomright", pch=1, legend="Hemley et al., 1980", bty="n", cex=0.9) +## add legend and title +legend("topleft", lty=c(0, 1, 0, 1), pch=c(1, NA, 4, NA), + col=c("black", "black", "red", "red"), bty="n", cex=0.9, + legend=c("Hemley et al., 1980", "SUPCRT92/SLOP98", "SUPCRTBL", "CHNOSZ")) mtitle(c("Kaolinite - Boehmite", "After Zhu and Lu, 2009 Fig. A1"), cex=0.95) # Zhu and Lu, 2009: doi:10.1016/j.gca.2009.03.015 # Helgeson et al., 1978 (HDNB78): http://www.worldcat.org/oclc/13594862 @@ -68,14 +59,12 @@ T <- c(100.1, 100.1, 150.1, 100.1, 150.1, 99.8, 99.8, 200.7, 99.8, 50.1, 75.1, 100.3, 150.1) logK <- -c(14.825, 14.735, 13.625, 14.79, 13.665, 14.725, 14.1775, 12.74, 14.4925, 16.8625, 15.61, 14.51, 13.455) plot(T, logK, xlim=c(25, 250), ylim=c(-18, -10), xlab=axis.label("T"), ylab=axis.label("logK")) -# this gets us dawsonite and Al(OH)4- -add.obigt("SUPCRTBL") T <- 0:250 -# calculation 1: dawsonite with non-zero Cp +# calculation 1: CHNOSZ default species <- c("dawsonite", "H2O", "Al(OH)4-", "HCO3-", "Na+", "H+") coeffs <- c(-1, -2, 1, 1, 1, 1) Daw1 <- subcrt(species, coeffs, T=T) -# calculation 2: dawsonite with 0 Cp +# calculation 2: dawsonite with Cp = 0 mod.obigt("dawsonite", Cp=0) Daw2 <- subcrt(species, coeffs, T=T) ## plot the calculated logKs @@ -83,21 +72,15 @@ lines(T, Daw2$out$logK, col="red", lty=2) ## add points calculated using the SUPCRTBL package points(seq(25, 250, 25), c(-17.829, -16.523, -15.402, -14.425, -13.568, -12.815, -12.154, -11.581, -11.094, -10.699), pch=4, col="red") -## add labels, legend, and title -text(182.5, -3.17, "SUPCRT92\n(CHNOSZ default)", srt=43, cex=0.7, font=2) -text(145, -3.1, "SUPCRTBL", srt=41.5, cex=0.7, font=2, col="red") -legend("topleft", lty=c(1, 2, 0), pch=c(NA, NA, 4), col="red", bty="n", cex=0.9, - legend=c("Daw Cp != 0", "Daw Cp = 0", "SUPCRTBL")) -legend("bottomright", pch=1, legend="Ben\u00e9z\u00e9th et al., 2007", bty="n", cex=0.9) +## add legend and title +legend("topleft", lty=c(0, 1, 0, 2), pch=c(1, NA, 4, NA), col=c("black", "red", "red", "red"), + bty="n", cex=0.9, legend=c("Ben\u00e9z\u00e9th et al., 2007", "CHNOSZ", "SUPCRTBL", "Cp(dawsonite) = 0")) mtitle(c("Dawsonite - aqueous species", "After Zimmer et al., 2016 Fig. 2"), cex=0.95) # doi:10.1016/j.cageo.2016.02.013 ########### ### plot 3: Eh-pH diagram for As-O-H-S ########### -add.obigt("SUPCRTBL") -#basis(c("Fe", "As", "H2O", "H2S", "H+", "e-")) -#basis(c("Fe", "H2S"), c(-6, -3)) basis(c("As", "H2O", "H2S", "H+", "e-")) basis(c("H2S"), c(-3)) As_aq <- c("H3AsO4", "H2AsO4-", "HAsO4-2", "AsO4-3", "H3AsO3", "H2AsO3-", "HAsO3-2", "AsO3-3") @@ -133,7 +116,6 @@ ########### ### plot 4: aqueous Al species ########### -add.obigt("SUPCRTBL") basis(c("Al+3", "F-", "H+", "O2", "H2O")) AlOH <- c("Al(OH)4-", "Al(OH)3", "Al(OH)2+", "AlOH+2") Al <- "Al+3" Modified: pkg/CHNOSZ/demo/sources.R =================================================================== --- pkg/CHNOSZ/demo/sources.R 2019-01-27 16:54:58 UTC (rev 375) +++ pkg/CHNOSZ/demo/sources.R 2019-01-28 08:53:03 UTC (rev 376) @@ -10,17 +10,14 @@ tdata <- read.csv(system.file("extdata/OBIGT/DEW_aq.csv", package="CHNOSZ"), as.is=TRUE) os1 <- gsub("\ .*", "", tdata$ref1) os2 <- gsub("\ .*", "", tdata$ref2) -tdata <- read.csv(system.file("extdata/OBIGT/SUPCRTBL.csv", package="CHNOSZ"), as.is=TRUE) +tdata <- read.csv(system.file("extdata/OBIGT/SLOP98.csv", package="CHNOSZ"), as.is=TRUE) os3 <- gsub("\ .*", "", tdata$ref1) os4 <- gsub("\ .*", "", tdata$ref2) tdata <- read.csv(system.file("extdata/OBIGT/SUPCRT92.csv", package="CHNOSZ"), as.is=TRUE) os5 <- gsub("\ .*", "", tdata$ref1) os6 <- gsub("\ .*", "", tdata$ref2) -tdata <- read.csv(system.file("extdata/OBIGT/SLOP98.csv", package="CHNOSZ"), as.is=TRUE) -os7 <- gsub("\ .*", "", tdata$ref1) -os8 <- gsub("\ .*", "", tdata$ref2) # all of the thermodynamic data sources - some of them might be NA -obigt.source <- unique(c(ps1, ps2, os1, os2, os3, os4, os5, os6, os7, os8)) +obigt.source <- unique(c(ps1, ps2, os1, os2, os3, os4, os5, os6)) obigt.source <- obigt.source[!is.na(obigt.source)] # these all produce character(0) if the sources are all accounted for print("missing these sources for thermodynamic properties:") Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2019-01-27 16:54:58 UTC (rev 375) +++ pkg/CHNOSZ/inst/NEWS 2019-01-28 08:53:03 UTC (rev 376) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 1.1.3-83 (2019-01-27) +CHANGES IN CHNOSZ 1.1.3-84 (2019-01-28) --------------------------------------- BUG FIXES @@ -154,6 +154,8 @@ - Move superseded data for aqueous Au species to SLOP98.csv. +- Move SUPCRTBL updates into default database. + DIAGRAMS - Lines in 1-D diagram()s can optionally be drawn as splines using the @@ -221,7 +223,7 @@ for info("SiO2")). - info(): species with no matches in default database are also - searched in optional data files (SUPCRTBL, SUPCRT92). + searched in optional data files. - Add C implementation of counting occurrences of all letters in a string (src/count_letters.c) to speed up operation of count.aa(). Modified: pkg/CHNOSZ/inst/extdata/OBIGT/SLOP98.csv =================================================================== --- pkg/CHNOSZ/inst/extdata/OBIGT/SLOP98.csv 2019-01-27 16:54:58 UTC (rev 375) +++ pkg/CHNOSZ/inst/extdata/OBIGT/SLOP98.csv 2019-01-28 08:53:03 UTC (rev 376) @@ -8,3 +8,21 @@ Au+3,Au+3,Au+3,aq,"SSWS97.2 [S98]",NA,13.Nov.97,103600,97800,-54.8,-8.2,-31.4,-1.7167,-11.9654,10.4352,-2.2843,23.5775,-4.7048,2.4115,3 Au(Ac),NA,AuCH3COO,aq,"SK93.1 [S98]",NA,10.Sep.92,-49870,-68310,48,56.1,61.8,10.213,17.1576,-0.9969,-3.4882,38.7432,8.3843,-0.03,0 Au(Ac)2-,NA,Au(CH3COO)2-,aq,"SK93.1 [S98]",NA,10.Sep.92,-138240,-186750,61.3,132.8,118.3,18.1917,36.6392,-8.6534,-4.2936,90.461,24.0193,0.701,-1 +H2AsO3-,H2AsO3-,H2AsO3-,aq,"SH88.1 [S92]",NA,3.Jul.87,-140330,-170840,26.4,-2.9,26.4,5.7934,6.3646,3.2485,-3.0421,15.8032,-3.6253,1.2305,-1 +AsO4-3,AsO4-3,AsO4-3,aq,"SSWS97.3 [S98]",NA,11.Nov.97,-154970,-212270,-38.9,-116.1,-18.7,1.0308,-5.2609,7.8091,-2.5614,-12.1352,-26.6841,5.399,-3 +HAsO4-2,HAsO4-2,HAsO4-2,aq,"SSWS97.3 [S98]",NA,11.Nov.97,-170790,-216620,-0.4,-47.5,11.3,4.3994,2.9611,4.5853,-2.9013,7.9908,-12.7102,3.2197,-2 +H2AsO4-,H2AsO4-,H2AsO4-,aq,"SSWS97.3 [S98]",NA,11.Nov.97,-180010,-217390,28,-0.6,33.4,6.7429,8.6835,2.3351,-3.1379,16.9206,-3.1567,1.2055,-1 +H3AsO4,H3AsO4,H3AsO4,aq,"SSWS97.3 [S98]",NA,11.Nov.97,-183100,-215700,44,25.8,45.9,7.9357,11.5925,1.199,-3.2581,18.2805,2.2209,-0.3263,0 +AsO2-,AsO2-,AsO2-,aq,"SSWS97.3 [S98]",NA,11.Nov.97,-83650,-102540,9.7,-28,6.9,3.2101,0.0554,5.7305,-2.7812,3.4104,-8.7381,1.482,-1 +HAsO2,HAsO2,HAsO2,aq,"SSWS97.3 [S98]",NA,11.Nov.97,-96240,-109110,30.1,2.9,28.3,5.5984,5.8913,3.428,-3.0224,6.799,-2.4438,-0.1158,0 +SiO2,NA,SiO2,aq,"SHS89.1 [S92]",NA,13.Jan.89,-199190,-209775,18,-76.1,16.1,1.9,1.7,20,-2.7,29.1,-51.2,0.1291,0 +AlO2-,AlO2-,AlO2-1,aq,"SSWS97.4 [S98]",NA,07.Nov.97,-198693,-222125,-7.22,-11.9,10,3.7221,3.9954,-1.5879,-2.9441,15.2391,-5.4585,1.7418,-1 +Al+3,Al+3,Al+3,aq,"SSWS97.4 [S98]",NA,07.Nov.97,-115609,-126834,-77.7,-32.5,-44.4,-3.3802,-17.0071,14.5185,-2.0758,10.7,-8.06,2.753,3 +AlOH+2,AlOH+2,AlOH+2,aq,"SSWS97.4 [S98]",NA,13.Nov.97,-165475,-183300,-44.2,13.2,-2.2,2.0469,-2.7813,6.8376,-2.6639,29.7923,-0.3457,1.7247,2 +AlO+,AlO+,AlO+1,aq,"SSWS97.4 [S98]",NA,13.Nov.97,-158188,-170900,-27,-30,0.6,2.1705,-2.4811,6.7241,-2.6763,-2.5983,-9.1455,0.957,1 +HAlO2,HAlO2(AQ),HAlO2,aq,"SSWS97.4 [S98]",NA,13.Nov.97,-207700,-227500,5,-50,13,3.5338,0.8485,5.4132,-2.814,-23.4129,-13.2195,-0.03,0 +Al(Ac)+2,NA,AlCH3COO+2,aq,"SK93.2 [S98]",NA,5.Apr.93,-207630,-249130,-66.1,72.2,-0.03,2.4411,-1.8235,6.4722,-2.7035,67.0012,11.6689,2.0115,2 +Al(Ac)2+,NA,Al(CH3COO)2+,aq,"SK93.2 [S98]",NA,5.Apr.93,-298430,-372080,-59.8,168.7,49.4,8.9971,14.1844,0.1805,-3.3653,117.86,31.3303,1.3918,1 +Al(Ac)3,NA,Al(CH3COO)3,aq,"SK93.2 [S98]",NA,5.Apr.93,-391100,-498280,-57,NA,NA,16.0545,31.4184,-6.597,-4.0777,156.5453,49.3293,-0.03,0 +Al(Mal)+,NA,AlC3H2O4+,aq,"PSK99.1 [S07]",NA,24.Aug.06,-289589,-331497,-16,-17.9,0,0,0,0,0,2.2763,-6.6807,0.7895,1 +Al(Oxal)+,NA,AlC2O4+,aq,"PSK99.1 [S07]",NA,24.Aug.06,-286615,-321675,-25.6,-25.8,0,0,0,0,0,-1.0645,-8.29,0.9437,1 Deleted: pkg/CHNOSZ/inst/extdata/OBIGT/SUPCRTBL.csv =================================================================== --- pkg/CHNOSZ/inst/extdata/OBIGT/SUPCRTBL.csv 2019-01-27 16:54:58 UTC (rev 375) +++ pkg/CHNOSZ/inst/extdata/OBIGT/SUPCRTBL.csv 2019-01-28 08:53:03 UTC (rev 376) @@ -1,98 +0,0 @@ -name,abbrv,formula,state,ref1,ref2,date,G,H,S,Cp,V,a1.a,a2.b,a3.c,a4.d,c1.e,c2.f,omega.lambda,z.T -"arsenic,alpha",NA,As,cr,NA03,ZZL+16.1,16.Oct.17,0,0,8.515774378585085,5.838910133843212,12.96,NA,NA,NA,NA,NA,NA,NA,NA -arsenolite,NA,As2O3,cr,NA03,NA,16.Oct.17,-137748.56596558317,-157091.3001912046,25.664435946462714,23.154875717017205,NA,NA,NA,NA,NA,NA,NA,NA,NA -claudetite,NA,As2O3,cr,NA03,NA,16.Oct.17,-137793.97705544933,-156708.8910133843,27.09608030592734,23.178776290630974,NA,NA,NA,NA,NA,NA,NA,NA,NA -As2O5,NA,As2O5,cr,NA03,NA,16.Oct.17,-185172.08413001912,-219309.27342256214,25.20076481835564,27.70076481835564,NA,NA,NA,NA,NA,NA,NA,NA,NA -"realgar,alpha",NA,AsS,cr,NA03,NA,16.Oct.17,-7480.879541108986,-7600.38240917782,15.033460803059272,11.233269598470363,NA,NA,NA,NA,NA,NA,NA,NA,NA -"realgar,beta",NA,AsS,cr,NA03,NA,16.Oct.17,-7385.277246653919,-7409.177820267686,15.176864244741873,11.233269598470363,NA,NA,NA,NA,NA,NA,NA,NA,NA -orpiment,NA,As2S3,cr,NA03,NA,16.Oct.17,-20291.586998087954,-20506.692160611852,39.14913957934991,38.95793499043977,NA,NA,NA,NA,NA,NA,NA,NA,NA -"orpiment,amorphous",NA,As2S3,cr,NA03,NA,16.Oct.17,-18355.640535372848,-15989.483747609942,47.801147227533455,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA -arsenopyrite,NA,FeAsS,cr,BN91,ZZL+16,16.Oct.17,-33843.21223709369,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA -scorodite,NA,FeAsO4.2H2O,cr,LMR06,ZZL+16,16.Oct.17,-307619.5028680688,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA -"ferric arsenate,amorphous",NA,FeAsO4.2H2O,cr,LMR06,ZZL+16,16.Oct.17,-303771.51051625237,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA -"barium arsenate",NA,Ba3(AsO4)2,cr,ZZX+05,ZZL+16,16.Oct.17,-739749.0439770555,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA -"barium hydrogen arsenate",NA,BaHAsO4.H2O,cr,ZZX+05,ZZL+16,16.Oct.17,-367746.1759082218,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA -boehmite,NA,AlO(OH),cr,HRA91,ZZL+16.2,17.Oct.17,-219502.86806883363,-238145.3154875717,8.888623326959847,12.97634,19.535,40.48757170172084,-4.1108986615678775,0.6962476099426387,-467.3996175908221,0,0,0,NA -gibbsite,NA,Al(OH)3,cr,RHF78.3,ZZL+16.2,17.Oct.17,-276025.1,-309065,16.35755,21.72251,31.956,22.179732313575524,45.276768642447415,0.3199569789674952,-247.20363288718926,0,0,0,NA -dawsonite,NA,NaAlCO3(OH)2,cr,ZZL+16.3,FSR76,17.Oct.17,-425979.9,-463456,32.91109,34.08222,NA,NA,NA,NA,NA,NA,NA,NA,NA -H3AsO4,NA,H3AsO4,aq,NA03.1,NA,17.Oct.17,-183257.6481835564,-215929.7323135755,43.75478011472275,NA,NA,NA,NA,NA,NA,NA,NA,NA,0 -H2AsO4-,NA,H2AsO4-,aq,NA03.1,NA,17.Oct.17,-180126.67304015296,-217834.60803059273,26.85946462715105,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1 -HAsO4-2,NA,HAsO4-2,aq,NA03.1,NA,17.Oct.17,-170585.56405353727,-217115.20076481835,-2.7294455066921604,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2 -AsO4-3,NA,AsO4-3,aq,NA03.1,NA,17.Oct.17,-154483.74760994263,-212765.2963671128,-42.13910133843212,NA,NA,NA,NA,NA,NA,NA,NA,NA,-3 -H3AsO3,NA,H3AsO3,aq,NA03.1,NA,17.Oct.17,-152970.8413001912,-177428.29827915868,46.80449330783939,NA,NA,NA,NA,NA,NA,NA,NA,NA,0 -H2AsO3-,NA,H2AsO3-,aq,NA03.1,NA,17.Oct.17,-140454.11089866157,-170826.9598470363,26.957456978967496,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1 -HAsO3-2,NA,HAsO3-2,aq,NA03.1,NA,17.Oct.17,-121271.51051625238,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2 -AsO3-3,NA,AsO3-3,aq,NA03.1,NA,17.Oct.17,-100812.61950286807,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-3 -As3S4(HS)2-,NA,As3S4(HS)2-,aq,NA03.1,NA,17.Oct.17,-30019.12045889101,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1 -AsS(OH)HS-,NA,AsS(OH)HS-,aq,NA03.1,NA,17.Oct.17,-58413.00191204589,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1 -SiO2,NA,SiO2,aq,AS04,ZZL+16,16.Oct.17,-199539.9,-212179,11.12811,NA,NA,1.9,1.7,20,-2.7,32.22,-25.29001,0.3427103,0 -H4SiO4,NA,H4SiO4,aq,Ste01,NA,31.Aug.06,-312919.933078394,-348676.147227533,45.1003824091778,15.0095602294455,52.3,18.7299235181644,-21.2600382409178,18.6199808795411,-1.20004780114723,58.0305927342256,-20.789913957935,0.0869024856596558,0 -Al+3,NA,Al+3,aq,TS01,NA,25.Aug.06,-116510,NA,-81.203,-28.56,-45.3,-3.3984,-16.0789,12.0699,-2.1143,14.4295,-8.8523,2.7403,3 -Al(OH)4-,NA,Al(OH)4-,aq,TS01,NA,25.Aug.06,-312087,NA,24.748,23.06,46.3,8.4938,12.9576,0.657,-3.3147,55.7265,-11.4047,1.0403,-1 -AlOH+2,NA,AlOH+2,aq,TS01,NA,25.Aug.06,-166425,NA,-43.29,-8.97,-20.6,-0.4532,-8.8878,9.2434,-2.4116,15.4131,-4.8618,1.5897,2 -Al(OH)2+,NA,Al(OH)2+,aq,TS01,NA,25.Aug.06,-214987,NA,-6.584,9.76,3.86,2.4944,-1.6909,6.4146,-2.7091,16.7439,-1.0465,0.5324,1 -Al(OH)3,NA,Al(OH)3,aq,TS01,NA,25.Aug.06,-263321,NA,14.185,23.65,27.02,5.4624,5.556,3.5662,-3.0087,20.027,1.7829,0,0 -AlF+2,NA,AlF+2,aq,TS01,NA,25.Aug.06,-193374,NA,-52.413,-3.41,-17.74,0.0486,-7.6626,8.7618,-2.4622,21.3382,-3.7292,1.882,2 -AlF2+,NA,AlF2+,aq,TS01,NA,25.Aug.06,-268382,NA,-29.84,20.88,9.58,3.4523,0.648,5.4953,-2.8058,27.4906,1.2187,0.996,1 -AlF3,NA,AlF3,aq,TS01,NA,25.Aug.06,-341248,NA,-14.45,40.33,35.6,6.6365,8.4227,2.4395,-3.1272,29.8025,5.1806,0,0 -AlF4-,NA,AlF4-,aq,TS01,NA,25.Aug.06,-411835,NA,-6.691,45.3,57.74,10.3172,17.4096,-1.0929,-3.4987,48.4334,6.193,1.7229,-1 -Al(OH)2F2-,NA,Al(OH)2F2-,aq,TS01,NA,25.Aug.06,-361765,NA,45.062,34.18,52.02,9.3237,14.9838,-0.1394,-3.3984,1.8352,21.1478,1.1651,-1 -Al(OH)2F,NA,Al(OH)2F,aq,TS01,NA,25.Aug.06,-291441,NA,25.181,19.55,21.52,4.7098,3.7184,4.2885,-2.9327,17.6241,0.9477,0,0 -AlOHF2,NA,AlOHF2,aq,TS01,NA,25.Aug.06,-308085,NA,42.004,15.45,16.02,3.9572,1.8807,5.0108,-2.8567,15.2213,0.1126,0,0 -AlSO4+,NA,AlSO4+,aq,TS01,NA,25.Aug.06,-298759,NA,-46.724,106.7,-6.17,1.833,-3.3057,7.0494,-2.6423,90.7261,18.7002,2.4143,1 -NaAl(OH)3F,NA,NaAl(OH)3F,aq,TS01,NA,25.Aug.06,-398892,NA,71.594,28.2,48,8.3333,12.5657,0.811,-3.2985,22.6935,2.7097,0,0 -NaAl(OH)2F2,NA,NaAl(OH)2F2,aq,TS01,NA,25.Aug.06,-403511,NA,128.933,24.2,42.4,7.567,10.6947,1.5464,-3.2211,20.3493,1.8949,0,0 -NaAl(OH)4,NA,NaAl(OH)4,aq,TS01,DPS+96,25.Aug.06,-374611,-413601,48.8,32.2,53.6,9.1267,14.3411,0.1121,-3.3719,60.7157,-14.0523,0,0 -AlH3SiO4+2,NA,AlH3SiO4+2,aq,TS01,NA,25.Aug.06,-425860,NA,13.57,-71.9,-13.93,0.16,-7.23,8.61,-2.48,37.07,-49.66,0.88,2 -NaH2AsO4,NA,NaH2AsO4,aq,MA07,MA10,12.Sep.07,-240179,-272608,41.2,37.8,41.1,7.3772,10.2352,1.1421,-3.2022,27.9202,4.6622,-0.038,0 -KH2AsO4,NA,KH2AsO4,aq,MA07,MA10,12.Sep.07,-244935,-274352,54.5,21.9,52.4,8.9277,14.0226,-0.484,-3.3587,18.6125,1.4173,-0.038,0 -MgH2AsO4+,NA,MgH2AsO4+,aq,MA07,MA10,12.Sep.07,-290910,-332717,-10.4,50.7,18.3,4.5105,3.2335,4.1483,-2.9127,42.265,7.2899,0.7009,1 -CaH2AsO4+,NA,CaH2AsO4+,aq,MA07,MA10,12.Sep.07,-314170,-348007,18.5,45.8,22.2,4.8949,4.1724,3.7452,-2.9515,35.3597,6.2862,0.2639,1 -SrH2AsO4+,NA,SrH2AsO4+,aq,MA07,MA10,12.Sep.07,-315896,-347841,27.3,40.1,22.9,4.9488,4.3041,3.6887,-2.957,30.8142,5.1312,0.1301,1 -MnH2AsO4+,NA,MnH2AsO4+,aq,MA07,MA10,12.Sep.07,-236482,-270828,14.5,53.5,23.3,5.0617,4.5799,3.5702,-2.9684,40.4264,7.8583,0.3244,1 -FeH2AsO4+,NA,FeH2AsO4+,aq,MA07,MA10,12.Sep.07,-205693,-243719,1,44.9,17.6,4.3531,2.849,4.3134,-2.8968,37.3097,6.1166,0.5283,1 -CoH2AsO4+,NA,CoH2AsO4+,aq,MA07,MA10,12.Sep.07,-193388,-232357,-1.5,45.2,13.9,3.8628,1.6516,4.8275,-2.8473,37.7921,6.1625,0.5664,1 -NiH2AsO4+,NA,NiH2AsO4+,aq,MA07,MA10,12.Sep.07,-193146,-233785,-7.1,36.4,10,3.358,0.4185,5.3569,-2.7963,33.4496,4.375,0.6516,1 -CuH2AsO4+,NA,CuH2AsO4+,aq,MA07,MA10,12.Sep.07,-166866,-204382,4.1,49.9,14.9,3.9712,1.9164,4.7138,-2.8583,39.7683,7.1249,0.4813,1 -ZnH2AsO4+,NA,ZnH2AsO4+,aq,MA07,MA10,12.Sep.07,-215927,-255372,-0.3,50.7,15.3,4.0397,2.0836,4.642,-2.8652,40.8741,7.2945,0.5485,1 -PbH2AsO4+,NA,PbH2AsO4+,aq,MA07,MA10,12.Sep.07,-187896,-215577,44.7,34.1,25,5.1359,4.7611,3.4924,-2.9759,24.9084,3.9167,-0.1328,1 -AlH2AsO4+2,NA,AlH2AsO4+2,aq,MA07,MA10,12.Sep.07,-299978,-350717,-57,34.9,-7.1,1.4491,-4.244,7.3587,-2.6036,44.5413,4.0694,1.9508,2 -FeH2AsO4+2,NA,FeH2AsO4+2,aq,MA07,MA10,12.Sep.07,-189949,-235535,-39.9,66.2,1.1,2.4901,-1.7013,6.267,-2.7087,60.4374,10.4402,1.6927,2 -NaHAsO4-,NA,NaHAsO4-,aq,MA07,MA10,12.Sep.07,-234025,-272938,19.4,11,16.4,4.464,3.12,4.197,-2.908,24.8601,-0.79,1.3274,-1 -KHAsO4-,NA,KHAsO4-,aq,MA07,MA10,12.Sep.07,-238754,-275247,30.7,3.9,26.1,5.7282,6.2078,2.8713,-3.0357,19.1455,-2.2322,1.1561,-1 -MgHAsO4,NA,MgHAsO4,aq,MA07,MA10,12.Sep.07,-282655,-326456,-17.1,-3.4,-0.5,1.6885,-3.6591,7.1076,-2.6278,3.8675,-3.7233,-0.038,0 -CaHAsO4,NA,CaHAsO4,aq,MA07,MA10,12.Sep.07,-306038,-344341,3.5,-5.6,2,2.0228,-2.8426,6.757,-2.6615,2.5879,-4.1694,-0.038,0 -SrHAsO4,NA,SrHAsO4,aq,MA07,MA10,12.Sep.07,-307750,-344917,9.8,-8.1,2.4,2.0851,-2.6905,6.6917,-2.6678,1.1155,-4.6827,-0.038,0 -MnHAsO4,NA,MnHAsO4,aq,MA07,MA10,12.Sep.07,-229564,-268033,0.7,-2.1,2.7,2.1148,-2.618,6.6606,-2.6708,4.592,-3.4707,-0.038,0 -FeHAsO4,NA,FeHAsO4,aq,MA07,MA10,12.Sep.07,-196961,-237958,-8.9,-5.9,-0.9,1.6263,-3.8112,7.1729,-2.6215,2.3717,-4.2448,-0.038,0 -CoHAsO4,NA,CoHAsO4,aq,MA07,MA10,12.Sep.07,-187516,-229240,-10.7,-5.8,-3.2,1.3102,-4.5832,7.5044,-2.5896,2.4302,-4.2244,-0.038,0 -NiHAsO4,NA,NiHAsO4,aq,MA07,MA10,12.Sep.07,-185083,-227995,-14.7,-9.7,-5.7,0.9749,-5.4021,7.8559,-2.5557,0.1514,-5.0188,-0.038,0 -CuHAsO4,NA,CuHAsO4,aq,MA07,MA10,12.Sep.07,-160044,-200797,-6.7,-3.7,-2.6,1.3964,-4.3727,7.414,-2.5983,3.6572,-3.7966,-0.038,0 -ZnHAsO4,NA,ZnHAsO4,aq,MA07,MA10,12.Sep.07,-209827,-252128,-9.9,-3.4,-2.4,1.4251,-4.3025,7.3838,-2.6012,3.8733,-3.7213,-0.038,0 -PbHAsO4,NA,PbHAsO4,aq,MA07,MA10,12.Sep.07,-180119,-214509,22.2,-10.7,3.7,2.2585,-2.267,6.5099,-2.6853,-0.4328,-5.2225,-0.038,0 -AlHAsO4+,NA,AlHAsO4+,aq,MA07,MA10,12.Sep.07,-295884,-343378,-46.1,-37.3,-8.2,1.0572,-5.2011,7.7697,-2.564,-4.1613,-10.6336,1.242,1 -FeHAsO4+,NA,FeHAsO4+,aq,MA07,MA10,12.Sep.07,-188188,-232211,-34.7,-23.4,-4.9,1.4545,-4.2306,7.353,-2.6042,2.37,-7.8022,1.0694,1 -NaAsO4-2,NA,NaAsO4-2,aq,MA07,MA10,12.Sep.07,-223700,-253943,48.5,-38.4,-17,0.2824,-7.0935,8.5822,-2.4858,6.8433,-10.8648,2.5085,-2 -KAsO4-2,NA,KAsO4-2,aq,MA07,MA10,12.Sep.07,-228428,-249049,84,-45.5,-9.64,1.1121,-5.0669,7.712,-2.5696,-2.2416,-12.307,1.9714,-2 -MgAsO4-,NA,MgAsO4-,aq,MA07,MA10,12.Sep.07,-271474,-307316,9.64,-55,-25.98,-1.3284,-11.0278,10.2713,-2.3232,-12.33,-14.2311,1.3662,-1 -CaAsO4-,NA,CaAsO4-,aq,MA07,MA10,12.Sep.07,-294913,-323114,37.4,-57.2,-25.5,-1.3685,-11.1259,10.3134,-2.3191,-17.4821,-14.6772,1.0531,-1 -SrAsO4-,NA,SrAsO4-,aq,MA07,MA10,12.Sep.07,-296243,-323239,43.9,-59.7,-25.41,-1.3889,-11.1758,10.3349,-2.317,-19.8655,-15.1905,0.9562,-1 -MnAsO4-,NA,MnAsO4-,aq,MA07,MA10,12.Sep.07,-218289,-247805,30.7,-53.7,-25.37,-1.2541,-10.8464,10.1934,-2.3307,-14.5434,-13.9785,1.339,-1 -FeAsO4-,NA,FeAsO4-,aq,MA07,MA10,12.Sep.07,-186668,-218541,21.7,-57.5,-26.07,-1.3653,-11.1181,10.3101,-2.3194,-15.504,-14.7525,1.2932,-1 -CoAsO4-,NA,CoAsO4-,aq,MA07,MA10,12.Sep.07,-177190,-210481,17.6,-57.4,-26.53,-1.4073,-11.2205,10.3541,-2.3152,-14.8722,-14.7322,1.3555,-1 -NiAsO4-,NA,NiAsO4-,aq,MA07,MA10,12.Sep.07,-176304,-211320,11.8,-61.3,-27.01,-1.4432,-11.3083,10.3918,-2.3116,-16.3404,-15.5266,1.4434,-1 -CuAsO4-,NA,CuAsO4-,aq,MA07,MA10,12.Sep.07,-151743,-183607,23.1,-55.3,-26.4,-1.4178,-11.2463,10.3651,-2.3141,-14.418,-14.3044,1.2716,-1 -ZnAsO4-,NA,ZnAsO4-,aq,MA07,MA10,12.Sep.07,-200121,-233853,18.9,-55,-26.36,-1.3907,-11.1799,10.3366,-2.3169,-13.6104,-14.229,1.3358,-1 -PbAsO4-,NA,PbAsO4-,aq,MA07,MA10,12.Sep.07,-169793,-194437,54.9,-62.3,-25.16,-1.4108,-11.2291,10.3577,-2.3148,-22.9414,-15.7303,0.7904,-1 -AlAsO4,NA,AlAsO4,aq,MA07,MA10,12.Sep.07,-285558,-330011,-35.9,-60.2,-9.75,0.418,-6.7624,8.44,-2.4995,-29.3427,-15.3014,-0.038,0 -FeAsO4,NA,FeAsO4,aq,MA07,MA10,12.Sep.07,-177862,-218546,-23.5,-84.8,-13.09,-0.0391,-7.8787,8.9193,-2.4533,-43.7161,-20.3124,-0.038,0 -NaH2AsO3,NA,NaH2AsO3,aq,MA07,MA10,12.Sep.07,-203270,-228832,39.7,28.4,32.7,6.2236,7.4178,2.3518,-3.0857,22.4338,2.7495,-0.038,0 -AgH2AsO3,NA,AgH2AsO3,aq,MA07,MA10,12.Sep.07,-123526,-147071,44.3,25.8,33,6.2709,7.5332,2.3022,-3.0905,20.9088,2.2178,-0.038,0 -MgH2AsO3+,NA,MgH2AsO3+,aq,MA07,MA10,12.Sep.07,-251410,-286183,-11.3,41.3,9.9,3.3617,0.4276,5.353,-2.7967,36.9078,5.3772,0.7149,1 -CaH2AsO3+,NA,CaH2AsO3+,aq,MA07,MA10,12.Sep.07,-274922,-301872,17.1,36.4,13.8,3.7486,1.3726,4.9473,-2.8358,30.0706,4.3735,0.2853,1 -SrH2AsO3+,NA,SrH2AsO3+,aq,MA07,MA10,12.Sep.07,-275601,-300702,25.8,30.7,14.5,3.8032,1.506,4.89,-2.8413,25.5459,3.2185,0.1538,1 -BaH2AsO3+,NA,BaH2AsO3+,aq,MA07,MA10,12.Sep.07,-276315,-297936,40.1,25.6,19.9,4.4634,3.1185,4.1977,-2.908,20.5926,2.1872,-0.0628,1 [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/chnosz -r 376