Examples#
This gallery walks through every public feature of chemistrykit.md:
the Lennard-Jones fluid in reduced units (energy conservation, pressure,
and the radial distribution function g(r)); Morse/Buckingham/harmonic
bonded potentials and small bonded clusters; periodic boundaries; SHAKE
bond constraints; thermostats; and self-diffusion coefficients.
Each script in this gallery is self-contained and can be run directly with
python examples/md/<section>/<script>.py. Every script also carries an
RST module docstring as its title/description and uses # %% markers to
split narrative text from code, which is exactly what Sphinx-Gallery
renders into the pages below – the script is the source of truth for
what you see, not a copy of it.
Sections#
lj_fluid – Lennard-Jones fluid simulations: Rahman’s liquid argon g(r), a cross-check of the simulated speed distribution against
chemistrykit.statmech’s Maxwell-Boltzmann distribution, hard-sphere-like packing order, the Weeks-Chandler-Andersen repulsive reference fluid, Verlet’s integrator and neighbor list, and Einstein and Green-Kubo self-diffusion coefficients.pair_potentials – the Lennard-Jones potential, Morse vs. harmonic bond potentials and the classical vibration of a two-body
DiatomicOscillator, the Buckingham potential, and a small bonded molecule vibrating under coupled harmonic bond-stretch and angle-bend terms.periodic_boundaries – periodic boundary conditions and the minimum-image convention.
constraints – rigid bonds enforced with the SHAKE algorithm.
thermostats – Nose-Hoover, Berendsen weak-coupling, and stochastic velocity-rescaling temperature control.
Constraints#
Rigid bond-length constraints enforced with the SHAKE algorithm, removing fast bond vibrations from a molecular-dynamics trajectory.
SHAKE: rigid bonds let a bending molecule take larger time steps
Lennard-Jones fluid#
Simulations of the Lennard-Jones fluid: Rahman’s liquid argon, the Maxwell-Boltzmann speed distribution, hard-sphere-like packing order, the Weeks-Chandler-Andersen repulsive reference fluid, Verlet’s integrator and neighbor list, and self-diffusion from the Einstein mean-squared displacement and the Green-Kubo velocity autocorrelation.
Rahman’s liquid argon: g(r) of a Lennard-Jones liquid in real units
Cross-checking an MD trajectory against the Maxwell-Boltzmann distribution
Alder and Wainwright’s hard spheres: packing-driven order with no attraction
Weeks-Chandler-Andersen: repulsive forces set the structure of a dense liquid
Verlet’s integrator: bounded energy error instead of drift
Verlet’s neighbor list: a skin that lets one pair list serve many steps
Einstein’s diffusion law: mean-squared displacement grows linearly in time
Green-Kubo: the diffusion coefficient as the integral of the velocity autocorrelation
Pair potentials#
The Lennard-Jones 12-6 potential, Morse vs. harmonic bond potentials and the classical vibration of a two-body diatomic oscillator, the Buckingham exp-6 potential, and a small bonded molecule vibrating under coupled harmonic bond-stretch and angle-bend terms.
Morse vs. harmonic bond potentials, and diatomic bond vibration
A bent triatomic molecule: coupled bond-stretch and angle-bend vibrations
Buckingham vs. Lennard-Jones: exponential repulsion and its inner turnover
The Lennard-Jones 12-6 potential: repulsion, dispersion, and the minimum
Periodic boundaries#
Periodic boundary conditions and the minimum-image convention: how a small simulation box stands in for an effectively infinite bulk fluid.
Periodic boundary conditions and the minimum-image convention
Thermostats#
Temperature control for a Lennard-Jones fluid: the Nose-Hoover extended-system thermostat, Berendsen weak coupling, and Bussi-Donadio-Parrinello stochastic velocity rescaling.
The Nose-Hoover thermostat: a friction variable that steers the temperature
Berendsen’s weak coupling: exponential relaxation to the bath temperature
Bussi-Donadio-Parrinello: stochastic velocity rescaling samples the canonical ensemble