relentless.simulate.PotentialTabulator#

class relentless.simulate.PotentialTabulator(potentials, start, stop, num)#

Tabulator for an interaction potential.

The energy, force, and derivative are evaluated at different positions x and stored in arrays. The start and end of this range must be specified, along with the number of points (num) to use.

If potentials is None, the tabulator returns zeros for all.

Parameters:
  • potentials (Potential or array_like) – The potential(s) to be tabulated. If array_like, all elements must be Potentials.

  • start (float) – The positional value of x at which to begin tabulation.

  • stop (float) – The positional value of x at which to end tabulation.

  • num (int) – The number of points (value of x) at which to tabulate and evaluate the potential.

Methods

derivative(key, var[, x])

Evaluates and accumulates derivative for all potentials.

energy(key[, x])

Evaluates and accumulates energy for all potentials.

force(key[, x])

Evaluates and accumulates force for all potentials.

Attributes

linear_space

x values spaced linearly from start to stop.

num

The number of points at which to tabulate/evaluate the potential, must be at least 2.

potentials

The individual potentials that are tabulated.

squared_space

x values spaced linearly from start**2` to ``stop**2.

start

The x value at which to start tabulation.

stop

The x value at which to stop tabulation.

derivative(key, var, x=None)#

Evaluates and accumulates derivative for all potentials.

Parameters:
  • key (str) – The key for which to evaluate the derivative for each potential.

  • var (Variable) – Variable to differentiate with respect to.

  • x (float or list) – The pair distance(s) at which to evaluate the derivative. Default of None will use a linear space from start to stop.

Returns:

Accumulated force at each x value.

Return type:

array_like

energy(key, x=None)#

Evaluates and accumulates energy for all potentials.

Parameters:
  • key (str) – The key for which to evaluate the energy for each potential.

  • x (float or list) – The pair distance(s) at which to evaluate the derivative. Default of None will use a linear space from start to stop.

Returns:

Accumulated energy at each x value.

Return type:

array_like

force(key, x=None)#

Evaluates and accumulates force for all potentials.

Parameters:
  • key (str) – The key for which to evaluate the force for each potential.

  • x (float or list) – The pair distance(s) at which to evaluate the derivative. Default of None will use a linear space from start to stop.

Returns:

Accumulated force at each x value.

Return type:

array_like

property linear_space#

x values spaced linearly from start to stop.

Type:

array_like

property num#

The number of points at which to tabulate/evaluate the potential, must be at least 2.

Type:

int

property potentials#

The individual potentials that are tabulated.

Type:

array_like

property squared_space#

x values spaced linearly from start**2` to ``stop**2.

Type:

array_like

property start#

The x value at which to start tabulation.

Type:

float

property stop#

The x value at which to stop tabulation.

Type:

float