OpenMPCD
CUDA/NormalMode.hpp
Go to the documentation of this file.
1 /**
2  * @file
3  * Declares functionality in the `OpenMPCD::CUDA::NormalMode` namespace.
4  */
5 
6 #ifndef OPENMPCD_CUDA_NORMALMODE_HPP
7 #define OPENMPCD_CUDA_NORMALMODE_HPP
8 
9 #include <OpenMPCD/Types.hpp>
10 
11 #include <vector>
12 
13 namespace OpenMPCD
14 {
15 namespace CUDA
16 {
17 
18 /**
19  * Namespace for Host-callable CUDA functionality related to normal modes.
20  *
21  * @see OpenMPCD::NormalMode
22  */
23 namespace NormalMode
24 {
25 
26 /**
27  * Calculates all normal coordinates for a number of polymer chains stored
28  * contiguously in Device memory.
29  *
30  * @see OpenMPCD::NormalMode
31  *
32  * @throw OpenMPCD::InvalidArgumentException
33  * If `OPENMPCD_DEBUG` is defined, throws if `chainLength == 0`.
34  * @throw OpenMPCD::NULLPointerException
35  * If `OPENMPCD_DEBUG` is defined, throws if `normalModes0 == nullptr`.
36  * @throw OpenMPCD::NULLPointerException
37  * If `OPENMPCD_DEBUG` is defined, throws if `normalModesT == nullptr`.
38  *
39  * @param[in] chainLength
40  * The number of particles in a chain, which must be greater than
41  * `0`.
42  * @param[in] chainCount
43  * The number of chains present.
44  * @param[in] positions
45  * The Device array of particle positions.
46  * It is assumed that first, the `x`, `y`, and `z` coordinates of
47  * the first chain's first particle are stored, followed by the
48  * first chain's second particle, and so forth, up to the first
49  * chain's last particle. After that, the second chain's particles
50  * follow in a similar fashion, and so forth.
51  * @param[out] normalModeCoordinates
52  * A Device buffer that holds at least
53  * `3 * chainCount * (chainLength + 1)` elements, where the
54  * calculated normal mode coordinates will be saved.
55  * First, the normal mode coordinates of the first chain will be
56  * saved (starting with the `x`, `y`, and `z` coordinate of the
57  * normal mode `0`, followed by mode `1`, up to and including mode
58  * `N`), followed by the second chain, and so forth.
59  * @param[in] shift
60  * The shift parameter \f$ S \f$.
61  */
63  const unsigned int chainLength,
64  const unsigned int chainCount,
65  const MPCParticlePositionType* const positions,
66  MPCParticlePositionType* const normalModeCoordinates,
67  const MPCParticlePositionType shift = 0);
68 
69 /**
70  * Computes the average normal mode coordinate autocorrelation functions.
71  *
72  * With \f$ \vec{q}_i^k (t) \f$ being the normal mode coordinates for mode
73  * \f$ i \f$ of chain \f$ k \f$ at time \f$ t \f$, this returns, for each
74  * normal mode \f$ i \in \left[0, N\right] \f$ and with \f$ N_C \f$ being
75  * the number of chains in the fluid, the average
76  * \f$ N_C^{-1} \sum_{k=1}^{N_C} \vec{q}_i^k (0) \cdot \vec{q}_i^k (T) \f$,
77  * where \f$ \cdot \f$ denotes the inner product.
78  *
79  * @see OpenMPCD::NormalMode
80  *
81  * @throw OpenMPCD::InvalidArgumentException
82  * Throws if `chainLength == 0`.
83  * @throw OpenMPCD::NULLPointerException
84  * If `OPENMPCD_DEBUG` is defined, throws if `normalModes0 == nullptr`.
85  * @throw OpenMPCD::NULLPointerException
86  * If `OPENMPCD_DEBUG` is defined, throws if `normalModesT == nullptr`.
87  *
88  * @param[in] chainLength The number of particles in a chain, which must not
89  * be `0`.
90  * @param[in] chainCount The number \f$ N_C \f$ of chains.
91  * @param[in] normalModes0 Device pointer to the normal mode coordinates at
92  * time \f$ 0 \f$, as calculated by
93  * `calculateNormalModeCoordinatesForChain`.
94  * @param[in] normalModesT Device pointer to the normal mode coordinates at
95  * time \f$ T \f$, as calculated by
96  * `calculateNormalModeCoordinatesForChain`.
97  * @return
98  * Returns the average autocorrelation of the normal mode vector
99  * \f$ \vec{q}_i \f$ at index `i`, for all `i` in the range `[0, chainLength]`.
100  */
101 const std::vector<MPCParticlePositionType>
103  const unsigned int chainLength,
104  const unsigned int chainCount,
105  const MPCParticlePositionType* const normalModes0,
106  const MPCParticlePositionType* const normalModesT);
107 
108 } //namespace NormalMode
109 } //namespace CUDA
110 } //namespace OpenMPCD
111 
112 
113 #endif //OPENMPCD_CUDA_NORMALMODE_HPP
OpenMPCD::CUDA::NormalMode::getAverageNormalCoordinateAutocorrelation
const std::vector< MPCParticlePositionType > getAverageNormalCoordinateAutocorrelation(const unsigned int chainLength, const unsigned int chainCount, const MPCParticlePositionType *const normalModes0, const MPCParticlePositionType *const normalModesT)
Computes the average normal mode coordinate autocorrelation functions.
OpenMPCD::CUDA::NormalMode::computeNormalCoordinates
void computeNormalCoordinates(const unsigned int chainLength, const unsigned int chainCount, const MPCParticlePositionType *const positions, MPCParticlePositionType *const normalModeCoordinates, const MPCParticlePositionType shift=0)
Calculates all normal coordinates for a number of polymer chains stored contiguously in Device memory...
OpenMPCD::MPCParticlePositionType
FP MPCParticlePositionType
The data type for the positions of MPC particles.
Definition: Types.hpp:15
Types.hpp