hoomd.filter¶

Overview

 ParticleFilter Base class for all particle filters. All Select all particles in the system. Intersection Set intersection operation. Null Select no particles. SetDifference Set difference operation. Tags Select particles by tag. Type Select particles by type. Union Set union operation.

Details

Particle filters.

Particle filters describe criteria to select subsets of the particle in the system for use by various operations throughout HOOMD. To maintain high performance, filters are not re-evaluated on every use. Instead, each unique particular filter (defined by the class name and hash) is mapped to a group, an internally maintained list of the selected particles. Subsequent uses of the same particle filter specification (in the same Simulation) will resolve to the same group and the originally selected particles, even if the state of the system has changed.

Groups are not completely static. HOOMD-blue re-evaluates the filter specifications and updates the group membership whenever the number of particles in the simulation changes. A future release will include an operation that you can schedule to periodically update groups on demand.

For molecular dynamics simulations, each group maintains a count of the number of degrees of freedom given to the group by integration methods. This count is used by hoomd.md.compute.ThermodynamicQuantities and the integration methods themselves to compute the kinetic temperature. See hoomd.State.update_group_dof for details on when HOOMD-blue updates this count.

class hoomd.filter.ParticleFilter

Base class for all particle filters.

This class provides methods common to all particle filters.

Attention

Users should instantiate one of the subclasses. Calling ParticleFilter directly may result in an error.

__call__(state)

Evaluate the filter.

Returns

The particle tags selected by this filter.

Return type

list[int]

Note

This method may return tags that are only present on the local MPI rank. The full set of particles selected is the combination of these the lists across ranks with a set union operation.

__eq__(other)

Test for equality between two particle filters.

__hash__()

Return a hash of the filter parameters.

__str__()

Format a human readable string describing the filter.

class hoomd.filter.All

Select all particles in the system.

class hoomd.filter.Intersection(f, g)

Set intersection operation.

Parameters

Intersection is a composite filter. It selects particles in the set intersection $$f \cap g$$.

class hoomd.filter.Null

Select no particles.

class hoomd.filter.SetDifference(f, g)

Set difference operation.

Parameters

SetDifference is a composite filter. It selects particles in the set difference $$f \setminus g$$.

class hoomd.filter.Tags(tags)

Select particles by tag.

Parameters

tags (list[int]) – List of particle tags to select.

A particle tag is a unique identifier assigned to each particle in the simulation state. When the state is first initialized, it assigns tags 0 through N_particles to the particles in the order provided.

property tags

List of particle tags to select.

Type

list[int]

class hoomd.filter.Type(types)

Select particles by type.

Parameters

types (list[str]) – List of particle type names to select.

property types

List of particle type names to select.

Type

list[str]

class hoomd.filter.Union(f, g)

Set union operation.

Parameters

Union is a composite filter. It selects particles in the set union $$f \cup g$$.