xnn.common.deploy.lammps#

Export a trained model to TorchScript for LAMMPS.

LAMMPS coupling follows the established pattern used by pair_nequip / pair_mace / pair_allegro: the trained model is serialized with torch.jit.script and a C++ pair style loads it and feeds it the local neighbor list each timestep.

LAMMPSWrapper exposes a forward whose inputs mirror what such a pair style provides – positions, edge list, integer shifts, atom types and the cell – and returns total energy, per-atom energy and forces. Pair the produced .pt file with the matching C++ pair style for your model family.

Functions

export_to_lammps(model, cutoff, path[, ...])

Script the model and save a .pt usable by a LAMMPS pair style.

export_torchscript(model, path)

Generic TorchScript export (e.g. for custom C++/Python serving).

Classes

LAMMPSWrapper(model, cutoff[, total_charge])

TorchScript-friendly bridge between LAMMPS tensors and the model.