Skip to content

Commit

Permalink
Add reference list to output
Browse files Browse the repository at this point in the history
  • Loading branch information
jedick committed Jun 18, 2020
1 parent c575a09 commit 0329fb4
Show file tree
Hide file tree
Showing 5 changed files with 570 additions and 3 deletions.
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Date: 2020-06-17
Package: logKcalc
Version: 0.1.0
Title: Calculate Equilibrium Constants for GWB Thermodynamic Data Files
Expand All @@ -8,7 +7,7 @@ Authors@R: c(
)
Maintainer: Jeffrey Dick <[email protected]>
Depends: CHNOSZ (>= 1.3.0)
Imports: ggplot2, ggrepel
Imports: ggplot2, ggrepel, bibtex
Suggests: knitr, gridExtra, testthat
Description: Calculate equilibrium constants of reactions for data files
used in The Geochemist's Workbench®. The main function updates logK values
Expand Down
6 changes: 6 additions & 0 deletions R/logKcalc.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
#source("writedat.R")

logKcalc <- function(infile = "thermo.tdat", outfile = "thermo_OBIGT.tdat", T = NULL, P = "Psat", maxprint = Inf) {
## for debugging:
# infile <- "thermo.tdat"
# outfile <- "thermo_OBIGT.tdat"
# T <- NULL
# P <- "Psat"
maxprint <- Inf
if(!file.exists(infile)) stop("file specified by 'infile' doesn't exist")
# read the GWB data file
LINES <- readLines(infile)
Expand Down
28 changes: 27 additions & 1 deletion R/writedat.R
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,33 @@ writedat <- function(outfile, LINES, HEAD, LOGK) {

}

# cleanup and write the output to file
# cleanup
out <- stats::na.omit(out)
# add reference block 20200618
if(utils::packageVersion("CHNOSZ") > "1.3.6") {
# get all reference keys used in output GWB file
reftypes <- c("redox", "aqueous", "electron", "mineral", "gas")
allrefs <- lapply(reftypes, function(x) c(LOGK[[x]]$ref1, LOGK[[x]]$ref2))
keys <- sort(unique(stats::na.omit(unlist(allrefs))))
# read the bibtex file from CHNOSZ
bibfile <- system.file("extdata/OBIGT/obigt.bib", package = "CHNOSZ")
bibentry <- bibtex::read.bib(bibfile)
# format the printed references
op <- options(width = 90)
on.exit(options(op))
reftext <- utils::capture.output(print(bibentry[keys]))
# insert the reference keys before the references
keys <- paste0("[", keys, "]")
refout <- character()
j <- 1
for(i in 1:length(reftext)) {
if(i==1) { refout <- c(refout, keys[j]); j <- j + 1 }
refout <- c(refout, reftext[i])
if(reftext[i]=="") { refout <- c(refout, keys[j]); j <- j + 1 }
}
out <- c(out, refout)
}

# write the output to file
writeLines(out, outfile)
}
261 changes: 261 additions & 0 deletions inst/extdata/tests/ThermoGWB_OBIGT.tdat
Original file line number Diff line number Diff line change
Expand Up @@ -2021,3 +2021,264 @@ S2(g)
0 oxides

-end-
[AT14]
Akinfiev NN, Tagirov BR (2014). “Zn in hydrothermal systems: Thermodynamic
description of hydroxide, chloride, and hydrosulfide complexes.” _Geochemistry
International_, *52*(3), 197-214. doi: 10.1134/S0016702914030021 (URL:
https://doi.org/10.1134/S0016702914030021).

[AVZP06]
Akinfiev NN, Voronin MV, Zotov AV, Prokof'ev V\Y (2006). “Experimental
investigation of the stability of a chloroborate complex and thermodynamic
description of aqueous species in the B-Na-Cl-O-H system up to 350°C.”
_Geochemistry International_, *44*(9), 867-878. doi: 10.1134/S0016702906090035
(URL: https://doi.org/10.1134/S0016702906090035).

[AZ01]
Akinfiev NN, Zotov AV (2001). “Thermodynamic description of chloride,
hydrosulfide, and hydroxo complexes of Ag(I), Cu(I), and Au(I) at temperatures
of 25-500°C and pressures of 1-2000 bar.” _Geochemistry International_,
*39*(10), 990-1006.

[AZ10]
Akinfiev NN, Zotov AV (2010). “Thermodynamic description of aqueous species in
the system Cu-Ag-Au-S-O-H at temperatures of 0-600°C and pressures of 1-3000
bar.” _Geochemistry International_, *48*(7), 714-720. doi:
10.1134/S0016702910070074 (URL: https://doi.org/10.1134/S0016702910070074).

[BDat17]
berman.dat (2017). “Data file in SUPCRT92b.zip on the DEW website.” Last updated
on 2017-02-03. Accessed on 2017-05-04. <URL:
http://www.dewcommunity.org/resources.html>.

[Ber88]
Berman RG (1988). “Internally-consistent thermodynamic data for minerals in the
system
Na$_2$O-K$_2$O-CaO-MgO-FeO-Fe$_2$O$_3$-Al$_2$O$_3$-SiO$_2$-TiO$_2$-H$_2$O-CO$_2$.”
_Journal of Petrology_, *29*(2), 445-522. doi: 10.1093/petrology/29.2.445 (URL:
https://doi.org/10.1093/petrology/29.2.445).

[Ber90]
Berman RG (1990). “Mixing properties of Ca-Mg-Fe-Mn garnets.” _American
Mineralogist_, *75*(3-4), 328-344. ISSN 0003-004X, <URL:
http://ammin.geoscienceworld.org/content/75/3-4/328>.

[Eva90]
Evans BW (1990). “Phase relations of epidote-blueschists.” _Lithos_, *25*(1),
3-23. ISSN 0024-4937, doi: 10.1016/0024-4937(90)90003-J (URL:
https://doi.org/10.1016/0024-4937(90)90003-J), Third International Eclogite
Conference.

[FDM+14]
Facq S, Daniel I, Montagnac G, Cardon H, Sverjensky DA (2014). “_In situ_ Raman
study and thermodynamic model of aqueous carbonate speciation in equilibrium
with aragonite under subduction zone conditions.” _Geochimica et Cosmochimica
Acta_, *132*(Supplement C), 375-390. ISSN 0016-7037, doi:
10.1016/j.gca.2014.01.030 (URL: https://doi.org/10.1016/j.gca.2014.01.030).

[Got04]
Gottschalk M (2004). “Thermodynamic properties of zoisite, clinozoisite and
epidote.” _Reviews in Mineralogy and Geochemistry_, *56*(1), 83-124. doi:
10.2138/gsrmg.56.1.83 (URL: https://doi.org/10.2138/gsrmg.56.1.83).

[HDNB78]
Helgeson HC, Delany JM, Nesbitt HW, Bird DK (1978). “Summary and critique of the
thermodynamic properties of rock-forming minerals.” _American Journal of
Science_, *278A*, 1-229. <URL: http://www.worldcat.org/oclc/13594862>.

[HRA91]
Hemingway BS, Robie RA, Apps JA (1991). “Revised values for the thermodynamic
properties of boehmite, AlO(OH) , and related species and phases in the system
Al-H-O.” _American Mineralogist_, *76*(3-4), 445-457. <URL:
https://pubs.er.usgs.gov/publication/70016664>.

[Hel85]
Helgeson HC (1985). “Errata. II. Thermodynamics of minerals, reactions, and
aqueous solutions at high pressures and temperatures.” _American Journal of
Science_, *285*(9), 845-855. doi: 10.2475/ajs.285.9.845 (URL:
https://doi.org/10.2475/ajs.285.9.845).

[JH85]
Jackson KJ, Helgeson HC (1985). “Chemical and thermodynamic constraints on the
hydrothermal transport and deposition of tin. II. Interpretation of phase
relations in the Southeast Asian tin belt.” _Economic Geology_, *80*(5),
1365-1378. doi: 10.2113/gsecongeo.80.5.1365 (URL:
https://doi.org/10.2113/gsecongeo.80.5.1365).

[JUN92]
JUN92.bs (1992). “JUN92.bs database supplied with Theriak/Domino software.” Last
updated on 2017-02-04. Accessed on 2017-10-01. <URL:
http://titan.minpet.unibas.ch/minpet/theriak/prog170204/>.

[Joh92]
Kelley KK (1960). _Contributions to the Data in Theoretical Metallurgy XIII:
High Temperature Heat Content, Heat Capacities and Entropy Data for the Elements
and Inorganic Compounds_, series Bulletin 584. U. S. Bureau of Mines. <URL:
http://www.worldcat.org/oclc/693388901>.

[Kel60]
Majzlan J, Grevel K, Navrotsky A (2003). “Thermodynamics of Fe oxides: Part II.
Enthalpies of formation and relative stability of goethite ($\alpha$-FeOOH),
lepidocrocite ($\gamma$-FeOOH), and maghemite ($\gamma$-Fe$_2$O$_3$).” _American
Mineralogist_, *88*(5-6), 855-859. ISSN 0003-004X, doi: 10.2138/am-2003-5-614
(URL: https://doi.org/10.2138/am-2003-5-614).

[MGN03]
Majzlan J, Lang BE, Stevens R, Navrotsky A, Woodfield BF, Boerio-Goates J
(2003). “Thermodynamics of Fe oxides: Part I. Entropy at standard temperature
and pressure and heat capacity of goethite ($\alpha$-FeOOH), lepidocrocite
($\gamma$-FeOOH), and maghemite ($\gamma$-Fe$_2$O$_3$).” _American
Mineralogist_, *88*(5-6), 846-854. ISSN 0003-004X, doi: 10.2138/am-2003-5-613
(URL: https://doi.org/10.2138/am-2003-5-613).

[MLS+03]
McCollom TM, Shock EL (1997). “Geochemical constraints on chemolithoautotrophic
metabolism by microorganisms in seafloor hydrothermal systems.” _Geochimica et
Cosmochimica Acta_, *61*(20), 4375-4391. doi: 10.1016/S0016-7037(97)00241-X
(URL: https://doi.org/10.1016/S0016-7037(97)00241-X).

[MS97]
Nordstrom DK, Archer DG (2003). “Arsenic thermodynamic data and environmental
geochemistry.” In Welch AH, Stollenwerk KG (eds.), _Arsenic in Groundwater_,
1-25. Springer, New York. doi: 10.1007/0-306-47956-7_1 (URL:
https://doi.org/10.1007/0-306-47956-7_1).

[NA03]
Naumov GB, Ryzhenko BN, Khodakovskii IL (1974). _Handbook of Thermodynamic
Data_. U.S. Geological Survey, Water Resources Division, Menlo Park, Calif.
Translated by George J. Soleimani, <URL:
https://trove.nla.gov.au/work/22192707>.

[NRK74]
Pokrovski GS, Akinfiev NN, Borisova AY, Zotov AV, Kouzmanov K (2014). “Gold
speciation and transport in geological fluids: insights from experiments and
physical-chemical modelling.” _Geological Society, London, Special
Publications_, *402*(1), 9-70. ISSN 0305-8719, doi: 10.1144/SP402.4 (URL:
https://doi.org/10.1144/SP402.4).

[PAB+14]
Pankratz LB, King EG (1970). _High-Temperature Enthalpies and Entropies of
Chalcopyrite and Bornite_, number 7435 series Report of Investigations. U. S.
Bureau of Mines. <URL: http://www.worldcat.org/oclc/14154292>.

[PK70]
Plyasunov AV, Shock EL (2001). “Correlation strategy for determining the
parameters of the revised Helgeson-Kirkham-Flowers model for aqueous
nonelectrolytes.” _Geochimica et Cosmochimica Acta_, *65*(21), 3879-3900. doi:
10.1016/S0016-7037(01)00678-0 (URL:
https://doi.org/10.1016/S0016-7037(01)00678-0).

[PS01]
Robie RA, Hemingway BS (1995). _Thermodynamic Properties of Minerals and Related
Substances at 298.15 K and 1 Bar (10\textsuperscript{5} Pascals) Pressure and at
Higher Temperatures_, series Bulletin 2131. U. S. Geological Survey, Washington,
D. C. doi: 10.3133/b2131 (URL: https://doi.org/10.3133/b2131).

[RH95]
Robie RA, Hemingway BS, Fisher JR (1978). _Thermodynamic Properties of Minerals
and Related Substances at 298.15 K and 1 Bar ($10^5$ Pascals) Pressure and at
Higher Temperatures_, series Bulletin 1452. U. S. Geological Surv. <URL:
https://pubs.er.usgs.gov/publication/b1452>.

[RHF78]
Shvarov Y, Bastrakov E (1999). _HCh: A software package for geochemical
equilibrium modelling. User's Guide_. Australian Geological Survey Organisation,
Record 1999/25. <URL: http://pid.geoscience.gov.au/dataset/ga/25473>.

[SB99]
Shock EL, Helgeson HC (1988). “Calculation of the thermodynamic and transport
properties of aqueous species at high pressures and temperatures: Correlation
algorithms for ionic species and equation of state predictions to 5 kb and
1000°C.” _Geochimica et Cosmochimica Acta_, *52*(8), 2009-2036. doi:
10.1016/0016-7037(88)90181-0 (URL:
https://doi.org/10.1016/0016-7037(88)90181-0).

[SH88]
Shock EL, Helgeson HC (1990). “Calculation of the thermodynamic and transport
properties of aqueous species at high pressures and temperatures: Standard
partial molal properties of organic species.” _Geochimica et Cosmochimica Acta_,
*54*(4), 915-945. doi: 10.1016/0016-7037(90)90429-O (URL:
https://doi.org/10.1016/0016-7037(90)90429-O).

[SH90]
Sverjensky DA, Hemley JJ, D'Angelo WM (1991). “Thermodynamic assessment of
hydrothermal alkali feldspar-mica-aluminosilicate equilibria.” _Geochimica et
Cosmochimica Acta_, *55*(4), 989-1004. doi: 10.1016/0016-7037(91)90157-Z (URL:
https://doi.org/10.1016/0016-7037(91)90157-Z).

[SHD91]
Shock EL, Helgeson HC, Sverjensky DA (1989). “Calculation of the thermodynamic
and transport properties of aqueous species at high pressures and temperatures:
Standard partial molal properties of inorganic neutral species.” _Geochimica et
Cosmochimica Acta_, *53*(9), 2157-2183. doi: 10.1016/0016-7037(89)90341-4 (URL:
https://doi.org/10.1016/0016-7037(89)90341-4).

[SHS89]
slop98.dat (1998). “Sequential-access thermodynamic datafile used by PROGRAM
supcrt92.” Last updated on 1998-08-20. Accessed on 2019-04-08. doi:
10.5281/zenodo.2630820 (URL: https://doi.org/10.5281/zenodo.2630820).

[SLOP98]
sprons92.dat (1992). “s[equential-access] pro[perties of] n[atural]
s[ubstances].dat; datafile used by PROGRAM supcrt91.” Included with the SUPCRT92
package (Johnson et al., 1992). Last updated on 1991-02-15.

[SPRONS92]
Shock EL, Sassani DC, Betz H (1997b). “Uranium in geologic fluids: Estimates of
standard partial molal properties, oxidation potentials, and hydrolysis
constants at high temperatures and pressures.” _Geochimica et Cosmochimica
Acta_, *61*(20), 4245-4266. doi: 10.1016/S0016-7037(97)00240-8 (URL:
https://doi.org/10.1016/S0016-7037(97)00240-8).

[SSB97]
Sverjensky DA, Shock EL, Helgeson HC (1997). “Prediction of the thermodynamic
properties of aqueous metal complexes to 1000°C and 5 kb.” _Geochimica et
Cosmochimica Acta_, *61*(7), 1359-1412. doi: 10.1016/S0016-7037(97)00009-4 (URL:
https://doi.org/10.1016/S0016-7037(97)00009-4).

[SSH97]
Shock EL, Sassani DC, Willis M, Sverjensky DA (1997). “Inorganic species in
geologic fluids: Correlations among standard molal thermodynamic properties of
aqueous ions and hydroxide complexes.” _Geochimica et Cosmochimica Acta_,
*61*(5), 907-950. doi: 10.1016/S0016-7037(96)00339-0 (URL:
https://doi.org/10.1016/S0016-7037(96)00339-0).

[SSWS97]
Shock EL (1995). “Organic acids in hydrothermal solutions: Standard molal
thermodynamic properties of carboxylic acids and estimates of dissociation
constants at high temperatures and pressures.” _American Journal of Science_,
*295*(5), 496-580. doi: 10.2475/ajs.295.5.496 (URL:
https://doi.org/10.2475/ajs.295.5.496).

[Sho95]
Tagirov B, Schott J (2001). “Aluminum speciation in crustal fluids revisited.”
_Geochimica et Cosmochimica Acta_, *65*(21), 3965-3992. doi:
10.1016/S0016-7037(01)00705-0 (URL:
https://doi.org/10.1016/S0016-7037(01)00705-0).

[TS01]
Tagirov BR, Zotov AV, Akinfiev NN (1997). “Experimental study of dissociation of
HCl from 350 to 500°C and from 500 to 2500 bars: Thermodynamic properties of
HCl°\textsubscript{(aq)}.” _Geochimica et Cosmochimica Acta_, *61*(20),
4267-4280. doi: 10.1016/S0016-7037(97)00274-3 (URL:
https://doi.org/10.1016/S0016-7037(97)00274-3).

[TZA97]
Vidal O, Parra T, Trotet F (2001). “A thermodynamic model for fe-mg aluminous
chlorite using data from phase equilibrium experiments and natural pelitic
assemblages in the 100° to 600°C, 1 to 25 kb range.” _American Journal of
Science_, *301*(6), 557-592. doi: 10.2475/ajs.301.6.557 (URL:
https://doi.org/10.2475/ajs.301.6.557).

[VPT01]
Wagman DD, Evans WH, Parker VB, Schumm RH, Halow I, Bailey SM, Churney KL,
Nuttall RL (1982). “The NBS tables of chemical thermodynamic properties.
Selected values for inorganic and C$_1$ and C$_2$ organic substances in SI
units.” _Journal of Physical and Chemical Reference Data_, *11*(Suppl. 2),
1-392. <URL: https://srd.nist.gov/JPCRD/jpcrdS2Vol11.pdf>.

[WEP+82]
Zimmer K, Zhang Y, Lu P, Chen Y, Zhang G, Dalkilic M, Zhu C (2016). “SUPCRTBL: A
revised and extended thermodynamic dataset and software package of SUPCRT92.”
_Computers \& Geosciences_, *90*, 97-111. ISSN 0098-3004, doi:
10.1016/j.cageo.2016.02.013 (URL: https://doi.org/10.1016/j.cageo.2016.02.013).
Loading

0 comments on commit 0329fb4

Please sign in to comment.