Pair

class hoomd.md.pair.Pair(nlist, default_r_cut=None, default_r_on=0.0, mode='none')

Bases: Force

Base class pair force.

Pair is the base class for all pair forces.

Warning

This class should not be instantiated by users. The class can be used for isinstance or issubclass checks.


Members inherited from AutotunedObject:

property kernel_parameters

Kernel parameters. Read more...

property is_tuning_complete

Check if kernel parameter tuning is complete. Read more...

tune_kernel_parameters()

Start tuning kernel parameters. Read more...


Members inherited from Force:

additional_energy

Additional energy term. Read more...

additional_virial

Additional virial tensor term \(W_\mathrm{additional}\). Read more...

cpu_local_force_arrays

Local force arrays on the CPU. Read more...

energies

Energy contribution \(U_i\) from each particle. Read more...

energy

The potential energy \(U\) of the system from this force. Read more...

forces

The force \(\vec{F}_i\) applied to each particle. Read more...

gpu_local_force_arrays

Local force arrays on the GPU. Read more...

torques

The torque \(\vec{\tau}_i\) applied to each particle. Read more...

virials

Virial tensor contribution \(W_i\) from each particle. Read more...


Members defined in Pair:

nlist

Neighbor list used to compute the pair force.

Type: hoomd.md.nlist.NeighborList

mode

mode, optional: defaults to "none". Possible values: "none", "shift", "xplor"

Type: str

r_cut

Cuttoff radius beyond which the energy and force are 0 \([\mathrm{length}]\). Optional: defaults to the value default_r_cut specified on construction.

Type: TypeParameter [tuple [particle_type, particle_type], float])

r_on

Radius at which the smoothing modification to the potential starts \([\mathrm{length}]\). Optional: defaults to the value default_r_on specified on construction.

Type: TypeParameter [tuple [particle_type, particle_type], float])

compute_energy(tags1, tags2)

Compute the energy between two sets of particles.

Parameters:
  • tags1 (ndarray<int32>) – a numpy array of particle tags in the first group.

  • tags2 (ndarray<int32>) – a numpy array of particle tags in the second group.

\[U = \sum_{i \in \mathrm{tags1}, j \in \mathrm{tags2}} V_{ij}(r)\]

where \(V_{ij}(r)\) is the pairwise energy between two particles \(i\) and \(j\).

Assumed properties of the sets tags1 and tags2 are:

  • tags1 and tags2 are disjoint

  • all elements in tags1 and tags2 are unique

  • tags1 and tags2 are contiguous numpy arrays of dtype int32

None of these properties are validated.

Examples:

tags = numpy.linspace(0, N - 1, 1, dtype=numpy.int32)
# computes the energy between even and odd particles
U = mypair.compute_energy(
    tags1=numpy.array(tags[0:N:2]),
    tags2=numpy.array(tags[1:N:2]),
)