ReliaSolve / Molprobity2

0 stars 0 forks source link

Consider how to handle Phil options in Reduce #121

Closed russell-taylor closed 3 years ago

russell-taylor commented 3 years ago

SuiteName uses a setOptions(options) function that sets module-wide values to avoid having to pass them into each function.

This has the negative impact of all global variables, that you cannot be running two instances of the same module at the same time that use different options.

Another option is to construct a Reduce object and pass the options to the constructor, then call methods on the object rather than module-level functions. This provides both a single passing of the value and the ability to run multiple instances. It also allows other shared state on a per-instance basis.

russell-taylor commented 3 years ago

There is no way to work around the main() routine to get access to these parameters because they are returned by a parser that is constructed using the Program as a parameter and then stored internally in whatever data structure the program decides to put them into.

russell-taylor commented 3 years ago

Because there are a number of different object types within Reduce (Movers, InteractionGraphs, etc.) in different Python files, there is not an overall Reduce class that can have the parameters used to construct it.

This requires passing the options into every class or functions if we want to enable different instances to be running with different options from within the same program.

russell-taylor commented 3 years ago

Some of the options are in fact Probe options (probe radius) rather than Reduce options. Do we transcode them? Do we pass the superset of all Phil options in? Do we make our own intermediate MolProbity options and put all of the options into there across the entire set of tools?

russell-taylor commented 3 years ago

Phil parameters are meant to support a single program, not necessarily to provide a consistent set of commands across programs. They can handle complex nested structures and multiple instances of options, along with defaults for each.

russell-taylor commented 3 years ago

We'll not use them in Probe or Reduce, just pass optional specific arguments to functions. The confusion of a vague interface and the threading problems with global variables make each of the solutions suboptimal.

russell-taylor commented 3 years ago

Removed these from Probe and reduce library functions -- we'll use Phil parameters in the application but not the library.