1 #ifndef OPENMPCD_PAIRPOTENTIALS_WEEKSCHANDLERANDERSEN_DISTANCEOFFSET_HPP
2 #define OPENMPCD_PAIRPOTENTIALS_WEEKSCHANDLERANDERSEN_DISTANCEOFFSET_HPP
4 #include <OpenMPCD/PairPotentials/Base.hpp>
11 namespace PairPotentials
38 template<
typename T = FP>
55 const T epsilon,
const T sigma,
const T d)
56 : epsilon(epsilon), sigma(sigma), d(d)
87 const T sigma2 = sigma * sigma;
88 const T cutoff =
pow(2, 1.0/6) * sigma;
94 const T denominator2 = (r - d) * (r - d);
95 const T frac2 = sigma2 / denominator2;
96 const T frac6 = frac2 * frac2 * frac2;
97 const T frac12 = frac6 * frac6;
99 return R * (24 * epsilon / (r * (r - d)) * ( 2 * frac12 - frac6 ));
121 const T sigma2 = sigma * sigma;
122 const T cutoff =
pow(2, 1.0/6) * sigma;
124 const T r =
sqrt(r2);
127 const T denominator2 = (r - d) * (r - d);
128 const T frac2 = sigma2 / denominator2;
129 const T frac6 = frac2 * frac2 * frac2;
130 const T frac12 = frac6 * frac6;
132 return 4 * epsilon * (frac12 - frac6 + 1.0/4);
170 #endif //OPENMPCD_PAIRPOTENTIALS_WEEKSCHANDLERANDERSEN_DISTANCEOFFSET_HPP
A generalization of the Weeks-Chandler-Andersen (WCA) potential.
OPENMPCD_CUDA_HOST_AND_DEVICE T getSigma() const
Returns the parameter.
#define OPENMPCD_DEBUG_ASSERT(assertion)
Asserts that the given expression evaluates to true, but only if OPENMPCD_DEBUG is defined.
OPENMPCD_CUDA_HOST_AND_DEVICE boost::enable_if< boost::is_integral< B >, double >::type pow(const B base, const double exponent)
The power function.
#define OPENMPCD_CUDA_HOST_AND_DEVICE
Denotes a function to be callable both from the Host and from a CUDA Device.
OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D< T > force(const Vector3D< T > &R) const
Returns the force vector of the interaction for a given position vector.
OPENMPCD_CUDA_HOST_AND_DEVICE T getD() const
Returns the parameter.
OPENMPCD_CUDA_HOST_AND_DEVICE WeeksChandlerAndersen_DistanceOffset(const T epsilon, const T sigma, const T d)
The constructor.
OPENMPCD_CUDA_HOST_AND_DEVICE T potential(const Vector3D< T > &R) const
Returns the potential of the interaction for a given position vector.
OPENMPCD_CUDA_HOST_AND_DEVICE T sqrt(const T x)
Returns the sqaure root of the argument.
Abstract base class for pair potentials.
OPENMPCD_CUDA_HOST_AND_DEVICE T getEpsilon() const
Returns the parameter.
OPENMPCD_CUDA_HOST_AND_DEVICE RealType getMagnitudeSquared() const
Returns the square of the magnitude of this vector.