xnn.common.deploy.torchscript.export_torchscript_potential#

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

Script a trained model to a standalone .pt and save it.

Wraps model in TorchScriptPotential, compiles it with torch.jit.script and writes the archive. The cutoff and the long_range / dispersion flags are embedded as extra files, alongside any caller metadata, so a consumer can introspect the artifact without xnn.

Parameters:
  • model (torch.nn.Module) – The trained model (optionally LES-wrapped).

  • cutoff (float) – Neighbor-list cutoff radius to bake in.

  • path (str) – Destination .pt path.

  • metadata (dict or None, optional) – Extra key/value metadata; values are stringified.

  • total_charge (float, optional) – Net charge of the deployed system (D4 EEQ charges), by default 0.

Returns:

The path written.

Return type:

str