6 using namespace OpenMPCD;
12 :
Base(sim->getConfiguration(), mpcFluid_),
13 simulation(sim), mpcFluid(mpcFluid_),
15 bond1LengthHistogram(
"harmonicTrimers.bond1LengthHistogram", sim->getConfiguration()),
16 bond2LengthHistogram(
"harmonicTrimers.bond2LengthHistogram", sim->getConfiguration()),
18 bond1LengthSquaredHistogram(
"harmonicTrimers.bond1LengthSquaredHistogram", sim->getConfiguration()),
19 bond2LengthSquaredHistogram(
"harmonicTrimers.bond2LengthSquaredHistogram", sim->getConfiguration()),
21 bond1XXHistogram(
"harmonicTrimers.bond1XXHistogram", sim->getConfiguration()),
22 bond2XXHistogram(
"harmonicTrimers.bond2XXHistogram", sim->getConfiguration()),
24 bond1YYHistogram(
"harmonicTrimers.bond1YYHistogram", sim->getConfiguration()),
25 bond2YYHistogram(
"harmonicTrimers.bond2YYHistogram", sim->getConfiguration()),
27 bond1ZZHistogram(
"harmonicTrimers.bond1ZZHistogram", sim->getConfiguration()),
28 bond2ZZHistogram(
"harmonicTrimers.bond2ZZHistogram", sim->getConfiguration()),
30 bond1XYHistogram(
"harmonicTrimers.bond1XYHistogram", sim->getConfiguration()),
31 bond2XYHistogram(
"harmonicTrimers.bond2XYHistogram", sim->getConfiguration()),
33 bond1XYAngleWithFlowDirectionHistogram(
"harmonicTrimers.bond1XYAngleWithFlowDirectionHistogram", sim->getConfiguration()),
34 bond2XYAngleWithFlowDirectionHistogram(
"harmonicTrimers.bond2XYAngleWithFlowDirectionHistogram", sim->getConfiguration()),
36 trimerCenterOfMassesSnapshotTime(-1)
39 "instrumentation.selfDiffusionCoefficient.measurementTime",
40 &selfDiffusionCoefficientMeasurementTime);
75 bond1XXHistogram.
fill(xx1);
76 bond2XXHistogram.
fill(xx2);
78 bond1YYHistogram.
fill(yy1);
79 bond2YYHistogram.
fill(yy2);
81 bond1ZZHistogram.
fill(zz1);
82 bond2ZZHistogram.
fill(zz2);
84 bond1XYHistogram.
fill(xy1);
85 bond2XYHistogram.
fill(xy2);
90 bond1XYAngleWithFlowDirectionHistogram.
fill(R_1_xy.
getAngle(flowDirection));
91 bond2XYAngleWithFlowDirectionHistogram.
fill(R_2_xy.
getAngle(flowDirection));
95 const unsigned int trimerCount = getTrimerCount();
97 if(trimerCenterOfMassesSnapshotTime < 0)
99 trimerCenterOfMassesSnapshot.reserve(trimerCount);
101 for(
unsigned int i=0; i<trimerCount; ++i)
102 trimerCenterOfMassesSnapshot.push_back(getTrimerCenterOfMass(i));
104 trimerCenterOfMassesSnapshotTime = simulation->
getMPCTime();
107 const FP timeSinceLastCenterOfMassSnapshot = simulation->
getMPCTime() - trimerCenterOfMassesSnapshotTime;
108 if(timeSinceLastCenterOfMassSnapshot >= selfDiffusionCoefficientMeasurementTime)
110 FP accumulatedSquares = 0;
111 for(
unsigned int i=0; i<trimerCount; ++i)
120 trimerCenterOfMassesSnapshot[i] = newPosition;
123 const FP selfDiffusionCoefficient =
124 accumulatedSquares / (6 * timeSinceLastCenterOfMassSnapshot * trimerCount);
126 selfDiffusionCoefficients.
addPoint(trimerCenterOfMassesSnapshotTime, selfDiffusionCoefficient);
128 trimerCenterOfMassesSnapshotTime = simulation->
getMPCTime();
134 bond1LengthHistogram.
save(rundir+
"/harmonicTrimers/bond1/lengthHistogram.data");
135 bond2LengthHistogram.
save(rundir+
"/harmonicTrimers/bond2/lengthHistogram.data");
137 bond1LengthSquaredHistogram.
save(rundir+
"/harmonicTrimers/bond1/lengthSquaredHistogram.data");
138 bond2LengthSquaredHistogram.
save(rundir+
"/harmonicTrimers/bond2/lengthSquaredHistogram.data");
140 bond1XXHistogram.
save(rundir+
"/harmonicTrimers/bond1/XXHistogram.data");
141 bond2XXHistogram.
save(rundir+
"/harmonicTrimers/bond2/XXHistogram.data");
143 bond1YYHistogram.
save(rundir+
"/harmonicTrimers/bond1/YYHistogram.data");
144 bond2YYHistogram.
save(rundir+
"/harmonicTrimers/bond2/YYHistogram.data");
146 bond1ZZHistogram.
save(rundir+
"/harmonicTrimers/bond1/ZZHistogram.data");
147 bond2ZZHistogram.
save(rundir+
"/harmonicTrimers/bond2/ZZHistogram.data");
149 bond1XYHistogram.
save(rundir+
"/harmonicTrimers/bond1/XYHistogram.data");
150 bond2XYHistogram.
save(rundir+
"/harmonicTrimers/bond2/XYHistogram.data");
152 bond1XYHistogram.
save(rundir+
"/harmonicTrimers/bond1/XYHistogram.data");
153 bond2XYHistogram.
save(rundir+
"/harmonicTrimers/bond2/XYHistogram.data");
155 bond1XYAngleWithFlowDirectionHistogram.
save(rundir+
"/harmonicTrimers/bond1/angleWithFlowDirectionHistogram.data");
156 bond2XYAngleWithFlowDirectionHistogram.
save(rundir+
"/harmonicTrimers/bond2/angleWithFlowDirectionHistogram.data");
158 selfDiffusionCoefficients.
save(rundir+
"/selfDiffusionCoefficient.data",
false);
163 #ifdef OPENMPCD_DEBUG
164 if(trimerID >= getTrimerCount())
168 const unsigned int particle1ID = trimerID * 3;
174 return (r_1 + r_2 + r_3) / 3.0;