data(thermo)
## converting among Gibbs, enthalpy, entropy
GHS("H") # entropy of H (element)
# calculate enthalpy of formation of arsenopyrite
GHS("FeAsS",DG=-33843,S=68.5)
# return the value of DG calculated from DH and S
# cf. -56687.71 from subcrt("water")
GHS("H2O",DH=-68316.76,S=16.7123)
## mass and entropy of compounds of elements
element("CH4")
element(c("CH4","H2O"),"mass")
element("Z") # charge
# same mass, opposite entropy as charge
element("Z-1") # i.e., electron
## count selected elements in a formula
t <- makeup("H2O")
expand.formula(c("H","O"),t)
expand.formula(c("C","H","S"),t)
## nominal carbon oxidation states
ZC("CHNOSZ")
t <- info(info("LYSC_CHICK"))
ZC(t$formula)
## calculate the average chemical formula of all of
## the proteins in CHNOSZ' database
## this is much faster than a for-loop
pf <- protein.formula(thermo$protein)
colSums(pf)/nrow(pf)
Run the code above in your browser using DataLab