relentless.simulate.PairPotentialTabulator#

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

Tabulate one or more pair potentials.

Enables evaluation of energy, force, and derivative at different positional values (i.e. r).

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

  • start (float) – The minimum value of r at which to tabulate.

  • stop (float) – The maximum value of r at which to tabulate.

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

  • neighbor_buffer (float) – Buffer radius used in computing the neighbor list.

Methods

derivative(pair, var[, x])

Evaluates and accumulates derivative for all potentials.

energy(pair[, x])

Evaluates and accumulates energy for all potentials.

force(pair[, x])

Evaluates and accumulates force for all potentials.

pairwise_energy_and_force(types[, x, tight, ...])

Compute pairwise matrix of energy and force.

Attributes

linear_space

x values spaced linearly from start to stop.

neighbor_buffer

The amount to be added to rmax to search for particles while computing the neighbor list.

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(pair, var, x=None)#

Evaluates and accumulates derivative for all potentials.

Shifts the derivative to be 0 at rmax.

Parameters:
  • pair (str) – The pair 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 derivative at each r value.

Return type:

array_like

energy(pair, x=None)#

Evaluates and accumulates energy for all potentials.

Shifts the energy to be 0 at stop.

Parameters:
  • pair (str) – The pair 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 r value.

Return type:

array_like

force(pair, x=None)#

Evaluates and accumulates force for all potentials.

Parameters:
  • pair (str) – The pair 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 r value.

Return type:

array_like

property linear_space#

x values spaced linearly from start to stop.

Type:

array_like

property neighbor_buffer#

The amount to be added to rmax to search for particles while computing the neighbor list.

Type:

float

property num#

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

Type:

int

pairwise_energy_and_force(types, x=None, tight=False, minimum_num=2)#

Compute pairwise matrix of energy and force.

Parameters:
  • types (array_like) – Types to include in matrix.

  • x (float or array_like) – Pairwise distances at which to evaluate energy and force. Default of None will use a linear space from start to stop.

  • tight (bool) – If True, trim zeros from the ends of the energies and forces using a combination of cutoffs and evaluated potential. This option can only be used when x is an array.

  • minimum_num (int) – When tight is True, the minimum number of points to include, even if they could be trimmed.

Returns:

  • float or numpy.ndarray – Pairwise distance.

  • PairMatrix – Pairwise energies.

  • PairMatrix – Pairwise forces.

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