:orphan: :mod:`atsim.potentials._potential` ================================== .. py:module:: atsim.potentials._potential Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: atsim.potentials._potential.Potential .. py:class:: Potential(speciesA, speciesB, potentialFunction, h=1e-06) Bases: :class:`object` Class used to describe a potential to the :func:`~atsim.potentials.writePotentials()` function. Potential objects encapsulate a python function or callable which is used by the :meth:`~atsim.potentials.Potential.energy` method to calculate potential energy. The :meth:`~atsim.potentials.Potential.force` method returns :math:`\frac{-dU}{dr}`\ . If the energy callable provides `.deriv()` and `.deriv2()` methods these are used for evaluating the first and second derivatives of energy with respect to sepration. This allows analytical derivatives to be defined to the Potential object. When not defined, numerical derivatives are used instead. The :func:`gradient` function is used to wrap the energy callable so that the correct derivative implementation is used. .. attribute:: speciesA .. attribute:: speciesB .. attribute:: potentialFunction .. method:: energy(self, r) :param r: Separation :return: Energy for given separation .. method:: force(self, r) Calculate force for this potential at a given separation. If this object's potentialFunction has a .deriv() method this will be used to calculate force (allowing analytical derivatives to be specified). If potentialFunction doesn't have a deriv method then a numerical derivative of the potential function will be returned instead. :param r: Separation :type r: float :return: -dU/dr at given separation :rtype: float