The module constructs a set of wavevectors \vec k compatible with the reciprocal space of the periodic simulation box and grouped into shells according to their wavenumber, |\vec k|. The wavevectors are of the form

\vec k = (k_x, k_y, \dots) = \left(n_x \frac{2\pi}{L_x}, n_y
\frac{2\pi}{L_y}, \dots \right)

where n_x, n_y, \dots are integers and L_x, L_y, \dots denote the edge length of the cuboid box.

Two modes are supported:

  1. a sparse sampling of thin shells according to a predefined set of wavenumbers \{ k_i \}, allowing for a relative deviation of the wavenumber. The number of wavevectors per shell may be limited to avoid excessively large shells for large wavenumber.
  2. a dense grid of wavevectors from all points of the reciprocal lattice up to the maximum wavenumber given, |\vec k| < \max \{ k_i \}. The result is grouped into shells according to the wavenumbers given. In this case, shells are half-open sets, k_{i-1} \leq |\vec k| < k_i, provided that k_i < k_j for all i < j.

The list of wavenumbers may be constructed using halmd.observables.utility.semilog_grid, where the smallest wavenumber is given by 2\pi / \max(L_x, L_y, \dots).


local numeric = halmd.numeric
local utility = halmd.observables.utility

local box = halmd.mdsim.box({length={5,10,20}})

local qmin = 2 * math.pi / numeric.max(box.length)
local grid = utility.semilog_grid({start=qmin, stop=5 * math.pi, decimation=10})
local wavevector = utility.wavevector({box = box, wavenumber = grid.value, tolerance=0.05, max_count=7})
class halmd.observables.utility.wavevector(args)

Construct instance of wavevector module.

  • args (table) – keyword arguments
  • args.box – instance of halmd.mdsim.box
  • args.wavenumber (table) – list of wavenumbers
  • args.dense (boolean) – dense grid of wavevectors (default: false)
  • args.tolerance (number) – relative tolerance on wavevector magnitude
  • args.max_count (integer) – maximum number of wavevectors per wavenumber shell
  • args.filter (table) – filter on wavevectors (default: {1, …, 1})

If dense is true, a dense grid of wavevectors is created. Otherwise, the arguments tolerance and max_count are required and a sparse sampling of wavevectors is returned.

The argument filter contains 0 or 1 for each Cartesian coordinate, 0 deletes the respective wavevector component.


Returns data slot that yiels the wavenumber grid.


Returns data slot that yiels the list of wavevectors grouped by their magnitude in ascending order.

Parameters:other – instance of halmd.observables.utility.wavevector

Implements the equality operator a = b and returns true if the other wavevector instance is the same as this one.

halmd.observables.utility.wavevector.add_options(parser, defaults)

Add module options to command line parser: wavenumbers, tolerance, max-count.