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.
1 2 3 4 5 6
numeric, object returned by
logical, drop elements with a coefficient of zero?
character, chemical formulas, or numeric, rownumbers in
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
i2A returns a stoichiometric matrix representing the elemental composition of the
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
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.
entropy return the sums of masses or entropies of elements in each of the
The masses are calculated using the masses of the elements in their natural isotopic distribution, and the entropies, in cal K^-1 mol^-1, are calculated using the entropies of the compounds of the pure elements in their stable states at 25 °C and 1 bar.
The properties of the elements used by this function are taken from
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.
S arguments must all have the same length.
The entropies of the elements (
Se) in each
formula are calculated using
The equation in effect can be written as delta_G = delta_H - T * delta_S, where delta_S = S - Se and T is the temperature given in
T (defaults to 298.15 K) (note that
H in the arguments correspond respectively to delta_G and delta_H in the equation).
For each formula, if one of
S is NA, its value is calculated from the other two.
Otherwise, the values are returned unchanged. Units of cal mol^-1 (
DH) and cal K^-1 mol^-1 (
S) are assumed.
ZC returns the average oxidation state of carbon (Z_C) calculated from ratios of the elements in the chemical
The equation used is
Z_C = (Z - nH + 2*(nO + nS) + 3*nN) / nC, where the n refer to the number of the indicated element in the formula (Dick and Shock, 2011).
The result 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.
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.
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. http://dx.doi.org/10.1371/journal.pone.0022782
makeup, used by
i2A for counting the elements in a formula (the latter two make use of the
run.wjd uses the stoichiometric matrices created by
protein.formula has an example of computing ZC for proteins compiled from the RefSeq database.
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
## 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)