Custom pair potential

This module implements a custom pair potential,

U^{(ij)}_\text{custom}\left(r\right) = \text{FIXME (put LaTeX formula of the custom potential)}

for the interaction between two particles of species i and j. The template assumes three potential parameters, named \sigma_{ij}, p^{(2)}_{ij}, and p^{(3)}_{ij}. One of the parameters must be named \sigma, which is used as the unit of length by the Potential truncations.

The corresponding source files contain FIXME markers where adjustments to a specific potential are needed. These files are:

halmd/mdsim/host/potentials/pair/custom.cpp
halmd/mdsim/host/potentials/pair/custom.hpp
halmd/mdsim/gpu/potentials/pair/custom.cpp
halmd/mdsim/gpu/potentials/pair/custom.hpp
halmd/mdsim/gpu/potentials/pair/custom_kernel.cu
halmd/mdsim/gpu/potentials/pair/custom_kernel.hpp
lua/halmd/mdsim/potentials/pair/custom.lua.in
test/unit/mdsim/potentials/pair/custom.cpp

The last file contains a unit test, where reference values for U^{(ij)}_\text{custom}(r) must be provided for a number of distances r and a few combinations of potential parameters. The Python script compute_potential_reference.py in the same folder can generate such values.

class halmd.mdsim.potentials.pair.custom(args)

Construct custom potential.

Parameters:
  • args (table) – keyword arguments
  • args – keyword arguments
  • args.sigma (table) – matrix with elements \sigma_{ij} (default: 1)
  • args.param2 (table) – matrix with elements p^{(2)}_{ij} (default: 1)
  • args.param3 (table) – matrix with elements p^{(3)}_{ij} (default: 1)
  • args.species (number) – number of particle species (optional)
  • args.memory (string) – select memory location (optional)
  • args.label (string) – instance label (optional)

If the argument species is omitted, it is inferred from the first dimension of the parameter matrices.

If all elements of a matrix are equal, a scalar value may be passed instead which is promoted to a square matrix of size given by the number of particle species.

The supported values for memory are “host” and “gpu”. If memory is not specified, the memory location is selected according to the compute device.

sigma

Matrix with elements \sigma_{ij}.

param2

Matrix with elements p^{(2)}_{ij}.

param3

Matrix with elements p^{(3)}_{ij}.

description

Name of potential for profiler.

memory

Device where the particle memory resides.

truncate(args)

Truncate potential. See Potential truncations for available truncations.

Parameters:
  • args (table) – keyword argument
  • args[1] (string) – name of truncation type
  • cutoff (table) – matrix with elements r_{\text{c}, ij}
  • args.* (any) – additional arguments depend on the truncation type
Returns:

truncated potential

Example:

potential = potential:truncate({"smooth_r4", cutoff = 5, h = 0.05})
modify(args)

Apply potential modification. See Potential modifications for available modifications.

Parameters:
  • args (table) – keyword argument
  • args[1] (string) – name of modification type
  • args.* (any) – additional arguments depend on the modification type
Returns:

modified potential

Example:

potential = potential:modify({"hard_core", radius = 0.5})