OpenMPCD
GaussianChains.hpp
Go to the documentation of this file.
1 /**
2  * @file
3  * Defines the OpenMPCD::CUDA::MPCFluid::GaussianChains class.
4  */
5 
6 #ifndef OPENMPCD_CUDA_MPCFLUID_GAUSSIANCHAINS_HPP
7 #define OPENMPCD_CUDA_MPCFLUID_GAUSSIANCHAINS_HPP
8 
10 
11 namespace OpenMPCD
12 {
13 namespace CUDA
14 {
15 namespace MPCFluid
16 {
17 
18 /**
19  * Generalization of GaussianDumbbells to chains with an arbitrary number of constituent particles.
20  *
21  * The particles interact with the following potential:
22  * \f[
23  * V
24  * = \frac{K}{2} \sum_{i = 1}^{N-1} \left( \vec{r}_i - \vec{r}_{i+1} \right)^2
25  * \f]
26  * where \f$ \vec{r}_i \f$ is the current position of particle \f$ i \f$, and
27  * \f$ N \f$ is the number of particles in a chain.
28  *
29  * The configuration group of this fluid is expected to be named
30  * `mpc.fluid.gaussianChains`, and contains:
31  * - The positive integer value `particlesPerChain`, which defines \f$ N \f$;
32  * - The floating-point value `springConstant`, which defines the spring
33  * constant \f$ K \f$ in the interaction potential \f$ V \f$;
34  * - The integer value `mdStepCount`, which specifies how many molecular
35  * dynamics steps should be performed per MPC streaming step to integrate
36  * the equations of motion that correspond to the potential \f$ V \f$.
37  */
38 class GaussianChains : public Base
39 {
40  public:
41  /**
42  * The constructor.
43  * @param[in] sim The simulation instance.
44  * @param[in] count The number of fluid particles.
45  * @param[in] streamingTimestep_ The timestep for a streaming step.
46  * @param[in] rng_ A random number generator to seed this instance's RNG with.
47  * @param[in] devMemMgr The Device memory manager.
48  */
49  GaussianChains(const CUDA::Simulation* const sim, const unsigned int count,
50  const FP streamingTimestep_, RNG& rng_,
51  DeviceMemoryManager* const devMemMgr);
52 
53  /**
54  * The destructor.
55  */
56  virtual ~GaussianChains();
57 
58  public:
59  virtual unsigned int getNumberOfLogicalEntities() const
60  {
61  return getParticleCount() / particlesPerChain;
62  }
63 
65  {
66  return true;
67  }
68 
69  virtual unsigned int getNumberOfParticlesPerLogicalEntity() const
70  {
71  return particlesPerChain;
72  }
73 
74  virtual void stream();
75 
76  private:
77  /**
78  * Reads the configuration.
79  */
80  void readConfiguration();
81 
82  /**
83  * Initializes the particle positions and velocities on the host.
84  */
85  void initializeOnHost();
86 
87  private:
88  unsigned int particlesPerChain; ///< The number of MPC particles per chain.
89  FP springConstant; ///< The spring constant \f$ k \f$.
90 
91  unsigned int mdStepCount; ///< The number of velocity-Verlet steps in each streaming step.
92 
93  FP* d_velocityVerletAccelerationBuffer; /**< Buffer for the initial accelerations in the velocity
94  Verlet algorithm.*/
95 }; //class GaussianChains
96 
97 } //namespace MPCFluid
98 } //namespace CUDA
99 } //namespace OpenMPCD
100 
101 #endif
OpenMPCD::CUDA::MPCFluid::Base
Base class for MPC fluids.
Definition: CUDA/MPCFluid/Base.hpp:40
OpenMPCD::CUDA::MPCFluid::GaussianChains::~GaussianChains
virtual ~GaussianChains()
The destructor.
OpenMPCD::CUDA::DeviceMemoryManager
Class for managing memory on the CUDA Device.
Definition: DeviceMemoryManager.hpp:21
Base.hpp
OpenMPCD::CUDA::MPCFluid::GaussianChains::numberOfParticlesPerLogicalEntityIsConstant
virtual bool numberOfParticlesPerLogicalEntityIsConstant() const
Returns whether all logical entities consist of the same number of MPC particles.
Definition: GaussianChains.hpp:64
OpenMPCD::CUDA::MPCFluid::GaussianChains::getNumberOfLogicalEntities
virtual unsigned int getNumberOfLogicalEntities() const
Returns the number of logical entities in the fluid.
Definition: GaussianChains.hpp:59
OpenMPCD::CUDA::MPCFluid::GaussianChains::getNumberOfParticlesPerLogicalEntity
virtual unsigned int getNumberOfParticlesPerLogicalEntity() const
Returns the number of MPC particles per logical entity.
Definition: GaussianChains.hpp:69
OpenMPCD::CUDA::Simulation
MPCD simulation with Molecular Dynamics on CUDA-capable GPUs.
Definition: CUDA/Simulation.hpp:48
OpenMPCD::RNG
boost::mt11213b RNG
The random number generator type.
Definition: Types.hpp:18
OpenMPCD::CUDA::MPCFluid::GaussianChains::stream
virtual void stream()
Performs a streaming step.
OpenMPCD::CUDA::MPCFluid::Base::getParticleCount
unsigned int getParticleCount() const
Returns the number of MPC fluid particles.
Definition: CUDA/MPCFluid/Base.hpp:72
OpenMPCD::FP
double FP
Default floating point type.
Definition: Types.hpp:13
OpenMPCD::CUDA::MPCFluid::GaussianChains::GaussianChains
GaussianChains(const CUDA::Simulation *const sim, const unsigned int count, const FP streamingTimestep_, RNG &rng_, DeviceMemoryManager *const devMemMgr)
The constructor.
OpenMPCD::CUDA::MPCFluid::GaussianChains
Generalization of GaussianDumbbells to chains with an arbitrary number of constituent particles.
Definition: GaussianChains.hpp:38