Neighbour List

This module provides the implementation for a Verlet neighbour list. It stores the neighbours for each particle that are within a certain radius to reduce the computational cost for the force calculation in each time step.

Due to its nature it can only work with finite interaction potentials.

class halmd.mdsim.neighbour(args)

Construct neighbour module.

  • args (table) – keyword arguments
  • args.particle – instance, or sequence of two instances, of halmd.mdsim.particle
  • – instance of
  • args.r_cut (table) – matrix with elements r_{\text{c}, ij}
  • (number) – neighbour list skin (default: 0.5)
  • args.algorithm (string) – Preferred implementation of the neighbour list (GPU variant only)
  • args.occupancy (number) – Desired cell occupancy. Defaults to halmd.mdsim.defaults.occupancy() (GPU variant only)
  • args.disable_binning (boolean) – Disable use of binning module and construct neighbour lists from particle positions directly (default: false).
  • args.disable_sorting (boolean) – Disable use of Hilbert sorting halmd.mdsim.sorts.hilbert (default: false).
  • args.displacement – instance or two instances of halmd.mdsim.max_displacement (optional)
  • args.binning – instance or two instances of halmd.mdsim.binning (optional)

If all elements in r_cut matrix are equal, a scalar value may be passed instead.

If displacement or binning is left unspecified, a default module of halmd.mdsim.max_displacement or halmd.mdsim.binning is constructed. Providing an instance of the respective module allows the reuse of the module (e.g. when different neighbour lists share the first instance of particle).

For the host implementation of the particle module with binning disabled, Hilbert sorting is disabled also.

Specifying algorithm will affect the GPU implementation of the neighbour list build when binning is enabled only. The available algorithms are naive and shared_mem, where the latter tends to be faster on older GPUs (i.e. ≤ Tesla C1060), but slower on at least GTX 260 and later. Note that the shared_mem algorithm works only when both binning modules have equal number of cells in each spatial direction.


Sequence of the two instances of halmd.mdsim.particle.


Sequence of two instances of halmd.mdsim.max_displacement.


Sequence of two instances of halmd.mdsim.binning. May be nil if binning was disabled.


Average cell occupancy. Only available on GPU variant.


“Skin” of the particle. This is an additional distance ratio added to the cutoff radius. Particles within this extended sphere are stored as neighbours.


Disconnect neighbour module from core and profiler.