The classes described below calculate the thermodynamic properties of interacting and non-interacting quantum and classical particles.

Particles contents

Particle data classes

The class o2scl::part_tl is the basic structure for a particle. The classes with a _tl suffix are templates which can handle a variety of floating point types. Typedefs without a _tl suffix specialize these templates for the floating point type double.

The data members o2scl::part_tl::ms and o2scl::part_tl::nu allow one to specify modifications to the mass and the chemical potential due to interactions. This allows one to calculate the properties of particle due to interactions so long as the basic form of the free-particle dispersion relation is unchanged, i.e.

\[\sqrt{k^2+m^2} - \mu \rightarrow \sqrt{k^2+m^{* 2}} - \nu\]

If the particle is non-interacting, then o2scl::part_tl::nu and o2scl::part_tl::ms are sometimes used by O₂scl_part functions for temporary storage.

If o2scl::part_tl::inc_rest_mass is c true (this is the default in all of the classes except o2scl::nucleus), then all functions include the rest mass (stored in o2scl::part_tl::m) energy density in the energy density, the “mu” functions expect that the rest mass is included in o2scl::part_tl::mu or o2scl::part_tl::nu as input and the “density” functions output o2scl::part_tl::mu or o2scl::part_tl::nu including the rest mass. Note that it is assumed that o2scl::part_tl::m contains the rest mass even if the particle is interacting and an effective mass is stored in o2scl::part_tl::ms.

When o2scl::part_tl::inc_rest_mass is true, antiparticles are implemented by choosing the antiparticle chemical potential to be \(- \mu\). When o2scl::part_tl::inc_rest_mass is false, there is an ambiguity in the relative definitions of the rest mass contribution for the antiparticles and the combination of both particles and antiparticles. Define energy density for particles including the rest mass contribution as \(\varepsilon_+\), and the energy density without the rest mass contribution as \(\tilde{\varepsilon}_{+} = \varepsilon_{+} - n_{+} m\) . Similarly, for antiparticles, we have \(\tilde{\varepsilon}_- = \varepsilon_- - n_- m\). The total energy density including the rest mass contribution is then \(\varepsilon = \varepsilon_{+} + \varepsilon_-\) and without the rest mass contribution \(\tilde{\varepsilon} \equiv \varepsilon - (n_{+}-n_-) m\). Then,

\[\begin{split}\begin{eqnarray} \tilde{\varepsilon} & = & \varepsilon_+ - n_{+} m + \varepsilon_- + n_- m \nonumber \\ & = & \varepsilon_+ - n_{+} m + \varepsilon_- - n_- m + 2 n_- m \nonumber \\ & = & \tilde{\varepsilon}_+ + \tilde{\varepsilon}_- + 2 n_- m \nonumber \end{eqnarray}\end{split}\]

Similarly, for the chemical potentials, we have

\[\tilde{\mu}_+ \equiv \frac{\partial \tilde{\varepsilon}_+} {\partial n_+} = \mu_+ - m \quad \mathrm{and} \quad \tilde{\mu}_- \equiv \frac{\partial \tilde{\varepsilon}_-} {\partial n_-} = \mu_- - m\]

thus \(\tilde{\mu}_- = - \tilde{\mu}_+ - 2 m\) . This bookkeeping is handled by o2scl::part_tl::anti(), the o2scl::fermion_thermo_tl::pair_mu(), and the o2scl::fermion_thermo_tl::pair_density(), functions.

The thermodynamic identity used to compute the pressure for interacting particles is

\[P = -\varepsilon + s T + \nu n\]

where o2scl::part_tl::nu is used. This way, the particle class doesn’t need to know about the structure of the interactions to ensure that the thermodynamic identity is satisfied. Note that in the O₂scl_eos library, where in the equations of state the normal thermodynamic identity is used

\[P = -\varepsilon + s T + \mu n\]

Frequently, the interactions which create an effective chemical potential which is different than o2scl::part_tl::mu thus create extra terms in the pressure and the energy density for the given equation of state.

The o2scl::fermion_tl class is a child of o2scl::part_tl which contains data members for the Fermi momentum and energy gap. The o2scl::boson class contains an extra data member for the condensate. The o2scl::quark class is a descendant of the o2scl::fermion_tl class which contains extra data members for the quark condensate and the contribution to the bag constant. Nuclei are represented by the o2scl::nucleus class and documented in nuclei_section.


Factors of \(\hbar, c\) and \(k_B\) have been removed everywhere, so that mass, energy, and temperature all have the same units. Number and entropy densities have units of mass cubed (or energy cubed). The particle classes can be used with any system of units which is based on powers of one unit, i.e. \([n] = [T]^3 = [m]^3 = [P]^{3/4} = [\varepsilon]^{3/4}\), etc. For O₂scl EOS classes, powers of \(\mathrm{fm}^{-1}\) are often chosen.

Classes for particle thermodynamics

At zero temperature, the thermodynamic properties of fermions can be computed using o2scl::fermion_zerot_tl. The class o2scl::classical_thermo_tl computes the properties of particles in the classical limit.

At finite temperature, there are different classes corresponding to different approaches to computing the integrals over the distribution functions. The approximation scheme from [Johns96] is used in o2scl::boson_eff and o2scl::fermion_eff. An exact method employing direct integration of the distribution functions is used in o2scl::boson_rel and o2scl::fermion_rel_tl, but these are necessarily quite a bit slower. All of these classes use expansions to give ensure comparably accurate results in the degenerate and non-degenerate limits.

The class o2scl::fermion_eff usually works to within about 1 part in \(10^4\), but can be as bad as 1 part in \(10^2\) in some more extreme cases. The default settings for o2scl::fermion_rel_tl give an accuracy of at least 1 part in \(10^6\) (and frequently better than this). For o2scl::fermion_rel_tl, the accuracy can be improved to 1 part in \(10^{10}\) by decreasing the integration tolerances.

See Fermion Details for more discussion on the fermion integrals.

The class o2scl::fermion_nonrel_tl assumes a non-relativistic dispersion relation for fermions. It uses an exact method for both zero and finite temperatures. The non-relativistic integrands are much simpler and o2scl::fermion_nonrel_tl uses the appropriate GSL functions (which are nearly exact) to compute them.

Thermodynamics with derivatives

Sometimes it is useful to know derivatives like \(ds/dT\) in addition to the energy and pressure. The class o2scl::part_deriv_press_tl stores the three derivatives which correspond to second derivatives of the pressure

\[\left(\frac{\partial n}{\partial \mu}\right)_{T}, \quad \left(\frac{\partial n}{\partial T}\right)_{\mu}, \quad \mathrm{and} \quad \left(\frac{\partial s}{\partial T}\right)_{\mu} \quad .\]

All other first derivatives of the thermodynamic functions can be written in terms of these three.

The new data classes are o2scl::part_deriv_tl and o2scl::fermion_deriv_tl which store the basic particle thermodynamics described above with these additional three derivatives.

There are three classes which compute these derivatives for fermions and classical particles. The class o2scl::classical_deriv_thermo_tl handles the nondegenerate limit, o2scl::fermion_deriv_rel_tl handles fermions and o2scl::fermion_deriv_nr_tl handles nonrelativistic fermions. The class o2scl::fermion_deriv_thermo_tl is a base class for o2scl::fermion_deriv_rel_tl and uses degenerate and nondegenerate expansions to evaluate both the base thermodynamic quantities and the three derivatives from o2scl::part_deriv_press_tl .

The function o2scl::part_deriv_tl::deriv_f() computes the derivatives which are second derivatives of the free energy from the three computed above.

Other derivatives

For the derivative of the entropy with respect to the chemical potential, there is a Maxwell relation

\[\left(\frac{\partial s}{\partial \mu}\right)_{T,V} = \left(\frac{\partial^2 P}{\partial \mu \partial T}\right)_{V} = \left(\frac{\partial^2 P}{\partial T \partial \mu}\right)_{V} = \left(\frac{\partial n}{\partial T}\right)_{\mu,V}\]

The first derivatives of the energy density can be computed using the thermodynamic identity:

\[\left(\frac{\partial \varepsilon}{\partial \mu}\right)_{T,V}= \mu \left(\frac{\partial n}{\partial \mu}\right)_{T,V}+ T \left(\frac{\partial s}{\partial \mu}\right)_{T,V}\]
\[\left(\frac{\partial \varepsilon}{\partial T}\right)_{\mu,V}= \mu \left(\frac{\partial n}{\partial T}\right)_{\mu,V}+ T \left(\frac{\partial s}{\partial T}\right)_{\mu,V}\]

Most of the other common derivatives which are used are those which can be obtained by second derivatives of the Gibbs free energy, \(G = F + P V\).

\[\begin{split}\begin{eqnarray} \left(\frac{\partial^2 G}{\partial T^2}\right)_{P,\{N_i\}} &=& -\left( \frac{\partial S}{\partial T} \right)_{P,\{N_i\}} = - \frac{N c_P}{T} \nonumber \\ \left(\frac{\partial^2 G}{\partial T \partial P}\right)_{\{N_i\}} &=& \left( \frac{\partial V}{\partial T} \right)_{P,\{N_i\}} = V \alpha \nonumber \\ \left(\frac{\partial^2 G}{\partial P^2}\right)_{T,\{N_i\}} &=& \left( \frac{\partial V}{\partial P} \right)_{T,\{N_i\}} = - V \kappa_T \nonumber \end{eqnarray}\end{split}\]

Other common derivatives are the heat capacity per particle at constant volume, \(c_V\), and the speed of sound, \(( d P / d \varepsilon)_{\{N_i\},S}\). These derivatives are computed by functions in o2scl::deriv_thermo_base_tl from the three second derivatives of the pressure stored in a o2scl::part_deriv_tl or o2scl::fermion_deriv_tl object.

Particle example