ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/applications/staticProps/RNEMDStats.cpp
(Generate patch)

Comparing trunk/src/applications/staticProps/RNEMDStats.cpp (file contents):
Revision 1888 by gezelter, Tue Jun 18 17:52:37 2013 UTC vs.
Revision 1892 by gezelter, Wed Jun 19 14:14:56 2013 UTC

# Line 104 | Line 104 | namespace OpenMD {
104      int i;
105  
106      vector<RealType> binMass(nBins_, 0.0);
107 <    vector<Vector3d> binVel(nBins_, V3Zero);
107 >    vector<RealType> binPx(nBins_, 0.0);
108 >    vector<RealType> binPy(nBins_, 0.0);
109 >    vector<RealType> binPz(nBins_, 0.0);
110      vector<RealType> binKE(nBins_, 0.0);
111      vector<unsigned int> binDof(nBins_, 0);
112      vector<unsigned int> binCount(nBins_, 0);
# Line 117 | Line 119 | namespace OpenMD {
119        
120        for (rb = mol->beginRigidBody(rbIter); rb != NULL;
121             rb = mol->nextRigidBody(rbIter)) {
122 <        rb->updateAtoms();
122 >        rb->updateAtomVel();
123        }
124      }
125    
# Line 140 | Line 142 | namespace OpenMD {
142        binCount[bin] += 1;
143  
144        binMass[bin] += m;
145 <      binVel[bin] += vel;
145 >      binPx[bin] += m * vel.x();
146 >      binPy[bin] += m * vel.y();
147 >      binPz[bin] += m * vel.z();
148        binKE[bin] += 0.5 * (m * vel.lengthSquare());
149        binDof[bin] += 3;
150        
# Line 170 | Line 174 | namespace OpenMD {
174                                            PhysicalConstants::energyConvert);
175          RealType den = binMass[i] * nBins_ * PhysicalConstants::densityConvert
176            / volume_;
177 <        Vector3d vel = binVel[i] / RealType(binCount[i]);
177 >        Vector3d vel;
178 >        vel.x() = binPx[i] / binMass[i];
179 >        vel.y() = binPy[i] / binMass[i];
180 >        vel.z() = binPz[i] / binMass[i];
181 >
182          dynamic_cast<Accumulator *>(temperature->accumulator[i])->add(temp);
183          dynamic_cast<VectorAccumulator *>(velocity->accumulator[i])->add(vel);
184          dynamic_cast<Accumulator *>(density->accumulator[i])->add(den);
# Line 243 | Line 251 | namespace OpenMD {
251        
252        for (rb = mol->beginRigidBody(rbIter); rb != NULL;
253             rb = mol->nextRigidBody(rbIter)) {
254 <        rb->updateAtoms();
254 >        rb->updateAtomVel();
255        }
256      }
257    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines