Workflow

class openff.evaluator.workflow.Workflow(global_metadata, unique_id=None)[source]

Encapsulates and prepares a workflow which is able to estimate a physical property.

__init__(global_metadata, unique_id=None)[source]

Constructs a new Workflow object.

Parameters
  • global_metadata (dict of str and Any) – A dictionary of the metadata which will be made available to each of the workflow protocols through the pseudo “global” scope.

  • unique_id (str, optional) – A unique identifier to assign to this workflow. This id will be appended to the ids of the protocols of this workflow. If none is provided, one will be chosen at random.

Methods

__init__(global_metadata[, unique_id])

Constructs a new Workflow object.

execute([root_directory, ...])

Executes the workflow.

from_schema(schema, metadata[, unique_id])

Creates a workflow from its schema blueprint, and the associated metadata.

generate_default_metadata(physical_property, ...)

Generates the default global metadata dictionary.

label_molecules(force_field, topology)

replace_protocol(old_protocol, new_protocol)

Replaces an existing protocol with a new one, while updating all input and local references to point to the new protocol.

to_graph()

Converts this workflow to an executable WorkflowGraph.

Attributes

final_value_source

The path to the protocol output which corresponds to the estimated value of the property being estimated.

outputs_to_store

A collection of data classes to populate ready to be stored by a StorageBackend.

protocols

The protocols in this workflow.

schema

property protocols

The protocols in this workflow.

Type

tuple of Protocol

property final_value_source

The path to the protocol output which corresponds to the estimated value of the property being estimated.

Type

ProtocolPath

property outputs_to_store

A collection of data classes to populate ready to be stored by a StorageBackend.

Type

dict of str and StorageBackend

replace_protocol(old_protocol, new_protocol, update_paths_only=False)[source]

Replaces an existing protocol with a new one, while updating all input and local references to point to the new protocol.

The main use of this method is when merging multiple protocols into one.

Parameters
  • old_protocol (Protocol or ProtocolPath) – The protocol (or its id) to replace.

  • new_protocol (Protocol or ProtocolPath) – The new protocol (or its id) to use.

  • update_paths_only (bool) – Whether only update the final_value_source, and outputs_to_store attributes, or to also update all of the protocols in protocols.

static generate_default_metadata(physical_property, force_field_path, parameter_gradient_keys=UNDEFINED, target_uncertainty=None)[source]

Generates the default global metadata dictionary.

Parameters
  • physical_property (PhysicalProperty) – The physical property whose arguments are available in the global scope.

  • force_field_path (str) – The path to the force field parameters to use in the workflow.

  • parameter_gradient_keys (list of ParameterGradientKey) – A list of references to all of the parameters which all observables should be differentiated with respect to.

  • target_uncertainty (openff.evaluator.unit.Quantity, optional) – The uncertainty which the property should be estimated to within.

Returns

The metadata dictionary, with the following keys / types:

  • thermodynamic_state: ThermodynamicState - The state (T,p) at which the

    property is being computed

  • substance: Substance - The composition of the system of interest.

  • components: list of Substance - The components present in the system for

    which the property is being estimated.

  • target_uncertainty: openff.evaluator.unit.Quantity - The target uncertainty with which

    properties should be estimated.

  • per_component_uncertainty: openff.evaluator.unit.Quantity - The target uncertainty divided

    by the sqrt of the number of components in the system + 1

  • force_field_path: str - A path to the force field parameters with which the

    property should be evaluated with.

  • parameter_gradient_keys: list of ParameterGradientKey - A list of references to all of the

    parameters which all observables should be differentiated with respect to.

Return type

dict of str, Any

to_graph()[source]

Converts this workflow to an executable WorkflowGraph.

Returns

The graph representation of this workflow.

Return type

WorkflowGraph

classmethod from_schema(schema, metadata, unique_id=None)[source]

Creates a workflow from its schema blueprint, and the associated metadata.

Parameters
  • schema (WorkflowSchema) – The schema blueprint for this workflow.

  • metadata (dict of str and Any) – The metadata to make available to the workflow.

  • unique_id (str, optional) – A unique identifier to assign to this workflow. This id will be appended to the ids of the protocols of this workflow. If none is provided one will be chosen at random.

Returns

The created workflow.

Return type

cls

execute(root_directory='', calculation_backend=None, compute_resources=None)[source]

Executes the workflow.

Parameters
  • root_directory (str) – The directory to execute the graph in.

  • calculation_backend (CalculationBackend, optional.) – The backend to execute the graph on. This parameter is mutually exclusive with compute_resources.

  • compute_resources (CalculationBackend, optional.) – The compute resources to run using. If None and no calculation_backend is specified, the workflow will be executed on a single CPU thread. This parameter is mutually exclusive with calculation_backend.

Returns

The result of executing this workflow. If executed on a calculation_backend, the result will be wrapped in a Future object.

Return type

WorkflowResult or Future of WorkflowResult