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): V(r), \partial_x V(r), \partial_y V(r), \partial_x \partial_y V(r), \partial_z V(r), \partial_x \partial_z V(r), \partial_y \partial_z V(r), \partial_x \partial_y \partial_z V(r), where r is the position of the knot.

The partial derivatives in z-direction are calculated only for 3D systems, i.e. 2^d 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 2^d\times 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:
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.