Go to the documentation of this file.
8 #ifndef OPENMPCD_PAIRPOTENTIALS_MAGNETICDIPOLEDIPOLEINTERACTION_CONSTANTEQUALDIPOLESALONGZ_HPP
9 #define OPENMPCD_PAIRPOTENTIALS_MAGNETICDIPOLEDIPOLEINTERACTION_CONSTANTEQUALDIPOLESALONGZ_HPP
11 #include <OpenMPCD/PairPotentials/Base.hpp>
17 namespace PairPotentials
53 template<
typename T = FP>
66 : prefactor(prefactor)
92 const T r_m2 = 1 / r2;
93 const T r_m3 = r_m2 /
sqrt(r2);
94 const T r_m5 = r_m2 * r_m3;
95 const T r_m7 = r_m5 * r_m2;
97 const T r_x = R.
getX();
98 const T r_y = R.
getY();
99 const T r_z = R.
getZ();
100 const T r_z_squared = r_z * r_z;
101 const T F_x = - 5 * r_x * r_z_squared * r_m7 + r_x * r_m5;
102 const T F_y = - 5 * r_y * r_z_squared * r_m7 + r_y * r_m5;
103 const T F_z = - 5 * r_z * r_z_squared * r_m7 + 3 * r_z * r_m5;
106 return (3 * prefactor) * F;
125 const T r_m2 = 1 / r2;
126 const T r_m3 = r_m2 /
sqrt(r2);
127 const T r_z_squared = R.
getZ() * R.
getZ();
129 return - prefactor * r_m3 * (3 * r_z_squared * r_m2 - 1);
147 #endif //OPENMPCD_PAIRPOTENTIALS_MAGNETICDIPOLEDIPOLEINTERACTION_CONSTANTEQUALDIPOLESALONGZ_HPP
OPENMPCD_CUDA_HOST_AND_DEVICE T getPrefactor() const
Returns the term .
Interactions between two constant and equal magnetic dipoles oriented along the Z axis.
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.
OPENMPCD_CUDA_HOST_AND_DEVICE T getZ() const
Returns the z coordinate.
OPENMPCD_CUDA_HOST_AND_DEVICE T getX() const
Returns the x coordinate.
#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 T getY() const
Returns the y coordinate.
OPENMPCD_CUDA_HOST_AND_DEVICE MagneticDipoleDipoleInteraction_ConstantEqualDipolesAlongZ(const T prefactor)
The constructor.
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 potential(const Vector3D< T > &R) const
Returns the potential 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.
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.