Go to the documentation of this file.
8 #ifndef OPENMPCD_PAIRPOTENTIALS_MAGNETICDIPOLEDIPOLEINTERACTION_CONSTANTIDENTICALDIPOLES_HPP
9 #define OPENMPCD_PAIRPOTENTIALS_MAGNETICDIPOLEDIPOLEINTERACTION_CONSTANTIDENTICALDIPOLES_HPP
11 #include <OpenMPCD/PairPotentials/Base.hpp>
15 #include <boost/core/is_same.hpp>
16 #include <boost/static_assert.hpp>
17 #include <boost/type_traits/remove_cv.hpp>
21 namespace PairPotentials
56 template<
typename T = FP>
72 const T prefactor_,
const Vector3D<T>& orientation_)
73 : prefactor(prefactor_), orientation(orientation_)
79 typename boost::remove_cv<T>::type,
106 const T r_m2 = 1 / r2;
107 const T r_m3 = r_m2 /
sqrt(r2);
108 const T r_m5 = r_m2 * r_m3;
110 const T dot = orientation.dot(R);
114 F -= (5 * r_m2 * dot * dot - 1) * R;
116 return (3 * prefactor * r_m5) * F;
135 const T r_m2 = 1 / r2;
136 const T r_m3 = r_m2 /
sqrt(r2);
137 const T dot = R.
dot(orientation);
139 return - prefactor * r_m3 * (3 * dot * dot * r_m2 - 1);
168 #endif //OPENMPCD_PAIRPOTENTIALS_MAGNETICDIPOLEDIPOLEINTERACTION_CONSTANTIDENTICALDIPOLES_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.
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D< T > & getDipoleOrientation() const
Returns the dipole orientation .
const OPENMPCD_CUDA_HOST_AND_DEVICE T dot(const Vector3D &rhs) const
Returns the scalar product of this vector with the given vector.
Interactions between two constant and identical magnetic dipoles.
#define OPENMPCD_DEBUG_ASSERT(assertion)
Asserts that the given expression evaluates to true, but only if OPENMPCD_DEBUG is defined.
#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 MagneticDipoleDipoleInteraction_ConstantIdenticalDipoles(const T prefactor_, const Vector3D< T > &orientation_)
The constructor.
OPENMPCD_CUDA_HOST_AND_DEVICE T getPrefactor() const
Returns the term .
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 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 RealType getMagnitudeSquared() const
Returns the square of the magnitude of this vector.