GradientReducedPotentials¶
-
class
propertyestimator.protocols.gradients.
GradientReducedPotentials
(protocol_id)[source]¶ A protocol to estimates the gradient of an observable with respect to a number of specified force field parameters.
Methods
__init__
(protocol_id)Constructs a new EstimateParameterGradients object.
apply_replicator
(replicator, template_values)Applies a ProtocolReplicator to this protocol.
can_merge
(other)Determines whether this protocol can be merged with another.
execute
(directory, available_resources)Execute the protocol.
get_attribute_type
(reference_path)Returns the type of one of the protocol input/output attributes.
get_value
(reference_path)Returns the value of one of this protocols inputs / outputs.
get_value_references
(input_path)Returns a dictionary of references to the protocols which one of this protocols inputs (specified by input_path) takes its value from.
merge
(other)Merges another BaseProtocol with this one.
replace_protocol
(old_id, new_id)Finds each input which came from a given protocol
set_uuid
(value)Store the uuid of the calculation this protocol belongs to
set_value
(reference_path, value)Sets the value of one of this protocols inputs.
Attributes
If true, this protocol is allowed to merge with other identical protocols.
A path to the initial coordinates of the simulation trajectory which was used to estimate the observable of interest.
A list of pointers to the protocols which this protocol takes input from.
NOTE - this is currently a placeholder input ONLY, and currently is not used for anything.
If true, periodic boundary conditions will be enabled when re-evaluating the reduced potentials.
A path to the force field which contains the parameters to differentiate the observable with respect to.
forward_parameter_value
forward_potentials_path
The unique id of this protocol.
A list of the parameters to differentiate with respect to.
The amount to perturb the parameter by, such that p_new = p_old * (1 +/- perturbation_scale)
A list of path to the force field file which were originally used to estimate the observable of interest.
reference_potential_paths
An optional path to the statistics array which was generated alongside the observable of interest, which will be used to correct the potential energies at the reverse and forward states.
reverse_parameter_value
reverse_potentials_path
A serializable schema for this object.
The substance which describes the composition of the system.
The thermodynamic state to estimate the gradients at.
A path to the simulation trajectory which was used to estimate the observable of interest.
If true, the reduced potential will be estimated using an OpenMM system which only contains the parameter of interest.
-
reference_force_field_paths
¶ A list of path to the force field file which were originally used to estimate the observable of interest.
-
reference_statistics_path
¶ An optional path to the statistics array which was generated alongside the observable of interest, which will be used to correct the potential energies at the reverse and forward states.
This is only really needed when the observable of interest is an energy.
-
force_field_path
¶ A path to the force field which contains the parameters to differentiate the observable with respect to.
-
enable_pbc
¶ If true, periodic boundary conditions will be enabled when re-evaluating the reduced potentials.
-
substance
¶ The substance which describes the composition of the system.
-
thermodynamic_state
¶ The thermodynamic state to estimate the gradients at.
-
coordinate_file_path
¶ A path to the initial coordinates of the simulation trajectory which was used to estimate the observable of interest.
-
trajectory_file_path
¶ A path to the simulation trajectory which was used to estimate the observable of interest.
-
parameter_key
¶ A list of the parameters to differentiate with respect to.
-
perturbation_scale
¶ The amount to perturb the parameter by, such that p_new = p_old * (1 +/- perturbation_scale)
-
use_subset_of_force_field
¶ If true, the reduced potential will be estimated using an OpenMM system which only contains the parameter of interest.
-
effective_sample_indices
¶ NOTE - this is currently a placeholder input ONLY, and currently is not used for anything.
-
execute
(directory, available_resources)[source]¶ Execute the protocol.
Protocols may be chained together by passing the output of previous protocols as input to the current one.
- Parameters
directory (str) – The directory to store output data in.
available_resources (ComputeResources) – The resources available to execute on.
- Returns
The output of the execution.
- Return type
Dict[str, Any]
-
apply_replicator
(replicator, template_values, template_index=-1, template_value=None, update_input_references=False)¶ Applies a ProtocolReplicator to this protocol. This method should clone any protocols whose id contains the id of the replicator (in the format $(replicator.id)).
- Parameters
replicator (ProtocolReplicator) – The replicator to apply.
template_values (list of Any) –
A list of the values which will be inserted into the newly replicated protocols.
This parameter is mutually exclusive with template_index and template_value
template_index (int, optional) –
A specific value which should be used for any protocols flagged as to be replicated by the replicator. This option is mainly used when replicating children of an already replicated protocol.
This parameter is mutually exclusive with template_values and must be set along with a template_value.
template_value (Any, optional) –
A specific index which should be used for any protocols flagged as to be replicated by the replicator. This option is mainly used when replicating children of an already replicated protocol.
This parameter is mutually exclusive with template_values and must be set along with a template_index.
update_input_references (bool) –
If true, any protocols which take their input from a protocol which was flagged for replication will be updated to take input from the actually replicated protocol. This should only be set to true if this protocol is not nested within a workflow or a protocol group.
This option cannot be used when a specific template_index or template_value is providied.
- Returns
A dictionary of references to all of the protocols which have been replicated, with keys of original protocol ids. Each value is comprised of a list of the replicated protocol ids, and their index into the template_values array.
- Return type
dict of ProtocolPath and list of tuple of ProtocolPath and int
-
can_merge
(other)¶ Determines whether this protocol can be merged with another.
- Parameters
other (
BaseProtocol
) – The protocol to compare against.- Returns
True if the two protocols are safe to merge.
- Return type
-
property
dependencies
¶ A list of pointers to the protocols which this protocol takes input from.
- Type
list of ProtocolPath
-
get_attribute_type
(reference_path)¶ Returns the type of one of the protocol input/output attributes.
- Parameters
reference_path (ProtocolPath) – The path pointing to the value whose type to return.
- Returns
The type of the attribute.
- Return type
-
get_value
(reference_path)¶ Returns the value of one of this protocols inputs / outputs.
- Parameters
reference_path (ProtocolPath) – The path pointing to the value to return.
- Returns
The value of the input / output
- Return type
Any
-
get_value_references
(input_path)¶ Returns a dictionary of references to the protocols which one of this protocols inputs (specified by input_path) takes its value from.
Notes
Currently this method only functions correctly for an input value which is either currently a
ProtocolPath
, or a list / dict which contains at least oneProtocolPath
.- Parameters
input_path (
propertyestimator.workflow.utils.ProtocolPath
) – The input value to check.- Returns
A dictionary of the protocol paths that the input targeted by input_path depends upon.
- Return type
dict of ProtocolPath and ProtocolPath
-
merge
(other)¶ Merges another BaseProtocol with this one. The id of this protocol will remain unchanged.
It is assumed that can_merge has already returned that these protocols are compatible to be merged together.
- Parameters
other (BaseProtocol) – The protocol to merge into this one.
- Returns
A map between any original protocol ids and their new merged values.
- Return type
-
replace_protocol
(old_id, new_id)¶ - Finds each input which came from a given protocol
and redirects it to instead take input from a new one.
Notes
This method is mainly intended to be used only when merging multiple protocols into one.
-
property
schema
¶ A serializable schema for this object.
- Type
-
set_uuid
(value)¶ Store the uuid of the calculation this protocol belongs to
- Parameters
value (str) – The uuid of the parent calculation.
-
set_value
(reference_path, value)¶ Sets the value of one of this protocols inputs.
- Parameters
reference_path (ProtocolPath) – The path pointing to the value to return.
value (Any) – The value to set.
-