Semi-logarithmic grid

Construct a semi-logarithmically spaced grid. The grid consists of a concatenation of linearly spaced grids and starts with multiples of the smallest value. After a given number of points, the grid is “decimated” by doubling the spacing until a maximum value is reached. A logarithmic grid is obtained by decimation=1, decimation is disabled by default.


-- construct grid from 0.1 to 4, double spacing every 3 points
local grid = semilog_grid({start=0.1, stop=4, decimation=3})

-- print the result
for i,x in pairs(grid.value) do
    io.write(x .. " ")

The result is a grid of 12 points: 0.1 0.2 0.3 0.4 0.6 0.8 1.0 1.4 1.8 2.2 3.0 3.8.


Return array of grid points.

class halmd.observables.utility.semilog_grid(args)

Construct instance of semilog_grid module.

  • args (table) – keyword arguments
  • args.start (number) – first grid point, corresponds to initial spacing
  • args.stop (number) – upper limit on grid points (not included)
  • args.decimation (integer) – decimation parameter: 0=disabled (default), 1=logarithmic, …
halmd.observables.utility.semilog_grid.add_options(parser, defaults)

Add module options maximum and decimation to command line parser.