OpenMPCD
GaussianDumbbells.cpp
2 
5 
7 
9  const Simulation* const sim, DeviceMemoryManager* const devMemMgr,
10  const MPCFluid::GaussianDumbbells* const mpcFluid_)
11  : Base(sim->getConfiguration(), mpcFluid_),
12  simulation(sim), mpcFluid(mpcFluid_),
13  dumbbellBondLengthHistogram("dumbbellBondLengthHistogram", sim->getConfiguration()),
14  dumbbellBondLengthSquaredHistogram("dumbbellBondLengthSquaredHistogram", sim->getConfiguration()),
15 
16  dumbbellBondXHistogram("dumbbellBondXHistogram", sim->getConfiguration()),
17  dumbbellBondYHistogram("dumbbellBondYHistogram", sim->getConfiguration()),
18  dumbbellBondZHistogram("dumbbellBondZHistogram", sim->getConfiguration()),
19 
20  dumbbellBondXXHistogram("dumbbellBondXXHistogram", sim->getConfiguration()),
21  dumbbellBondYYHistogram("dumbbellBondYYHistogram", sim->getConfiguration()),
22  dumbbellBondZZHistogram("dumbbellBondZZHistogram", sim->getConfiguration()),
23 
24  dumbbellBondXYHistogram("dumbbellBondXYHistogram", sim->getConfiguration()),
25 
26  dumbbellBondAngleWithFlowDirectionHistogram("dumbbellBondAngleWithFlowDirectionHistogram", sim->getConfiguration()),
27  dumbbellBondXYAngleWithFlowDirectionHistogram("dumbbellBondXYAngleWithFlowDirectionHistogram", sim->getConfiguration())
28 {
30  velocityAutocorrelation = new VelocityAutocorrelation::Doublets(sim, devMemMgr, mpcFluid_);
31 }
32 
34 {
35  static const Vector3D<MPCParticleVelocityType> flowDirection(1, 0, 0);
36 
37  FP averageBondXX = 0;
38  FP averageBondYY = 0;
39  FP averageBondZZ = 0;
40  for(unsigned int i=0; i<mpcFluid->getParticleCount(); i+=2)
41  {
44 
45  const Vector3D<MPCParticlePositionType> R = r_2 - r_1;
46 
47  dumbbellBondLengthHistogram.fill(R.magnitude());
48  dumbbellBondLengthSquaredHistogram.fill(R.magnitudeSquared());
49 
50  dumbbellBondXHistogram.fill(R.getX());
51  dumbbellBondYHistogram.fill(R.getY());
52  dumbbellBondZHistogram.fill(R.getZ());
53 
54  const FP bondXX = R.getX()*R.getX();
55  const FP bondYY = R.getY()*R.getY();
56  const FP bondZZ = R.getZ()*R.getZ();
57 
58  dumbbellBondXXHistogram.fill(bondXX);
59  dumbbellBondYYHistogram.fill(bondYY);
60  dumbbellBondZZHistogram.fill(bondZZ);
61 
62  dumbbellBondXYHistogram.fill(R.getX()*R.getY());
63 
64  averageBondXX += bondXX;
65  averageBondYY += bondYY;
66  averageBondZZ += bondZZ;
67 
68  const Vector3D<MPCParticlePositionType> R_xy(R.getX(), R.getY(), 0);
69  dumbbellBondAngleWithFlowDirectionHistogram.fill(R.getAngle(flowDirection));
70  dumbbellBondXYAngleWithFlowDirectionHistogram.fill(R_xy.getAngle(flowDirection));
71  }
72 
73  const unsigned int dumbbellCount = mpcFluid->getParticleCount() / 2;
74  averageBondXX /= dumbbellCount;
75  averageBondYY /= dumbbellCount;
76  averageBondZZ /= dumbbellCount;
77 
78  dumbbellAverageBondXXVSTime.addPoint(simulation->getMPCTime(), averageBondXX);
79  dumbbellAverageBondYYVSTime.addPoint(simulation->getMPCTime(), averageBondYY);
80  dumbbellAverageBondZZVSTime.addPoint(simulation->getMPCTime(), averageBondZZ);
81 }
82 
83 void GaussianDumbbells::saveSpecific(const std::string& rundir) const
84 {
85  dumbbellBondLengthHistogram.save(rundir+"/dumbbellBondLengthHistogram.data");
86  dumbbellBondLengthSquaredHistogram.save(rundir+"/dumbbellBondLengthSquaredHistogram.data");
87 
88  dumbbellBondXHistogram.save(rundir+"/dumbbellBondXHistogram.data");
89  dumbbellBondYHistogram.save(rundir+"/dumbbellBondYHistogram.data");
90  dumbbellBondZHistogram.save(rundir+"/dumbbellBondZHistogram.data");
91 
92  dumbbellBondXXHistogram.save(rundir+"/dumbbellBondXXHistogram.data");
93  dumbbellBondYYHistogram.save(rundir+"/dumbbellBondYYHistogram.data");
94  dumbbellBondZZHistogram.save(rundir+"/dumbbellBondZZHistogram.data");
95 
96  dumbbellBondXYHistogram.save(rundir+"/dumbbellBondXYHistogram.data");
97 
98  dumbbellAverageBondXXVSTime.save(rundir+"/dumbbellAverageBondXXVSTime.data", false);
99  dumbbellAverageBondYYVSTime.save(rundir+"/dumbbellAverageBondYYVSTime.data", false);
100  dumbbellAverageBondZZVSTime.save(rundir+"/dumbbellAverageBondZZVSTime.data", false);
101 
102  dumbbellBondAngleWithFlowDirectionHistogram.save(rundir+"/dumbbellBondAngleWithFlowDirectionHistogram.data");
103  dumbbellBondXYAngleWithFlowDirectionHistogram.save(rundir+"/dumbbellBondXYAngleWithFlowDirectionHistogram.data");
104 }
OpenMPCD::RemotelyStoredVector
Represents a vector whose data is stored elsewhere.
Definition: RemotelyStoredVector.hpp:26
OpenMPCD::Vector3D::magnitudeSquared
OPENMPCD_CUDA_HOST_AND_DEVICE RealType magnitudeSquared() const
Returns the square of the magnitude of this vector.
Definition: Vector3D.hpp:218
OpenMPCD::Vector3D::getZ
OPENMPCD_CUDA_HOST_AND_DEVICE T getZ() const
Returns the z coordinate.
Definition: Vector3D.hpp:119
OpenMPCD::Graph::save
void save(const std::string &path, const bool prependGnuplotCommands) const
Saves the graph data to the given file path.
Definition: Graph.cpp:8
OpenMPCD::CUDA::DeviceMemoryManager
Class for managing memory on the CUDA Device.
Definition: DeviceMemoryManager.hpp:21
OpenMPCD::Vector3D
3-dimensional vector.
Definition: Vector3D.hpp:38
OpenMPCD::CUDA::MPCFluid::Instrumentation::GaussianDumbbells::measureSpecific
virtual void measureSpecific()
Performs measurements.
Definition: GaussianDumbbells.cpp:33
OpenMPCD::Vector3D::getX
OPENMPCD_CUDA_HOST_AND_DEVICE T getX() const
Returns the x coordinate.
Definition: Vector3D.hpp:61
GaussianDumbbells.hpp
OpenMPCD::CUDA::MPCFluid::Instrumentation
Namespace for instrumentation classes for MPC fluids.
Definition: CUDA/MPCFluid/Instrumentation/Base.hpp:29
OpenMPCD::Vector3D::getY
OPENMPCD_CUDA_HOST_AND_DEVICE T getY() const
Returns the y coordinate.
Definition: Vector3D.hpp:90
OpenMPCD::CUDA::MPCFluid::Instrumentation::Base::fourierTransformedVelocity
FourierTransformedVelocity::Base * fourierTransformedVelocity
Measures Fourier-transformed velocities.
Definition: CUDA/MPCFluid/Instrumentation/Base.hpp:160
OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Doublets
Class for measurements of velocity autocorrelation in MPC fluids that consist of doublets of particle...
Definition: Instrumentation/VelocityAutocorrelation/Doublets.hpp:27
OpenMPCD::CUDA::Simulation::getMPCTime
FP getMPCTime() const
Returns the MPC time that has passed since the start of the simulation.
Definition: CUDA/Simulation.hpp:200
OpenMPCD::CUDA::MPCFluid::Instrumentation::GaussianDumbbells::saveSpecific
virtual void saveSpecific(const std::string &rundir) const
Saves the data to the given run directory.
Definition: GaussianDumbbells.cpp:83
OpenMPCD::Vector3D::getAngle
T getAngle(const Vector3D &rhs) const
Returns the the angle between this vector and the given one.
Definition: Vector3D.hpp:200
OpenMPCD::CUDA::Simulation
MPCD simulation with Molecular Dynamics on CUDA-capable GPUs.
Definition: CUDA/Simulation.hpp:48
OpenMPCD::Histogram::save
void save(const std::string &filename, const FP binPoint=0.5) const
Saves the histogram at the given path.
Definition: Histogram.cpp:75
OpenMPCD::Vector3D::magnitude
OPENMPCD_CUDA_HOST_AND_DEVICE RealType magnitude() const
Returns the magnitude of this vector.
Definition: Vector3D.hpp:236
OpenMPCD::CUDA::MPCFluid::GaussianDumbbells
Fluid consisting of Gaussian dumbbells.
Definition: GaussianDumbbells.hpp:48
OpenMPCD::CUDA::MPCFluid::Instrumentation::FourierTransformedVelocity::Doublets
Class for measurements of Fourier-transformed velocities in MPC fluids that consist of doublets of pa...
Definition: Instrumentation/FourierTransformedVelocity/Doublets.hpp:28
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::Histogram::fill
void fill(const FP val)
Adds an entry to the histogram.
Definition: Histogram.cpp:21
OpenMPCD::CUDA::MPCFluid::Instrumentation::Base
Base class for MPC fluids instrumentation.
Definition: CUDA/MPCFluid/Instrumentation/Base.hpp:34
OpenMPCD::CUDA::MPCFluid::Instrumentation::GaussianDumbbells::GaussianDumbbells
GaussianDumbbells(const Simulation *const sim, DeviceMemoryManager *const devMemMgr, const MPCFluid::GaussianDumbbells *const mpcFluid_)
The constructor.
Definition: GaussianDumbbells.cpp:8
OpenMPCD::Graph::addPoint
void addPoint(const FP x, const FP y)
Adds a data point.
Definition: Graph.hpp:30
Doublets.hpp
OpenMPCD::CUDA::MPCFluid::Base::getPosition
const RemotelyStoredVector< const MPCParticlePositionType > getPosition(const unsigned int particleID) const
Returns a MPC fluid particle's position vector.
Doublets.hpp
OpenMPCD::CUDA::MPCFluid::Instrumentation::Base::velocityAutocorrelation
VelocityAutocorrelation::Base * velocityAutocorrelation
Measures velocity autocorrelation.
Definition: CUDA/MPCFluid/Instrumentation/Base.hpp:169