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 1665 by gezelter, Tue Nov 22 20:38:56 2011 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, 24107 (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 > namespace OpenMD {
49  
50 < void WrappingVisitor::visit(Atom *atom) {
51 < internalVisit(atom);
52 < }
50 >  void WrappingVisitor::visit(Atom *atom) {
51 >    internalVisit(atom);
52 >  }
53  
54 < void WrappingVisitor::visit(DirectionalAtom *datom) {
55 < internalVisit(datom);
56 < }
54 >  void WrappingVisitor::visit(DirectionalAtom *datom) {
55 >    internalVisit(datom);
56 >  }
57  
58 < void WrappingVisitor::visit(RigidBody *rb) {
59 < internalVisit(rb);
60 < }
58 >  void WrappingVisitor::visit(RigidBody *rb) {
59 >    internalVisit(rb);
60 >  }
61  
62 < void WrappingVisitor::internalVisit(StuntDouble *sd) {
62 >  void WrappingVisitor::internalVisit(StuntDouble *sd) {
63      GenericData *                     data;
64      AtomData *                        atomData;
65      AtomInfo *                        atomInfo;
# Line 67 | Line 68 | void WrappingVisitor::internalVisit(StuntDouble *sd) {
68      data = sd->getPropertyByName("ATOMDATA");
69  
70      if (data != NULL) {
71 <        atomData = dynamic_cast<AtomData *>(data);
71 >      atomData = dynamic_cast<AtomData *>(data);
72  
73 <        if (atomData == NULL)
74 <            return;
73 >      if (atomData == NULL)
74 >        return;
75      } else
76 <        return;
76 >      return;
77  
78      Snapshot* currSnapshot = info->getSnapshotManager()->getCurrentSnapshot();
79      
80      for( atomInfo = atomData->beginAtomInfo(i); atomInfo; atomInfo = atomData->nextAtomInfo(i) ) {
81 <        currSnapshot->wrapVector(atomInfo->pos);
81 >      Vector3d newPos = atomInfo->pos - origin_;
82 >      currSnapshot->wrapVector(newPos);
83 >      atomInfo->pos = newPos;
84      }
85 < }
85 >  }
86  
87 < const std::string WrappingVisitor::toString() {
87 >  void WrappingVisitor::update() {
88 >    if (useCom_){
89 >      origin_ = info->getCom();
90 >    }
91 >  }
92 >  
93 >  const std::string WrappingVisitor::toString() {
94      char        buffer[65535];
95      std::string result;
96  
# Line 101 | Line 110 | const std::string WrappingVisitor::toString() {
110      result += buffer;
111  
112      return result;
113 < }
113 >  }
114  
115 < //----------------------------------------------------------------------------//
115 >  //----------------------------------------------------------------------------//
116  
117 < ReplicateVisitor::ReplicateVisitor(SimInfo *info, Vector3i opt) :
117 >  ReplicateVisitor::ReplicateVisitor(SimInfo *info, Vector3i opt) :
118      BaseVisitor() {
119 <    this->info = info;
120 <    visitorName = "ReplicateVisitor";
121 <    this->replicateOpt = opt;
119 >      this->info = info;
120 >      visitorName = "ReplicateVisitor";
121 >      this->replicateOpt = opt;
122  
123 <    //generate the replicate directions
124 <    for( int i = 0; i <= replicateOpt[0]; i++ ) {
123 >      //generate the replicate directions
124 >      for( int i = 0; i <= replicateOpt[0]; i++ ) {
125          for( int j = 0; j <= replicateOpt[1]; j++ ) {
126 <            for( int k = 0; k <= replicateOpt[2]; k++ ) {
127 <                //skip original frame
128 <                if (i == 0 && j == 0 && k == 0) {
129 <                    continue;
130 <                } else {
131 <                    dir.push_back(Vector3i(i, j, k));
132 <                }
133 <            }
126 >          for( int k = 0; k <= replicateOpt[2]; k++ ) {
127 >            //skip original frame
128 >            if (i == 0 && j == 0 && k == 0) {
129 >              continue;
130 >            } else {
131 >              dir.push_back(Vector3i(i, j, k));
132 >            }
133 >          }
134          }
135 <    }
135 >      }
136      
137 < }
137 >    }
138  
139 < void ReplicateVisitor::visit(Atom *atom) {
140 < internalVisit(atom);
141 < }
139 >  void ReplicateVisitor::visit(Atom *atom) {
140 >    internalVisit(atom);
141 >  }
142  
143 < void ReplicateVisitor::visit(DirectionalAtom *datom) {
144 < internalVisit(datom);
145 < }
143 >  void ReplicateVisitor::visit(DirectionalAtom *datom) {
144 >    internalVisit(datom);
145 >  }
146  
147 < void ReplicateVisitor::visit(RigidBody *rb) {
148 < internalVisit(rb);
149 < }
147 >  void ReplicateVisitor::visit(RigidBody *rb) {
148 >    internalVisit(rb);
149 >  }
150  
151 < void ReplicateVisitor::internalVisit(StuntDouble *sd) {
151 >  void ReplicateVisitor::internalVisit(StuntDouble *sd) {
152      GenericData *          data;
153      AtomData *             atomData;
154  
# Line 147 | Line 156 | void ReplicateVisitor::internalVisit(StuntDouble *sd)
156      data = sd->getPropertyByName("ATOMDATA");
157  
158      if (data != NULL) {
159 <        atomData = dynamic_cast<AtomData *>(data);
159 >      atomData = dynamic_cast<AtomData *>(data);
160  
161 <        if (atomData == NULL) {
162 <            return;
163 <        }
161 >      if (atomData == NULL) {
162 >        return;
163 >      }
164      } else {
165 <        return;
165 >      return;
166      }
167  
168      Snapshot* currSnapshot = info->getSnapshotManager()->getCurrentSnapshot();
# Line 162 | Line 171 | void ReplicateVisitor::internalVisit(StuntDouble *sd)
171      std::vector<AtomInfo *> atomInfoList = atomData->getData();
172  
173      replicate(atomInfoList, atomData, box);
174 < }
174 >  }
175  
176 < void ReplicateVisitor::replicate(std::vector<AtomInfo *>&infoList, AtomData *data, const Mat3x3d& box) {
176 >  void ReplicateVisitor::replicate(std::vector<AtomInfo *>&infoList, AtomData *data, const Mat3x3d& box) {
177      AtomInfo* newAtomInfo;
178      std::vector<Vector3i>::iterator dirIter;
179      std::vector<AtomInfo *>::iterator i;
180  
181      for( dirIter = dir.begin(); dirIter != dir.end(); ++dirIter ) {
182 <        for( i = infoList.begin(); i != infoList.end(); i++ ) {
183 <            newAtomInfo = new AtomInfo();
184 <            *newAtomInfo = *(*i);
176 <
177 <            for( int j = 0; j < 3; j++ )
178 <                newAtomInfo->pos[j] += (*dirIter)[0]*box(j, 0) + (*dirIter)[1]*box(j, 1) + (*dirIter)[2]*box(j, 2);
182 >      for( i = infoList.begin(); i != infoList.end(); i++ ) {
183 >        newAtomInfo = new AtomInfo();
184 >        *newAtomInfo = *(*i);
185  
186 <            data->addAtomInfo(newAtomInfo);
187 <        }
186 >        for( int j = 0; j < 3; j++ )
187 >          newAtomInfo->pos[j] += (*dirIter)[0]*box(j, 0) + (*dirIter)[1]*box(j, 1) + (*dirIter)[2]*box(j, 2);
188 >
189 >        data->addAtomInfo(newAtomInfo);
190 >      }
191      } // end for(dirIter)  
192 < }
192 >  }
193  
194 < const std::string ReplicateVisitor::toString() {
194 >  const std::string ReplicateVisitor::toString() {
195      char                            buffer[65535];
196      std::string                     result;
197      std::set<std::string>::iterator i;
# Line 213 | Line 222 | const std::string ReplicateVisitor::toString() {
222      result += buffer;
223  
224      return result;
225 < }
225 >  }
226  
227 < //----------------------------------------------------------------------------//
227 >  //------------------------------------------------------------------------//
228  
229 < XYZVisitor::XYZVisitor(SimInfo *info) :
230 <    BaseVisitor(), seleMan(info), evaluator(info){
229 >  XYZVisitor::XYZVisitor(SimInfo *info) : BaseVisitor(), seleMan(info),
230 >                                          evaluator(info), doPositions_(true),
231 >                                          doVelocities_(false),
232 >                                          doForces_(false), doVectors_(false),
233 >                                          doCharges_(false) {
234      this->info = info;
235      visitorName = "XYZVisitor";
236 <
236 >    
237      evaluator.loadScriptString("select all");
238 <
238 >    
239      if (!evaluator.isDynamic()) {
240 <        seleMan.setSelectionSet(evaluator.evaluate());
240 >      seleMan.setSelectionSet(evaluator.evaluate());
241      }
242 <
243 < }
244 <
245 < XYZVisitor::XYZVisitor(SimInfo *info, const std::string& script) :
246 <    BaseVisitor(), seleMan(info), evaluator(info) {
242 >  }
243 >  
244 >  XYZVisitor::XYZVisitor(SimInfo *info, const std::string& script) :
245 >    BaseVisitor(), seleMan(info), evaluator(info), doPositions_(true),
246 >    doVelocities_(false), doForces_(false), doVectors_(false),
247 >    doCharges_(false) {
248 >    
249      this->info = info;
250      visitorName = "XYZVisitor";
251 <
251 >    
252      evaluator.loadScriptString(script);
253 <
253 >    
254      if (!evaluator.isDynamic()) {
255 <        seleMan.setSelectionSet(evaluator.evaluate());
255 >      seleMan.setSelectionSet(evaluator.evaluate());
256      }
257 <          
244 < }
257 >  }
258      
259 < void XYZVisitor::visit(Atom *atom) {
259 >  void XYZVisitor::visit(Atom *atom) {
260      if (isSelected(atom))
261 <        internalVisit(atom);
262 < }
261 >      internalVisit(atom);
262 >  }
263  
264 < void XYZVisitor::visit(DirectionalAtom *datom) {
264 >  void XYZVisitor::visit(DirectionalAtom *datom) {
265      if (isSelected(datom))
266 <        internalVisit(datom);
267 < }
268 <
269 < void XYZVisitor::visit(RigidBody *rb) {
266 >      internalVisit(datom);
267 >  }
268 >  
269 >  void XYZVisitor::visit(RigidBody *rb) {
270      if (isSelected(rb))
271 <        internalVisit(rb);
272 < }
273 <
274 < void XYZVisitor::update() {
271 >      internalVisit(rb);
272 >  }
273 >  
274 >  void XYZVisitor::update() {
275      //if dynamic, we need to re-evaluate the selection
276      if (evaluator.isDynamic()) {
277 <       seleMan.setSelectionSet(evaluator.evaluate());
277 >      seleMan.setSelectionSet(evaluator.evaluate());
278      }
279 < }
280 <
281 < void XYZVisitor::internalVisit(StuntDouble *sd) {
279 >  }
280 >  
281 >  void XYZVisitor::internalVisit(StuntDouble *sd) {
282      GenericData *                     data;
283      AtomData *                        atomData;
284      AtomInfo *                        atomInfo;
285      std::vector<AtomInfo *>::iterator i;
286      char                              buffer[1024];
287 <
287 >    
288      //if there is not atom data, just skip it
289      data = sd->getPropertyByName("ATOMDATA");
290 <
290 >    
291      if (data != NULL) {
292 <        atomData = dynamic_cast<AtomData *>(data);
293 <
294 <        if (atomData == NULL)
295 <            return;
292 >      atomData = dynamic_cast<AtomData *>(data);
293 >      
294 >      if (atomData == NULL)
295 >        return;
296      } else
297 <        return;
297 >      return;
298  
299      for( atomInfo = atomData->beginAtomInfo(i); atomInfo;
300 <        atomInfo = atomData->nextAtomInfo(i) ) {
301 <        sprintf(buffer,
302 <                "%s%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f",
303 <                atomInfo->atomTypeName.c_str(),
304 <                atomInfo->pos[0],
305 <                atomInfo->pos[1],
306 <                atomInfo->pos[2],
307 <                atomInfo->dipole[0],
308 <                atomInfo->dipole[1],
309 <                atomInfo->dipole[2]);
310 <        frame.push_back(buffer);
311 <    }
312 < }
300 >         atomInfo = atomData->nextAtomInfo(i) ) {
301 >    
302 >      std::string line;
303 >      sprintf(buffer, "%s", atomInfo->atomTypeName.c_str());
304 >      line += buffer;
305 >      
306 >      if (doPositions_){
307 >        sprintf(buffer, "%15.8f%15.8f%15.8f", atomInfo->pos[0],
308 >                atomInfo->pos[1], atomInfo->pos[2]);
309 >        line += buffer;
310 >      }      
311 >      if (doCharges_ && atomInfo->hasCharge) {
312 >        sprintf(buffer, "%15.8f", atomInfo->charge);
313 >        line += buffer;
314 >      }
315 >      if (doVectors_ && atomInfo->hasVector) {
316 >        sprintf(buffer, "%15.8f%15.8f%15.8f", atomInfo->vec[0],
317 >                atomInfo->vec[1], atomInfo->vec[2]);
318 >        line += buffer;
319 >      }
320 >      if (doVelocities_ && atomInfo->hasVelocity) {
321 >        sprintf(buffer, "%15.8f%15.8f%15.8f", atomInfo->vel[0],
322 >                atomInfo->vel[1], atomInfo->vel[2]);
323 >        line += buffer;
324 >      }
325 >      if (doForces_ && atomInfo->hasForce) {
326 >        sprintf(buffer, "%15.8f%15.8f%15.8f", atomInfo->frc[0],
327 >                atomInfo->frc[1], atomInfo->frc[2]);
328 >        line += buffer;
329 >      }      
330 >      frame.push_back(line);
331 >    }    
332 >  }
333  
334 < bool XYZVisitor::isSelected(StuntDouble *sd) {
334 >  bool XYZVisitor::isSelected(StuntDouble *sd) {
335      return seleMan.isSelected(sd);
336 < }
336 >  }
337  
338 < void XYZVisitor::writeFrame(std::ostream &outStream) {
338 >  void XYZVisitor::writeFrame(std::ostream &outStream) {
339      std::vector<std::string>::iterator i;
340      char buffer[1024];
341 <
341 >    
342      if (frame.size() == 0)
343 <        std::cerr << "Current Frame does not contain any atoms" << std::endl;
344 <
343 >      std::cerr << "Current Frame does not contain any atoms" << std::endl;
344 >    
345      //total number of atoms  
346      outStream << frame.size() << std::endl;
347 <
347 >    
348      //write comment line
349      Snapshot* currSnapshot = info->getSnapshotManager()->getCurrentSnapshot();
350      Mat3x3d box = currSnapshot->getHmat();
# Line 322 | Line 355 | void XYZVisitor::writeFrame(std::ostream &outStream) {
355              box(0, 0), box(0, 1), box(0, 2),
356              box(1, 0), box(1, 1), box(1, 2),
357              box(2, 0), box(2, 1), box(2, 2));
358 <
358 >    
359      outStream << buffer << std::endl;
360 <
360 >    
361      for( i = frame.begin(); i != frame.end(); ++i )
362 <        outStream << *i << std::endl;
363 < }
364 <
365 < const std::string XYZVisitor::toString() {
362 >      outStream << *i << std::endl;
363 >  }
364 >  
365 >  std::string XYZVisitor::trimmedName(const std::string&atomTypeName) {    
366 >    return atomTypeName.substr(0, atomTypeName.find('-'));
367 >  }
368 >  
369 >  const std::string XYZVisitor::toString() {
370      char        buffer[65535];
371      std::string result;
372 <
372 >    
373      sprintf(buffer,
374              "------------------------------------------------------------------\n");
375      result += buffer;
376 <
376 >    
377      sprintf(buffer, "Visitor name: %s\n", visitorName.c_str());
378      result += buffer;
379 <
379 >    
380      sprintf(buffer,
381              "Visitor Description: assemble the atom data and output xyz file\n");
382      result += buffer;
# Line 347 | Line 384 | const std::string XYZVisitor::toString() {
384      sprintf(buffer,
385              "------------------------------------------------------------------\n");
386      result += buffer;
387 <
387 >    
388      return result;
389 < }
390 <
391 < //----------------------------------------------------------------------------//
392 <
393 < void PrepareVisitor::internalVisit(Atom *atom) {
389 >  }
390 >  
391 >  //----------------------------------------------------------------------------//
392 >  
393 >  void PrepareVisitor::internalVisit(Atom *atom) {
394      GenericData *data;
395      AtomData *   atomData;
396 <
396 >    
397      //if visited property is  existed, remove it
398      data = atom->getPropertyByName("VISITED");
399 <
399 >    
400      if (data != NULL) {
401 <    atom->removeProperty("VISITED");
401 >      atom->removeProperty("VISITED");
402      }
403 <
403 >    
404      //remove atomdata
405      data = atom->getPropertyByName("ATOMDATA");
406  
407      if (data != NULL) {
408 <        atomData = dynamic_cast<AtomData *>(data);
408 >      atomData = dynamic_cast<AtomData *>(data);
409  
410 <        if (atomData != NULL)
411 <            atom->removeProperty("ATOMDATA");
410 >      if (atomData != NULL)
411 >        atom->removeProperty("ATOMDATA");
412      }
413 < }
413 >  }
414  
415 < void PrepareVisitor::internalVisit(RigidBody *rb) {
415 >  void PrepareVisitor::internalVisit(RigidBody *rb) {
416      GenericData* data;
417      AtomData* atomData;
418      std::vector<Atom *> myAtoms;
# Line 385 | Line 422 | void PrepareVisitor::internalVisit(RigidBody *rb) {
422      data = rb->getPropertyByName("VISITED");
423  
424      if (data != NULL) {
425 <    rb->removeProperty("VISITED");
425 >      rb->removeProperty("VISITED");
426      }
427  
428      //remove atomdata
429      data = rb->getPropertyByName("ATOMDATA");
430  
431      if (data != NULL) {
432 <        atomData = dynamic_cast<AtomData *>(data);
432 >      atomData = dynamic_cast<AtomData *>(data);
433  
434 <        if (atomData != NULL)
435 <            rb->removeProperty("ATOMDATA");
434 >      if (atomData != NULL)
435 >        rb->removeProperty("ATOMDATA");
436      }
437  
438      myAtoms = rb->getAtoms();
439  
440      for( atomIter = myAtoms.begin(); atomIter != myAtoms.end(); ++atomIter )
441 <        internalVisit(*atomIter);
442 < }
441 >      internalVisit(*atomIter);
442 >  }
443  
444 < const std::string PrepareVisitor::toString() {
445 <     char buffer[65535];
446 <     std::string result;
444 >  const std::string PrepareVisitor::toString() {
445 >    char buffer[65535];
446 >    std::string result;
447  
448 <     sprintf(buffer,
449 <             "------------------------------------------------------------------\n");
450 <     result += buffer;
448 >    sprintf(buffer,
449 >            "------------------------------------------------------------------\n");
450 >    result += buffer;
451  
452 <     sprintf(buffer, "Visitor name: %s", visitorName.c_str());
453 <     result += buffer;
452 >    sprintf(buffer, "Visitor name: %s", visitorName.c_str());
453 >    result += buffer;
454  
455 <     sprintf(buffer,
456 <             "Visitor Description: prepare for operation of other vistors\n");
457 <     result += buffer;
455 >    sprintf(buffer,
456 >            "Visitor Description: prepare for operation of other vistors\n");
457 >    result += buffer;
458  
459 <     sprintf(buffer,
460 <             "------------------------------------------------------------------\n");
461 <     result += buffer;
459 >    sprintf(buffer,
460 >            "------------------------------------------------------------------\n");
461 >    result += buffer;
462  
463 <     return result;
464 < }
463 >    return result;
464 >  }
465  
466 < //----------------------------------------------------------------------------//
466 >  //----------------------------------------------------------------------------//
467  
468 < WaterTypeVisitor::WaterTypeVisitor() {
468 >  WaterTypeVisitor::WaterTypeVisitor() {
469      visitorName = "WaterTypeVisitor";
470      waterTypeList.insert("TIP3P_RB_0");
471      waterTypeList.insert("TIP4P_RB_0");
472 +    waterTypeList.insert("TIP4P-Ew_RB_0");
473      waterTypeList.insert("TIP5P_RB_0");
474 +    waterTypeList.insert("TIP5P-E_RB_0");
475      waterTypeList.insert("SPCE_RB_0");
476 < }
476 >    waterTypeList.insert("SPC_RB_0");
477 >  }
478  
479 < void WaterTypeVisitor::visit(RigidBody *rb) {
479 >  void WaterTypeVisitor::visit(RigidBody *rb) {
480      std::string rbName;
481      std::vector<Atom *> myAtoms;
482      std::vector<Atom *>::iterator atomIter;
# Line 446 | Line 486 | void WaterTypeVisitor::visit(RigidBody *rb) {
486      std::vector<AtomInfo *>::iterator i;
487  
488      rbName = rb->getType();
489 <
489 >    
490      if (waterTypeList.find(rbName) != waterTypeList.end()) {
491 <        myAtoms = rb->getAtoms();
491 >      myAtoms = rb->getAtoms();
492  
493 <        for( atomIter = myAtoms.begin(); atomIter != myAtoms.end();
494 <            ++atomIter ) {
495 <            data = (*atomIter)->getPropertyByName("ATOMDATA");
496 <
497 <            if (data != NULL) {
498 <                atomData = dynamic_cast<AtomData *>(data);
499 <
500 <                if (atomData == NULL)
501 <                    continue;
502 <            } else
503 <                continue;
504 <
505 <            for( atomInfo = atomData->beginAtomInfo(i); atomInfo;
506 <                 atomInfo = atomData->nextAtomInfo(i) ) {
507 <              atomInfo->atomTypeName = trimmedName(atomInfo->atomTypeName);
508 <            } //end for(atomInfo)
509 <        }     //end for(atomIter)
493 >      for( atomIter = myAtoms.begin(); atomIter != myAtoms.end();
494 >           ++atomIter ) {
495 >        data = (*atomIter)->getPropertyByName("ATOMDATA");
496 >        
497 >        if (data != NULL) {
498 >          atomData = dynamic_cast<AtomData *>(data);
499 >          
500 >          if (atomData == NULL)
501 >            continue;
502 >        } else
503 >          continue;
504 >        
505 >        for( atomInfo = atomData->beginAtomInfo(i); atomInfo;
506 >             atomInfo = atomData->nextAtomInfo(i) ) {
507 >          atomInfo->atomTypeName = trimmedName(atomInfo->atomTypeName);
508 >        } //end for(atomInfo)
509 >      }     //end for(atomIter)
510      }         //end if (waterTypeList.find(rbName) != waterTypeList.end())
511 < }
511 >  }
512  
513    std::string WaterTypeVisitor::trimmedName(const std::string&atomTypeName) {
514      return atomTypeName.substr(0, atomTypeName.find('_'));
515    }
516  
517 < const std::string WaterTypeVisitor::toString() {
517 >  const std::string WaterTypeVisitor::toString() {
518      char buffer[65535];
519      std::string result;
520  
# Line 494 | Line 534 | const std::string WaterTypeVisitor::toString() {
534      result += buffer;
535  
536      return result;
537 < }
537 >  }
538  
539 < } //namespace oopse
539 > } //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 1665 by gezelter, Tue Nov 22 20:38:56 2011 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines