lmparticle

lmparticle is a seeded Monte Carlo photon transport host for LMScript with embedded NIST XCOM cross sections. It simulates shielding, detector spectra, radiographic contrast, and collision kerma from 1 keV to 20 MeV in a self-contained 2.5 MB executable.

Quick reference

npm install -g @lmctl-ai/lmctl
lmparticle --version
lmparticle --lmcode-schema --json
lmctl autorun examples/depth_dose.lms
Object or methodSignature or syntaxPurpose
context rad: Radrad.builtin(name) | rad.material(name, density)Load 15 built-in materials or define custom mixtures from 19 NIST XCOM elements or custom element_table data.
Materialm.mu(E), m.mu_mass(E), m.mu_partial(E, proc), m.mfp(E), m.hvl(E)Query linear and mass attenuation coefficients, partial cross sections, mean free paths, and half-value layers.
Geometryg.box(...), g.slab(...), g.sphere(...), g.cylinder(...)Build multi-region 3D geometries where earlier regions take priority on overlap and outside is vacuum.
Sources.point(...), s.disc(r), s.beam(...), s.cone(...), s.isotropic(), s.energy(E), s.line(E, w)Configure spatial origin, angular distribution, and monoenergetic or multi-line photon energies in MeV.
Sim / Resultrad.simulation(g, s).plane(...).spectrum(...).pulse_height(...).seed(n).run(N)Run seeded xoshiro256** transport and query collision kerma, plane crossings, spectra, and standard errors.
p = _lmcode_ cli="lmparticle" install="github:lmctl-ai/lmparticle@latest";
let pb = rad.builtin("lead");
let g = rad.geometry().slab("shield", pb, 0.0, 1.0);
let s = rad.source().point(0.0, 0.0, -1.0).beam(0.0, 0.0, 1.0).energy(0.662);
let r = rad.simulation(g, s).plane("exit", "z", 1.0).seed(1).run(200000);
rad.assert_close(r.plane_uncollided("exit"), pow(2.718281828459045, -pb.mu(0.662)), 0.005);
end _lmcode_
r = run_lmcode(p);
require(r.ok, json_stringify(r));

Documentation pages

Source repository and releases