Harmonic potential

This module implements the harmonic potential,

U_i \left(\vec r\right) = \frac{1}{2} K_i \left(\vec r - \vec r_{0,i} \right)^2

for the potential energy of a particle of species i.

class halmd.mdsim.potentials.external.harmonic(args)

Construct the harmonic potential.

  • args (table) – keyword arguments
  • args.stiffness (table) – sequence of stiffness coefficients K_i
  • args.offset (table) – sequence of offset vectors \vec r_{0,i}
  • args.species (number) – number of particle species (optional)
  • args.memory (string) – select memory location (optional)
  • args.label (string) – instance label (optional)

If all elements of a parameter sequence are equal, a single value may be passed instead. In this case, species must be specified.

If the argument species is omitted, it is inferred from the length of the parameter sequences.

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


Sequence with stiffness coefficients K_i.


Sequence with offset vectors \vec r_{0,i}.


Name of potential for profiler.


Device where the particle memory resides.