openmmml.models.asepotential.ASEPotentialImpl#

class openmmml.models.asepotential.ASEPotentialImpl(name)#

This MLPotentialImpl implements potentials using an ASE calculator.

It can be used in two ways. One option is to provide an ASE Atoms object that has already been configured with the correct calculator and all other settings.

>>> potential = MLPotential('ase')
>>> system = potential.createSystem(topology, aseAtoms=atoms)

When used this way, you must make sure the Atoms object describes exactly the same atoms in the same order as the OpenMM Topology. If it does not, you will get incorrect results.

Alternatively you can provide a calculator. In this case, createSystem() automatically creates an Atoms object based on the Topology and assigns the calculator to it.

>>> system = potential.createSystem(topology, calculator=calculator)

When used this way, you can optionally include an info argument with properties that should be added to the Atoms object’s info dict.

>>> system = potential.createSystem(topology, calculator=calculator, info={'charge':2})
__init__(name)#

Methods

__init__(name)

addForces(topology, system, atoms, ...)

Add Force objects to a System to implement the potential function.

addForces(topology: Topology, system: System, atoms: Iterable[int] | None, forceGroup: int, **args)#

Add Force objects to a System to implement the potential function.

This is invoked by MLPotential.createSystem(). Subclasses must implement it to create the requested potential function.

Parameters:
  • topology (Topology) – the Topology from which the System is being created

  • system (System) – the System that is being created

  • atoms (Optional[Iterable[int]]) – the indices of atoms the potential should be applied to, or None if it should be applied to the entire System

  • forceGroup (int) – the force group that any newly added Forces should be in

  • args – any additional keyword arguments that were provided to createSystem() are passed to this method. This allows subclasses to customize their behavior based on extra arguments.