[CHNOSZ-commits] r162 - in pkg/CHNOSZ: . R inst man src vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Feb 18 15:18:11 CET 2017


Author: jedick
Date: 2017-02-18 15:18:11 +0100 (Sat, 18 Feb 2017)
New Revision: 162

Added:
   pkg/CHNOSZ/src/init.c
Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/NAMESPACE
   pkg/CHNOSZ/R/water.R
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/man/util.water.Rd
   pkg/CHNOSZ/vignettes/anintro.Rmd
   pkg/CHNOSZ/vignettes/eos-regress.Rmd
Log:
register native routines


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2017-02-18 10:15:38 UTC (rev 161)
+++ pkg/CHNOSZ/DESCRIPTION	2017-02-18 14:18:11 UTC (rev 162)
@@ -1,6 +1,6 @@
 Date: 2017-02-18
 Package: CHNOSZ
-Version: 1.0.8-51
+Version: 1.0.8-52
 Title: Chemical Thermodynamics and Activity Diagrams
 Author: Jeffrey Dick
 Maintainer: Jeffrey Dick <j3ffdick at gmail.com>

Modified: pkg/CHNOSZ/NAMESPACE
===================================================================
--- pkg/CHNOSZ/NAMESPACE	2017-02-18 10:15:38 UTC (rev 161)
+++ pkg/CHNOSZ/NAMESPACE	2017-02-18 14:18:11 UTC (rev 162)
@@ -1,8 +1,9 @@
-# Export all names
-exportPattern(".")
+# Export all names except those beginning with F_
+# (so we don't export F_h2o92 created below)
+exportPattern("^([^F]|F($|[^_])).*")
 
 # Load shared objects
-useDynLib(CHNOSZ)
+useDynLib(CHNOSZ, .registration = TRUE, .fixes = "F_")
 
 # Imports from default packages
 importFrom("grDevices", "dev.cur", "dev.off", "extendrange",
@@ -19,4 +20,3 @@
 
 # Imports from colorspace
 importFrom("colorspace", "diverge_hcl")
-

Modified: pkg/CHNOSZ/R/water.R
===================================================================
--- pkg/CHNOSZ/R/water.R	2017-02-18 10:15:38 UTC (rev 161)
+++ pkg/CHNOSZ/R/water.R	2017-02-18 14:18:11 UTC (rev 162)
@@ -83,8 +83,8 @@
       rho.out[i] <- NA
     } else {
       # now to the actual calculations
-      H2O <- .Fortran("H2O92", as.integer(specs), as.double(states),
-        as.double(rep(0, 46)), as.integer(0), PACKAGE="CHNOSZ")
+      H2O <- .Fortran(F_h2o92, as.integer(specs), as.double(states),
+        as.double(rep(0, 46)), as.integer(0))
       # errors
       err.out[i] <- H2O[[4]]
       # density of two states

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2017-02-18 10:15:38 UTC (rev 161)
+++ pkg/CHNOSZ/inst/NEWS	2017-02-18 14:18:11 UTC (rev 162)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.0.8-51 (2017-02-18)
+CHANGES IN CHNOSZ 1.0.8-52 (2017-02-18)
 ---------------------------------------
 
 DOCUMENTATION:

Modified: pkg/CHNOSZ/man/util.water.Rd
===================================================================
--- pkg/CHNOSZ/man/util.water.Rd	2017-02-18 10:15:38 UTC (rev 161)
+++ pkg/CHNOSZ/man/util.water.Rd	2017-02-18 14:18:11 UTC (rev 162)
@@ -73,7 +73,7 @@
 
 \references{
 
-  Archer, D. G. and Wang, P. M. (1990) The dielectric constant of water and Debye-Hückel limiting law slopes. \emph{J. Phys. Chem. Ref. Data} \bold{19}, 371--411. \url{https://www.nist.gov/data/PDFfiles/jpcrd383.pdf}
+  Archer, D. G. and Wang, P. M. (1990) The dielectric constant of water and Debye-Hückel limiting law slopes. \emph{J. Phys. Chem. Ref. Data} \bold{19}, 371--411. \url{https://srd.nist.gov/JPCRD/jpcrd383.pdf}
 
   Wagner, W. and Pruß, A. (2002) The IAPWS formulation 1995 for the thermodynamic properties of ordinary water substance for general and scientific use. \emph{J. Phys. Chem. Ref. Data} \bold{31}, 387--535. \url{http://dx.doi.org/10.1063/1.1461829}
 

Added: pkg/CHNOSZ/src/init.c
===================================================================
--- pkg/CHNOSZ/src/init.c	                        (rev 0)
+++ pkg/CHNOSZ/src/init.c	2017-02-18 14:18:11 UTC (rev 162)
@@ -0,0 +1,17 @@
+#include <R_ext/RS.h>
+#include <stdlib.h> // for NULL
+#include <R_ext/Rdynload.h>
+
+/* .Fortran calls */
+extern void F77_NAME(h2o92)(void *, void *, void *, void *);
+
+static const R_FortranMethodDef FortranEntries[] = {
+    {"h2o92", (DL_FUNC) &F77_NAME(h2o92), 4},
+    {NULL, NULL, 0}
+};
+
+void R_init_CHNOSZ(DllInfo *dll)
+{
+    R_registerRoutines(dll, NULL, NULL, FortranEntries, NULL);
+    R_useDynamicSymbols(dll, FALSE);
+}

Modified: pkg/CHNOSZ/vignettes/anintro.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/anintro.Rmd	2017-02-18 10:15:38 UTC (rev 161)
+++ pkg/CHNOSZ/vignettes/anintro.Rmd	2017-02-18 14:18:11 UTC (rev 162)
@@ -1795,7 +1795,7 @@
 
 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/tools) for SUPCRT updates (slop files), including corrections that have not yet been ported to CHNOSZ.
+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

Modified: pkg/CHNOSZ/vignettes/eos-regress.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/eos-regress.Rmd	2017-02-18 10:15:38 UTC (rev 161)
+++ pkg/CHNOSZ/vignettes/eos-regress.Rmd	2017-02-18 14:18:11 UTC (rev 162)
@@ -286,8 +286,8 @@
 EOScoeffs("Na+", "Cp")
 ```
 
-Alrighty! We managed to obtain EOS parameters from synthetic data for Na<sup>+</sup>.
-The regressed values of the EOS parameters (shown in the plot legend) are very close to the database values (printed by the call to <span style="color:green">`EOScoeffs()`</span>) used to generate the synthetic data.
+Alrighty! We managed to obtain HKF coefficients from synthetic data for Na<sup>+</sup>.
+The regressed values of the HKF coefficients (shown in the plot legend) are very close to the database values (printed by the call to <span style="color:green">`EOScoeffs()`</span>) used to generate the synthetic data.
 
 ## Doing it for volume
 
@@ -403,7 +403,6 @@
 s1 <- subcrt(c("pseudo-H4SiO4", "SiO2", "H2O"), c(-1, 1, 2))
 plot(s1$out$T, s1$out$G, type = "l", ylim = c(-100, 600),
   xlab = axis.label("T"), ylab = axis.label("DG0"))
-add.obigt()
 s2 <- subcrt(c("H4SiO4_Ste01", "SiO2", "H2O"), c(-1, 1, 2))
 lines(s2$out$T, s2$out$G, lty = 2)
 abline(h = 0, lty = 3)



More information about the CHNOSZ-commits mailing list