ManualTuneDefinition¶
- class hoomd.tune.ManualTuneDefinition(get_y, target, get_x, set_x, domain=None)¶
Class for defining y = f(x) relationships for tuning x for a set y target.
This class is made to be used with
hoomd.tune.SolverStepsubclasses. Here y represents a dependent variable of x. In general, x and y should be of typefloat, but specifichoomd.tune.SolverStepsubclasses may accept other types.A special case for the return type of y is
None. If the value is currently inaccessible or would be invalid, aManualTuneDefinitionobject can return a y ofNoneto indicate this.hoomd.tune.SolverStepobjects will handle this automatically. Since we check forNoneinternally inhoomd.tune.SolverStepobjects, aManualTuneDefinitionobject’syproperty should be consistent when called multiple times within a timestep.When setting
xthe value is clamped between the given domain via,- Parameters:
get_y (
callable) – A callable that gets the current value for y.target (
any) – The target y value to approach.get_x (
callable) – A callable that gets the current value for x.set_x (
callable) – A callable that sets the current value for x.domain (
tuple[any,any], optional) – A tuple pair of the minimum and maximum accepted values of x, defaults toNone. When, the domain isNonethen any value of x is accepted. Either the minimum or maximum can be set toNoneas well which means there is no maximum or minimum. The domain is used to wrap values within the specified domain when setting x.
Note
Placing domain restrictions on x can lead to the target y value being impossible to converge to. This will lead to the
hoomd.tune.SolverStepobject passed this tunable to never finish solving regardless if all otherManualTuneDefinitionobjects are converged.- __eq__(other)¶
Test for equality.
- __hash__()¶
Compute a hash of the tune definition.
- clamp_into_domain(value)¶
Return the closest value within the domain.
- Parameters:
value (
any) – A value of the same type as x.- Returns:
The value clamps within the domains of x. Clamping here refers to returning the value or minimum or maximum of the domain if value is outside the domain.
- property domain¶
A tuple pair of the minimum and maximum accepted values of x.
When the domain is None, any value of x is accepted. Either the minimum or maximum can be set to
Noneas well which means there is no maximum or minimum. The domain is used to wrap values within the specified domain when setting x.- Type:
tuple[
any,any]
- in_domain(value)¶
Check whether a value is in the domain.
- Parameters:
value (
any) – A value that can be compared to the minimum and maximum of the domain.- Returns:
Whether the value is in the domain of x.
- Return type:
- property max_x¶
Maximum allowed x value.
- property min_x¶
Minimum allowed y value.
- property target¶
The targetted y value, can be set.
- property x¶
The dependent variable.
Can be set. When set the setting value is clamped within the provided domain. See
clamp_into_domainfor further explanation.
- property y¶
The independent variable, and is unsettable.