Box

The box module keeps the edge lengths of the simulation box, and implements periodic boundary conditions for use in other modules. At present the module supports cuboid box geometries.

Example:

local box = halmd.mdsim.box({length = {100, 100, 10})
class halmd.mdsim.box(args)

Construct box.

Parameters:
  • args (table) – keyword arguments
  • args.edges (table) – sequence of edge vectors (parallelepiped)
  • args.length (table) – sequence of edge lengths (cuboid)
Returns:

instance of box

Warning

Non-cuboid geometries are not implemented, edges must be a diagonal matrix.

dimension

Space dimension of the simulation box as a number.

edges

Edge vectors as a matrix.

For a cuboid simulation domain, edges is equal to

{{length[1], 0, 0},
 {0, length[2], 0},
 {0, 0, length[3]}}
length

Edge lengths as a sequence.

origin

Coordinates of the lowest corner of the box.

writer(file)

Write box specification to file.

http://nongnu.org/h5md/draft.html#box-specification

Parameters:file – instance of file writer
Returns:instance of group writer

Note that the box specification will not be written immediately, but upon the start of the simulation. The writer is connected to the on_start signal of sampler.

halmd.mdsim.box.reader(file)

Read edge vectors of simulation domain from H5MD file.

http://nongnu.org/h5md/draft.html#box-specification

Parameters:file – instance of halmd.io.readers.h5md
Returns:edge vectors

The return value may be used to restore the domain:

local file = readers.h5md({path = args.trajectory})
local edges = mdsim.box.reader(file)
local box = mdsim.box({edges = edges})