openmm / openmm-ml

High level API for using machine learning models in OpenMM simulations
Other
83 stars 26 forks source link

Create entry point for potentials #73

Closed peastman closed 7 months ago

peastman commented 8 months ago

OpenMM-ML uses a plugin architecture for defining potential functions. It supports a few potentials out of the box. Other packages can add support for additional potentials. To do that, the potential has to be registered by calling MLPotential.registerImplFactory(). The user doesn't need to do that directly. Instead, the package can do it automatically when you import it.

This provides a mostly seamless experience for users, but it does have one minor issue: your script has to import the outside library before you can create a MLPotential from it. If you leave out the import, the name of the potential function won't be recognized.

We can fix this by defining an entry point for potential functions. That would let MLPotential automatically discover all available potentials without any other packages needing to by imported first.