1 class WeeksChandlerAndersen_DistanceOffset:
3 A generalization of the Weeks-Chandler-Andersen (WCA) potential.
5 The Weeks-Chandler-Andersen potential has been introduced by Weeks,
6 Chandler, and Andersen, in J. Chem. Phys. 54, 5237 (1971).
9 This generalization introduces an offset \f$ D \f$ of the particle distance
10 \f$ r \f$. With \f$ \epsilon \f$ and \f$ sigma \f$ being parameters, the
11 interaction potential is given by
15 \left( \frac{ \sigma }{ r - D } \right)^{12}
17 \left( \frac{ \sigma }{ r - D } \right)^{6}
22 \theta \left( 2^{1/6} \sigma - r + D \right)
24 with \f$ \theta \left( x \right) \f$ being the Heaviside step function,
25 which is \f$ 1 \f$ if \f$ x > 0 \f$, and \f$ 0 \f$ otherwise.
28 def __init__(self, epsilon, sigma, d):
33 Throws if `epsilon`, `sigma`, or `d` are neither `int` nor
36 Throws if `epsilon`, `sigma`, or `d` are negative.
39 The \f$ \epsilon \f$ potential parameter, which must be
42 The \f$ \sigma \f$ potential parameter, which must be
45 The \f$ D \f$ potential parameter, which must be
49 for var
in [epsilon, sigma, d]:
50 if not isinstance(var, (int, float)):
62 Returns the \f$ \epsilon \f$ potential parameter as a `float`.
70 Returns the \f$ \sigma \f$ potential parameter as a `float`.
78 Returns the \f$ D \f$ potential parameter as a `float`.
86 Returns the potential for an input value of \f$ r \f$.
89 Throws if `r` is neither `int` nor `float` or `Vector3DReal`.
91 Throws if `r` is negative.
93 Throws if `r` is smaller than or equal to \f$ D \f$.
96 The input value. It may be either an `int` or `float`, in
97 which case it must be non-negative. Alternatively, it may be
98 of type `Vector3DReal`, which is then euqivalent to calling
99 `getPotential(r.getLength())` instead.
104 if isinstance(r, Vector3DReal):
107 if not isinstance(r, (int, float)):
119 sigma2 = sigma * sigma
121 cutoff = 2 ** (1.0 / 6.0) * sigma
126 denominator2 = (r - d) * (r - d)
127 frac2 = sigma2 / denominator2
128 frac6 = frac2 * frac2 * frac2
129 frac12 = frac6 * frac6
131 return 4 * self.
getEpsilon() * (frac12 - frac6 + 1.0 / 4)