data(thermo)
## examples using convert
# temperature (Kelvin) to degrees C
convert(273.15, "C")
# temperature (degrees C) to Kelvin
convert(100, "K")
# Gibbs energy (cal mol-1) to/from logK
convert(1000, "logK")
convert(1000, "logK", T=373.15)
convert(1, "G")
# Eh (volt) to pe
convert(-1, "pe")
convert(-1, "pe", T=373.15)
# logfO2 to E0 (volt)
convert(-80, "E0")
convert(-80, "E0", pH=5)
convert(-80, "E0", pH=5, logaH2O=-5)
# calorie to/from joule
convert(10, "J")
convert(10, "cal")
# cm3bar to calories
convert(10, "calories")
## examples showing unit settings
T.units("C")
T1in <- envert(25, "C") # no convertion
T1out <- outvert(313.15, "K") # K to C
T.units("K")
T2in <- envert(298.15, "C") # K to C
T2out <- outvert(-233.15, "C") # C to K
# these are the same temperature (25 deg C)
stopifnot(all.equal(T1in, T2in))
# these are numerically equivalent (40 deg C / 40 K)
stopifnot(all.equal(T1out, T2out))
T.units("C") # return to default
Run the code above in your browser using DataLab