ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/visitors/OtherVisitor.cpp
(Generate patch)

Comparing:
trunk/src/visitors/OtherVisitor.cpp (file contents), Revision 413 by tim, Wed Mar 9 17:30:29 2005 UTC vs.
branches/development/src/visitors/OtherVisitor.cpp (file contents), Revision 1871 by gezelter, Fri May 10 14:59:13 2013 UTC

# Line 6 | Line 6
6   * redistribute this software in source and binary code form, provided
7   * that the following conditions are met:
8   *
9 < * 1. Acknowledgement of the program authors must be made in any
10 < *    publication of scientific results based in part on use of the
11 < *    program.  An acceptable form of acknowledgement is citation of
12 < *    the article in which the program was described (Matthew
13 < *    A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher
14 < *    J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented
15 < *    Parallel Simulation Engine for Molecular Dynamics,"
16 < *    J. Comput. Chem. 26, pp. 252-271 (2005))
17 < *
18 < * 2. Redistributions of source code must retain the above copyright
9 > * 1. Redistributions of source code must retain the above copyright
10   *    notice, this list of conditions and the following disclaimer.
11   *
12 < * 3. Redistributions in binary form must reproduce the above copyright
12 > * 2. Redistributions in binary form must reproduce the above copyright
13   *    notice, this list of conditions and the following disclaimer in the
14   *    documentation and/or other materials provided with the
15   *    distribution.
# Line 37 | Line 28
28   * arising out of the use of or inability to use software, even if the
29   * University of Notre Dame has been advised of the possibility of
30   * such damages.
31 + *
32 + * SUPPORT OPEN SCIENCE!  If you use OpenMD or its source code in your
33 + * research, please cite the appropriate papers when you publish your
34 + * work.  Good starting points are:
35 + *                                                                      
36 + * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).            
37 + * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).          
38 + * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008).          
39 + * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40 + * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
42   #include "selection/SelectionManager.hpp"
43   #include "visitors/OtherVisitor.hpp"
# Line 44 | Line 45
45   #include "primitives/RigidBody.hpp"
46   #include "primitives/Molecule.hpp"
47   #include "brains/SimInfo.hpp"
48 < namespace oopse {
48 > #include "brains/Thermo.hpp"
49  
50 < void WrappingVisitor::visit(Atom *atom) {
50 < internalVisit(atom);
51 < }
50 > namespace OpenMD {
51  
52 < void WrappingVisitor::visit(DirectionalAtom *datom) {
53 < internalVisit(datom);
54 < }
52 >  void WrappingVisitor::visit(Atom *atom) {
53 >    internalVisit(atom);
54 >  }
55  
56 < void WrappingVisitor::visit(RigidBody *rb) {
57 < internalVisit(rb);
58 < }
56 >  void WrappingVisitor::visit(DirectionalAtom *datom) {
57 >    internalVisit(datom);
58 >  }
59  
60 < void WrappingVisitor::internalVisit(StuntDouble *sd) {
60 >  void WrappingVisitor::visit(RigidBody *rb) {
61 >    internalVisit(rb);
62 >  }
63 >
64 >  void WrappingVisitor::internalVisit(StuntDouble *sd) {
65      GenericData *                     data;
66      AtomData *                        atomData;
67      AtomInfo *                        atomInfo;
# Line 67 | Line 70 | void WrappingVisitor::internalVisit(StuntDouble *sd) {
70      data = sd->getPropertyByName("ATOMDATA");
71  
72      if (data != NULL) {
73 <        atomData = dynamic_cast<AtomData *>(data);
73 >      atomData = dynamic_cast<AtomData *>(data);
74  
75 <        if (atomData == NULL)
76 <            return;
75 >      if (atomData == NULL)
76 >        return;
77      } else
78 <        return;
78 >      return;
79  
80      Snapshot* currSnapshot = info->getSnapshotManager()->getCurrentSnapshot();
81      
82 <    for( atomInfo = atomData->beginAtomInfo(i); atomInfo; atomInfo = atomData->nextAtomInfo(i) ) {
83 <        currSnapshot->wrapVector(atomInfo->pos);
82 >    for( atomInfo = atomData->beginAtomInfo(i); atomInfo;
83 >         atomInfo = atomData->nextAtomInfo(i) ) {
84 >
85 >      Vector3d newPos = atomInfo->pos - origin_;
86 >      currSnapshot->wrapVector(newPos);
87 >      atomInfo->pos = newPos;
88 >
89      }
90 < }
90 >  }
91  
92 < const std::string WrappingVisitor::toString() {
92 >  void WrappingVisitor::update() {
93 >    if (useCom_){
94 >      Thermo thermo(info);
95 >      origin_ = thermo.getCom();
96 >    }
97 >  }
98 >  
99 >  const std::string WrappingVisitor::toString() {
100      char        buffer[65535];
101      std::string result;
102  
# Line 101 | Line 116 | const std::string WrappingVisitor::toString() {
116      result += buffer;
117  
118      return result;
119 < }
119 >  }
120  
121 < //----------------------------------------------------------------------------//
121 >  //----------------------------------------------------------------------------//
122  
123 < ReplicateVisitor::ReplicateVisitor(SimInfo *info, Vector3i opt) :
123 >  ReplicateVisitor::ReplicateVisitor(SimInfo *info, Vector3i opt) :
124      BaseVisitor() {
125 <    this->info = info;
126 <    visitorName = "ReplicateVisitor";
127 <    this->replicateOpt = opt;
125 >      this->info = info;
126 >      visitorName = "ReplicateVisitor";
127 >      this->replicateOpt = opt;
128  
129 <    //generate the replicate directions
130 <    for( int i = 0; i <= replicateOpt[0]; i++ ) {
129 >      //generate the replicate directions
130 >      for( int i = 0; i <= replicateOpt[0]; i++ ) {
131          for( int j = 0; j <= replicateOpt[1]; j++ ) {
132 <            for( int k = 0; k <= replicateOpt[2]; k++ ) {
133 <                //skip original frame
134 <                if (i == 0 && j == 0 && k == 0) {
135 <                    continue;
136 <                } else {
137 <                    dir.push_back(Vector3i(i, j, k));
138 <                }
139 <            }
132 >          for( int k = 0; k <= replicateOpt[2]; k++ ) {
133 >            //skip original frame
134 >            if (i == 0 && j == 0 && k == 0) {
135 >              continue;
136 >            } else {
137 >              dir.push_back(Vector3i(i, j, k));
138 >            }
139 >          }
140          }
141 <    }
141 >      }
142      
143 < }
143 >    }
144  
145 < void ReplicateVisitor::visit(Atom *atom) {
146 < internalVisit(atom);
147 < }
145 >  void ReplicateVisitor::visit(Atom *atom) {
146 >    internalVisit(atom);
147 >  }
148  
149 < void ReplicateVisitor::visit(DirectionalAtom *datom) {
150 < internalVisit(datom);
151 < }
149 >  void ReplicateVisitor::visit(DirectionalAtom *datom) {
150 >    internalVisit(datom);
151 >  }
152  
153 < void ReplicateVisitor::visit(RigidBody *rb) {
154 < internalVisit(rb);
155 < }
153 >  void ReplicateVisitor::visit(RigidBody *rb) {
154 >    internalVisit(rb);
155 >  }
156  
157 < void ReplicateVisitor::internalVisit(StuntDouble *sd) {
157 >  void ReplicateVisitor::internalVisit(StuntDouble *sd) {
158      GenericData *          data;
159      AtomData *             atomData;
160  
# Line 147 | Line 162 | void ReplicateVisitor::internalVisit(StuntDouble *sd)
162      data = sd->getPropertyByName("ATOMDATA");
163  
164      if (data != NULL) {
165 <        atomData = dynamic_cast<AtomData *>(data);
165 >      atomData = dynamic_cast<AtomData *>(data);
166  
167 <        if (atomData == NULL) {
168 <            return;
169 <        }
167 >      if (atomData == NULL) {
168 >        return;
169 >      }
170      } else {
171 <        return;
171 >      return;
172      }
173  
174      Snapshot* currSnapshot = info->getSnapshotManager()->getCurrentSnapshot();
# Line 162 | Line 177 | void ReplicateVisitor::internalVisit(StuntDouble *sd)
177      std::vector<AtomInfo *> atomInfoList = atomData->getData();
178  
179      replicate(atomInfoList, atomData, box);
180 < }
180 >  }
181  
182 < void ReplicateVisitor::replicate(std::vector<AtomInfo *>&infoList, AtomData *data, const Mat3x3d& box) {
182 >  void ReplicateVisitor::replicate(std::vector<AtomInfo *>&infoList, AtomData *data, const Mat3x3d& box) {
183      AtomInfo* newAtomInfo;
184      std::vector<Vector3i>::iterator dirIter;
185      std::vector<AtomInfo *>::iterator i;
186  
187      for( dirIter = dir.begin(); dirIter != dir.end(); ++dirIter ) {
188 <        for( i = infoList.begin(); i != infoList.end(); i++ ) {
189 <            newAtomInfo = new AtomInfo();
190 <            *newAtomInfo = *(*i);
188 >      for( i = infoList.begin(); i != infoList.end(); i++ ) {
189 >        newAtomInfo = new AtomInfo();
190 >        *newAtomInfo = *(*i);
191  
192 <            for( int j = 0; j < 3; j++ )
193 <                newAtomInfo->pos[j] += (*dirIter)[0]*box(j, 0) + (*dirIter)[1]*box(j, 1) + (*dirIter)[2]*box(j, 2);
192 >        for( int j = 0; j < 3; j++ )
193 >          newAtomInfo->pos[j] += (*dirIter)[0]*box(j, 0) + (*dirIter)[1]*box(j, 1) + (*dirIter)[2]*box(j, 2);
194  
195 <            data->addAtomInfo(newAtomInfo);
196 <        }
195 >        data->addAtomInfo(newAtomInfo);
196 >      }
197      } // end for(dirIter)  
198 < }
198 >  }
199  
200 < const std::string ReplicateVisitor::toString() {
200 >  const std::string ReplicateVisitor::toString() {
201      char                            buffer[65535];
202      std::string                     result;
203      std::set<std::string>::iterator i;
# Line 213 | Line 228 | const std::string ReplicateVisitor::toString() {
228      result += buffer;
229  
230      return result;
231 < }
231 >  }
232  
233 < //----------------------------------------------------------------------------//
233 >  //------------------------------------------------------------------------//
234  
235 < XYZVisitor::XYZVisitor(SimInfo *info) :
236 <    BaseVisitor(), seleMan(info), evaluator(info){
235 >  XYZVisitor::XYZVisitor(SimInfo *info) : BaseVisitor(), seleMan(info),
236 >                                          evaluator(info), doPositions_(true),
237 >                                          doVelocities_(false),
238 >                                          doForces_(false), doVectors_(false),
239 >                                          doCharges_(false) {
240      this->info = info;
241      visitorName = "XYZVisitor";
242 <
242 >    
243      evaluator.loadScriptString("select all");
244 <
244 >    
245      if (!evaluator.isDynamic()) {
246 <        seleMan.setSelectionSet(evaluator.evaluate());
246 >      seleMan.setSelectionSet(evaluator.evaluate());
247      }
248 <
249 < }
250 <
251 < XYZVisitor::XYZVisitor(SimInfo *info, const std::string& script) :
252 <    BaseVisitor(), seleMan(info), evaluator(info) {
248 >  }
249 >  
250 >  XYZVisitor::XYZVisitor(SimInfo *info, const std::string& script) :
251 >    BaseVisitor(), seleMan(info), evaluator(info), doPositions_(true),
252 >    doVelocities_(false), doForces_(false), doVectors_(false),
253 >    doCharges_(false) {
254 >    
255      this->info = info;
256      visitorName = "XYZVisitor";
257 <
257 >    
258      evaluator.loadScriptString(script);
259 <
259 >    
260      if (!evaluator.isDynamic()) {
261 <        seleMan.setSelectionSet(evaluator.evaluate());
261 >      seleMan.setSelectionSet(evaluator.evaluate());
262      }
263 <          
244 < }
263 >  }
264      
265 < void XYZVisitor::visit(Atom *atom) {
265 >  void XYZVisitor::visit(Atom *atom) {
266      if (isSelected(atom))
267 <        internalVisit(atom);
268 < }
267 >      internalVisit(atom);
268 >  }
269  
270 < void XYZVisitor::visit(DirectionalAtom *datom) {
270 >  void XYZVisitor::visit(DirectionalAtom *datom) {
271      if (isSelected(datom))
272 <        internalVisit(datom);
273 < }
274 <
275 < void XYZVisitor::visit(RigidBody *rb) {
272 >      internalVisit(datom);
273 >  }
274 >  
275 >  void XYZVisitor::visit(RigidBody *rb) {
276      if (isSelected(rb))
277 <        internalVisit(rb);
278 < }
279 <
280 < void XYZVisitor::update() {
277 >      internalVisit(rb);
278 >  }
279 >  
280 >  void XYZVisitor::update() {
281      //if dynamic, we need to re-evaluate the selection
282      if (evaluator.isDynamic()) {
283 <       seleMan.setSelectionSet(evaluator.evaluate());
283 >      seleMan.setSelectionSet(evaluator.evaluate());
284      }
285 < }
286 <
287 < void XYZVisitor::internalVisit(StuntDouble *sd) {
285 >  }
286 >  
287 >  void XYZVisitor::internalVisit(StuntDouble *sd) {
288      GenericData *                     data;
289      AtomData *                        atomData;
290      AtomInfo *                        atomInfo;
291      std::vector<AtomInfo *>::iterator i;
292      char                              buffer[1024];
293 <
293 >    
294      //if there is not atom data, just skip it
295      data = sd->getPropertyByName("ATOMDATA");
296 <
296 >    
297      if (data != NULL) {
298 <        atomData = dynamic_cast<AtomData *>(data);
299 <
300 <        if (atomData == NULL)
301 <            return;
298 >      atomData = dynamic_cast<AtomData *>(data);
299 >      
300 >      if (atomData == NULL)
301 >        return;
302      } else
303 <        return;
303 >      return;
304  
305      for( atomInfo = atomData->beginAtomInfo(i); atomInfo;
306 <        atomInfo = atomData->nextAtomInfo(i) ) {
307 <        sprintf(buffer,
308 <                "%s%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f",
309 <                atomInfo->atomTypeName.c_str(),
310 <                atomInfo->pos[0],
311 <                atomInfo->pos[1],
312 <                atomInfo->pos[2],
313 <                atomInfo->dipole[0],
314 <                atomInfo->dipole[1],
315 <                atomInfo->dipole[2]);
316 <        frame.push_back(buffer);
317 <    }
318 < }
306 >         atomInfo = atomData->nextAtomInfo(i) ) {
307 >    
308 >      std::string line;
309 >      sprintf(buffer, "%s", atomInfo->atomTypeName.c_str());
310 >      line += buffer;
311 >      
312 >      if (doPositions_){
313 >        sprintf(buffer, "%15.8f%15.8f%15.8f", atomInfo->pos[0],
314 >                atomInfo->pos[1], atomInfo->pos[2]);
315 >        line += buffer;
316 >      }      
317 >      if (doCharges_ && atomInfo->hasCharge) {
318 >        sprintf(buffer, "%15.8f", atomInfo->charge);
319 >        line += buffer;
320 >      }
321 >      if (doVectors_ && atomInfo->hasVector) {
322 >        sprintf(buffer, "%15.8f%15.8f%15.8f", atomInfo->vec[0],
323 >                atomInfo->vec[1], atomInfo->vec[2]);
324 >        line += buffer;
325 >      }
326 >      if (doVelocities_ && atomInfo->hasVelocity) {
327 >        sprintf(buffer, "%15.8f%15.8f%15.8f", atomInfo->vel[0],
328 >                atomInfo->vel[1], atomInfo->vel[2]);
329 >        line += buffer;
330 >      }
331 >      if (doForces_ && atomInfo->hasForce) {
332 >        sprintf(buffer, "%15.8f%15.8f%15.8f", atomInfo->frc[0],
333 >                atomInfo->frc[1], atomInfo->frc[2]);
334 >        line += buffer;
335 >      }      
336 >      if (doElectricFields_ && atomInfo->hasElectricField) {
337 >        sprintf(buffer, "%15.8f%15.8f%15.8f", atomInfo->eField[0],
338 >                atomInfo->eField[1], atomInfo->eField[2]);
339 >        line += buffer;
340 >      }      
341 >      frame.push_back(line);
342 >    }    
343 >  }
344  
345 < bool XYZVisitor::isSelected(StuntDouble *sd) {
345 >  bool XYZVisitor::isSelected(StuntDouble *sd) {
346      return seleMan.isSelected(sd);
347 < }
347 >  }
348  
349 < void XYZVisitor::writeFrame(std::ostream &outStream) {
349 >  void XYZVisitor::writeFrame(std::ostream &outStream) {
350      std::vector<std::string>::iterator i;
351      char buffer[1024];
352 <
352 >    
353      if (frame.size() == 0)
354 <        std::cerr << "Current Frame does not contain any atoms" << std::endl;
355 <
354 >      std::cerr << "Current Frame does not contain any atoms" << std::endl;
355 >    
356      //total number of atoms  
357      outStream << frame.size() << std::endl;
358 <
358 >    
359      //write comment line
360      Snapshot* currSnapshot = info->getSnapshotManager()->getCurrentSnapshot();
361      Mat3x3d box = currSnapshot->getHmat();
# Line 322 | Line 366 | void XYZVisitor::writeFrame(std::ostream &outStream) {
366              box(0, 0), box(0, 1), box(0, 2),
367              box(1, 0), box(1, 1), box(1, 2),
368              box(2, 0), box(2, 1), box(2, 2));
369 <
369 >    
370      outStream << buffer << std::endl;
371 <
371 >    
372      for( i = frame.begin(); i != frame.end(); ++i )
373 <        outStream << *i << std::endl;
374 < }
375 <
376 < const std::string XYZVisitor::toString() {
373 >      outStream << *i << std::endl;
374 >  }
375 >  
376 >  std::string XYZVisitor::trimmedName(const std::string&atomTypeName) {    
377 >    return atomTypeName.substr(0, atomTypeName.find('-'));
378 >  }
379 >  
380 >  const std::string XYZVisitor::toString() {
381      char        buffer[65535];
382      std::string result;
383 <
383 >    
384      sprintf(buffer,
385              "------------------------------------------------------------------\n");
386      result += buffer;
387 <
387 >    
388      sprintf(buffer, "Visitor name: %s\n", visitorName.c_str());
389      result += buffer;
390 <
390 >    
391      sprintf(buffer,
392              "Visitor Description: assemble the atom data and output xyz file\n");
393      result += buffer;
# Line 347 | Line 395 | const std::string XYZVisitor::toString() {
395      sprintf(buffer,
396              "------------------------------------------------------------------\n");
397      result += buffer;
398 <
398 >    
399      return result;
400 < }
401 <
402 < //----------------------------------------------------------------------------//
403 <
404 < void PrepareVisitor::internalVisit(Atom *atom) {
400 >  }
401 >  
402 >  //----------------------------------------------------------------------------//
403 >  
404 >  void PrepareVisitor::internalVisit(Atom *atom) {
405      GenericData *data;
406      AtomData *   atomData;
407 <
407 >    
408      //if visited property is  existed, remove it
409      data = atom->getPropertyByName("VISITED");
410 <
410 >    
411      if (data != NULL) {
412 <    atom->removeProperty("VISITED");
412 >      atom->removeProperty("VISITED");
413      }
414 <
414 >    
415      //remove atomdata
416      data = atom->getPropertyByName("ATOMDATA");
417  
418      if (data != NULL) {
419 <        atomData = dynamic_cast<AtomData *>(data);
419 >      atomData = dynamic_cast<AtomData *>(data);
420  
421 <        if (atomData != NULL)
422 <            atom->removeProperty("ATOMDATA");
421 >      if (atomData != NULL)
422 >        atom->removeProperty("ATOMDATA");
423      }
424 < }
424 >  }
425  
426 < void PrepareVisitor::internalVisit(RigidBody *rb) {
426 >  void PrepareVisitor::internalVisit(RigidBody *rb) {
427      GenericData* data;
428      AtomData* atomData;
429      std::vector<Atom *> myAtoms;
# Line 385 | Line 433 | void PrepareVisitor::internalVisit(RigidBody *rb) {
433      data = rb->getPropertyByName("VISITED");
434  
435      if (data != NULL) {
436 <    rb->removeProperty("VISITED");
436 >      rb->removeProperty("VISITED");
437      }
438  
439      //remove atomdata
440      data = rb->getPropertyByName("ATOMDATA");
441  
442      if (data != NULL) {
443 <        atomData = dynamic_cast<AtomData *>(data);
443 >      atomData = dynamic_cast<AtomData *>(data);
444  
445 <        if (atomData != NULL)
446 <            rb->removeProperty("ATOMDATA");
445 >      if (atomData != NULL)
446 >        rb->removeProperty("ATOMDATA");
447      }
448  
449      myAtoms = rb->getAtoms();
450  
451      for( atomIter = myAtoms.begin(); atomIter != myAtoms.end(); ++atomIter )
452 <        internalVisit(*atomIter);
453 < }
452 >      internalVisit(*atomIter);
453 >  }
454  
455 < const std::string PrepareVisitor::toString() {
456 <     char buffer[65535];
457 <     std::string result;
455 >  const std::string PrepareVisitor::toString() {
456 >    char buffer[65535];
457 >    std::string result;
458  
459 <     sprintf(buffer,
460 <             "------------------------------------------------------------------\n");
461 <     result += buffer;
459 >    sprintf(buffer,
460 >            "------------------------------------------------------------------\n");
461 >    result += buffer;
462  
463 <     sprintf(buffer, "Visitor name: %s", visitorName.c_str());
464 <     result += buffer;
463 >    sprintf(buffer, "Visitor name: %s", visitorName.c_str());
464 >    result += buffer;
465  
466 <     sprintf(buffer,
467 <             "Visitor Description: prepare for operation of other vistors\n");
468 <     result += buffer;
466 >    sprintf(buffer,
467 >            "Visitor Description: prepare for operation of other vistors\n");
468 >    result += buffer;
469  
470 <     sprintf(buffer,
471 <             "------------------------------------------------------------------\n");
472 <     result += buffer;
470 >    sprintf(buffer,
471 >            "------------------------------------------------------------------\n");
472 >    result += buffer;
473  
474 <     return result;
475 < }
474 >    return result;
475 >  }
476  
477 < //----------------------------------------------------------------------------//
477 >  //----------------------------------------------------------------------------//
478  
479 < WaterTypeVisitor::WaterTypeVisitor() {
479 >  WaterTypeVisitor::WaterTypeVisitor() {
480      visitorName = "WaterTypeVisitor";
481      waterTypeList.insert("TIP3P_RB_0");
482      waterTypeList.insert("TIP4P_RB_0");
483 +    waterTypeList.insert("TIP4P-Ew_RB_0");
484      waterTypeList.insert("TIP5P_RB_0");
485 +    waterTypeList.insert("TIP5P-E_RB_0");
486      waterTypeList.insert("SPCE_RB_0");
487 < }
487 >    waterTypeList.insert("SPC_RB_0");
488 >  }
489  
490 < void WaterTypeVisitor::visit(RigidBody *rb) {
490 >  void WaterTypeVisitor::visit(RigidBody *rb) {
491      std::string rbName;
492      std::vector<Atom *> myAtoms;
493      std::vector<Atom *>::iterator atomIter;
# Line 446 | Line 497 | void WaterTypeVisitor::visit(RigidBody *rb) {
497      std::vector<AtomInfo *>::iterator i;
498  
499      rbName = rb->getType();
500 <
500 >    
501      if (waterTypeList.find(rbName) != waterTypeList.end()) {
502 <        myAtoms = rb->getAtoms();
502 >      myAtoms = rb->getAtoms();
503  
504 <        for( atomIter = myAtoms.begin(); atomIter != myAtoms.end();
505 <            ++atomIter ) {
506 <            data = (*atomIter)->getPropertyByName("ATOMDATA");
507 <
508 <            if (data != NULL) {
509 <                atomData = dynamic_cast<AtomData *>(data);
510 <
511 <                if (atomData == NULL)
512 <                    continue;
513 <            } else
514 <                continue;
515 <
516 <            for( atomInfo = atomData->beginAtomInfo(i); atomInfo;
517 <                 atomInfo = atomData->nextAtomInfo(i) ) {
518 <              atomInfo->atomTypeName = trimmedName(atomInfo->atomTypeName);
519 <            } //end for(atomInfo)
520 <        }     //end for(atomIter)
504 >      for( atomIter = myAtoms.begin(); atomIter != myAtoms.end();
505 >           ++atomIter ) {
506 >        data = (*atomIter)->getPropertyByName("ATOMDATA");
507 >        
508 >        if (data != NULL) {
509 >          atomData = dynamic_cast<AtomData *>(data);
510 >          
511 >          if (atomData == NULL)
512 >            continue;
513 >        } else
514 >          continue;
515 >        
516 >        for( atomInfo = atomData->beginAtomInfo(i); atomInfo;
517 >             atomInfo = atomData->nextAtomInfo(i) ) {
518 >          atomInfo->atomTypeName = trimmedName(atomInfo->atomTypeName);
519 >        } //end for(atomInfo)
520 >      }     //end for(atomIter)
521      }         //end if (waterTypeList.find(rbName) != waterTypeList.end())
522 < }
522 >  }
523  
524    std::string WaterTypeVisitor::trimmedName(const std::string&atomTypeName) {
525      return atomTypeName.substr(0, atomTypeName.find('_'));
526    }
527  
528 < const std::string WaterTypeVisitor::toString() {
528 >  const std::string WaterTypeVisitor::toString() {
529      char buffer[65535];
530      std::string result;
531  
# Line 494 | Line 545 | const std::string WaterTypeVisitor::toString() {
545      result += buffer;
546  
547      return result;
548 < }
548 >  }
549  
550 < } //namespace oopse
550 > } //namespace OpenMD

Comparing:
trunk/src/visitors/OtherVisitor.cpp (property svn:keywords), Revision 413 by tim, Wed Mar 9 17:30:29 2005 UTC vs.
branches/development/src/visitors/OtherVisitor.cpp (property svn:keywords), Revision 1871 by gezelter, Fri May 10 14:59:13 2013 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines