Tabulated Force Generator¶
This module is intended to be used in combination with halmd.mdsim.forces.tabulated
.
If the external potential can be calculated from a potential listed in
halmd.mdsim.potentials
, this helper force will generate the needed
coefficients for the interpolation scheme in halmd.mdsim.forces.tabulated
.
For the given potential, the first species (0
) always corresponds to
the test particle that can move freely in space.
All other species in particle
can be used to distinguish different
particles. The particle
is instance must only contain particles that
form the external tabulated potential.
Generated coefficients¶
The generated coefficients are the potential values and its derivatives. Depending on the dimension of the system, the generated coefficients are (in that order): , , , , , , , , where is the position of the knot.
The partial derivatives in -direction are calculated only for 3D systems, i.e. coefficients will be calculated for each knot.
The coefficients will be returned as a one-dimensional array, where the index
of the first coefficient can be determined by
multi_index_to_offset()
.
Note
The coefficient generator is implemented as host variant only.
-
class
halmd.mdsim.forces.
tabulated_generator
(args)¶ Construct tabulated force.
Parameters: - args (table) – keyword arguments
- args.potential – instance of
halmd.mdsim.potentials
- args.particle – instance of
halmd.mdsim.particle
- args.box – instance of
halmd.mdsim.box
- args.grid_size (number table) – number of grid points in each dimension
Returns: instance of tabulated coefficient generator
-
get_coefficients
()¶ Return the calculated coefficients
-
write_coefficients
(args)¶ Write interpolation coefficients for external force to file.
Parameters: - args (table) – keyword arguments
- args.file – instance of file reader
- args.location (string table) – location within file (optional)
The argument
location
specifies a path in a structured file format like H5MD given as a table of strings. If omitted it defaults to{"parameters"}
.
-
disconnect
()¶ Disconnect force from profiler.