Calculate thermodynamic properties using the revised Helgeson-Kirkham-Flowers (HKF) equations of state for aqueous species, or using a generic heat capacity equation for crystalline, gas, and liquid species.

1 2 3 4 5 |

`property` |
character, name(s) of properties to calculate |

`T` |
numeric, temperature(s) at which to calculate properties (K) |

`P` |
numeric, pressure(s) at which to calculate properties (bar) |

`ghs` |
dataframe, values of the standard molal Gibbs energy and enthalpy of formation from the elements and entropy at 25 |

`eos` |
dataframe, values of the equations-of-state parameters |

`contrib` |
character, which contributions to consider in the revised HKF equations equations of state: ( |

`H2O.PT` |
dataframe, values of the electrostatic properties of water at the temperature(s) and pressure(s) of interest |

`H2O.PrTr` |
dataframe, values of the electrostatic properties of water at the reference temperature and pressure |

`domega` |
logical, calculate the T and P derivatives of omega? |

`rhohat` |
numeric, density of water (g/cm3) |

`Tc` |
numeric, temperature ( |

`alpha` |
numeric, coefficient of isobaric expansivity (K^-1) |

`daldT` |
numeric, temperature derivative of coefficient of isobaric expansivity (K^-2) |

`beta` |
numeric, coefficient of isothermal compressibility (bar^-1) |

The equations of state permit the calculation of the standard molal properties of species as a function of temperature and pressure. For interactive use, `subcrt`

is usually more convenient than calling these functions directly.

The `property`

argument is required and refers to one or more of G, H, S, Cp and V, and for aqueous species only, kT and E. The units of these properties are the first ones shown in the description for `subcrt`

. The names of the properties are matched without regard to case.

The revised HKF equations of state (Helgeson et al., 1981; Tanger and Helgeson, 1988; Shock and Helgeson, 1988) are incorporated in `hkf`

. The equations-of-state parameters are `a1`

, `a2`

, `a3`

, `a4`

, `c1`

, `c2`

, `omega`

and `Z`

; the units of these parameters are as indicated for `thermo$obigt`

, *sans* the order of magnitude multipliers. Note that the equation-of-state parameter `Z`

(appearing in the *g*-function for the temperature derivatives of the omega parameter; Shock et al., 1992) is taken from `thermo$obigt`

and *not* from the `makeup`

of the species, although in most cases the two values are coincident. `H2O.PT`

and `H2O.PrTr`

are optional arguments that contain the electrostatic properties of *H2O* required for the calculations. If either of these is `NULL`

(the default), the required values are retrieved using `water`

.

Unless `domega`

, the value of which is recycled to the number of species (rows of ghs and eos), is FALSE for any of the species, the temperature and pressure derivatives of the `omega`

parameter for charged species (where `Z != 0`

) are calculated using the *g*- and *f*-functions described by Shock et al., 1992 and Johnson et al., 1992, and coded here in `gfun`

. This option is currently blocked when the IAPWS-95 equations are activated (see `water`

).

The parameters in the `cgl`

equations of state for crystalline, gas and liquid species (except liquid water) include `V`

, `a`

, `b`

, `c`

, `d`

, `e`

, `f`

and `lambda`

. The terms denoted by `a`

, `b`

and `c`

correspond to the Maier-Kelley equation for heat capacity (Maier and Kelley, 1932); the additional terms are useful for representing heat capacities of minerals (Robie and Hemingway, 1995) and gaseous or liquid organic species (Helgeson et al., 1998). The standard molal volumes (V) of species in these calculations are taken to be independent of temperature and pressure.

For both `hkf`

and `cgl`

, if at least one equations-of-state parameter for a species is provided, any NA values of the other parameters are reset to zero.
If all equations-of-state parameters are NA, but values of Cp and/or V are available, those values are used in the integration of G, H and S as a function of temperature.

The `T`

and `P`

arguments (and `rhohat`

, `Tc`

, `alpha`

, `daldT`

, `beta`

for `gfun`

) should all be the same length; the functions perform no argument validating.

A list of length equal to the number of species (i.e., number rows of supplied `ghs`

and `eos`

values). Each element of the list contains a dataframe, each column of which corresponds to one of the specified properties; the number of rows is equal to the number of pressure-temperature points.

The temperature and pressure range of validity of the revised HKF equations of state for aqueous species corresponds to the stability region of liquid water or the supercritical fluid at conditions between 0 to 1000 *°*C and 1 to 5000 bar (Tanger and Helgeson, 1988; Shock and Helgeson, 1988).
The `hkf`

function does not check these limits and will compute properties as long as the requisite electrostatic properties of water are available. There are conceptually no temperature limits (other than 0 Kelvin) for the validity of the `cgl`

equations of state.
However, the actual working upper temperature limits correspond to the temperatures of phase transitions of minerals or to those temperatures beyond which extrapolations from experimental data become highly uncertain.
These temperature limits are stored in the thermodynamic database for some minerals, but `cgl`

ignores them; however, `subcrt`

warns if they are exceeded.

Helgeson, H. C., Kirkham, D. H. and Flowers, G. C. (1981) Theoretical prediction of the thermodynamic behavior of aqueous electrolytes at high pressures and temperatures. IV. Calculation of activity coefficients, osmotic coefficients, and apparent molal and standard and relative partial molal properties to 600*°*C and 5 Kb. *Am. J. Sci.* **281**, 1249–1516. http://www.ajsonline.org/cgi/content/abstract/281/10/1249

Helgeson, H. C., Owens, C. E., Knox, A. M. and Richard, L. (1998) Calculation of the standard molal thermodynamic properties of crystalline, liquid, and gas organic molecules at high temperatures and pressures. *Geochim. Cosmochim. Acta* **62**, 985–1081. http://dx.doi.org/10.1016/S0016-7037(97)00219-6

Maier, C. G. and Kelley, K. K. (1932) An equation for the representation of high-temperature heat content data. *J. Am. Chem. Soc.* **54**, 3243–3246. http://dx.doi.org/10.1021/ja01347a029

Robie, R. A. and Hemingway, B. S. (1995) *Thermodynamic Properties of Minerals and Related Substances at 298.15 K and 1 Bar ( 10^5 Pascals) Pressure and at Higher Temperatures*. U. S. Geol. Surv., Bull. 2131, 461 p. http://www.worldcat.org/oclc/32590140

Shock, E. L. and Helgeson, H. C. (1988) Calculation of the thermodynamic and transport properties of aqueous species at high pressures and temperatures: Correlation algorithms for ionic species and equation of state predictions to 5 kb and 1000*°*C. *Geochim. Cosmochim. Acta* **52**, 2009–2036. http://dx.doi.org/10.1016/0016-7037(88)90181-0

Shock, E. L., Oelkers, E. H., Johnson, J. W., Sverjensky, D. A. and Helgeson, H. C. (1992) Calculation of the thermodynamic properties of aqueous species at high pressures and temperatures: Effective electrostatic radii, dissociation constants and standard partial molal properties to 1000 *°*C and 5 kbar. *J. Chem. Soc. Faraday Trans.* **88**, 803–826. http://dx.doi.org/10.1039/FT9928800803

Tanger, J. C. IV and Helgeson, H. C. (1988) Calculation of the thermodynamic and transport properties of aqueous species at high pressures and temperatures: Revised equations of state for the standard partial molal properties of ions and electrolytes. *Am. J. Sci.* **288**, 19–98. http://www.ajsonline.org/cgi/content/abstract/288/1/19

`info`

for retrieving equations of state parameters from the thermodynamic database, `water`

for equations of state of water, `subcrt`

for calculations that use these equations.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
## aqueous species
a <- info(info("methane","aq"))
hkf(property="Cp",ghs=a,eos=a)
# the non-solvation heat capacity
hkf(property="Cp",ghs=a,eos=a,contrib="n")
# at different temperature and pressure
hkf(property="Cp",ghs=a,eos=a,T=c(373.15,473.15),P=1000)
## crystalline, gas, liquid species
a <- info(info("methane","gas"))
cgl(property="Cp",ghs=a,eos=a)
# melting and vaporization of n-octane
a <- info(info(rep("n-octane",3),c("cr","liq","gas")))
b <- cgl(property="G",ghs=a,eos=a,T=seq(200,420,10),P=1)
which.pmax(b,pmin=TRUE) # 1 = cr, 2 = liq, 3 = gas
# compare that result with the tabulated transition temperatures
print(a)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.