BaseOptimizer

class openff.bespokefit.optimizers.BaseOptimizer[source]

Bases: ABC

This is the abstract basic BaseOptimizer class that each optimizer should use.

Methods

__init__()

deregister_target(target_name)

Remove a registered target from the optimizer.

description()

Returns a friendly description of the optimizer.

get_registered_targets()

Internal method to get the registered targets for this specific optimizer.

is_available()

This method should check that installation requirements are met before trying to run the optimizer.

name()

Returns the friendly name of the optimizer.

optimize(schema, initial_force_field[, ...])

This is the main function of the optimizer which is called when the optimizer is put in a workflow.

prepare(schema, initial_force_field, ...)

Prepares the optimization by creating any required inputs and setting up the required environment.

provenance()

This function should detail the programs with the version information called during the running od the optimizer.

register_target(target_type[, replace])

Take a target and register it with the optimizer under an alias name which is used to call the target.

__init__()
classmethod deregister_target(target_name: str)[source]

Remove a registered target from the optimizer.

Parameters

target_name (str) – The name of the target that should be removed.

Raises

TargetRegisterError – If no target is registered under the name to be removed.

abstract classmethod description() str[source]

Returns a friendly description of the optimizer.

classmethod get_registered_targets() Dict[str, Type[BaseTargetSchema]][source]

Internal method to get the registered targets for this specific optimizer.

abstract classmethod is_available() bool[source]

This method should check that installation requirements are met before trying to run the optimizer.

abstract classmethod name() str[source]

Returns the friendly name of the optimizer.

classmethod optimize(schema: OptimizationStageSchema, initial_force_field: ForceField, root_directory: Optional[str] = None) OptimizationStageResults[source]

This is the main function of the optimizer which is called when the optimizer is put in a workflow.

It should loop over the targets and assert they are registered and then dispatch compute and optimization.

classmethod prepare(schema: OptimizationStageSchema, initial_force_field: ForceField, root_directory: str)[source]

Prepares the optimization by creating any required inputs and setting up the required environment.

abstract classmethod provenance() Dict[source]

This function should detail the programs with the version information called during the running od the optimizer.

Returns

A dictionary containing the information about the optimizer called.

classmethod register_target(target_type: Type[BaseTargetSchema], replace: bool = False) None[source]

Take a target and register it with the optimizer under an alias name which is used to call the target.

Parameters
  • target_type – The type of target to be registered with the optimizer.

  • replace – If the alias is already registered replaced with the new target data with no exception.

Raises

TargetRegisterError – If the target has already been registered.

abstract classmethod name() str[source]

Returns the friendly name of the optimizer.

abstract classmethod description() str[source]

Returns a friendly description of the optimizer.

abstract classmethod provenance() Dict[source]

This function should detail the programs with the version information called during the running od the optimizer.

Returns

A dictionary containing the information about the optimizer called.

abstract classmethod is_available() bool[source]

This method should check that installation requirements are met before trying to run the optimizer.

classmethod get_registered_targets() Dict[str, Type[BaseTargetSchema]][source]

Internal method to get the registered targets for this specific optimizer.

classmethod register_target(target_type: Type[BaseTargetSchema], replace: bool = False) None[source]

Take a target and register it with the optimizer under an alias name which is used to call the target.

Parameters
  • target_type – The type of target to be registered with the optimizer.

  • replace – If the alias is already registered replaced with the new target data with no exception.

Raises

TargetRegisterError – If the target has already been registered.

classmethod deregister_target(target_name: str)[source]

Remove a registered target from the optimizer.

Parameters

target_name (str) – The name of the target that should be removed.

Raises

TargetRegisterError – If no target is registered under the name to be removed.

classmethod prepare(schema: OptimizationStageSchema, initial_force_field: ForceField, root_directory: str)[source]

Prepares the optimization by creating any required inputs and setting up the required environment.

classmethod optimize(schema: OptimizationStageSchema, initial_force_field: ForceField, root_directory: Optional[str] = None) OptimizationStageResults[source]

This is the main function of the optimizer which is called when the optimizer is put in a workflow.

It should loop over the targets and assert they are registered and then dispatch compute and optimization.