lmmolecule guide

lmmolecule embeds OpenMM 8.2.0 behind a deterministic LMScript schema so molecular dynamics simulations, custom Lepton potentials, and structural analyses run as self-contained scripts without Python or external force-field databases.

Overview

An lmmolecule program builds a physical model through the global md context in three stages: configure the execution platform (Reference double precision or SIMD CPU), assemble particles and forces on a System object, and instantiate a Sim context to minimize energy, integrate trajectories, and sample observables.

Unit conventions

Every method in lmmolecule uses OpenMM's coherent molecular dynamics unit system:

Building lattices, gases, and rigid water

System provides built-in geometry generators for common condensed-matter benchmarks as well as file loaders:

let sys = md.system()
  .water_box("tip3p", 6, 0.31, 42)
  .coulomb("pme", 0.9)
  .dispersion_correction(true);

Forces and custom Lepton potentials

Standard bonded and nonbonded interactions are configured directly on System with bond, angle, torsion, constrain, lj, lj_particle, charge, coulomb, dielectric, dispersion_correction, and exclude. When analytic potentials outside standard harmonic or Lennard-Jones 12-6 forms are needed, OpenMM's embedded Lepton compiler evaluates custom energy expressions:

Before optimization, lmmolecule validates every Lepton expression tree and rejects non-finite constant sub-expressions (such as 1/0 or sqrt(-1)).

Integrators, thermostats, barostats, and reproducibility

Call sys.sim(integrator, dt, temp_K, friction, seed) to compile the system into an OpenMM Context:

By default, lmmolecule runs on OpenMM's double-precision Reference platform. Calling md.platform("cpu") switches subsequent simulations to the SIMD CPU platform with DeterministicForces enabled; md.threads(1) keeps single-thread CPU runs byte-identical across reruns on the same machine.

Structural and transport observables

In addition to instantaneous ke(), pe(), energy(), temperature(), dof(), box_volume(), distance(i, j), angle_val(i, j, k), and per-particle x/y/z, vx/vy/vz, and fx/fy/fz accessors, Sim includes built-in condensed-matter analysis methods: