Methane–Nitrogen Mixing at the Molecular Scale: LJ Molecular Dynamics with LAMMPS

Simulation Engine: LAMMPS

Team SimuXAI (All rights reserved)

Team SimuXAI (All rights reserved) / SimuXAI Blog

support@simuxai.com

Introduction

Methane in nitrogen is one of the most economically important gas mixtures on Earth. Natural gas wells routinely produce CH₄ contaminated with N₂ at concentrations that push the fuel below pipeline heating-value specifications; upstream processors spend billions each year on nitrogen rejection units, and the design of those units depends on how the two gases mix, separate, and diffuse under high pressure. On the cryogenic side, the boiling points of CH₄ (111 K) and N₂ (77 K) differ by only 34 K, so the same mixture is the working system for LNG production and for many air-separation cascades. Understanding how these two species interpenetrate at the molecular scale — how fast, in which regime, and under what thermal driving force — is a materials-science question dressed up as an engineering one.

Molecular dynamics is uniquely suited to answering it. Below the continuum limit (roughly < 100 nm channels or < 10 ns timescales) Fick's law starts to fray, and any predictive statement about diffusion coefficients, thermal separation, or interfacial thickness must come from an atomistic simulation. This post walks through the physics of CH₄–N₂ mixing and shows how a compact Lennard-Jones LAMMPS setup can capture density profiles, temperature gradients, and transport signatures across a non-isothermal binary interface.

Self-diffusion ≠ mutual diffusion – The rate at which a labelled CH₄ molecule wanders through a bath of identical CH₄ molecules (self-diffusion, D<sub>s</sub>) is a different quantity from the rate at which CH₄ smears into a body of N₂ (mutual, or interdiffusion, D<sub>AB</sub>). Only the latter has an interface. Mixing them up is one of the classic beginner MD errors.


1 Fundamental Physics

AspectWhy It Matters
Pair potential (LJ 12-6)Captures short-range repulsion and dispersion attraction between non-polar / weakly-polar species. Two parameters per pair: ε (well depth) and σ (collision diameter).
Mixing rulesCross-species parameters (ε<sub>AB</sub>, σ<sub>AB</sub>) are inferred from pure-component values via Lorentz–Berthelot: σ<sub>AB</sub> = (σ<sub>A</sub><sub>B</sub>)/2, ε<sub>AB</sub> = √(ε<sub>A</sub>ε<sub>B</sub>). Small deviations from this ideal-mixing assumption drive real thermodynamic non-ideality.
Mutual diffusion coefficient (D<sub>AB</sub>)Governs how fast a compositional gradient decays. Obeys Fick's law only in the ideal, isothermal limit; deviates when concentration is large or a temperature gradient co-exists.
Soret effectNon-isothermal binaries develop a steady-state composition gradient even without an imposed concentration gradient. Light species drift toward the hot side; heavy species toward the cold. Quantified by the Soret coefficient S<sub>T</sub>.
Onsager reciprocityMass and heat fluxes are coupled: ∇T drives a mass flux and ∇c drives a heat flux with symmetric off-diagonal transport coefficients (L<sub>12</sub> = L<sub>21</sub>). Essential for thermodiffusion.

The Lennard-Jones potential itself is deceptively simple:

$$U_\text{LJ}(r) = 4\varepsilon\left[\left(\frac{\sigma}{r}\right)^{12} - \left(\frac{\sigma}{r}\right)^{6}\right]$$

For methane, the united-atom parameters commonly used are ε/k<sub>B</sub> ≈ 148 K and σ ≈ 3.73 Å. For diatomic nitrogen (two-site model), ε/k<sub>B</sub> ≈ 36 K per site, σ ≈ 3.31 Å with a bond length of 1.10 Å. The 12–6 form is not fundamental — it is a computationally convenient approximation to the true intermolecular potential — but for these two small, weakly-polar molecules it reproduces vapour–liquid equilibria, viscosity, and diffusion coefficients to within a few percent of experiment.


2 Why Modeling Diffusion Is Hard

  1. Timescale gap – Real diffusion coefficients are ~10⁻⁵ cm²/s. Traversing a 10 nm interface takes ~1 ns in MD, ~100 μs in experiment. The atomistic run is fine; extrapolating to macroscopic timescales requires care.
  2. Finite-size effects – Yeh–Hummer corrections show that D<sub>MD</sub> systematically under-predicts D<sub></sub> by O(k<sub>B</sub>T/(6πηL)). Box sides < 5 nm can be 10–20% off.
  3. Cutoff artefacts – Truncating the LJ potential at r<sub>c</sub> without a tail correction shifts pressure, phase boundaries, and interfacial tension. Use pair_modify tail yes or explicit long-range dispersion when accuracy matters.
  4. Thermostat coupling – Applying a global Berendsen or Langevin thermostat to a mixture with two nominal temperatures homogenises them within tens of picoseconds. If you want a steady thermal gradient, thermostat each species (or each spatial region) separately.
  5. Interface definition – The instantaneous interface between two miscible gases fluctuates at the ~1 nm scale. Averaging density over 100+ ps and 20+ chunks along the mixing axis is standard.

3 MD Workflow in LAMMPS

3.1 Choose an Appropriate Force Field

ModelStyleBest For
United-atom LJ (TraPPE-UA)pair_style lj/cutFast, physically accurate for small alkanes and diatomics. Ideal for mixing studies.
All-atom LJ + Coulomb (OPLS-AA)pair_style lj/cut/coul/long + kspace_style pppmExplicit hydrogens on CH₄; needed when polarisation or bond dynamics matters.
Ab initio–derived (SNAP, GAP)pair_style snapReference-quality energies; expensive.
ReaxFFpair_style reaxffIf you also care about combustion or dissociation.

For pure mixing at ambient conditions the united-atom LJ (or the two-site N₂ model) is the correct choice. All-atom + Coulomb (lj/cut/coul/long with PPPM electrostatics) becomes necessary only when explicit hydrogens or polarisation effects matter — for most transport-property studies the united-atom flavour is faster and equally accurate.

3.2 Build the Initial Configuration

  1. Two-region initial condition – place CH₄ molecules in one slab (say 0 < x < 100 Å) and N₂ in the adjacent slab (100 < x < 200 Å). LAMMPS region ... block + create_atoms + delete_atoms porosity is the most compact way; packmol is friendlier for larger systems.
  2. Charge neutrality – if using lj/cut/coul/long, verify each molecule's partial charges sum to zero.
  3. Minimise before dynamics – always: 200 steps of conjugate-gradient prevents blow-ups from overlapping placements.

3.3 Assign Ensembles and Boundary Conditions

  • Equilibrationfix press/berendsen iso 20.0 20.0 1000.0 at target pressure, plus per-species temp/berendsen at the target temperatures. Do NOT couple pressure and temperature with a single Nose–Hoover chain at this stage; species-specific thermostats let you hold hot CH₄ and cold N₂ simultaneously without artificially equilibrating them.
  • Production – switch to fix nvt temp <T> <T> 100 per species. Berendsen is a rescaling thermostat and generates wrong canonical distributions; NVT (Nose–Hoover) is correct for equilibrium sampling.
  • Periodic boundaries – full 3D periodicity is standard. If the interface is normal to x, ensure the box is long enough in x that the interfacial region and both bulk reservoirs are well-separated (typically ≥ 5σ each).

4 Sample Applications

#ScenarioKey PhysicsTypical Output
1Nitrogen rejection in natural gasHigh-pressure mutual diffusion, non-ideal mixing at ~50 barD<sub>AB</sub>(P, T), mixing entropy
2LNG loading tankCold N₂ blanket over cryogenic CH₄, stratificationVertical composition profile, boil-off rate
3Combustion premixingHot CH₄ jet into ambient N₂/air, fast turbulent mixingSpecies mass fraction, ignition delay
4Atmospheric methane plumesBuoyant CH₄ rise, Soret separation across stratosphereConcentration decay, isotopic fractionation
5Membrane separationDiffusion of CH₄ vs N₂ through a polymer or MOF slabSelectivity α = D<sub>CH₄</sub>/D<sub>N₂</sub>
6Non-isothermal binary (this post)Coupled thermal + mass diffusion across a hot-cold interfaceρ(x), T(x), S<sub>T</sub>

5 See It In Motion

The animation below shows a slab of methane (hot, 400 K) meeting a slab of nitrogen (cold, 300 K) at 20 bar. Watch the interface widen as mutual diffusion carries CH₄ molecules into the N₂ bath, while species-specific thermostats hold each reservoir at its target temperature so a persistent thermal gradient develops across the mixing zone.

The subtle asymmetry in the mixing front — CH₄ advances slightly faster into the cold N₂ than the reverse — is the fingerprint of the Soret effect predicted by the Onsager coupling in Section 1.


6 Common Pitfalls & Remedies

  1. Both species drift to the same temperature within picoseconds – you accidentally used a global thermostat. Split into per-group Nose–Hoover chains (fix nvt temp per group).
  2. Pressure ratchets up during equilibration – Berendsen barostat time constant too small; increase to ≥ 1000 fs and lengthen the equilibration run.
  3. Density profile looks like a straight line right from step 1 – the initial condition is already mixed. Check that your CH₄ and N₂ groups were placed in disjoint x-regions and that delete_atoms overlap didn't blend them.
  4. PPPM warnings about slab geometry – if you have vacuum in z, add kspace_modify slab 3.0 or switch to 2D-Ewald.
  5. D<sub>AB</sub> disagrees with experiment by 30% – check the Yeh–Hummer finite-size correction and box size, then verify your force-field parameters (TraPPE-UA methane ≠ OPLS-AA methane).

Stay Connected

Questions? Email support@simuxai.com or join our community forum.

Happy Simulating!