OpenMPCD
NormalMode.hpp
Go to the documentation of this file.
1 /**
2  * @file
3  * Declares functionality in the `OpenMPCD::NormalMode` namespace.
4  */
5 
6 #ifndef OPENMPCD_NORMALMODE_HPP
7 #define OPENMPCD_NORMALMODE_HPP
8 
9 #include <OpenMPCD/Vector3D.hpp>
10 
11 namespace OpenMPCD
12 {
13 
14 /**
15  * Namespace for functionality related to normal modes.
16  *
17  * Given a number \f$ N \f$ of coordinate vectors \f$ \vec{r}_n \f$,
18  * \f$ n \in \left[ 1, N \right] \f$,
19  * the \f$ i \f$-th normal coordinate \f$ \vec{q}_i \f$, with
20  * \f$ i \in \left[ 0, N \right] \f$, is defined as
21  * \f[
22  * \vec{q}_i
23  * =
24  * \frac{1}{N} \sum_{n=1}^N
25  * \cos\left( \frac{ i \pi \left( n + S \right) }{N} \right) \vec{r}_n
26  * \f]
27  * where \f$ S \f$ is a shift parameter.
28  */
29 namespace NormalMode
30 {
31 
32 /**
33  * Calculates a normal coordinate.
34  *
35  * @see OpenMPCD::NormalMode
36  *
37  * @throw OpenMPCD::NULLPointerException
38  * If `OPENMPCD_DEBUG` is defined, throws if `vectors == nullptr`.
39  * @throw OpenMPCD::InvalidArgumentException
40  * If `OPENMPCD_DEBUG` is defined, throws if `N == 0`, or if `i` is out of
41  * range.
42  *
43  * @tparam T The underlying floating-point data type.
44  *
45  * @param[in] i
46  * The index of the normal coordinate to compute, which must lie in
47  * the range `[0, N]`.
48  * @param[in] vectors
49  * The input vectors to use. Must be a non-`nullptr` pointer pointing
50  * to at least `N` instances.
51  * @param[in] N
52  * The number of input coordinate vectors, which must not be `0`.
53  * @param[in] shift
54  * The shift parameter \f$ S \f$.
55  */
56 template<typename T>
57 const Vector3D<T> computeNormalCoordinate(
58  const unsigned int i, const Vector3D<T>* const vectors,
59  const std::size_t N, const T shift = 0);
60 
61 } //namespace NormalMode
62 } //namespace OpenMPCD
63 
64 
66 
67 #endif //OPENMPCD_NORMALMODE_HPP
OpenMPCD::NormalMode::computeNormalCoordinate
const Vector3D< T > computeNormalCoordinate(const unsigned int i, const Vector3D< T > *const vectors, const std::size_t N, const T shift)
Calculates a normal coordinate.
Definition: ImplementationDetails/NormalMode.hpp:22
NormalMode.hpp
Vector3D.hpp