Defines a cylindrical domain and a predicate whether a given position is inside or outside of the domain.

The cylinder is parametrised by an axis vector \hat n, a centre point \vec a on that axis, a radius \rho, and a length \ell. A point \vec r is inside of the cylinder if

|\Delta \vec r|^2 - (\Delta \vec r \cdot \hat n)^2 \leq \rho^2
\: \text{and} \:
|\Delta \vec r \cdot \hat n| \leq \ell/2 \,,
\quad \Delta \vec r = \vec r - \vec a \,.

class halmd.mdsim.geometries.cylinder(args)

Construct cylinder geometry instance.

  • args (table) – keyword arguments
  • args.centre (table) – cylinder centre
  • args.radius (number) – cylinder radius
  • args.length (number) – cylinder length
  • args.precision (string) –

    floating point precision (optional)

    The supported values for precision are single and double. If precision is not specified, the precision is selected according to the compute device: single for GPU computing and double otherwise.


This module does not perform a validation of the meaningfulness of the domain, i.e. it does not test whether the geometry is placed outside the simulation domain.


Coordinates of cylinder axis vector, which may have any non-zero length.


Coordinates of cylinder centre.


Cylinder radius.


Cylinder length.


The volume of the cylinder.