# Workflow

class `openff.evaluator.workflow.``Workflow`(global_metadata, unique_id=None)

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

  `__init__`(global_metadata, unique_id=None)

    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.
  `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.
  `gradients_sources` | A list of paths to the protocol outputs which correspond to the gradients of the estimated property with respect to specified force field parameters.
  `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 `gradients_sources`

    A list of paths to the protocol outputs which correspond to the gradients of the estimated property with respect to specified force field parameters.

    Type

      list of 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)

    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, gradients_sources 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=None, target_uncertainty=None)

    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 (pint.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: pint.Quantity - The target uncertainty with which

          properties should be estimated.

      - per_component_uncertainty: pint.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`()

    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)

    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)

    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