xnn.common.deploy.openmm_force.OpenMMPotential#

class xnn.common.deploy.openmm_force.OpenMMPotential(potential, atomic_numbers, atoms=None, periodic=False)[source]#

Bases: Module

A scriptable module with openmm-torch’s calling convention.

forward(positions, boxvectors) takes the positions of every particle of the OpenMM system (nanometers) and, for a periodic system, the box vectors as rows, and returns the energy in kJ/mol and the forces in kJ/mol/nm of every particle. The model sees only atoms.

Parameters:
  • potential (TorchScriptPotential) – The exported model.

  • atomic_numbers (sequence of int) – Atomic numbers of the model’s atoms, in the order of atoms.

  • atoms (sequence of int or None, optional) – Indices of the model’s atoms among the system’s particles; None (default) for every particle.

  • periodic (bool, optional) – Whether the system is periodic, by default False.

forward(positions, boxvectors=None)[source]#

Energy (kJ/mol, a scalar) and forces (kJ/mol/nm, every particle) of the positions (nm).

Parameters:
Return type:

Tuple[Tensor, Tensor]