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

Comparing trunk/src/selection/DistanceFinder.cpp (file contents):
Revision 1953 by gezelter, Thu Dec 5 18:19:26 2013 UTC vs.
Revision 2052 by gezelter, Fri Jan 9 19:06:35 2015 UTC

# Line 55 | Line 55 | namespace OpenMD {
55      nObjects_.push_back(info_->getNGlobalBends());
56      nObjects_.push_back(info_->getNGlobalTorsions());
57      nObjects_.push_back(info_->getNGlobalInversions());
58 +    nObjects_.push_back(info_->getNGlobalMolecules());
59  
60      stuntdoubles_.resize(nObjects_[STUNTDOUBLE]);
61      bonds_.resize(nObjects_[BOND]);
62      bends_.resize(nObjects_[BEND]);
63      torsions_.resize(nObjects_[TORSION]);
64      inversions_.resize(nObjects_[INVERSION]);
65 +    molecules_.resize(nObjects_[MOLECULE]);
66      
67      SimInfo::MoleculeIterator mi;
68      Molecule::AtomIterator ai;
# Line 80 | Line 82 | namespace OpenMD {
82      
83      for (mol = info_->beginMolecule(mi); mol != NULL;
84           mol = info_->nextMolecule(mi)) {
85 <        
85 >
86 >      molecules_[mol->getGlobalIndex()] = mol;
87 >      
88        for(atom = mol->beginAtom(ai); atom != NULL;
89            atom = mol->nextAtom(ai)) {
90          stuntdoubles_[atom->getGlobalIndex()] = atom;
# Line 120 | Line 124 | namespace OpenMD {
124      int mol;
125      int proc;
126      RealType data[3];
127 <    int worldRank = MPI::COMM_WORLD.Get_rank();
127 >    int worldRank;
128 >    MPI_Comm_rank( MPI_COMM_WORLD, &worldRank);
129   #endif
130  
131      for (unsigned int j = 0; j < stuntdoubles_.size(); ++j) {
# Line 151 | Line 156 | namespace OpenMD {
156          data[0] = centerPos.x();
157          data[1] = centerPos.y();
158          data[2] = centerPos.z();          
159 <        MPI::COMM_WORLD.Bcast(data, 3, MPI::REALTYPE, proc);
159 >        MPI_Bcast(data, 3, MPI_REALTYPE, proc, MPI_COMM_WORLD);
160        } else {
161 <        MPI::COMM_WORLD.Bcast(data, 3, MPI::REALTYPE, proc);
161 >        MPI_Bcast(data, 3, MPI_REALTYPE, proc, MPI_COMM_WORLD);
162          centerPos = Vector3d(data);
163        }
164   #else
# Line 161 | Line 166 | namespace OpenMD {
166        centerPos = center->getPos();
167   #endif
168        
169 +      for (unsigned int j = 0; j < molecules_.size(); ++j) {
170 +        Vector3d r =centerPos - molecules_[j]->getCom();
171 +        currSnapshot->wrapVector(r);
172 +        if (r.length() <= distance) {
173 +          bsResult.bitsets_[MOLECULE].setBitOn(j);
174 +        }
175 +      }
176        for (unsigned int j = 0; j < stuntdoubles_.size(); ++j) {
177          Vector3d r =centerPos - stuntdoubles_[j]->getPos();
178          currSnapshot->wrapVector(r);
# Line 229 | Line 241 | namespace OpenMD {
241      int mol;
242      int proc;
243      RealType data[3];
244 <    int worldRank = MPI::COMM_WORLD.Get_rank();
244 >    int worldRank;
245 >    MPI_Comm_rank( MPI_COMM_WORLD, &worldRank);
246   #endif
247  
248      for (unsigned int j = 0; j < stuntdoubles_.size(); ++j) {
# Line 260 | Line 273 | namespace OpenMD {
273          data[0] = centerPos.x();
274          data[1] = centerPos.y();
275          data[2] = centerPos.z();          
276 <        MPI::COMM_WORLD.Bcast(data, 3, MPI::REALTYPE, proc);
276 >        MPI_Bcast(data, 3, MPI_REALTYPE, proc, MPI_COMM_WORLD);
277        } else {
278 <        MPI::COMM_WORLD.Bcast(data, 3, MPI::REALTYPE, proc);
278 >        MPI_Bcast(data, 3, MPI_REALTYPE, proc, MPI_COMM_WORLD);
279          centerPos = Vector3d(data);
280        }
281   #else
282        center = stuntdoubles_[i];
283        centerPos = center->getPos(frame);
284   #endif
285 +      for (unsigned int j = 0; j < molecules_.size(); ++j) {
286 +        Vector3d r =centerPos - molecules_[j]->getCom(frame);
287 +        currSnapshot->wrapVector(r);
288 +        if (r.length() <= distance) {
289 +          bsResult.bitsets_[MOLECULE].setBitOn(j);
290 +        }
291 +      }
292 +      
293        for (unsigned int j = 0; j < stuntdoubles_.size(); ++j) {
294          Vector3d r =centerPos - stuntdoubles_[j]->getPos(frame);
295          currSnapshot->wrapVector(r);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines