[CHNOSZ-commits] r660 - in pkg/CHNOSZ: . R demo inst inst/extdata/OBIGT inst/extdata/adds inst/extdata/thermo
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Mar 21 11:28:46 CET 2021
Author: jedick
Date: 2021-03-21 11:28:45 +0100 (Sun, 21 Mar 2021)
New Revision: 660
Modified:
pkg/CHNOSZ/DESCRIPTION
pkg/CHNOSZ/R/add.OBIGT.R
pkg/CHNOSZ/R/species.R
pkg/CHNOSZ/R/subcrt.R
pkg/CHNOSZ/demo/AkDi.R
pkg/CHNOSZ/inst/NEWS.Rd
pkg/CHNOSZ/inst/TODO
pkg/CHNOSZ/inst/extdata/OBIGT/SUPCRT92.csv
pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_cr.csv
pkg/CHNOSZ/inst/extdata/OBIGT/organic_aq.csv
pkg/CHNOSZ/inst/extdata/adds/OBIGT_check.csv
pkg/CHNOSZ/inst/extdata/thermo/stoich.csv.xz
Log:
Various small fixes
Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION 2021-03-20 10:13:33 UTC (rev 659)
+++ pkg/CHNOSZ/DESCRIPTION 2021-03-21 10:28:45 UTC (rev 660)
@@ -1,6 +1,6 @@
-Date: 2021-03-20
+Date: 2021-03-21
Package: CHNOSZ
-Version: 1.4.0-29
+Version: 1.4.0-30
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/add.OBIGT.R
===================================================================
--- pkg/CHNOSZ/R/add.OBIGT.R 2021-03-20 10:13:33 UTC (rev 659)
+++ pkg/CHNOSZ/R/add.OBIGT.R 2021-03-21 10:28:45 UTC (rev 660)
@@ -3,6 +3,7 @@
## if this file is interactively sourced, the following are also needed to provide unexported functions:
#source("info.R")
+#source("util.data.R")
mod.OBIGT <- function(...) {
# add or modify species in thermo()$OBIGT
@@ -19,9 +20,11 @@
if(is.numeric(args[[1]][1])) {
ispecies <- args[[1]]
args <- args[-1]
+ speciesname <- info(ispecies, check.it = FALSE)$name
} else {
# if the name of the first argument is missing, assume it's the species name
if(names(args)[1]=="") names(args)[1] <- "name"
+ speciesname <- args$name
# search for this species, use check.protein=FALSE to avoid infinite loop when adding proteins
# and suppressMessages to not show messages about matches of this name to other states
if("state" %in% names(args)) ispecies <- suppressMessages(mapply(info.character,
@@ -89,11 +92,11 @@
state <- thermo$OBIGT$state[ispecies[iold[i]]]
# tell user if they're the same, otherwise update the data entry
if(isTRUE(all.equal(oldprop, args[iold[i], ], check.attributes=FALSE)))
- message("mod.OBIGT: no change for ", args$name[iold[i]], "(", state, ")")
+ message("mod.OBIGT: no change for ", speciesname[iold[i]], "(", state, ")")
else {
thermo$OBIGT[ispecies[iold[i]], icol] <- args[iold[i], ]
assign("thermo", thermo, CHNOSZ)
- message("mod.OBIGT: updated ", args$name[iold[i]], "(", state, ")")
+ message("mod.OBIGT: updated ", speciesname[iold[i]], "(", state, ")")
}
}
}
Modified: pkg/CHNOSZ/R/species.R
===================================================================
--- pkg/CHNOSZ/R/species.R 2021-03-20 10:13:33 UTC (rev 659)
+++ pkg/CHNOSZ/R/species.R 2021-03-21 10:28:45 UTC (rev 660)
@@ -173,7 +173,7 @@
### unexported functions ###
# to retrieve the coefficients of reactions to form the species from the basis species
-species.basis <- function(species=get("thermo", CHNOSZ)$species$ispecies) {
+species.basis <- function(species=get("thermo", CHNOSZ)$species$ispecies, mkp = NULL) {
# current basis elements
bmat <- basis.elements()
tbmat <- t(bmat)
@@ -180,7 +180,8 @@
# what are the elements?
belem <- rownames(tbmat)
# get the species makeup into a matrix
- mkp <- as.matrix(sapply(makeup(species, count.zero=TRUE), c))
+ # If 'species' is NULL, get it from the 'mkp' argument (for use by subcrt()) 20210321
+ if(!is.null(species)) mkp <- as.matrix(sapply(makeup(species, count.zero=TRUE), c))
# the positions of the species elements in the basis elements
ielem <- match(rownames(mkp), belem)
# the elements of the species must be contained by the basis species
Modified: pkg/CHNOSZ/R/subcrt.R
===================================================================
--- pkg/CHNOSZ/R/subcrt.R 2021-03-20 10:13:33 UTC (rev 659)
+++ pkg/CHNOSZ/R/subcrt.R 2021-03-21 10:28:45 UTC (rev 660)
@@ -234,10 +234,8 @@
tb <- thermo$basis
if(!is.null(tb) & autobalance) {
if(all(names(miss) %in% colnames(tb)[1:nrow(tb)])) {
- # the missing composition as formula
- ft <- as.chemical.formula(miss)
- # the basis species needed to supply it
- bc <- species.basis(ft)
+ # the missing composition in terms of the basis species
+ bc <- species.basis(species = NULL, mkp = as.matrix(miss))
# drop zeroes
bc.new <- bc[,(bc[1,]!=0),drop=FALSE]
# and get the states
Modified: pkg/CHNOSZ/demo/AkDi.R
===================================================================
--- pkg/CHNOSZ/demo/AkDi.R 2021-03-20 10:13:33 UTC (rev 659)
+++ pkg/CHNOSZ/demo/AkDi.R 2021-03-21 10:28:45 UTC (rev 660)
@@ -25,7 +25,9 @@
# set up plot
opar <- par(no.readonly = TRUE)
-par(mfrow=c(2, 2))
+par(mfrow = c(2, 2))
+par(mar = c(3.5, 3.5, 2.5, 1))
+par(mgp = c(2.4, 1, 0))
ylab <- quote(ln~italic(K[H]))
xlab <- quote(1000 / list(italic(T), K))
Modified: pkg/CHNOSZ/inst/NEWS.Rd
===================================================================
--- pkg/CHNOSZ/inst/NEWS.Rd 2021-03-20 10:13:33 UTC (rev 659)
+++ pkg/CHNOSZ/inst/NEWS.Rd 2021-03-21 10:28:45 UTC (rev 660)
@@ -44,10 +44,12 @@
(\href{https://doi.org/10.1016/j.gca.2020.04.009}{Akinfiev et al., 2020})
to \samp{OBIGT/inorganic_aq.csv}.
- \item Renamed \samp{CDC2_HUMAN} to \samp{CDK1_HUMAN} (UniProt:
+ \item Rename \samp{CDC2_HUMAN} to \samp{CDK1_HUMAN} (UniProt:
\href{https://www.uniprot.org/uniprot/P06493}{P06493}) in
\samp{thermo/protein.csv}.
+ \item Move alunite from \samp{SUPCRT92.csv} to \samp{inorganic_cr.csv}.
+
}
}
@@ -57,7 +59,7 @@
\item Automatic detection of dissociation reactions was fragile and has
been removed from \code{solubility()}. The new default (\code{dissociate
- = FALSE}) is to not condiser dissociation reactions.
+ = FALSE}) is to not consider dissociation reactions.
\item In the return value of \code{diagram()}, \code{predominant.values}
previously only contained affinities (extracted from the \code{values}
Modified: pkg/CHNOSZ/inst/TODO
===================================================================
--- pkg/CHNOSZ/inst/TODO 2021-03-20 10:13:33 UTC (rev 659)
+++ pkg/CHNOSZ/inst/TODO 2021-03-21 10:28:45 UTC (rev 660)
@@ -14,10 +14,6 @@
- add check to mosaic() that 'stable' values have the right dimensions.
-- anintro.Rmd, help files: make it clear that species with
-different units (cal, J) in OBIGT can be used in subcrt, diagrams, etc.
-in CHNOSZ.
-
- move H2O92D.f and R wrapper to a separate package (so people
don't have to compile anything to install CHNOSZ updates).
@@ -32,8 +28,6 @@
- make swap.basis() work when DEW model is active
-- Show species name in message: mod.OBIGT(5, G = 0)
-
- Check that protein ionization calculations are not affected by E.units()
library(testthat)
reset()
@@ -43,16 +37,6 @@
a2 <- affinity(iprotein = 1)
expect_equal(a1$values, a2$values)
-- diagram(): scale predominant.values in output by balancing coefficients?
-
-[20210115]
-
-BUG: Why doesn't this work?
-> basis("QEC")
-> subcrt("LYSC_CHICK", 1/129)
-Error in count.elements(formula) :
- 'C2.15503876355161e-07H3.72868217191069e-07O1.72868217157562eZ-7' is not a simple chemical formula
-
[20210122] Fix incorrect states in messages:
> subcrt("C10H22")
info.character: found C10H22(decane); other available phases are gas, gas, gas, liq, liq, liq
@@ -59,10 +43,7 @@
> subcrt("C10H22", "liq")
info.character: found C10H22(liq); other available states are liq, liq
-[20210201]
-- Move alunite from SUPCRT92.csv to inorganic_cr.csv.
-
[20210212]
- Fix formatting of messages from palply() (seen with read.fasta())
@@ -82,14 +63,10 @@
- Add demo for effective equilibrium constant for diglycine on T-pH plot at
high pressure (DEW model; Robinson et al., 2021)
-- Combine solubility() and solubilities() into single function (for CHNOSZ 1.5.0).
-
[20210306]
- Remove 'bases2' argument from mosaic() (old backward compatibility)
-- Widen margins in demo/AkDi.R
-
[20210309]
- Add argument to OBIGT() to exclude data files for organic species.
Modified: pkg/CHNOSZ/inst/extdata/OBIGT/SUPCRT92.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/OBIGT/SUPCRT92.csv 2021-03-20 10:13:33 UTC (rev 659)
+++ pkg/CHNOSZ/inst/extdata/OBIGT/SUPCRT92.csv 2021-03-21 10:28:45 UTC (rev 660)
@@ -10,7 +10,6 @@
"albite,low",Lo-Ab,Na(AlSi3)O8,cr,HDNB78,NA,1978-05-05,cal,-886308,-939680,49.51,NA,100.07,61.7,13.9,-15.01,0,0,0,0,1400
almandine,Alm,Fe3Al2Si3O12,cr,HDNB78,RH95.3,2020-07-06,cal,-1181142,-1258293,81.88,82.05,115.28,97.52,33.64,-18.73,0,0,0,0,848
almandine,Alm,Fe3Al2Si3O12,cr2,HDNB78,OBIGT.1,2020-07-06,cal,-1181153.741,NA,78.21,NA,115.28,107.09,14.86,-10.63,0,0,0,0,1600
-alunite,Alu,KAl3(OH)6(SO4)2,cr,HDNB78,NA,1978-05-05,cal,-1113600,-1235600,78.4,NA,293.6,153.45,0,-54.95,0,0,0,0,650
"amesite,14A",14A-Am,Mg4Al2(Al2Si2)O10(OH)8,cr,HDNB78,NA,1978-05-05,cal,NA,NA,108.9,NA,205.4,172.59,34.98,-41.67,0,0,0,0,848
"amesite,14A",14A-Am,Mg4Al2(Al2Si2)O10(OH)8,cr2,HDNB78,OBIGT.1,1978-05-05,cal,3.895,NA,110.1233,NA,205.4,169.4,41.24,-44.37,0,0,0,0,1000
"amesite,7A",Ams-7A,Mg2Al(AlSi)O5(OH)4,cr,HDNB78,NA,1978-05-05,cal,NA,NA,52,NA,103,81.03,24.738,-20.23,0,0,0,0,1000
Modified: pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_cr.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_cr.csv 2021-03-20 10:13:33 UTC (rev 659)
+++ pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_cr.csv 2021-03-21 10:28:45 UTC (rev 660)
@@ -3,6 +3,7 @@
acanthite,Acn,Ag2S,cr2,HDNB78,OBIGT.1,1978-05-05,cal,-9235.197,-7024.866,35.3543,NA,34.2,1.819,53,0,0,0,0,0,620
acanthite,Acn,Ag2S,cr3,HDNB78,OBIGT.1,1978-05-05,cal,-8227.324,-4960.457,38.898,NA,34.2,21.6,0,0,0,0,0,0,1000
alabandite,Alb,MnS,cr,HDNB78,NA,1978-05-05,cal,-52178,-51000,19.2,NA,21.46,11.4,1.8,0,0,0,0,0,1803
+alunite,Alu,KAl3(OH)6(SO4)2,cr,HDNB78,NA,1978-05-05,cal,-1113600,-1235600,78.4,NA,293.6,153.45,0,-54.95,0,0,0,0,650
anglesite,Ang,PbSO4,cr,HDNB78,NA,1978-05-05,cal,-194353,-219870,35.51,NA,47.95,10.96,31,4.2,0,0,0,0,1100
anhydrite,Anh,CaSO4,cr,HDNB78,NA,1978-05-05,cal,-315925,-342760,25.5,NA,45.94,16.78,23.6,0,0,0,0,0,1453
artinite,Art,Mg2(OH)2(CO3)*3H2O,cr,HDNB78,NA,1978-05-05,cal,-613915,-698043,55.67,NA,96.9,70.87,27.66,-7.43,0,0,0,0,1000
Modified: pkg/CHNOSZ/inst/extdata/OBIGT/organic_aq.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/OBIGT/organic_aq.csv 2021-03-20 10:13:33 UTC (rev 659)
+++ pkg/CHNOSZ/inst/extdata/OBIGT/organic_aq.csv 2021-03-21 10:28:45 UTC (rev 660)
@@ -172,7 +172,7 @@
nonanal,NA,CH3(CH2)7CHO,aq,SS93,NA,1993-01-14,cal,-18100,-89060,79.9,183.3,154.3,22.8599,45.0867,-5.6439,-4.6428,156.0486,13.149,-0.0577,0
decanal,NA,CH3(CH2)8CHO,aq,SS93,NA,1993-01-14,cal,-16600,-95290,86.6,204.5,170.1,25.037,50.0234,-6.7709,-4.8469,173.4014,15.2436,-0.0133,0
"formic acid",NA,H2CO2,aq,Sho95,NA,1992-06-17,cal,-88982,-101680,38.9,22.8,34.69,6.3957,7.7713,2.8318,-3.1002,26.1,-3.1,-0.33,0
-"acetic acid",NA,C2H4O2,aq,Sho95,NA,1992-03-06,cal,-94760,-116100,42.7,40.56,52.01,11.6198,5.218,2.5088,-2.9946,42.076,-1.5417,-0.15,0
+"acetic acid",CH3COOH,C2H4O2,aq,Sho95,NA,1992-03-06,cal,-94760,-116100,42.7,40.56,52.01,11.6198,5.218,2.5088,-2.9946,42.076,-1.5417,-0.15,0
"propanoic acid",NA,C3H6O2,aq,Sho95,NA,1992-03-06,cal,-93450,-122470,49.4,60.5,67.9,11.0057,18.7077,-0.7792,-3.5523,62.97,-1.19,-0.15,0
"n-butanoic acid","butanoic acid",C4H8O2,aq,Sho95,NA,1992-03-06,cal,-91210,-127950,56.1,80.5,84.61,13.2702,23.3487,-0.6985,-3.7441,72.4342,2.9924,-0.2155,0
"n-pentanoic acid",NA,C5H10O2,aq,Sho95,NA,1992-03-06,cal,-89240,-133690,62.8,103.3,100.5,15.4596,28.3156,-1.8374,-3.9495,91.0659,5.245,-0.171,0
Modified: pkg/CHNOSZ/inst/extdata/adds/OBIGT_check.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/adds/OBIGT_check.csv 2021-03-20 10:13:33 UTC (rev 659)
+++ pkg/CHNOSZ/inst/extdata/adds/OBIGT_check.csv 2021-03-21 10:28:45 UTC (rev 660)
@@ -261,33 +261,33 @@
"OBIGT",1879,"diglycine-","aq","cal",-49.22,,565
"OBIGT",1880,"triglycine+","aq","cal",,1.75,
"OBIGT",1881,"triglycine-","aq","cal",,1.78,
-"OBIGT",1940,"hydromagnesite","cr","cal",,,-2569
-"OBIGT",2017,"jarosite","cr","cal",,,20697
-"OBIGT",2018,"natrojarosite","cr","cal",,,17554
-"OBIGT",2026,"realgar,alpha","cr","J",,,768
-"OBIGT",2027,"realgar,beta","cr","J",,,989
-"OBIGT",2028,"orpiment","cr","J",,,-1036
-"OBIGT",2036,"dawsonite","cr","J",,,19466
-"OBIGT",2038,"ferberite","cr","J",1.21,,
-"OBIGT",2051,"Co-pentlandite","cr","cal",,,-3630
-"OBIGT",2072,"octadecane","cr","cal",-2.63,,
-"OBIGT",2073,"nonadecane","cr","cal",-13.32,,
-"OBIGT",2074,"eicosane","cr","cal",-2.79,,
-"OBIGT",2075,"heneicosane","cr","cal",-8.61,,
-"OBIGT",2076,"docosane","cr","cal",-2.63,,
-"OBIGT",2077,"tricosane","cr","cal",-5.22,,
-"OBIGT",2078,"tetracosane","cr","cal",-2.02,,
-"OBIGT",2079,"pentacosane","cr","cal",-2.93,,
-"OBIGT",2080,"hexacosane","cr","cal",-1.29,,
-"OBIGT",2081,"heptacosane","cr","cal",-1.23,,
-"OBIGT",2133,"carbazole","cr","cal",-43.39,,
-"OBIGT",2174,"triphenylene","cr","cal",,,541
-"OBIGT",2487,"deoxyadenosine","cr","cal",,,-2977
-"OBIGT",2645,"ethylene","gas","cal",-4.59,,
-"OBIGT",2655,"3,5-dimethylphenol","gas","cal",,,628
-"OBIGT",2965,"nonacontane","liq","cal",,,635
-"OBIGT",2972,"2-methyloctane","liq","cal",10,,
-"OBIGT",3385,"5,6-dithiadecane","liq","cal",2,,
+"OBIGT",1941,"hydromagnesite","cr","cal",,,-2569
+"OBIGT",2018,"jarosite","cr","cal",,,20697
+"OBIGT",2019,"natrojarosite","cr","cal",,,17554
+"OBIGT",2027,"realgar,alpha","cr","J",,,768
+"OBIGT",2028,"realgar,beta","cr","J",,,989
+"OBIGT",2029,"orpiment","cr","J",,,-1036
+"OBIGT",2037,"dawsonite","cr","J",,,19466
+"OBIGT",2039,"ferberite","cr","J",1.21,,
+"OBIGT",2052,"Co-pentlandite","cr","cal",,,-3630
+"OBIGT",2073,"octadecane","cr","cal",-2.63,,
+"OBIGT",2074,"nonadecane","cr","cal",-13.32,,
+"OBIGT",2075,"eicosane","cr","cal",-2.79,,
+"OBIGT",2076,"heneicosane","cr","cal",-8.61,,
+"OBIGT",2077,"docosane","cr","cal",-2.63,,
+"OBIGT",2078,"tricosane","cr","cal",-5.22,,
+"OBIGT",2079,"tetracosane","cr","cal",-2.02,,
+"OBIGT",2080,"pentacosane","cr","cal",-2.93,,
+"OBIGT",2081,"hexacosane","cr","cal",-1.29,,
+"OBIGT",2082,"heptacosane","cr","cal",-1.23,,
+"OBIGT",2134,"carbazole","cr","cal",-43.39,,
+"OBIGT",2175,"triphenylene","cr","cal",,,541
+"OBIGT",2488,"deoxyadenosine","cr","cal",,,-2977
+"OBIGT",2646,"ethylene","gas","cal",-4.59,,
+"OBIGT",2656,"3,5-dimethylphenol","gas","cal",,,628
+"OBIGT",2966,"nonacontane","liq","cal",,,635
+"OBIGT",2973,"2-methyloctane","liq","cal",10,,
+"OBIGT",3386,"5,6-dithiadecane","liq","cal",2,,
"DEW",8,"AlO2(SiO2)-","aq","cal",,,-897
"DEW",17,"BO(OH)","aq","cal",,,-1111
"DEW",19,"Ca(HCO3)+","aq","cal",,,-2971
@@ -357,15 +357,15 @@
"SLOP98",169,"PdCl4-2","aq","cal",,-1.05,
"SLOP98",171,"HNbO3","aq","cal",,,-1244
"SUPCRT92",10,"almandine","cr","cal",4.43,,
-"SUPCRT92",26,"antigorite","cr","cal",,,812
-"SUPCRT92",41,"clinochlore,7A","cr","cal",,,666
-"SUPCRT92",57,"daphnite,14A","cr","cal",,,-836
-"SUPCRT92",82,"ferrosilite","cr","cal",,,694
-"SUPCRT92",83,"ferrosilite","cr2","cal",,,694
-"SUPCRT92",93,"glaucophane","cr","cal",-2.57,,
-"SUPCRT92",94,"greenalite","cr","cal",,,142507
-"SUPCRT92",96,"grunerite","cr","cal",9.72,,
-"SUPCRT92",97,"halloysite","cr","cal",-1.6,,
+"SUPCRT92",25,"antigorite","cr","cal",,,812
+"SUPCRT92",40,"clinochlore,7A","cr","cal",,,666
+"SUPCRT92",56,"daphnite,14A","cr","cal",,,-836
+"SUPCRT92",81,"ferrosilite","cr","cal",,,694
+"SUPCRT92",82,"ferrosilite","cr2","cal",,,694
+"SUPCRT92",92,"glaucophane","cr","cal",-2.57,,
+"SUPCRT92",93,"greenalite","cr","cal",,,142507
+"SUPCRT92",95,"grunerite","cr","cal",9.72,,
+"SUPCRT92",96,"halloysite","cr","cal",-1.6,,
"OldAA",11,"alanate","aq","cal",-24.28,,
"OldAA",24,"Fe(Gly)2","aq","cal",,,537
"OldAA",50,"Fe(Ala)2","aq","cal",,,553
Modified: pkg/CHNOSZ/inst/extdata/thermo/stoich.csv.xz
===================================================================
(Binary files differ)
More information about the CHNOSZ-commits
mailing list