This tutorial demonstrates how to use example codes in the libstatmech distribution examples/ directory.

Example 1: Create a fermion and print out its data.

The example code is create_fermion.c

To run create_fermion, type the following on the command line:


./create_fermion electron 0.511 2 -1 > ex1_output.txt

The result is ex1_output.txt

Example 2: Compute the chemical potential for an increasing degree of accuracy.

The example code is fermion_accuracy.c

To run fermion_accuracy, type the following on the command line:


./fermion_accuracy electron 0.511 2 -1 1.e6 1.e32 > ex2_output.txt

The result is ex2_output.txt

Example 3: Create a fermion and print out the pressure integrand as a function of the dimensionless energy using the default integrand and a user-supplied one for the input temperature and mu/kT.

The example code is pressure_integrand.c

To run pressure_integrand, type the following on the command line:


./pressure_integrand electron 0.511 2 -1 1.e7 25. > ex3_output.txt

The result is ex3_output.txt

Example 4: Create a fermion gas and print out the thermodynamics quantities using the default integrands and user-supplied ones for the input temperature and number density.

The example code is thermodynamic.c

To run thermodynamic, type the following on the command line:


./thermodynamic electron 0.511 2 -1 1.e7 1.e25 > ex4_output.txt

The result is ex4_output.txt

Example 5: Create a fermion gas and print out the temperature derivatives of thermodynamics quantities as well as the heat capacity using the default integrands for the input temperature and number density.

The example code is fermion_derivatives.c

To run fermion_derivatives, type the following on the command line:


./fermion_derivatives electron 0.511 2 -1 1.e7 1.e25 > ex5_output.txt

The result is ex5_output.txt

Example 6: Compute the heat capacity of a fermion gas as a function of density.

The example code is heat_capacity_vs_rho.c

To run heat_capacity_vs_rho, type the following on the command line:


./heat_capacity_vs_rho electron 0.511 2 -1 1.e7 0.5 > ex6_output.txt

The result is ex6_output.txt

Example 7: Compute the number density of electrons in a Yukawa potential.

The example code is thomas_fermi.c

To run thomas_fermi, type the following on the command line:


./thomas_fermi 2000. 1 2. 1. > ex7_output.txt

The result is ex7_output.txt

Example 8: Create a boson and print out its data.

The example code is create_boson.c

To run create_boson, type the following on the command line:


./create_boson boson 1. 3 -1 > ex8_output.txt

The result is ex8_output.txt

Example 9: Create a boson gas and print out the thermodynamics quantities using supplied functions for ground state properties and the default integrands for the input temperature and number density.

The example code is boson_function.c

To run boson_function, type the following on the command line:


./boson_function boson 1. 3 -1 1.e7 1.e25 > ex9_output.txt

The result is ex9_output.txt

Example 10: Create a boson gas and print out the temperature derivatives of thermodynamics quantities as well as the heat capacity using the default integrands for the input temperature and number density.

The example code is boson_derivatives.c

To run boson_derivatives, type the following on the command line:


./boson_derivatives boson 1. 3 -1 1.e7 1.e25 > ex10_output.txt

The result is ex10_output.txt

Example 11: Create a photon gas and print out the thermodynamics quantities using the default integrands and user-supplied ones for the input temperature.

The example code is photons.c

To run photons, type the following on the command line:


./photons 1.e3 > ex11_output.txt

The result is ex11_output.txt

Example 12: Create a boson gas and print out thermodynamic quantities at a series of temperatures for the input number of particles to show the Bose-Einstein condensate at low temperatures.

The example code is bec_n.c

To run bec_n, type the following on the command line:


./bec_n boson 1. 3 -1 1.e25 > ex12_output.txt

The result is ex12_output.txt

Example 13: Create a boson gas and print out thermodynamic quantities at a series of number densities for the input temperature to show the Bose-Einstein condensate at high number densities.

The example code is bec_T.c

To run bec_T, type the following on the command line:


./bec_T boson 1. 3 -1 1.e7 > ex13_output.txt

The result is ex13_output.txt