Variant

class hoomd.variant.Variant

Variant base class.

Provides methods common to all variants and a base class for user-defined variants.

Subclasses should override the __call__, _min, and _max methods and must explicitly call the base class constructor in __init__:

class CustomVariant(hoomd.variant.Variant):
    def __init__(self):
        hoomd.variant.Variant.__init__(self)

    def __call__(self, timestep):
        return float(timestep) ** (1 / 2)

    def _min(self):
        return 0.0

    def _max(self):
        return float("inf")

Note

Provide the minimum and maximum values in the _min and _max methods respectively.

__call__(timestep)

Evaluate the function.

Parameters:

timestep (int) – The time step.

Returns:

The value of the function at the given time step.

Return type:

float

__getstate__()

Get the variant’s __dict__ attribute.

__setstate__(state)

Restore the state of the variant.

property max

The maximum value of this variant for \(t \in [0,\infty)\).

property min

The minimum value of this variant for \(t \in [0,\infty)\).