You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@jchodera, the current default constructor for ToolkitRegistry will attempt to initialize OE, Amber, and RDK toolkits. The command to initialize an empty ToolkitRegistry is ToolkitRegistry(toolkit_precedence=[]). Revisiting this months later, this is really unintuitive, and I think we should change it (ToolkitRegistry() should initialize an empty registry). Opening a new issue.
If the API is breaking the "principle of least surprise", then the default behavior should definitely be changed.
I originally thought the least surprising default behavior was "do the right thing automatically unless I tell you not to"---that is, "find all the toolkits that are installed and use those". I expected that, if someone wanted fine-grained control over toolkits, they would initialize with specific toolkits or an empty set and add them one at a time, since this is the minority use case.
But I clearly got the API wrong in my debugging in #346 (comment) :)
I agree that ToolkitRegistry() should give me an instance with no wrappers registered into it. I find this type of behavior quite surprising when I ran into it:
In [1]: fromopenforcefield.utils.toolkitsimport*In [2]: reg=ToolkitRegistry()
In [3]: [reg.register_toolkit(tk) fortkin [OpenEyeToolkitWrapper, RDKitToolkitWrapper, AmberToolsToolkitWrapper]]
Out[3]: [None, None, None]
In [4]: reg.registered_toolkitsOut[4]:
[<openforcefield.utils.toolkits.OpenEyeToolkitWrapperat0x14071f6d0>,
<openforcefield.utils.toolkits.RDKitToolkitWrapperat0x144349550>,
<openforcefield.utils.toolkits.AmberToolsToolkitWrapperat0x144349910>,
<openforcefield.utils.toolkits.BuiltInToolkitWrapperat0x144349a50>,
<openforcefield.utils.toolkits.OpenEyeToolkitWrapperat0x1443758d0>,
<openforcefield.utils.toolkits.RDKitToolkitWrapperat0x14527e110>,
<openforcefield.utils.toolkits.AmberToolsToolkitWrapperat0x14527e050>]
(this is surprising for two reasons, one being the non-empty default registry and also that .register_toolkit should probably check to see if one is already registered)
I wouldn't expect this to be a hugely problematic API break since most functionality silently uses GLOBAL_TOOLKIT_REGISTRY behind the scenes and initializing a custom ToolkitRegistry() often comes with a populated toolkit_precedence argument. Is there a compelling reason to maintain this behavior that I'm not considering?
@jchodera, the current default constructor for
ToolkitRegistry
will attempt to initialize OE, Amber, and RDK toolkits. The command to initialize an empty ToolkitRegistry isToolkitRegistry(toolkit_precedence=[])
. Revisiting this months later, this is really unintuitive, and I think we should change it (ToolkitRegistry()
should initialize an empty registry). Opening a new issue.Originally posted by @j-wags in #346 (comment)
The text was updated successfully, but these errors were encountered: