# atsim.potentials.spline¶

## Package Contents¶

### Classes¶

 Spline_Point(potential_function, r) Class for the attachment and detachment points of potential objects and region to be splined Exp_Spline(detach_point, attach_point) Class for represention splines of the form: Buck4_Spline(detach_point, attach_point, r_min) Class for representing the splined part of the four ranged Buckingham potential. Custom_SplinePotential(spline) Callable to allow splining of one potential to another SplinePotential(startPotential, endPotential, detachmentX, attachmentX) Callable to allow splining of one potential to another using an exponential spline Buck4_SplinePotential(startPotential, endPotential, detachmentX, attachmentX, r_min) Callable to allow splining of one potential to another using the Buck4 spline type

### Functions¶

 gradient(func, h=1e-06) Function wrapper that returns derivative of func.
atsim.potentials.spline.gradient(func, h=1e-06)[source]

Function wrapper that returns derivative of func.

If the callable, func provides a .deriv(r) method this will be used to evaluate the derivative of the function, if not the returned function will use num_deriv() in gradient evaluation.

If the callable additionally provides a .deriv2(r) method, representing its second derivative, the function returned by this routine will have a deriv() method which will delegate to func.deriv2() when called.

By providing .deriv() and .deriv2() on the func callable analytical descriptions of a potential’s first and second derivatives may be specified.

Parameters: func – Function to be wrapped h – Step size used when performing numerical differentiation Function that returns derivative of func
atsim.potentials.spline.polynomial[source]
atsim.potentials.spline.exp_spline[source]
class atsim.potentials.spline.Spline_Point(potential_function, r)[source]

Bases: object

Class for the attachment and detachment points of potential objects and region to be splined

potential_function[source]

Potential function

r[source]

Value at which splining takes place

v[source]

Value of potential_function at r

deriv[source]

First derivative of potential_function: dv/dr(r)

deriv2[source]

Second derivative of potential_function: d2v/dr^2(r)

deriv_callable[source]
deriv2_callable[source]
class atsim.potentials.spline.Exp_Spline(detach_point, attach_point)[source]

Bases: object

Class for represention splines of the form:

$U(r_{ij}) = \exp \left( B_0 + B_1 r_{ij} + B_2 r_{ij}^2 + B_3 r_{ij}^3 + B_4 r_{ij}^4 + B_5 r_{ij}^5 \right) + C$

The spline coefficients $$B_{0...5}$$ and C can be obtained using the spline_coefficients() property.

detach_point[source]

Spline_Point giving start of splined region

attach_point[source]

Spline_Point giving end of splined region

spline_coefficients[source]

Coefficients for spline_function

__call__(self, r)[source]
deriv(self, r)[source]
deriv2(self, r)[source]
class atsim.potentials.spline.Buck4_Spline(detach_point, attach_point, r_min)[source]

Bases: object

Class for representing the splined part of the four ranged Buckingham potential.

Between the detachment point and r_min this is a 5th order polynomial:

$U(r_{ij}) = A_0 + A_1 r_{ij} + A_2 r_{ij}^2 + A_3 r_{ij}^3 + A_4 r_{ij}^4 + A_5 r_{ij}^5$

and between r_min and the re-attachment point a 3rd order spline is used:

$U(r_{ij}) = B0 + B_1 r_{ij} + B_2 r_{ij}^2 + B_3 r_{ij}^3$

The spline coefficients $$A_{0..5}$$ and $$B_{0..3}$$ are solved such that the the spline values match with the potential functions at the detach and re-attachment points and r_min. They are continuous in their first and second derivatives across these points and where the two splines meet at r_min. Finally, the derivative at r_min is set to be 0 with the aim of creating a minimum.

detach_point[source]

Spline_Point giving start of splined region

attach_point[source]

Spline_Point giving end of splined region

r_min[source]

Position of minimum

spline_coefficients[source]

Spline coefficients as list of form [A_0, A_1, A_2, A_3, A_4, A_5, B_0, B_1, B_2, B_3]

spline5[source]

Callable (atsim.potentials.potentialfunctions.polynomial) object representing the fifth order section of the buck4 spline - between detach_point and r_min

spline3[source]

Callable (atsim.potentials.potentialfunctions.polynomial) object representing the fifth order section of the buck4 spline - between detach_point and r_min

__call__(self, r)[source]
deriv(self, r)[source]
deriv2(self, r)[source]
class atsim.potentials.spline.Custom_SplinePotential(spline)[source]

Bases: object

Callable to allow splining of one potential to another

startPotential[source]
Returns: Function defining potential for separations < detachmentX
endPotential[source]
Returns: Function defining potential for separations > attachmentX
interpolationFunction[source]
Returns: Spline object connecting startPotential and endPotential for separations detachmentX < rij < attachmentX
detachmentX[source]
Returns: Point at which spline should start
attachmentX[source]
Returns: Point at which spline should end
splineCoefficients[source]
Returns: Tuple containing the seven coefficients of the spline polynomial
__call__(self, rij)[source]
Parameters: rij – separation at which to evaluate splined potential spline value
class atsim.potentials.spline.SplinePotential(startPotential, endPotential, detachmentX, attachmentX)[source]

Callable to allow splining of one potential to another using an exponential spline

class atsim.potentials.spline.Buck4_SplinePotential(startPotential, endPotential, detachmentX, attachmentX, r_min)[source]

Callable to allow splining of one potential to another using the Buck4 spline type