Single Molecule Gas Explorer

Live Script simulations of the adiabatic compression of a single classical molecule in a shrinking circular container.

You are now following this Submission

A standard topic in introductory thermodynamics is an adiabatic process with an ideal gas for which the pressure P and volume V are related by , with adiabatic index where f is the effective number of degrees of freedom per molecule. This relationship can be demonstrated with gas in a pipe with one end closed and the other end closed by a plunger. In compression, the work against the gas pressure is heats the gas so the temperature and pressure as the volume decreases.
This educational Live Script package simulates the adiabatic compression of a single classical monatomic, rigid diatomic, or flexible diatomic molecule in a shrinking circular container, measures the adiabatic index γ, and compares the results to the textbook predictions. The simulator records every wall collision, energy partition, and conserved quantity. Three Live Scripts (one per molecule type) compare the textbook γ to the fitted simulated value and examine the distributions of energy associated with each degree of freedom.
Each script simulates ensembles of up to 1000 initial conditions drawn from a microcanonical distribution (uniform on the constant-energy surface, with all initial conditions weighted equally). The adiabatic index γ is fit for each trajectory and the ensemble mean reported. In some cases the ensemble distribution of energy among degrees of freedom is also compared to the analytic microcanonical prediction (a Beta marginal of a Dirichlet distribution -- see Background information below and docs/BetaMarginalDistribution.md).
These Live Scripts build on an earlier educational script that explores a single atom gas in one dimension and is one of a series of educational Live Scripts available at the author's FEX page. Try this suggestions throughout each script invite parameter exploration. Challenges at the end propose extensions for student projects. Included in the package is the simulation code package, animations, documentation, and references.
This package can generate large sample and also animation files which are not included. The Live Script SingleMoleculeGasExplorer introduces the physics, the package, and how to generate the large samples and animations.

Cite As

Duncan Carlsmith (2026). Single Molecule Gas Explorer (https://au.mathworks.com/matlabcentral/fileexchange/183931-single-molecule-gas-explorer), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.1

Cosmetic improvements.

1.0.0