openmmml.models.orbpotential.OrbPotentialImpl#
- class openmmml.models.orbpotential.OrbPotentialImpl(name: str)#
Implementation of Orb potentials for OpenMM.
To use one of the recommended pretrained models, specify it by name:
>>> potential = MLPotential('orb-v3-conservative-omol')
This gives Orb-v3 (with conservative forces) trained on OMol25. Orb-v3 trained on OMat24 is also available as orb-v3-conservative-inf-omat.
- __init__(name: str) None#
Initialize the OrbPotentialImpl.
- Parameters:
name (str) – The full name of the Orb model to load.
Methods
__init__(name)Initialize the OrbPotentialImpl.
addForces(topology, system, atoms, forceGroup)Add Force objects to a System to implement the potential function.
createMixedSystem(topology, system, atoms, ...)Creates a mixed system using a potential-specific embedding method.
Returns whether ML interactions are local (False), or long-ranged (True) when periodic boundary conditions are present.
Retrieves a list of names of supported embedding methods (for the creation of mixed ML/MM systems) specific to this potential.
- addForces(topology: Topology, system: System, atoms: Iterable[int] | None, forceGroup: int, charge: int = 0, multiplicity: int = 1, **args) None#
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.
- getMLLongRange() bool | None#
Returns whether ML interactions are local (False), or long-ranged (True) when periodic boundary conditions are present. This controls which interactions are included by some ML/MM embedding methods. Consult the documentation for each embedding method for more details. None can be returned if the nature of the interactions is not known by the MLPotentialImpl.
The default implementation of this method, used if a subclass does not override it, always returns None.
- createMixedSystem(topology: Topology, system: System, atoms: list[int], forceGroup: int, interpolate: bool, embedding: str, **args) System#
Creates a mixed system using a potential-specific embedding method.
This is invoked by MLPotential.createMixedSystem(). It will only be called with one of the names returned by getSupportedEmbeddings(). If subclasses support any potential-specific embedding methods, they must also provide implementations of those methods by overriding this method. If not, it does not need to be implemented.
Each embedding method is responsible for implementing interpolation; if interpolate is True, a global parameter “lambda_interpolate” should be present in the returned system, with the behavior as described by MLPotential.createMixedSystem().
- Parameters:
topology (Topology) – the Topology for which to create a System
system (System) – a System that models the Topology with a conventional force field
atoms (Iterable[int]) – the indices of all atoms whose interactions should be computed with this potential
forceGroup (int) – the force group the ML potential’s Forces should be placed in
interpolate (bool) – if True, create a System that can smoothly interpolate between the conventional and ML potentials
embedding (str) – the name of the embedding method (will always be one in the list returned by the getSupportedEmbeddings() method)
args – any additional arguments for the potential or embedding method
- Returns:
a newly created System object that uses this potential function and the
requested embedding method to model the Topology
- getSupportedEmbeddings() list[str]#
Retrieves a list of names of supported embedding methods (for the creation of mixed ML/MM systems) specific to this potential. If one of these names is provided instead of providing the name of a generic embedding plugin, embedding will be performed by the potential itself.
This is invoked by MLPotential.createMixedSystem(). If a subclass wishes to define one or more potential-specific embedding methods, it should implement this method; otherwise, it does not need to.