Skip to content

Commit

Permalink
Set dpi in vignettes to reduce package size
Browse files Browse the repository at this point in the history
git-svn-id: svn://scm.r-forge.r-project.org/svnroot/chnosz/pkg/CHNOSZ@815 edb9625f-4e0d-4859-8d74-9fd3b1da38cb
  • Loading branch information
jedick committed Nov 29, 2023
1 parent 253c7e3 commit 4096512
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 56 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Date: 2023-11-28
Date: 2023-11-29
Package: CHNOSZ
Version: 2.0.0-34
Version: 2.0.0-35
Title: Thermodynamic Calculations and Diagrams for Geochemistry
Authors@R: c(
person("Jeffrey", "Dick", , "[email protected]", role = c("aut", "cre"),
Expand Down
3 changes: 2 additions & 1 deletion inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
\newcommand{\Cp}{\ifelse{latex}{\eqn{C_P}}{\ifelse{html}{\out{<I>C<sub>P</sub></I>}}{Cp}}}
\newcommand{\DG0}{\ifelse{latex}{\eqn{{\Delta}G^{\circ}}}{\ifelse{html}{\out{&Delta;<I>G</I>&deg;}}{ΔG°}}}

\section{Changes in CHNOSZ version 2.0.0-32 (2023-11-15)}{
\section{Changes in CHNOSZ version 2.0.0-34 (2023-11-28)}{

\itemize{

Expand All @@ -30,6 +30,7 @@
\item How can minerals with polymorphic transitions be added to the database?
\item How can I make a diagram with the trisulfur radical ion (S\s{3}\S{-})?
\item In OBIGT, what is the meaning of \code{T} for solids, liquids, and gases?
\item How do I plot mineral buffers for pH?

}

Expand Down
26 changes: 14 additions & 12 deletions vignettes/FAQ.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ knitr::knit_hooks$set(
'</div>', sep = '\n')
}
)
# Set dpi 20231129
dpi <- 72
```

```{r echo = F, cache = F}
Expand Down Expand Up @@ -207,7 +209,7 @@ This vignette was compiled on `r Sys.Date()` with CHNOSZ version `r sessionInfo(
As one syllable that starts with an *sh* sound and [rhymes with *Oz*](https://en.wiktionary.org/wiki/Rhymes:English/%C9%92z).
CHNOSZ and [schnoz](https://en.wiktionary.org/wiki/schnozz) are homophones.

*Answered on 2023-05-22.*
*Added on 2023-05-22.*

## How should CHNOSZ be cited?

Expand Down Expand Up @@ -235,7 +237,7 @@ reset()

* Additional minerals from @HDNB78, that were available in SUPCRT92 but may conflict with the @Ber88 compilation, can be loaded from an optional database with `add.OBIGT("SUPCRT92")`. When using these data, it is appropriate to cite @HDNB78 rather than SUPCRT92.

*Answered on 2023-05-27; PPM example added on 2023-11-15.*
*Added on 2023-05-27; PPM example added on 2023-11-15.*

## What thermodynamic models are used in CHNOSZ?

Expand All @@ -246,7 +248,7 @@ reset()
* Activity coefficients are implemented via adjusted standard Gibbs energies at specified ionic strength [@Alb96], which converts all activity variables in the workflow to molalities.
* A related adjustment is available to convert standard Gibbs energies for gases from the 1 bar standard state used in SUPCRT92 to a variable-pressure standard state [@AC93,Ch.12].

*Answered on 2018-11-13; moved to FAQ from <https://chnosz.net/> website on 2023-05-27; added references for **revised** HKF on 2023-11-17.*
*Added to <https://chnosz.net/> website on 2018-11-13; moved to FAQ on 2023-05-27; added references for **revised** HKF on 2023-11-17.*

## When and why do equal-activity boundaries depend on total activity?

Expand Down Expand Up @@ -331,10 +333,10 @@ reset()
```
</div>

```{r DEW_Ctot, echo = FALSE, message = FALSE, results = "hide", fig.width = 8, fig.height = 4, out.width = "100%", fig.align = "center", pngquant = pngquant, cache = TRUE}
```{r DEW_Ctot, echo = FALSE, message = FALSE, results = "hide", fig.width = 8, fig.height = 4, out.width = "100%", fig.align = "center", pngquant = pngquant, cache = TRUE, dpi = dpi}
```

*Answered on 2023-05-17.*
*Added on 2023-05-17.*

## How can minerals with polymorphic transitions be added to the database?

Expand Down Expand Up @@ -493,12 +495,12 @@ for(property in c("G", "H", "S", "Cp")) {
reset()
```
</div>
```{r pyrrhotite_T, echo = FALSE, message = FALSE, results = "hide", fig.width = 8, fig.height = 2.5, out.width = "100%", fig.align = "center", pngquant = pngquant}
```{r pyrrhotite_T, echo = FALSE, message = FALSE, results = "hide", fig.width = 8, fig.height = 2.5, out.width = "100%", fig.align = "center", pngquant = pngquant, dpi = dpi}
```

For additional polymorphs, we could repeat the above procedure using polymorph 2 as the starting point to calculate `G`, `H`, and `S` of polymorph 3, and so on.

*Answered on 2023-06-23.*
*Added on 2023-06-23.*

## How can I make a diagram with the trisulfur radical ion (`r S3minus`)?

Expand Down Expand Up @@ -671,10 +673,10 @@ OBIGT()

Here are the three plots that we made:

```{r trisulfur, echo = FALSE, message = FALSE, results = "hide", fig.width = 10, fig.height = 3.33, out.width = "100%", out.extra='class="full-width"', pngquant = pngquant, cache = TRUE}
```{r trisulfur, echo = FALSE, message = FALSE, results = "hide", fig.width = 10, fig.height = 3.33, out.width = "100%", out.extra='class="full-width"', pngquant = pngquant, cache = TRUE, dpi = dpi}
```

*Answered on 2023-09-08.*
*Added on 2023-09-08.*

## In OBIGT, what is the meaning of `T` for solids, liquids, and gases?

Expand Down Expand Up @@ -747,7 +749,7 @@ In previous versions of CHNOSZ, values of Δ*G*° above the *C~p~* equation limi

**4. Finally, if `T` is NA or 0, then no upper temerature limit is imposed by `subcrt()`.**

*Answered on 2023-11-15.*
*Added on 2023-11-15.*

## How do I plot mineral buffers for pH?

Expand Down Expand Up @@ -799,7 +801,7 @@ title("Mineral data from Helgeson et al. (1978)\n(as used in SUPCRT92)",
font.main = 1, cex.main = 0.9)
OBIGT()
```
```{r KMQ_diagram, message = FALSE, fig.width = 8, fig.height = 4, results = "hide", echo = FALSE}
```{r KMQ_diagram, message = FALSE, fig.width = 8, fig.height = 4, out.width = "100%", results = "hide", echo = FALSE, dpi = dpi}
```

In this diagram, the gray area is below the reducing stability limit of water (i.e., where the equilibrium fugacity of `r H2` exceeds unity).
Expand All @@ -820,6 +822,6 @@ If we use the thermodynamic parameters for minerals from @HDNB78, we get the lin
```{r KMQ_diagram, eval = FALSE, echo = 10:14}
```

*Answered on 2023-11-28.*
*Added on 2023-11-28.*

## References
7 changes: 5 additions & 2 deletions vignettes/custom_data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ library(knitr)
knit_hooks$set(pngquant = hook_pngquant)
pngquant <- "--speed=1 --quality=0-25"
if (!nzchar(Sys.which("pngquant"))) pngquant <- NULL
## Set dpi 20231129
dpi <- 72
```

```{r HTML, include = FALSE}
Expand Down Expand Up @@ -510,7 +513,7 @@ A constant molality of `r F_` is based on the assumption of complete dissociatio
An ionic strength of 0.9 mol/kg is estimated for a solution with 1.8 m NaCl (use `NaCl(1.8, T = 300)`).
`r NOTE`: because the ionic strength is non-zero, the calculations here refer to molality instead of activity of species (see [An Introduction to CHNOSZ](anintro.html#from-activity-to-molality)).

```{r diagram1, message = FALSE, results = "hide", fig.width = 6, fig.height = 5, out.width = "75%", fig.align = "center", pngquant = pngquant}
```{r diagram1, message = FALSE, results = "hide", fig.width = 6, fig.height = 5, out.width = "75%", fig.align = "center", pngquant = pngquant, dpi = dpi}
basis(c("H+", "WO4-2", "F-", "H2O", "O2"))
basis("F-", log10(0.1))
iaq <- retrieve("W", c("O", "H", "F"), "aq")
Expand Down Expand Up @@ -539,7 +542,7 @@ a_F <- F_tot / (1 + 10^(logK_HF - pH))
```

Now that we have the molality of `r F_` as a function of pH, we can provide it in the call to `r affinity_`.
```{r diagram2, message = FALSE, results = "hide", results = "hide", fig.width = 6, fig.height = 5, out.width = "75%", fig.align = "center", pngquant = pngquant}
```{r diagram2, message = FALSE, results = "hide", results = "hide", fig.width = 6, fig.height = 5, out.width = "75%", fig.align = "center", pngquant = pngquant, dpi = dpi}
basis(c("H+", "WO4-2", "F-", "H2O", "O2"))
iaq <- retrieve("W", c("O", "H", "F"), "aq")
species(iaq)
Expand Down
55 changes: 29 additions & 26 deletions vignettes/equilibrium.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ link-citations: true
padding:10px;
}
}
/* zero margin around pre blocks (looks more like R console output) */
/* Zero margin around pre blocks (looks more like R console output) */
pre {
margin-top: 0;
margin-bottom: 0;
Expand All @@ -58,11 +58,14 @@ function ToggleDiv(ID) {
</script>

```{r setup, include=FALSE}
## use pngquant to optimize PNG images
## Use pngquant to optimize PNG images
library(knitr)
knit_hooks$set(pngquant = hook_pngquant)
pngquant <- "--speed=1 --quality=0-25"
if (!nzchar(Sys.which("pngquant"))) pngquant <- NULL
## Set dpi 20231129
dpi <- 72
```

```{r CHNOSZ_reset, include=FALSE}
Expand Down Expand Up @@ -196,7 +199,7 @@ Press the button to show all of the code for making the figure.
<div id="D-AAplot" style="display: none">
```{r AAplot, eval = FALSE}
showtime <- function(st) {
# plot time in lower-right of figure region
# Plot time in lower-right of figure region
f <- usrfig()
par(xpd=TRUE)
if(st[3] > 2) col <- "red" else col <- "black"
Expand All @@ -206,7 +209,7 @@ showtime <- function(st) {
layout(t(matrix(c(1:7, 11, 8:10, 12), nrow=4)), widths=c(1, 4, 4, 4), heights=c(0.7, 4, 4))
## row 0 (column titles)
## Row 0 (column titles)
opar <- par(mar=c(0, 0, 0, 0))
plot.new()
plot.new()
Expand All @@ -217,57 +220,57 @@ plot.new()
text(0.58, 0.5, "equilibration", cex=1.4)
par(opar)
## row 1 (balance = 1)
## Row 1 (balance = 1)
opar <- par(mar=c(0, 0, 0, 0))
plot.new()
text(0.5, 0.5, "balance = 1", srt=90, cex=1.4)
par(opar)
# figure A
# Figure A
st <- system.time(dA <- aaA())
showtime(st)
title(main="loga(species) = -3", cex.main=1)
label.figure("A", yfrac=0.92, xfrac=0.1, font = 2)
# figure B
# Figure B
st <- system.time(dB <- aaB())
showtime(st)
title(main=paste("loga(total species) =", round(dB$loga.balance[1], 2)), cex.main=1)
label.figure("C", yfrac=0.92, xfrac=0.1, font = 2)
## row 2 (balance = nCO2)
## Row 2 (balance = nCO2)
opar <- par(mar=c(0, 0, 0, 0))
plot.new()
text(0.5, 0.5, 'balance = "CO2"', srt=90, cex=1.4)
par(opar)
# figure C
# Figure C
st <- system.time(dC <- aaC())
showtime(st)
title(main="loga(species) = -3", cex.main=1)
label.figure("B", yfrac=0.92, xfrac=0.1, font = 2)
# figure D
# Figure D
st <- system.time(dD <- aaD())
showtime(st)
title(main=paste("loga(total CO2) =", round(dD$loga.balance[1], 2)), cex.main=1)
label.figure("D", yfrac=0.92, xfrac=0.1, font = 2)
## right (speciation at different total activity of CO2)
## Right column (speciation at different total activity of CO2)
par(xpd=NA)
lines(c(-66, -64.5), c(4, 9), lty=2)
lines(c(-66, -64.5), c(-8, -8.5), lty=2)
par(xpd=FALSE)
# figure E
# Figure E
st <- system.time(dE <- aaE())
showtime(st)
title(main=paste("loga(total CO2) =", round(dE$loga.balance[1], 2)), cex.main=1)
label.figure("E", yfrac=0.92, xfrac=0.1, font = 2)
# figure F
# Figure F
st <- system.time(dF <- aaF())
showtime(st)
title(main=paste("loga(total CO2) =", round(dF$loga.balance[1], 2)), cex.main=1)
label.figure("F", yfrac=0.92, xfrac=0.1, font = 2)
```
</div>

```{r AAplot, echo = FALSE, results = "hide", message = FALSE, fig.width = 13/2, fig.height = 8.7/2, out.width = "100%", pngquant = pngquant}
```{r AAplot, echo = FALSE, results = "hide", message = FALSE, fig.width = 13/2, fig.height = 8.7/2, out.width = "100%", pngquant = pngquant, dpi = dpi}
```

Diagrams **A** and **B** use the *maximum affinity method*, where the reference
Expand Down Expand Up @@ -367,10 +370,10 @@ prF <- function() {
```
</div>

```{r PRplot, echo = FALSE, results = "hide", message = FALSE, fig.width = 13/2, fig.height = 8.7/2, out.width = "100%", pngquant = pngquant}
```{r PRplot, echo = FALSE, results = "hide", message = FALSE, fig.width = 13/2, fig.height = 8.7/2, out.width = "100%", pngquant = pngquant, dpi = dpi}
layout(t(matrix(1:12, nrow=4)), widths=c(1, 4, 4, 4), heights=c(0.7, 4, 4))
## row 0 (column titles)
## Row 0 (column titles)
opar <- par(mar=c(0, 0, 0, 0))
plot.new()
plot.new()
Expand All @@ -381,38 +384,38 @@ plot.new()
text(0.58, 0.5, "as.residue = TRUE\n(balance = 1)", cex=1.4)
par(opar)
## row 1 (maximum affinity 2D)
## Row 1 (maximum affinity 2D)
opar <- par(mar=c(0, 0, 0, 0))
plot.new()
text(0.5, 0.5, "maximum affinity", srt=90, cex=1.4)
par(opar)
# figure A (balance = "length")
# Figure A (balance = "length")
st <- system.time(dA <- prA())
showtime(st)
label.figure("A", yfrac=0.9, xfrac=0.1, font = 2)
# figure C (normalize = TRUE)
# Figure C (normalize = TRUE)
st <- system.time(dC <- prC())
showtime(st)
label.figure("C", yfrac=0.9, xfrac=0.1, font = 2)
# figure E (as.residue = TRUE)
# Figure E (as.residue = TRUE)
st <- system.time(dE <- prE())
showtime(st)
label.figure("E", yfrac=0.9, xfrac=0.1, font = 2)
## row 2 (equilibrate 1D)
## Row 2 (equilibrate 1D)
opar <- par(mar=c(0, 0, 0, 0))
plot.new()
text(0.5, 0.5, "equilibration", srt=90, cex=1.4)
par(opar)
# figure B (balance = "length")
# Figure B (balance = "length")
st <- system.time(prB())
showtime(st)
label.figure("B", yfrac=0.9, xfrac=0.1, font = 2)
# figure D (normalize = TRUE)
# Figure D (normalize = TRUE)
st <- system.time(prD())
showtime(st)
label.figure("D", yfrac=0.9, xfrac=0.1, font = 2)
# figure F (as.residue = TRUE)
# Figure F (as.residue = TRUE)
st <- system.time(prF())
showtime(st)
label.figure("F", yfrac=0.9, xfrac=0.1, font = 2)
Expand Down Expand Up @@ -446,11 +449,11 @@ Here is another figure showing the effects of normalization.
This is like Figure 5 of @Dic08, extended to more extreme conditions.
If you wish to reproduce the diagram from the 2008 paper more closely, uncomment the `add.OBIGT()` command.

```{r ProteinSpeciation, results = "hide", message = FALSE, fig.width = 8, fig.height = 5.5, out.width = "100%", pngquant = pngquant}
```{r ProteinSpeciation, results = "hide", message = FALSE, fig.width = 8, fig.height = 5.5, out.width = "100%", pngquant = pngquant, dpi = dpi}
organisms <- c("METSC", "METJA", "METFE", "METVO", "METBU",
"HALJP", "ACEKI", "GEOSE", "BACLI", "AERSA")
proteins <- c(rep("CSG", 6), rep("SLAP", 4))
# use red for Methano* genera
# Use red for Methano* genera
col <- c(rep(2, 5), rep(1, 5))
basis("CHNOS+")
species(proteins, organisms)
Expand Down
Loading

0 comments on commit 4096512

Please sign in to comment.