Calculate the standard molal entropy of elements in a compound; calculate the standard molal Gibbs energy or enthalpy of formation, or standard molal entropy, from the other two; list coefficients of selected elements in a chemical formula; calculate the average oxidation state of carbon. Create a stoichiometric matrix for selected species.
as.chemical.formula(makeup, drop.zero = TRUE)
mass(formula)
entropy(formula)
GHS(formula, G = NA, H = NA, S = NA, T = 298.15)
ZC(formula)
i2A(formula)
numeric, object returned by makeup
logical, drop elements with a coefficient of zero?
character, chemical formulas, or numeric, rownumbers in thermo$obigt
numeric, standard molal Gibbs energy of formation from the elements
numeric, standard molal enthalpy of formation from the elements
numeric, standard molal molal entropy
numeric, temperature in Kelvin
mass
, entropy
, and ZC
return numeric values.
as.chemical.formula
returns a character object.
GHS
returns a matrix with column names G, H and S, and i2A
returns a matrix with column names corresponding to the elements in the formulas.
i2A
returns a stoichiometric matrix representing the elemental composition of the formula
s.
Each column corresponds to an element that is present in at least one of the formulas; some element counts will be zero if not all formula have the same elements.
If a matrix is passed to i2A
it is returned unchanged.
as.chemical.formula
makes a character string representing a chemical formula from a vector of coefficients with names corresponding to the elements (e.g., the output of makeup
) or from a stoichiometric matrix (output of i2A
).
Each elemental symbol is written followed by its coefficient; negative coefficients are signed.
Any coefficients equal to 1 are not explicitly written, and any charge (indicated by makeup
as Z) is shown as a signed number at the end of the formula.
If the formula is uncharged, and the last element has a negative coefficient, +0 is shown at the end of the formula to indicate a charge of zero.
The remaining functions documented here accept vectors of chemical formulas, species indices, or a mixture of both, or stoichiometric matrices with elements on the columns.
mass
and entropy
return the sums of masses or entropies of elements in each of the formula
s.
The masses are calculated using the masses of the elements in their natural isotopic distribution, and the entropies, in cal Kthermo$element
.
GHS
computes one of the standard molal Gibbs energy or enthalpy of formation from the elements, or standard molal entropy, from values of the other two.
The formula
, G
, H
and S
arguments must all have the same length.
The entropies of the elements (Se
) in each formula
are calculated using entropy
.
The equation in effect can be written as T
(defaults to 298.15 K) (note that G
and H
in the arguments correspond respectively to G
, H
, or S
is NA, its value is calculated from the other two.
Otherwise, the values are returned unchanged. Units of cal molDG
, DH
) and cal KS
) are assumed.
ZC
returns the average oxidation state of carbon (formula
s.
The equation used is
NaN
for any formula that does not contain carbon. Elements other than those shown in the equation are not included in the calculation, and produce a warning.
Dick, J. M. and Shock, E. L. (2011) Calculation of the relative chemical stabilities of proteins as a function of temperature and redox chemistry in a hot spring. PLoS ONE 6, e22782. https://doi.org/10.1371/journal.pone.0022782
makeup
, used by mass
and entropy
, and ZC
and i2A
for counting the elements in a formula (the latter two make use of the count.zero
argument).
run.wjd
uses the stoichiometric matrices created by i2A
.
protein.formula
has an example of computing ZC for proteins compiled from the RefSeq database.
# NOT RUN {
## mass and entropy from chemical formulas
mass("H2O")
entropy("H2O")
mass("-1") # electron
entropy("-1")
## different ways to get the formula of alanine
iA <- info("alanine")
info(iA)$formula
as.chemical.formula(makeup(iA))
## converting among Gibbs energy, enthalpy, entropy
# calculate the value of G from H and S
GHS("H2O", H=water("H"), S=water("S"))[1, ]
# that not quite equal to the value from water("G");
# probably using different entropies of the elements
## average oxidation states of carbon
stopifnot(ZC("CO2") == 4)
stopifnot(ZC("CH4") == -4)
stopifnot(ZC("CHNOSZ") == 7)
si <- info(info("LYSC_CHICK"))
stopifnot(si$formula == "C613H959N193O185S10")
stopifnot(all.equal(ZC(si$formula), 0.0163132137031))
## calculate the chemical formulas, then
## ZC of all of the proteins in CHNOSZ' database
pf <- protein.formula(thermo$protein)
range(mass(pf))
# use na.rm=TRUE because we have a "protein" with a formula of H2O
range(ZC(pf), na.rm=TRUE)
# }
Run the code above in your browser using DataLab