relentless.simulate.PairPotentialTabulator#

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

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.

  • exclusions (list) – The neighborlist nominally includes all pairs within rmax of each other. This option allows for exclusions of pairs that should not be included in the neighbor list. The string should be formatted as a tuple of strings. Allowed values are ‘1-2’, ‘1-3’, and ‘1-4’.

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

exclusions

The pairs to exclude from the neighbor list.

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.

types

The types of the potentials.

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

property exclusions#

The pairs to exclude from the neighbor list.

Exclusions are formatted as a tuple of strings. Allowed values are:

  • '1-2': Exclude pairs separated by one bond.

  • '1-3': Exclude pairs separated by two bonds.

  • '1-4': Exclude pairs separated by three bonds.

Type:

tuple

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

property types#

The types of the potentials.

Type:

tuple