util.misc: Functions for Miscellaneous Tasks

Description Usage Arguments Details Examples

Description

Calculate dP/dT and temperature of phase transitions; scale logarithms of activity to a desired total activity.

Usage

1
2
3
4
  dPdTtr(ispecies, ispecies2 = NULL)
  Ttr(ispecies, ispecies2 = NULL, P = 1, dPdT = NULL)
  GHS_Tr(ispecies, Htr)
  unitize(logact = NULL, length = NULL, logact.tot = 0)

Arguments

ispecies

numeric, species index of a mineral phase

ispecies2

numeric, species index of next mineral phase (the default is ispecies + 1)

P

numeric, pressure (bar)

dPdT

numeric, values of (dP/dT) of phase transitions (Ttr)

Htr

numeric, enthalpy(ies) of transition (cal/mol)

logact

numeric, logarithms of activity

length

numeric, numbers of residues

logact.tot

numeric, logarithm of total activity

Details

dPdTtr returns values of (dP/dT)Ttr, where Ttr represents the transition temperature, of the phase transition at the high-T stability limit of the ispecies in thermo()$OBIGT (other than checking that the names match, the function does not check that the species in fact represent different phases of the same mineral). dPdTtr takes account of the Clapeyron equation, (dP/dT)Ttr=DS/DV, where DS and DV represent the changes in entropy and volume of phase transition, and are calculated using subcrt at Ttr from the standard molal entropies and volumes of the two phases involved. Using values of dPdT calculated using dPdTtr or supplied in the arguments, Ttr returns as a function of P values of the upper transition temperature of the mineral phase represented by ispecies.

GHS_Tr can be used to calculate values of G, H, and S at Tr for the cr2, cr3, and cr4 phases in the database. It combines the given Htr (enthalpies of transition) with the database values of GHS @ Tr only for the phase that is stable at 298.15 K (cr) and the transition temperatures and Cp coefficients for higher-temperature phases, to calculate the GHS @ Tr (i.e. low-temperature metastable conditions) of the phases that are stable at higher temperatures.

unitize scales the logarithms of activities given in logact so that the logarithm of total activity of residues is equal to zero (i.e. total activity of residues is one), or to some other value set in logact.tot. length indicates the number of residues in each species. If logact is NULL, the function takes the logarithms of activities from the current species definition. If any of those species are proteins, the function gets their lengths using protein.length.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# we need the Helgeson et al., 1978 minerals for this example
add.OBIGT("SUPCRT92")
# that replaces the existing enstatite with the first phase;
# the other phases are appended to the end of thermo()$OBIGT
i1 <- info("enstatite")
i2 <- info("enstatite", "cr2")
i3 <- info("enstatite", "cr3")
# (dP/dT) of transitions
dPdTtr(i1, i2)  # first transition
dPdTtr(i2, i3)  # second transition
# temperature of transitions (Ttr) as a function of P
Ttr(i1, i2, P=c(1,10,100,1000))
Ttr(i2, i3, P=c(1,10,100,1000))
# restore default database
OBIGT()

# calculate the GHS at Tr for the high-temperature phases of iron
# using transition enthalpies from the SUPCRT92 database (sprons92.dat)
Htr <- c(326.0, 215.0, 165.0)
iiron <- info("iron")
GHS_Tr(iiron, Htr)
# the results calculated above are stored in the database ...
info(1:3 + iiron)[, c("G", "H", "S")]
# ... meaning that we can recalculate the transition enthalpies using subcrt()
sapply(info(0:2 + iiron)$T, function(T) {
  # a very small T increment around the transition temperature
  T <- convert(c(T-0.01, T), "C")
  # use suppressMessages to make the output less crowded
  substuff <- suppressMessages(subcrt("iron", T=T, P=1))
  diff(substuff$out$iron$H)
})

## scale logarithms of activity
# suppose we have two proteins whose lengths are 100 and 
# 200; what are the logarithms of activity of the proteins 
# that are equal to each other and that give a total 
# activity of residues equal to unity?
logact <- c(-3,-3)  # could be any two equal numbers
length <- c(100,200)
logact.tot <- 0
loga <- unitize(logact,length,logact.tot)
# the proteins have equal activity
stopifnot(identical(loga[1],loga[2]))
# the sum of activity of the residues is unity
stopifnot(isTRUE(all.equal(sum(10^loga * length),1)))
## now, what if the activity of protein 2 is ten
## times that of protein 1?
logact <- c(-3,-2)
loga <- unitize(logact,length,logact.tot)
# the proteins have unequal activity
stopifnot(isTRUE(all.equal(loga[2]-loga[1],1)))
# but the activities of residues still add up to one
stopifnot(isTRUE(all.equal(sum(10^loga * length),1)))

CHNOSZ documentation built on July 7, 2020, 3 p.m.