[CHNOSZ-commits] r206 - in pkg/CHNOSZ: . R data inst inst/extdata/OBIGT man vignettes
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Aug 29 11:24:00 CEST 2017
Author: jedick
Date: 2017-08-29 11:24:00 +0200 (Tue, 29 Aug 2017)
New Revision: 206
Modified:
pkg/CHNOSZ/DESCRIPTION
pkg/CHNOSZ/R/equilibrate.R
pkg/CHNOSZ/data/refs.csv
pkg/CHNOSZ/inst/NEWS
pkg/CHNOSZ/inst/extdata/OBIGT/CHNOSZ_aq.csv
pkg/CHNOSZ/man/equilibrate.Rd
pkg/CHNOSZ/vignettes/anintro.Rmd
Log:
add 'tol' argument to equil.reaction()
Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION 2017-07-27 00:01:56 UTC (rev 205)
+++ pkg/CHNOSZ/DESCRIPTION 2017-08-29 09:24:00 UTC (rev 206)
@@ -1,6 +1,6 @@
-Date: 2017-07-27
+Date: 2017-08-29
Package: CHNOSZ
-Version: 1.1.0-4
+Version: 1.1.0-5
Title: Chemical Thermodynamics and Activity Diagrams
Author: Jeffrey Dick
Maintainer: Jeffrey Dick <j3ffdick at gmail.com>
Modified: pkg/CHNOSZ/R/equilibrate.R
===================================================================
--- pkg/CHNOSZ/R/equilibrate.R 2017-07-27 00:01:56 UTC (rev 205)
+++ pkg/CHNOSZ/R/equilibrate.R 2017-08-29 09:24:00 UTC (rev 206)
@@ -4,7 +4,7 @@
equilibrate <- function(aout, balance=NULL, loga.balance=NULL,
ispecies=1:length(aout$values), normalize=FALSE, as.residue=FALSE,
- method=c("boltzmann", "reaction")) {
+ method=c("boltzmann", "reaction"), tol=.Machine$double.eps^0.25) {
### set up calculation of equilibrium activities of species from the affinities
### of their formation reactions from basis species at known activities
### split from diagram() 20120925 jmd
@@ -59,7 +59,7 @@
}
message(paste("equilibrate: using", method[1], "method"))
if(method[1]=="boltzmann") loga.equil <- equil.boltzmann(Astar, n.balance, loga.balance)
- else if(method[1]=="reaction") loga.equil <- equil.reaction(Astar, n.balance, loga.balance)
+ else if(method[1]=="reaction") loga.equil <- equil.reaction(Astar, n.balance, loga.balance, tol)
## if we normalized the formulas, get back to activities to species
if(normalize & !as.residue) {
loga.equil <- lapply(1:nspecies, function(i) {
@@ -112,7 +112,7 @@
return(A)
}
-equil.reaction <- function(Astar, n.balance, loga.balance) {
+equil.reaction <- function(Astar, n.balance, loga.balance, tol=.Machine$double.eps^0.25) {
# to turn the affinities/RT (A) of formation reactions into
# logactivities of species (logact(things)) at metastable equilibrium
# 20090217 extracted from diagram and renamed to abundance.old
@@ -206,7 +206,7 @@
# get limits of Abar where logadiff brackets zero
Abar.range <- Abarrange(i)
# now for the real thing: uniroot!
- Abar <- uniroot(logadiff, interval=Abar.range, i=i)$root
+ Abar <- uniroot(logadiff, interval=Abar.range, i=i, tol=tol)$root
return(Abar)
}
# calculate the logact(thing) for each condition
Modified: pkg/CHNOSZ/data/refs.csv
===================================================================
--- pkg/CHNOSZ/data/refs.csv 2017-07-27 00:01:56 UTC (rev 205)
+++ pkg/CHNOSZ/data/refs.csv 2017-08-29 09:24:00 UTC (rev 206)
@@ -77,6 +77,7 @@
HPT06,"B. Hawrylak, R. Palepu and P. R. Tremaine",2006,"J. Chem. Thermodynamics 38, 988-1007","methyldiethanolamine and methyldiethanolammonium chloride HKF parameters",https://doi.org/10.1016/j.jct.2005.10.013
LH06a,"D. E. LaRowe and H. C. Helgeson",2006,"Geochim. Cosmochim. Acta 70, 4680-4724","nucleic-acid bases, nucleosides, and nucleotides",https://doi.org/10.1016/j.gca.2006.04.010
LH06a.1,"D. E. LaRowe and H. C. Helgeson",2006,"Geochim. Cosmochim. Acta 70, 4680-4724","citric acid and citrate",https://doi.org/10.1016/j.gca.2006.04.010
+LH06a.2,"D. E. LaRowe and H. C. Helgeson",2006,"Geochim. Cosmochim. Acta 70, 4680-4724","adenine GHS",https://doi.org/10.1016/j.gca.2006.04.010
LH06b,"D. E. LaRowe and H. C. Helgeson",2006,"Thermochim. Acta 448, 82-106","Mg-complexed adenosine nucleotides (ATP), NAD, and NADP",https://doi.org/10.1016/j.tca.2006.06.008
LH06b.1,"D. E. LaRowe and H. C. Helgeson",2006,"Thermochim. Acta 448, 82-106","pyridine and piperidine",https://doi.org/10.1016/j.tca.2006.06.008
DLH06,"J. M. Dick, D. E. LaRowe and H. C. Helgeson",2006,"Biogeosciences 3, 311-336","amino acid, protein, and organic groups",https://doi.org/10.5194/bg-3-311-2006
Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS 2017-07-27 00:01:56 UTC (rev 205)
+++ pkg/CHNOSZ/inst/NEWS 2017-08-29 09:24:00 UTC (rev 206)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.1.0-4 (2017-07-27)
+CHANGES IN CHNOSZ 1.1.0-5 (2017-08-29)
--------------------------------------
- water.lines() now works for diagrams of Eh, pe, logfO2, logaO2,
@@ -14,6 +14,9 @@
the current database. If the species is not found, add.obigt() treats
the argument as a file name, as before.
+- Add 'tol' argument to equil.reaction() (convergence tolerance for
+ uniroot).
+
CHANGES IN CHNOSZ 1.1.0 (2017-05-04)
------------------------------------
Modified: pkg/CHNOSZ/inst/extdata/OBIGT/CHNOSZ_aq.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/OBIGT/CHNOSZ_aq.csv 2017-07-27 00:01:56 UTC (rev 205)
+++ pkg/CHNOSZ/inst/extdata/OBIGT/CHNOSZ_aq.csv 2017-08-29 09:24:00 UTC (rev 206)
@@ -1,3 +1,3 @@
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
pseudo-H4SiO4,NA,H4SiO4,aq,CHNOSZ.4,NA,18.Feb.17,-312565,-346409,51.4246,-40.0964,52.1998,89.2031,-176.5071,-452.1431,101.36051,67.0854,-52.0776,0.1215745,0
-adenine,NA,C5H5N5,aq,LCT17,LH06a,26.Jul.17,74770,31235,53.41,51.63,90.6,23.53,0,-17.75,0,48.54,-3.318,-1.093,0
+adenine,NA,C5H5N5,aq,LCT17,LH06a.2,26.Jul.17,74770,31235,53.41,51.63,90.6,23.53,0,-17.75,0,48.54,-3.318,-1.093,0
Modified: pkg/CHNOSZ/man/equilibrate.Rd
===================================================================
--- pkg/CHNOSZ/man/equilibrate.Rd 2017-07-27 00:01:56 UTC (rev 205)
+++ pkg/CHNOSZ/man/equilibrate.Rd 2017-08-29 09:24:00 UTC (rev 206)
@@ -11,9 +11,9 @@
\usage{
equilibrate(aout, balance=NULL, loga.balance=NULL,
ispecies=1:length(aout$values), normalize=FALSE, as.residue=FALSE,
- method=c("boltzmann", "reaction"))
+ method=c("boltzmann", "reaction"), tol=.Machine$double.eps^0.25)
equil.boltzmann(Astar, n.balance, loga.balance)
- equil.reaction(Astar, n.balance, loga.balance)
+ equil.reaction(Astar, n.balance, loga.balance, tol=.Machine$double.eps^0.25)
}
\arguments{
@@ -26,6 +26,7 @@
\item{n.balance}{numeric, number of moles of conserved component in the formation reactions of the species of interest}
\item{loga.balance}{numeric, logarithm of total activity of balanced quantity}
\item{method}{character, equilibration method to use}
+ \item{tol}{numeric, convergence tolerance for \code{\link{uniroot}}}
}
\details{
Modified: pkg/CHNOSZ/vignettes/anintro.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/anintro.Rmd 2017-07-27 00:01:56 UTC (rev 205)
+++ pkg/CHNOSZ/vignettes/anintro.Rmd 2017-08-29 09:24:00 UTC (rev 206)
@@ -1989,7 +1989,7 @@
Some functions in CHNOSZ lie outside the main workflow described above.
-## RHKF parameters regressed from heat capacity and volume of aqueous adenineegressing thermodynamic data
+## Regressing thermodynamic data
<span style="color:green">`EOSregress()`</span> and related functions can be used to regress "equation of state" parameters (e.g. coefficients in the HKF equations) from heat capacity and volumetric data. See <span style="color:blue">`?EOSregress`</span> and the vignette, [<span style="color:blue">*Regressing thermodynamic data*</span>](eos-regress.html).
More information about the CHNOSZ-commits
mailing list