Noninteracting Fermions in the Canonical Ensemble

free_fermi is a program which calculates thermodynamic properties of noninteracting fermions in the canonical ensemble, i.e. for fixed particle number.


Every statistical physics textbook specifies how to calculate thermodynamic quantities for noninteracting fermions in the grand canonical ensemble, i.e., in which particle-number fluctuations are allowed. The partition function is \( Z = \prod_r (1 + e^{-\beta (\epsilon_r - \mu)}) \), where the product is over all single-particle states, and the occupations are \( n_r = 1/(1 + e^{\beta (\epsilon_r - \mu)}) \). The thermodynamic functions (energy, free energy, etc.) can be then be easily obtained.

However, the grand-canonical ensemble is inappropriate for systems in which finite-size effects are important, such as nuclei, atoms, and metallic nanoparticles. In these systems, the canonical ensemble (of fixed particle number) should be used. In the canonical ensemble, however, calculating \( Z \), and hence the thermodynamic functions, is more involved, as \(Z\) and \(n_i\) do not reduce to such simple expressions.

The Fortran code free_fermi.f90 calculates thermodynamic functions for a collection of \(N\) noninteracting fermions in the canonical ensemble. It calculates:

It does so

The code and can easily be changed to support geometries/confining potentials other than an isotropic trap by changing the single-particle energies and degeneracies.

It has been tested by doing the calculations in two independent ways. First, free_fermi.f90 uses particle-number projection (via a Fourier transform) to calculate canonical-ensemble quantities. Second, an alternate code (in the altsrc directory on Github) uses arbitrary precision arithmetic and a set for recursive formulas based on the paper J. Chem. Phys. 98, 2484 (1993). The two codes give identical results.


Current version: free_fermi.f90

The Github repository can be found here, where test data and the recursion-relation version can also be found.

To Do

  1. Currently, the heat capacity is calculated using a numerical derivative. It would be preferrable to use the variance of the energy.