ASE contains a ase.thermochemistry module that lets the user derive commonly desired thermodynamic quantities of molecules and crystalline solids from ASE output and some user-specified parameters. Three cases are currently handled by this module: the ideal-gas limit (in which translational and rotational degrees of freedom are taken into account), the harmonic limit (generally used for adsorbates, in which all degrees of freedom are treated harmonically), and a crystalline solid model (in which a lattice of N atoms is treated as a system of 3N independent harmonic oscillators). The first two cases rely on good vibrational energies being fed to the calculators, which can be calculated with the ase.vibrations module. Likewise, the crystalline solid model depends on an accurate phonon density of states; this is readily calculated using the ase.phonons module.
The thermodynamic quantities of ideal gases are calculated by assuming that all spatial degrees of freedom are independent and separable into translational, rotational, and vibrational degrees of freedom. The IdealGasThermo class supports calculation of enthalpy (\(H\)), entropy (\(S\)), and Gibbs free energy (\(G\)), and has the interface listed below.
Class for calculating thermodynamic properties of a molecule based on statistical mechanical treatments in the ideal gas approximation.
Inputs for enthalpy calculations:
Extra inputs needed for for entropy / free energy calculations:
Returns the enthalpy, in eV, in the ideal gas approximation at a specified temperature (K).
The IdealGasThermo class would generally be called after an energy optimization and a vibrational analysis. The user needs to supply certain parameters if the entropy or free energy are desired, such as the geometry and symmetry number. An example on the nitrogen molecule is:
from ase.structure import molecule
from ase.calculators.emt import EMT
from ase.optimize import QuasiNewton
from ase.vibrations import Vibrations
from ase.thermochemistry import IdealGasThermo
atoms = molecule('N2')
atoms.set_calculator(EMT())
dyn = QuasiNewton(atoms)
dyn.run(fmax=0.01)
electronicenergy = atoms.get_potential_energy()
vib = Vibrations(atoms)
vib.run()
vib_energies = vib.get_energies()
thermo = IdealGasThermo(vib_energies=vib_energies,
electronicenergy=electronicenergy,
atoms=atoms,
geometry='linear',
symmetrynumber=2, spin=0)
G = thermo.get_gibbs_energy(temperature=298.15, pressure=101325.)
This will give the thermodynamic summary output:
Enthalpy components at T = 298.15 K:
===============================
E_elec 0.263 eV
E_ZPE 0.076 eV
Cv_trans (0->T) 0.039 eV
Cv_rot (0->T) 0.026 eV
Cv_vib (0->T) 0.000 eV
(C_v -> C_p) 0.026 eV
-------------------------------
H 0.429 eV
===============================
Entropy components at T = 298.15 K and P = 101325.0 Pa:
=================================================
S T*S
S_trans (1 atm) 0.0015579 eV/K 0.464 eV
S_rot 0.0004101 eV/K 0.122 eV
S_elec 0.0000000 eV/K 0.000 eV
S_vib 0.0000016 eV/K 0.000 eV
S (1 atm -> P) -0.0000000 eV/K -0.000 eV
-------------------------------------------------
S 0.0019695 eV/K 0.587 eV
=================================================
Free energy components at T = 298.15 K and P = 101325.0 Pa:
=======================
H 0.429 eV
-T*S -0.587 eV
-----------------------
G -0.158 eV
=======================
In the harmonic limit, all degrees of freedom are treated harmonically. The HarmonicThermo class supports the calculation of internal energy, entropy, and Gibbs free energy. This class uses all of the energies given to it in the vib_energies list; this is a list as can be generated with the .get_energies() method of ase.vibrations.Vibrations, but the user should take care that all of these energies are real (non-imaginary). The class HarmonicThermo has the interface described below.
Class for calculating thermodynamic properties in the approximation that all degrees of freedom are treated harmonically. Often used for adsorbates.
Inputs:
Returns the entropy, in eV/K, in the harmonic approximation at a specified temperature (K).
In this model a crystalline solid is treated as a periodic system of independent harmonic oscillators. The CrystalThermo class supports the calculation of internal energy (\(U\)), entropy (\(S\)) and Helmholtz free energy (\(F\)), and has the interface listed below.
Class for calculating thermodynamic properties of a crystalline solid in the approximation that a lattice of N atoms behaves as a system of 3N independent harmonic oscillators.
Inputs:
Returns the entropy, in eV/K, of crystalline solid at a specified temperature (K).
The CrystalThermo class will generally be called after an energy optimization and a phonon vibrational analysis of the crystal. An example for bulk gold is:
from ase.lattice.spacegroup import crystal
from ase.calculators.emt import EMT
from ase.optimize import QuasiNewton
from ase.phonons import Phonons
from ase.thermochemistry import CrystalThermo
# Set up gold bulk and attach EMT calculator
a = 4.078
atoms = crystal('Au', (0.,0.,0.),
spacegroup = 225,
cellpar = [a, a, a, 90, 90, 90],
pbc = (1, 1, 1))
calc = EMT()
atoms.set_calculator(calc)
qn = QuasiNewton(atoms)
qn.run(fmax = 0.05)
electronicenergy = atoms.get_potential_energy()
# Phonon analysis
N = 5
ph = Phonons(atoms, calc, supercell=(N, N, N), delta=0.05)
ph.run()
ph.read(acoustic=True)
phonon_energies, phonon_DOS = ph.dos(kpts=(40, 40, 40), npts=3000,
delta=5e-4)
# Calculate the Helmholtz free energy
thermo = CrystalThermo(phonon_energies=phonon_energies,
phonon_DOS = phonon_DOS,
electronicenergy = electronicenergy,
formula_units = 4)
F = thermo.get_helmholtz_energy(temperature=298.15)
This will give the thermodynamic summary output:
Internal energy components at T = 298.15 K,
on a per-formula-unit basis:
===============================
E_elec 0.0022 eV
E_ZPE 0.0135 eV
E_phonon 0.0629 eV
-------------------------------
U 0.0786 eV
===============================
Entropy components at T = 298.15 K,
on a per-formula-unit basis:
=================================================
S T*S
-------------------------------------------------
S 0.0005316 eV/K 0.1585 eV
=================================================
Helmholtz free energy components at T = 298.15 K,
on a per-formula-unit basis:
=======================
U 0.0786 eV
-T*S -0.1585 eV
-----------------------
F -0.0799 eV
=======================
Ideal gas. The conversion of electronic structure calculations to thermodynamic properties in the ideal-gas limit is well documented; see, for example, Chapter 10 of Cramer, 2004. The key equations used in the IdealGasThermo class are summarized here.
C.J. Cramer. Essentials of Computational Chemistry, Second Edition. Wiley, 2004.
The ideal-gas enthalpy is calculated from extrapolation of the energy at 0 K to the relevant temperature (for an ideal gas, the enthalpy is not a function of pressure):
where the first two terms are the electronic energy and the zero-point energy, and the integral is over the constant-pressure heat capacity. The heat capacity is separable into translational, rotational, vibrational, and electronic parts (plus a term of \(k_\text{B}\) to switch from constant-volume to constant-pressure):
The translational heat capacity is 3/2 \(k_\text{B}\) for a 3-dimensional gas. The rotational heat capacity is 0 for a monatomic species, \(k_\text{B}\) for a linear molecule, and 3/2 \(k_\text{B}\) for a nonlinear molecule. In this module, the electronic component of the heat capacity is assumed to be 0. The vibrational heat capacity contains \(3N-6\) degrees of freedom for nonlinear molecules and \(3N-5\) degrees of freedom for linear molecules (where \(N\) is the number of atoms). The integrated form of the vibrational heat capacity is:
where \(\epsilon_i\) are the energies associated with the vibrational frequencies, \(\epsilon_i = h \omega_i\).
The ideal gas entropy can be calculated as a function of temperature and pressure as:
where the translational, rotational, electronic, and vibrational components are calculated as below. (Note that the translational component also includes components from the Stirling approximation, and that the vibrational degrees of freedom are enumerated the same as in the above.)
\(I_\text{A}\) through \(I_\text{C}\) are the three principle moments of inertia for a non-linear molecule. \(I\) is the degenerate moment of inertia for a linear molecule. \(\sigma\) is the symmetry number of the molecule.
The ideal-gas Gibbs free energy is then just calculated from the combination of the enthalpy and entropy:
Harmonic limit. The conversion of electronic structure calculation information into thermodynamic properties is less established for adsorbates. However, the simplest approach often taken is to treat all \(3N\) degrees of freedom of the adsorbate harmonically since the adsorbate often has no real translational or rotational degrees of freedom. This is the approach implemented in the HarmonicThermo class. Thus, the internal energy and entropy of the adsorbate are calculated as
and the Gibbs free energy is calculated as
In this case, the number of harmonic energies (\(\epsilon_i\)) used in the summation is generally \(3N\), where \(N\) is the number of atoms in the adsorbate.
Crystalline solid
The derivation of the partition function for a crystalline solid is fairly straight-forward and can be found, for example, in Chapter 11 of McQuarrie, 2000.
D.A. McQuarrie. Statistical Mechanics. University Science Books, 2000.
The treatment implemented in the CrystalThermo class depends on introducing normal coordinates to the entire crystal and treating each atom in the lattice as an independent harmonic oscillator. This yields the partition function
where \(\omega_j\) are the \(3N\) vibrational frequencies, \(E_\text{elec}\) is the electronic energy of the crystalline solid, and \(\beta = \frac{1}{k_\text{B} T}\). Now, taking the logarithm of the partition function and replacing the resulting sum with an integral (assuming that the energy level spacing is essentially continuous) gives
Here \(\sigma (\omega)\) represents the degeneracy or phonon density of states as a function of vibrational frequency. Once this function has been determined (i.e. using the ase.phonons module), it is a simple matter to calculate the canonical ensemble thermodynamic quantities; namely the internal energy, the entropy and the Helmholtz free energy.