1 #ifndef OPENMPCD_PAIRPOTENTIALS_WEEKSCHANDLERANDERSEN_HPP
2 #define OPENMPCD_PAIRPOTENTIALS_WEEKSCHANDLERANDERSEN_HPP
4 #include <OpenMPCD/PairPotentials/Base.hpp>
11 namespace PairPotentials
37 template<
typename T = FP>
49 : epsilon(epsilon), sigma(sigma)
77 const T sigma2 = sigma * sigma;
78 const T cutoff =
pow(2, 1.0/3) * sigma2;
83 const T frac2 = sigma2 / r2;
84 const T frac6 = frac2 * frac2 * frac2;
85 const T frac12 = frac6 * frac6;
87 return R * (24 * epsilon / r2 * ( 2 * frac12 - frac6 ));
108 const T sigma2 = sigma * sigma;
109 const T cutoff =
pow(2, 1.0/3) * sigma2;
114 const T frac2 = sigma2 / r2;
115 const T frac6 = frac2 * frac2 * frac2;
116 const T frac12 = frac6 * frac6;
118 return 4 * epsilon * (frac12 - frac6 + 1.0/4);
128 #endif //OPENMPCD_PAIRPOTENTIALS_WEEKSCHANDLERANDERSEN_HPP
OPENMPCD_CUDA_HOST_AND_DEVICE boost::enable_if< boost::is_floating_point< T >, bool >::type isZero(const T &val)
Returns whether the given value is zero.
Weeks-Chandler-Andersen (WCA) potential.
#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 T potential(const Vector3D< T > &R) const
Returns the potential of the interaction for a given position vector.
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.
Abstract base class for pair potentials.
OPENMPCD_CUDA_HOST_AND_DEVICE WeeksChandlerAndersen(const T epsilon, const T sigma)
The constructor.
OPENMPCD_CUDA_HOST_AND_DEVICE RealType getMagnitudeSquared() const
Returns the square of the magnitude of this vector.