[CHNOSZ-commits] r595 - in pkg/CHNOSZ: . man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Aug 11 04:21:25 CEST 2020


Author: jedick
Date: 2020-08-11 04:21:24 +0200 (Tue, 11 Aug 2020)
New Revision: 595

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/man/NaCl.Rd
   pkg/CHNOSZ/man/add.protein.Rd
   pkg/CHNOSZ/man/info.Rd
   pkg/CHNOSZ/man/makeup.Rd
   pkg/CHNOSZ/man/nonideal.Rd
   pkg/CHNOSZ/man/objective.Rd
   pkg/CHNOSZ/man/taxonomy.Rd
   pkg/CHNOSZ/man/util.array.Rd
   pkg/CHNOSZ/man/util.blast.Rd
   pkg/CHNOSZ/man/util.fasta.Rd
   pkg/CHNOSZ/man/util.water.Rd
Log:
Remove stopifnot() from examples, round 3


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2020-08-11 01:24:46 UTC (rev 594)
+++ pkg/CHNOSZ/DESCRIPTION	2020-08-11 02:21:24 UTC (rev 595)
@@ -1,6 +1,6 @@
 Date: 2020-08-11
 Package: CHNOSZ
-Version: 1.3.6-68
+Version: 1.3.6-69
 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/man/NaCl.Rd
===================================================================
--- pkg/CHNOSZ/man/NaCl.Rd	2020-08-11 01:24:46 UTC (rev 594)
+++ pkg/CHNOSZ/man/NaCl.Rd	2020-08-11 02:21:24 UTC (rev 595)
@@ -81,8 +81,8 @@
 dprop <- describe.property(rep("T", 3), c(100, 300, 500))
 legend("topleft", dprop, lty=1, pch=1, col=col)
 title(main="H2O + NaCl; HCh (points) and 'NaCl()' (lines)")
+# plot activity coefficient (gamma)
 plot(c(1,6), c(0,0.8), xlab="NaCl (mol/kg)", ylab=expression(gamma[Cl^"-"]), type="n")
-# plot activity coefficient (gamma)
 for(i in 1:3) {
   points(m.HCh, gam_Cl.HCh[[i]], col=col[i])
   lines(m_tot, gam_Cl.calc[, i], col=col[i])

Modified: pkg/CHNOSZ/man/add.protein.Rd
===================================================================
--- pkg/CHNOSZ/man/add.protein.Rd	2020-08-11 01:24:46 UTC (rev 594)
+++ pkg/CHNOSZ/man/add.protein.Rd	2020-08-11 02:21:24 UTC (rev 595)
@@ -49,7 +49,7 @@
 # Human Gastric juice peptide 1
 aa <- seq2aa("GAJU_HUMAN", "LAAGKVEDSD")
 ip <- add.protein(aa)
-stopifnot(protein.length(ip)==10)
+protein.length(ip) # 10
 # the chemical formula of this peptide
 as.chemical.formula(protein.formula(ip)) # "C41H69N11O18"
 # we can also calculate a formula without using add.protein

Modified: pkg/CHNOSZ/man/info.Rd
===================================================================
--- pkg/CHNOSZ/man/info.Rd	2020-08-11 01:24:46 UTC (rev 594)
+++ pkg/CHNOSZ/man/info.Rd	2020-08-11 02:21:24 UTC (rev 595)
@@ -68,10 +68,10 @@
 
 # formulas default to aqueous species, if available
 i1 <- info(c("CH4", "CO2", "CS2", "MgO"))
-stopifnot(identical(info(i1)$state, c("aq", "aq", "gas", "cr")))
+info(i1)$state  # aq, aq, gas, cr
 # state argument overrides the default
 i2 <- info(c("CH4", "CO2", "MgO"), "gas") 
-stopifnot(identical(info(i2)$state, c("gas", "gas", NA)))
+info(i2)$state  # gas, gas, NA
 
 ## partial name or formula searches
 info("ATP")

Modified: pkg/CHNOSZ/man/makeup.Rd
===================================================================
--- pkg/CHNOSZ/man/makeup.Rd	2020-08-11 01:24:46 UTC (rev 594)
+++ pkg/CHNOSZ/man/makeup.Rd	2020-08-11 02:21:24 UTC (rev 595)
@@ -52,9 +52,8 @@
 # the formula of lawsonite, with a parenthetical part and a suffix
 makeup("CaAl2Si2O7(OH)2*H2O")
 # fractional coefficients are ok
-redfield <- c(106, 16, 1)
 reddiv10 <- makeup("C10.6N1.6P0.1")
-stopifnot(10*reddiv10 == redfield)
+10*reddiv10 # 106, 16, 1 (Redfield ratio)
 
 # the coefficient for charge is a number with a *preceding* sign
 # e.g., ferric iron, with a charge of +3 is expressed as
@@ -78,8 +77,8 @@
 # the 'sum' argument can be used to check mass and charge
 # balance in a chemical reaction
 formula <- c("H2O", "H+", "(Z-1)", "O2")
-(mf <- makeup(formula, c(-1, 2, 2, 0.5), sum=TRUE))
-stopifnot(all(mf==0))
+mf <- makeup(formula, c(-1, 2, 2, 0.5), sum = TRUE)
+all(mf==0)  # TRUE
 }
 
 \seealso{ \code{\link{mass}}, \code{\link{entropy}}, \code{\link{basis}}, \code{\link{i2A}} }

Modified: pkg/CHNOSZ/man/nonideal.Rd
===================================================================
--- pkg/CHNOSZ/man/nonideal.Rd	2020-08-11 01:24:46 UTC (rev 594)
+++ pkg/CHNOSZ/man/nonideal.Rd	2020-08-11 02:21:24 UTC (rev 595)
@@ -139,11 +139,11 @@
 # (needed for replication of the values in Alberty's book)
 nonideal("Alberty")
 thermo("opt$ideal.H" = FALSE)
-(sres <- subcrt(c("acetate", "H+", "acetic acid"), c(-1, -1, 1),
-  IS=c(0, 0.1, 0.25), T=25, property="logK"))
-# we're within 0.01 log of Alberty's pK values
+sres <- subcrt(c("acetate", "H+", "acetic acid"), c(-1, -1, 1),
+  IS=c(0, 0.1, 0.25), T=25, property="logK")
+# we're within 0.01 of Alberty's pK values
 Alberty_logK <- c(4.75, 4.54, 4.47)
-stopifnot(maxdiff(sres$out$logK, Alberty_logK) < 0.01)
+maxdiff(sres$out$logK, Alberty_logK) # 0.0072
 # reset option to default
 thermo("opt$ideal.H" = TRUE)
 
@@ -181,11 +181,9 @@
 sres <- subcrt("Na+", T = 700, P = 10000, IS = IS)
 water(oldwat)
 # compare the calculated activity coefficient to values from Manning's figure
+gamma <- 10^sres$out[[1]]$loggam
 Manning_gamma <- c(0.93, 0.82, 0.65, 0.76, 1.28, 2)
-gamma <- 10^sres$out[[1]]$loggam
-# the error is larger at higher IS
-stopifnot(maxdiff(gamma[1], Manning_gamma[1]) < 0.01)
-stopifnot(maxdiff(gamma, Manning_gamma) < 0.2)
+gamma - Manning_gamma
 
 ## Plot the data and splines used for calculating b_gamma
 ## (extended term parameter)

Modified: pkg/CHNOSZ/man/objective.Rd
===================================================================
--- pkg/CHNOSZ/man/objective.Rd	2020-08-11 01:24:46 UTC (rev 594)
+++ pkg/CHNOSZ/man/objective.Rd	2020-08-11 02:21:24 UTC (rev 595)
@@ -107,8 +107,8 @@
 title(main=paste("Transformation between metastable equilibrium\n",
   "assemblages of n-alkanes"))
 # DGtr but not DDGmix is positive (or zero) everywhere
-stopifnot(all(DGtr.out >= 0))
-stopifnot(!all(DDGmix.out >= 0))
+all(DGtr.out >= 0)    # TRUE
+all(DDGmix.out >= 0)  # FALSE
 }
 
 \references{

Modified: pkg/CHNOSZ/man/taxonomy.Rd
===================================================================
--- pkg/CHNOSZ/man/taxonomy.Rd	2020-08-11 01:24:46 UTC (rev 594)
+++ pkg/CHNOSZ/man/taxonomy.Rd	2020-08-11 02:21:24 UTC (rev 595)
@@ -73,7 +73,7 @@
 getrank(id5,taxdir)
 # find the species for each of these
 id6 <- sapply(id5,function(x) parent(x,taxdir=taxdir,rank="species"))
-stopifnot(unique(getrank(id6,taxdir))=="species")
+unique(getrank(id6, taxdir))  # "species"
 # note that the K-12 is dropped
 sciname(id6,taxdir)
 

Modified: pkg/CHNOSZ/man/util.array.Rd
===================================================================
--- pkg/CHNOSZ/man/util.array.Rd	2020-08-11 01:24:46 UTC (rev 594)
+++ pkg/CHNOSZ/man/util.array.Rd	2020-08-11 02:21:24 UTC (rev 595)
@@ -81,7 +81,7 @@
 a2 <- affinity(O2 = c(-80, -60), pH = c(0, 14, 7))
 # in the 2nd dimension (pH) get the 4th slice (pH=7)
 a3 <- slice.affinity(a2, 2, 4)
-stopifnot(all.equal(a1$values, a3$values))
+all.equal(a1$values, a3$values)  # TRUE
 }
 
 \concept{Utility functions}

Modified: pkg/CHNOSZ/man/util.blast.Rd
===================================================================
--- pkg/CHNOSZ/man/util.blast.Rd	2020-08-11 01:24:46 UTC (rev 594)
+++ pkg/CHNOSZ/man/util.blast.Rd	2020-08-11 02:21:24 UTC (rev 595)
@@ -63,7 +63,7 @@
 \examples{
 ## using def2gi
 def <- "gi|218295810|ref|ZP_03496590.1|"
-stopifnot(all.equal(def2gi(def), "218295810"))
+def2gi(def)  # "218295810"
 
 ## process some of the BLAST output for proteins
 ## from Bison Pool metagenome (JGI, 2007)

Modified: pkg/CHNOSZ/man/util.fasta.Rd
===================================================================
--- pkg/CHNOSZ/man/util.fasta.Rd	2020-08-11 01:24:46 UTC (rev 594)
+++ pkg/CHNOSZ/man/util.fasta.Rd	2020-08-11 02:21:24 UTC (rev 595)
@@ -94,7 +94,7 @@
 # warnings are issued for unrecognized characters
 atest <- count.aa("WhatAmIMadeOf?")
 # there are 3 "A" (alanine)
-stopifnot(atest[, "A"]==3)
+atest[, "A"]
 }
 }
 

Modified: pkg/CHNOSZ/man/util.water.Rd
===================================================================
--- pkg/CHNOSZ/man/util.water.Rd	2020-08-11 01:24:46 UTC (rev 594)
+++ pkg/CHNOSZ/man/util.water.Rd	2020-08-11 02:21:24 UTC (rev 595)
@@ -68,7 +68,7 @@
 V.vapor <- subcrt("water", T=convert(445:455, "C"))$out[[1]]$V
 thermo("opt$IAPWS.sat" = "liquid") # the default
 V.liquid <- subcrt("water", T=convert(445:455, "C"))$out[[1]]$V
-stopifnot(all(V.vapor > V.liquid))
+all(V.vapor > V.liquid)  # TRUE
 water(oldwat)
 }
 



More information about the CHNOSZ-commits mailing list