lmparticle guide

Physics models, NIST XCOM cross-section interpolation, geometry priority, variance reduction, and the standard lmcode_std_v3 library for lmparticle.

Overview

lmparticle is a C++17 Monte Carlo photon transport engine embedded in the lmcode-cpp runtime. It combines NIST XCOM element attenuation tables, exact Klein-Nishina Compton sampling, screened Thomas-Fermi Rayleigh scattering, pair production with at-rest positron annihilation, and a seeded xoshiro256** pseudorandom generator so simulations are bitwise reproducible on a given platform.

Photon interaction models and collision kerma

Every history tracks a photon from birth until it escapes all geometry regions, is photoelectrically absorbed, drops below the energy cutoff (default and minimum 0.001 MeV, maximum 20 MeV), or is terminated by Russian roulette:

Geometry priority, sources, and tallies

Multi-host simulation and visualization workflows

In LMScript pipelines, an lmparticle _lmcode_ block computes transport tallies, verifies known physical limits with rad.assert_close, and exports space-separated data files (save_regions, save_plane_spectrum, save_leakage_spectrum, save_pulse_height, save_tracks). Subsequent _lmcode_ blocks in the same script invoke lmplot to render publication curves and spectra, lmdraw to draw scaled geometric schematics, or lmcad to render 3D shielding layouts.

Standard lmcode_std_v3 library

Alongside context rad: Rad, lmparticle embeds the standard lmcode_std_v3 catalog (cpp/std/lmcode-std.schema.json) providing string manipulation, base64/hex encoding, math functions, typed lists/maps/queues/stacks/priority queues, JSON parsing, Mustache templates, file I/O, and structured return framing (lmcode_return_set, lmcode_return_put). The std catalog pinned in this repository does not include the REST and CLI handler interfaces (RestGet, CliCommand, rest_serve, and related signatures).