OpenMPCD
Instrumentation/HarmonicTrimers.hpp
Go to the documentation of this file.
1 /**
2  * @file
3  * Defines the OpenMPCD::CUDA::MPCFluid::Instrumentation::HarmonicTrimers class.
4  */
5 
6 #ifndef OPENMPCD_CUDA_MPCFLUID_INSTRUMENTATION_HARMONICTRIMERS_HPP
7 #define OPENMPCD_CUDA_MPCFLUID_INSTRUMENTATION_HARMONICTRIMERS_HPP
8 
12 #include <OpenMPCD/Graph.hpp>
13 #include <OpenMPCD/Histogram.hpp>
14 
15 #include <vector>
16 
17 namespace OpenMPCD
18 {
19 namespace CUDA
20 {
21 namespace MPCFluid
22 {
23 namespace Instrumentation
24 {
25 /**
26  * Instrumentation for Harmonic Trimer fluids.
27  */
28 class HarmonicTrimers : public Base
29 {
30  public:
31  /**
32  * The constructor.
33  * @param[in] sim The simulation instance.
34  * @param[in] devMemMgr The Device memory manager.
35  * @param[in] mpcFluid_ The MPC fluid to measure.
36  */
38  const Simulation* const sim, DeviceMemoryManager* const devMemMgr,
39  const MPCFluid::HarmonicTrimers* const mpcFluid_);
40 
41  /**
42  * The destructor.
43  */
44  virtual ~HarmonicTrimers()
45  {
46  }
47 
48  protected:
49  /**
50  * Performs measurements.
51  */
52  virtual void measureSpecific();
53 
54  /**
55  * Saves the data to the given run directory.
56  * @param[in] rundir The path to the run directory.
57  */
58  virtual void saveSpecific(const std::string& rundir) const;
59 
60  private:
61  /**
62  * Returns the number of trimers.
63  */
64  unsigned int getTrimerCount() const
65  {
66  return mpcFluid->getParticleCount()/3;
67  }
68 
69  /**
70  * Returns the center of mass coordinates for the trimer with the given ID.
71  * @param[in] trimerID The ID of the trimer.
72  * @throw OutOfBoundsException If OPENMPCD_DEBUG is defined, throws if trimerID>=getTrimerCount()
73  */
74  const Vector3D<MPCParticlePositionType> getTrimerCenterOfMass(const unsigned int trimerID) const;
75 
76  private:
77  const Simulation* const simulation; ///< The simulation instance.
78  const MPCFluid::HarmonicTrimers* const mpcFluid; ///< The fluid to measure.
79 
80  Histogram bond1LengthHistogram; ///< Histogram for the bond lengths between particles 1 and 2.
81  Histogram bond2LengthHistogram; ///< Histogram for the bond lengths between particles 2 and 3.
82 
83  Histogram bond1LengthSquaredHistogram; ///< Histogram for the squares of the bond length between particles 1 and 2.
84  Histogram bond2LengthSquaredHistogram; ///< Histogram for the squares of the bond length between particles 2 and 3.
85 
86  Histogram bond1XXHistogram; ///< Histogram for the squares of the x components of the bond 1.
87  Histogram bond2XXHistogram; ///< Histogram for the squares of the x components of the bond 2.
88 
89  Histogram bond1YYHistogram; ///< Histogram for the squares of the y components of the bond 1.
90  Histogram bond2YYHistogram; ///< Histogram for the squares of the y components of the bond 2.
91 
92  Histogram bond1ZZHistogram; ///< Histogram for the squares of the z components of the bond 1.
93  Histogram bond2ZZHistogram; ///< Histogram for the squares of the z components of the bond 2.
94 
95  Histogram bond1XYHistogram; ///< Histogram for the product of the x and y components of the first bond.
96  Histogram bond2XYHistogram; ///< Histogram for the product of the x and y components of the second bond.
97 
98  Histogram bond1XYAngleWithFlowDirectionHistogram; /**< Histogram for the angle between the 1-2 bond
99  vector's projection to the xy plane and the flow
100  direction.*/
101  Histogram bond2XYAngleWithFlowDirectionHistogram; /**< Histogram for the angle between the 2-3 bond
102  vector's projection to the xy plane and the flow
103  direction.*/
104 
105 
106  FP selfDiffusionCoefficientMeasurementTime;
107  ///< The time each measurement of the self-diffusion coefficient \f$D\f$ takes.
108  Graph selfDiffusionCoefficients;
109  ///< Holds the measured self-diffusion coefficients \f$D\f$ and the time they ware taken.
110  std::vector<Vector3D<MPCParticlePositionType> > trimerCenterOfMassesSnapshot;
111  ///< Holds the center-of-mass coordinates of the trimers at a given point in time.
112  FP trimerCenterOfMassesSnapshotTime; ///< The simulation time at which trimerCenterOfMassesSnapshot was taken.
113 }; //class HarmonicTrimers
114 } //namespace Instrumentation
115 } //namespace MPCFluid
116 } //namespace CUDA
117 } //namespace OpenMPCD
118 
119 #endif
HarmonicTrimers.hpp
OpenMPCD::CUDA::MPCFluid::Instrumentation::HarmonicTrimers::HarmonicTrimers
HarmonicTrimers(const Simulation *const sim, DeviceMemoryManager *const devMemMgr, const MPCFluid::HarmonicTrimers *const mpcFluid_)
The constructor.
Definition: HarmonicTrimers.cpp:9
OpenMPCD::Histogram
Represents a histogram.
Definition: Histogram.hpp:20
OpenMPCD::CUDA::DeviceMemoryManager
Class for managing memory on the CUDA Device.
Definition: DeviceMemoryManager.hpp:21
OpenMPCD::Vector3D
3-dimensional vector.
Definition: Vector3D.hpp:38
Histogram.hpp
OpenMPCD::CUDA::MPCFluid::HarmonicTrimers
Fluid consisting of three particles, with two harmonic springs coupling them.
Definition: HarmonicTrimers.hpp:41
OpenMPCD::CUDA::Simulation
MPCD simulation with Molecular Dynamics on CUDA-capable GPUs.
Definition: CUDA/Simulation.hpp:48
OpenMPCD::CUDA::MPCFluid::Instrumentation::HarmonicTrimers
Instrumentation for Harmonic Trimer fluids.
Definition: Instrumentation/HarmonicTrimers.hpp:28
OpenMPCD::CUDA::MPCFluid::Instrumentation::HarmonicTrimers::~HarmonicTrimers
virtual ~HarmonicTrimers()
The destructor.
Definition: Instrumentation/HarmonicTrimers.hpp:44
Simulation.hpp
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::Instrumentation::HarmonicTrimers::measureSpecific
virtual void measureSpecific()
Performs measurements.
Definition: HarmonicTrimers.cpp:46
OpenMPCD::CUDA::MPCFluid::Instrumentation::Base
Base class for MPC fluids instrumentation.
Definition: CUDA/MPCFluid/Instrumentation/Base.hpp:34
Graph.hpp
OpenMPCD::Graph
Represents a 2D graph.
Definition: Graph.hpp:19
Base.hpp
OpenMPCD::CUDA::MPCFluid::Instrumentation::HarmonicTrimers::saveSpecific
virtual void saveSpecific(const std::string &rundir) const
Saves the data to the given run directory.
Definition: HarmonicTrimers.cpp:132