[CHNOSZ-commits] r308 - in pkg/CHNOSZ: . R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Mar 27 09:57:23 CEST 2018


Author: jedick
Date: 2018-03-27 09:57:23 +0200 (Tue, 27 Mar 2018)
New Revision: 308

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/berman.R
   pkg/CHNOSZ/R/util.fasta.R
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/man/berman.Rd
Log:
berman(): read data from berman.csv if present in working directory


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2018-03-14 17:54:46 UTC (rev 307)
+++ pkg/CHNOSZ/DESCRIPTION	2018-03-27 07:57:23 UTC (rev 308)
@@ -1,6 +1,6 @@
-Date: 2018-03-15
+Date: 2018-03-27
 Package: CHNOSZ
-Version: 1.1.3-15
+Version: 1.1.3-16
 Title: Thermodynamic Calculations for Geobiochemistry
 Authors at R: c(
     person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"),

Modified: pkg/CHNOSZ/R/berman.R
===================================================================
--- pkg/CHNOSZ/R/berman.R	2018-03-14 17:54:46 UTC (rev 307)
+++ pkg/CHNOSZ/R/berman.R	2018-03-27 07:57:23 UTC (rev 308)
@@ -22,8 +22,11 @@
   DS10 <- read.csv(paste0(dir, "/DS10.csv"), as.is=TRUE)
   FDM14 <- read.csv(paste0(dir, "/FDM+14.csv"), as.is=TRUE)
   BDat17 <- read.csv(paste0(dir, "/BDat17.csv"), as.is=TRUE)
-  # assemble the files in reverse chronological order
-  dat <- rbind(BDat17, FDM14, DS10, JUN92, ZS92, SHD91, Ber90, Ber88)
+  if(file.exists("berman.csv")) {
+    BDat_user <- read.csv("berman.csv", as.is=TRUE)
+    # assemble the files in reverse chronological order
+    dat <- rbind(BDat_user, BDat17, FDM14, DS10, JUN92, ZS92, SHD91, Ber90, Ber88)
+  } else dat <- rbind(BDat17, FDM14, DS10, JUN92, ZS92, SHD91, Ber90, Ber88)
   # remove duplicates (only the first, i.e. most recent entry is kept)
   dat <- dat[!duplicated(dat$name), ]
   # remove the multipliers
@@ -38,6 +41,7 @@
   if(missing(name)) return(dat)
   # which row has data for this mineral?
   irow <- which(dat$name == name)
+  if(length(irow)==0) stop("Data for ", name, " not available. Please add it to berman.csv")
   # the function works fine with just the following assign() call,
   # but an explicit dummy assignment here is used to avoid "Undefined global functions or variables" in R CMD check
   GfPrTr <- HfPrTr <- SPrTr <- Tlambda <- Tmax <- Tmin <- Tref <- VPrTr <-

Modified: pkg/CHNOSZ/R/util.fasta.R
===================================================================
--- pkg/CHNOSZ/R/util.fasta.R	2018-03-14 17:54:46 UTC (rev 307)
+++ pkg/CHNOSZ/R/util.fasta.R	2018-03-27 07:57:23 UTC (rev 308)
@@ -42,7 +42,7 @@
   nlines <- length(lines)
   message(nlines, " lines ... ", appendLF=FALSE)
   if(is.null(ihead)) ihead <- which(substr(lines,1,1)==">")
-  message(length(ihead), " sequence headers")
+  message(length(ihead), " sequences")
   linefun <- function(i1,i2) lines[i1:i2]
   # identify the lines that begin and end each sequence
   begin <- ihead + 1

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2018-03-14 17:54:46 UTC (rev 307)
+++ pkg/CHNOSZ/inst/NEWS	2018-03-27 07:57:23 UTC (rev 308)
@@ -1,6 +1,21 @@
-CHANGES IN CHNOSZ 1.1.3-15 (2018-03-15)
+CHANGES IN CHNOSZ 1.1.3-16 (2018-03-27)
 ---------------------------------------
 
+BERMAN EQUATIONS AND DATA
+
+- berman() now reads data from a user-supplied file berman.csv if it is
+  present in the working directory.
+
+- Add mineral data from Berman and Aranovich, 1996 to
+  extdata/Berman/unused/BA96.csv.
+
+- Correct swapped v1 <-> v3 and v2 <-> v4 in extdata/Berman/DS10.csv.
+
+- Change files in extdata/Berman to be more like winTWQ format (no
+  value multipliers, except 10^5, 10^5, 10^5, and 10^8 on v1 to v4).
+
+OTHER CHANGES
+
 - Lines in 1-D diagram()s can optionally be drawn as splines using the
   method for splinefun() given in the 'spline.method' argument (the
   default of NULL means no splines).
@@ -10,11 +25,6 @@
 
 - Add 'srt' argument to diagram() (rotation of line labels).
 
-- Add mineral data from Berman and Aranovich, 1996 to
-  extdata/Berman/unused/BA96.csv.
-
-- Correct swapped v1 <-> v3 and v2 <-> v4 in extdata/Berman/DS10.csv.
-
 - Fix a bug where subcrt()$reaction$coeffs was incorrect for reactions
   involving minerals with phase transitions.
 
@@ -34,15 +44,13 @@
 - read.fasta(): add support for file connections created using
   archive::archive_read (https://github.com/jimhester/archive).
 
-- Change files in extdata/Berman to be more like winTWQ format (no
-  value multipliers, except 10^5, 10^5, 10^5, and 10^8 on v1 to v4).
-
 - diagram(): rename 'what' argument to 'type'.
 
 - digram(): add new type of diagram, 'saturation', which is used to
   plot saturation lines for minerals (where their affinity equals
   zero).
 
+
 CHANGES IN CHNOSZ 1.1.3 (2017-11-13)
 ------------------------------------
 

Modified: pkg/CHNOSZ/man/berman.Rd
===================================================================
--- pkg/CHNOSZ/man/berman.Rd	2018-03-14 17:54:46 UTC (rev 307)
+++ pkg/CHNOSZ/man/berman.Rd	2018-03-27 07:57:23 UTC (rev 308)
@@ -24,12 +24,11 @@
 
 \details{
 This function calculates the thermodynamic properties of minerals at high \P and \T using equations given by Berman (1988).
-Becuase they use a different set of parameters than Helgeson et al., 1978 (see \code{\link{cgl}}), the standard state thermodynamic properties and parameters for the calculations are stored in files under \code{extdata/Berman}.
+The standard state thermodynamic properties and parameters for the calculations are stored in files under \code{extdata/Berman}, or can be read from a user-created file (if available) named \samp{berman.csv} in the working directory.
 If the function is called with missing \code{name}, the data frame of parameters for all available minerals is returned.
 
-When \code{name} is given, it refers to a mineral that should listed in \code{thermo$obigt} with the state \samp{cr_Berman}.
-\code{thermo$obigt} also holds the chemical formula, which is required for calculating the entropies of the elements in the mineral.
-These entropies are used to convert the apparent Gibbs energies from the Berman-Brown convention to the the Benson-Helgeson convention (cf. Anderson, 2005).
+When \code{name} is given, it refers to a mineral that should listed in \code{thermo$obigt} with the state \samp{cr_Berman} and the chemical formula, and optinally an abbreviation and references, but all other properties set to NA.
+The chemical formula is required for calculating the entropies of the elements in the mineral, which are are used to convert the apparent Gibbs energies from the Berman-Brown convention to the the Benson-Helgeson convention (cf. Anderson, 2005).
 
 If \code{check.G} is TRUE, the tabulated value of DGfTrPr is compared with one calculated from DHfPrTr - T*DSPrTr (DS is the difference between the summed entropies of the elements and the tabulated entropy for the mineral).
 A warning is produced if the absolute value of the difference between tabulated and calculated DGfTrPr is greater than 1000 J/mol.



More information about the CHNOSZ-commits mailing list