Linear interpolation¶
When passed to halmd.mdsim.forces.tabulated
, this function
calculates the potential energy and force from lattice points of
precalculated potential energy points and coefficients at the lattice points.
In 1D the interpolated value is calculated by the following expression:
where the neighbouring knots are given by and with . is the reduced distance .
In higher dimensions this scheme is extended to bi- and triliniear interpolation.
Coefficients¶
The Cubic Hermite interpolation needs one coefficient per neighbour to determine the interpolated value.
-
class
halmd.mdsim.forces.interpolation.
linear
(args)¶ Construct linear interpolator.
Parameters: - args (table) – keyword arguments
- args.box – instance of
halmd.mdsim.box
- args.length (table) – length of the (optional, defaults to
box.length
) - args.lowest_corner (table) – distance of the box to the lowest corner (optional, defaults to
box.lowest_corner
) - args.nknots (number table) – number of knots in each dimension, including
- args.precision (string) – floating point number precision
Returns: instance of cubic hermite interpolation scheme
If
box
is not given, the argumentslength
andlowest_corner
have to be supplied. This enables the possibility to have a smaller “unit cell” of the interpolation area, while the simulation box may be multiples of this unit cell.length
andlowest_corner
both precedebox
.The linear interpolator supports “single” and “double” as floating point number precision.
-
nknots
¶ Returns the number of grid points in each spatial direction as a sequence.
-
total_knots
¶ Returns the total number of grid knots needed.
-
grid_basis
¶ Returns the edge lengths of one grid cell.
-
log
(logger)¶ Output interpolation scheme to logger
Parameters: logger – instance of halmd.io.log.logger