xnn.common.deploy.lammps.export_to_lammps#

xnn.common.deploy.lammps.export_to_lammps(model, cutoff, path, metadata=None, total_charge=0.0)[source]#

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

Wraps model in LAMMPSWrapper, compiles it with torch.jit.script and saves the scripted module to path. The cutoff (and any provided metadata) is embedded as extra files inside the archive, with all values stored as strings.

Parameters:
  • model (torch.nn.Module) – The trained model to serialize (must provide a scriptable node_energy core, as required by LAMMPSWrapper).

  • cutoff (float) – Neighbor-list cutoff radius; stored in the archive under the "cutoff" extra-file key.

  • path (str) – Destination file path for the scripted .pt archive.

  • metadata (dict or None, optional) – Additional key/value metadata to embed as extra files. Values are stringified. Defaults to None.

  • total_charge (float, optional) – Net charge of the system for a D4-wrapped model, by default 0.

Returns:

The path the scripted model was saved to.

Return type:

str