Learn R Programming

CHNOSZ (version 1.0.8)

util.misc: Functions for Miscellaneous Tasks

Description

Calculate $dP/dT$ and temperature of phase transitions, calculate heat capacities of unfolded proteins using an equation from the literature, calculate non-ideal contributions to apparent standard molal properties, identify a conserved basis species, scale logarithms of activity to a desired total activity, calculate Gibbs energy of transformation of a system.

Usage

dPdTtr(x) Ttr(x, P = 1, dPdT = NULL) which.balance(species) unitize(logact = NULL, length = NULL, logact.tot = 0)

Arguments

x
numeric index of a mineral phase (dPdTtr, Ttr)
P
numeric, pressure (bar)
dPdT
numeric, values of ($dP/dT$) of phase transitions (Ttr)
species
dataframe, species definition such as that in thermo$species
logact
numeric, logarithms of activity
length
numeric, numbers of residues
logact.tot
numeric, logarithm of total activity

Value

Numeric returns are made by dPdTtr, Ttr, spearman, mod.obigt Functions with no (or unspecified) returns are thermo.plot.new, thermo.postscript, label.plot and water.lines.

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 xth species in thermo$obigt (no checking is done to verify that the species represents in fact one phase of a mineral with phase transitions). 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 the xth species.

nonideal takes a list of dataframes (in proptable) containing the standard molal properties of the identified species. The function bypasses (leaves unchanged) properties of the proton (H+), electron (e-), and all species whose charge (determined by the number of Z in their makeup) is equal to zero. The values of IS are combined with Alberty's (2003) equation 3.6-1 (Debye-Huckel equation) and its derivatives, to calculate apparent molal properties at the specified ionic strength(s) and temperature(s). The lengths of IS and T supplied in the arguments should be equal to the number of rows of each dataframe in proptable, or one to use single values throughout. The apparent molal properties that can be calculated include G, H, S and Cp; any columns in the dataframes of proptable with other names are left untouched. A column named loggam (logarithm of gamma, the activity coefficient) is appended to the output dataframe of species properties.

which.balance returns, in order, which column(s) of species all have non-zero values. It is used by diagram and transfer to determine a conservant (i.e. basis species that are conserved in transformation reactions) if none is supplied by the user.

spearman calculates Spearman's rank correlation coefficient for a and b.

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.

References

Alberty, R. A. (2003) Thermodynamics of Biochemical Reactions, John Wiley & Sons, Hoboken, New Jersey, 397 p. http://www.worldcat.org/oclc/51242181

See Also

For some of the functions on which these utilities depend or were modeled, see paste, substr, tolower, par and text.

Examples

Run this code

## properties of phase transitions
si <- info("enstatite")
# (dP/dT) of transitions
dPdTtr(si)  # first transition
dPdTtr(si+1) # second transition
# temperature of transitions (Ttr) as a function of P
Ttr(si,P=c(1,10,100,1000))
Ttr(si,P=c(1,10,100,1000))

## 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)))

Run the code above in your browser using DataLab