openmmml.models.fennixpotential.FeNNixPotentialImpl#
- class openmmml.models.fennixpotential.FeNNixPotentialImpl(name: str, modelPath: str | None)#
Implementation of FeNNix potentials for OpenMM.
The FeNNol library is used to load FeNNix models and evaluate energies and forces. This implementation can use local files for models or automatically download them from the FeNNol-PMC repository.
To use one of the pre-trained FeNNix models, specify it by name. For example:
>>> potential = MLPotential('fennix-bio1-small')
Other available models include ‘fennix-bio1-medium’, ‘fennix-bio1-small-finetune-ions’, and ‘fennix-bio1-medium-finetune-ions’.
To use a local .fnx file, specify ‘fennix’ as the model name, and supply the modelPath argument, e.g.,
>>> potential = MLPotential('fennix', modelPath='custom_fennix_model.fnx')
- __init__(name: str, modelPath: str | None) None#
Initialize the FeNNixPotentialImpl.
- Parameters:
name (str) – The name of the model. Options include the pre-trained models ‘fennix-bio1-small’, ‘fennix-bio1-medium’, ‘fennix-bio1-small-finetune-ions’, and ‘fennix-bio1-medium-finetune-ions’, or ‘fennix’ to load a local model file.
modelPath (str, optional) – A path to the model file to load.
Methods
__init__(name, modelPath)Initialize the FeNNixPotentialImpl.
addForces(topology, system, atoms, forceGroup)Add Force objects to a System to implement the potential function.
Attributes
KNOWN_MODELS- addForces(topology: Topology, system: System, atoms: Iterable[int] | None, forceGroup: int, charge: int = 0, precision: str = 'single', **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.