Trigger

class hoomd.trigger.Trigger

Base class trigger.

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

Subclasses should override the Trigger.compute method and must explicitly call the base class constructor in __init__:

class CustomTrigger(hoomd.trigger.Trigger):
    def __init__(self):
        hoomd.trigger.Trigger.__init__(self)

    def compute(self, timestep):
        return (timestep ** (1 / 2)).is_integer()
__call__(timestep)

Evaluate the trigger.

Parameters:

timestep (int) – The timestep.

Note

When called several times with the same timestep, __call__ calls compute on the first invocation, caches the value, and returns that cached value in subsequent calls.

Returns:

True when the trigger is active, False when it is not.

Return type:

bool

compute(timestep)

Evaluate the trigger.

Parameters:

timestep (int) – The timestep.

Returns:

True when the trigger is active, False when it is not.

Return type:

bool

__getstate__()

Get the state of the trigger object.

__setstate__(state)

Set the state of the trigger object.