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 507 by gezelter, Fri Apr 15 22:04:00 2005 UTC vs.
Revision 1390 by gezelter, Wed Nov 25 20:02:06 2009 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]  Vardeman & Gezelter, in progress (2009).                        
40   */
41   #include "selection/SelectionManager.hpp"
42   #include "visitors/OtherVisitor.hpp"
# Line 44 | Line 44
44   #include "primitives/RigidBody.hpp"
45   #include "primitives/Molecule.hpp"
46   #include "brains/SimInfo.hpp"
47 < namespace oopse {
47 > namespace OpenMD {
48  
49    void WrappingVisitor::visit(Atom *atom) {
50      internalVisit(atom);
# Line 77 | Line 77 | namespace oopse {
77      Snapshot* currSnapshot = info->getSnapshotManager()->getCurrentSnapshot();
78      
79      for( atomInfo = atomData->beginAtomInfo(i); atomInfo; atomInfo = atomData->nextAtomInfo(i) ) {
80 <      currSnapshot->wrapVector(atomInfo->pos);
80 >      Vector3d newPos = atomInfo->pos - origin_;
81 >      currSnapshot->wrapVector(newPos);
82 >      atomInfo->pos = newPos;
83      }
84    }
85  
86 +  void WrappingVisitor::update() {
87 +    if (useCom_){
88 +      origin_ = info->getCom();
89 +    }
90 +  }
91 +  
92    const std::string WrappingVisitor::toString() {
93      char        buffer[65535];
94      std::string result;
# Line 227 | Line 235 | namespace oopse {
235        if (!evaluator.isDynamic()) {
236          seleMan.setSelectionSet(evaluator.evaluate());
237        }
238 <
238 >      posOnly_ = false;
239      }
240  
241    XYZVisitor::XYZVisitor(SimInfo *info, const std::string& script) :
# Line 240 | Line 248 | namespace oopse {
248        if (!evaluator.isDynamic()) {
249          seleMan.setSelectionSet(evaluator.evaluate());
250        }
251 <          
251 >      posOnly_ = false;
252      }
253      
254    void XYZVisitor::visit(Atom *atom) {
# Line 283 | Line 291 | namespace oopse {
291      } else
292        return;
293  
294 <    for( atomInfo = atomData->beginAtomInfo(i); atomInfo;
295 <         atomInfo = atomData->nextAtomInfo(i) ) {
296 <      sprintf(buffer,
297 <              "%s%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f",
298 <              atomInfo->atomTypeName.c_str(),
299 <              atomInfo->pos[0],
300 <              atomInfo->pos[1],
301 <              atomInfo->pos[2],
302 <              atomInfo->dipole[0],
303 <              atomInfo->dipole[1],
304 <              atomInfo->dipole[2]);
305 <      frame.push_back(buffer);
294 >    AtomType* at = dynamic_cast<Atom *>(sd)->getAtomType();
295 >    std::string bn = baseTypeName(at);
296 >
297 >    if (posOnly_){
298 >      for( atomInfo = atomData->beginAtomInfo(i); atomInfo;
299 >           atomInfo = atomData->nextAtomInfo(i) ) {
300 >        if (atomInfo->hasCharge) {
301 >          sprintf(buffer,
302 >                  "%s%15.8f%15.8f%15.8f%15.8f",
303 >                  bn.c_str(),
304 >                  atomInfo->pos[0],
305 >                  atomInfo->pos[1],
306 >                  atomInfo->pos[2],
307 >                  atomInfo->charge);
308 >        } else {
309 >          sprintf(buffer,
310 >                "%s%15.8f%15.8f%15.8f",
311 >                  bn.c_str(),
312 >                  atomInfo->pos[0],
313 >                  atomInfo->pos[1],
314 >                  atomInfo->pos[2]);
315 >        }
316 >        frame.push_back(buffer);
317 >      }
318 >    }else{
319 >      for( atomInfo = atomData->beginAtomInfo(i); atomInfo;
320 >           atomInfo = atomData->nextAtomInfo(i) ) {
321 >        if (atomInfo->hasCharge) {
322 >        sprintf(buffer,
323 >                "%s%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f",
324 >                bn.c_str(),
325 >                atomInfo->pos[0],
326 >                atomInfo->pos[1],
327 >                atomInfo->pos[2],
328 >                atomInfo->charge,
329 >                atomInfo->dipole[0],
330 >                atomInfo->dipole[1],
331 >                atomInfo->dipole[2]);
332 >        } else {
333 >        sprintf(buffer,
334 >                "%s%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f",
335 >                bn.c_str(),
336 >                atomInfo->pos[0],
337 >                atomInfo->pos[1],
338 >                atomInfo->pos[2],
339 >                atomInfo->dipole[0],
340 >                atomInfo->dipole[1],
341 >                atomInfo->dipole[2]);
342 >        }
343 >        frame.push_back(buffer);
344 >      }
345      }
346    }
347  
# Line 329 | Line 376 | namespace oopse {
376        outStream << *i << std::endl;
377    }
378  
379 +  std::string XYZVisitor::trimmedName(const std::string&atomTypeName) {    
380 +    return atomTypeName.substr(0, atomTypeName.find('-'));
381 +  }
382 +
383 +  std::string XYZVisitor::baseTypeName(AtomType* at) {
384 +    std::vector<AtomType*> ayb = at->allYourBase();
385 +    return ayb[ayb.size()-1]->getName();
386 +  }
387 +
388    const std::string XYZVisitor::toString() {
389      char        buffer[65535];
390      std::string result;
# Line 496 | Line 552 | namespace oopse {
552      return result;
553    }
554  
555 < } //namespace oopse
555 > } //namespace OpenMD

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines