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

Comparing branches/development/src/visitors/OtherVisitor.cpp (file contents):
Revision 1465 by chuckv, Fri Jul 9 23:08:25 2010 UTC vs.
Revision 1874 by gezelter, Wed May 15 15:09:35 2013 UTC

# Line 35 | Line 35
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).                        
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 + #include "brains/Thermo.hpp"
49 +
50   namespace OpenMD {
51  
52    void WrappingVisitor::visit(Atom *atom) {
# Line 76 | Line 79 | namespace OpenMD {
79  
80      Snapshot* currSnapshot = info->getSnapshotManager()->getCurrentSnapshot();
81      
82 <    for( atomInfo = atomData->beginAtomInfo(i); atomInfo; atomInfo = atomData->nextAtomInfo(i) ) {
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    }
91  
92    void WrappingVisitor::update() {
93      if (useCom_){
94 <      origin_ = info->getCom();
94 >      Thermo thermo(info);
95 >      origin_ = thermo.getCom();
96      }
97    }
98    
# Line 178 | Line 185 | namespace OpenMD {
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++ ) {
188 >      for( i = infoList.begin(); i != infoList.end(); ++i ) {
189          newAtomInfo = new AtomInfo();
190          *newAtomInfo = *(*i);
191  
# Line 193 | Line 200 | namespace OpenMD {
200    const std::string ReplicateVisitor::toString() {
201      char                            buffer[65535];
202      std::string                     result;
196    std::set<std::string>::iterator i;
203  
204 +
205      sprintf(buffer,
206 <            "------------------------------------------------------------------\n");
206 >            "--------------------------------------------------------------\n");
207      result += buffer;
208  
209      sprintf(buffer, "Visitor name: %s\n", visitorName.c_str());
# Line 217 | Line 224 | namespace OpenMD {
224      result += buffer;
225  
226      sprintf(buffer,
227 <            "------------------------------------------------------------------\n");
227 >            "--------------------------------------------------------------\n");
228      result += buffer;
229  
230      return result;
# Line 229 | Line 236 | namespace OpenMD {
236                                            evaluator(info), doPositions_(true),
237                                            doVelocities_(false),
238                                            doForces_(false), doVectors_(false),
239 <                                          doCharges_(false) {
239 >                                          doCharges_(false),
240 >                                          doElectricFields_(false) {
241      this->info = info;
242      visitorName = "XYZVisitor";
243      
# Line 243 | Line 251 | namespace OpenMD {
251    XYZVisitor::XYZVisitor(SimInfo *info, const std::string& script) :
252      BaseVisitor(), seleMan(info), evaluator(info), doPositions_(true),
253      doVelocities_(false), doForces_(false), doVectors_(false),
254 <    doCharges_(false) {
254 >    doCharges_(false), doElectricFields_(false) {
255      
256      this->info = info;
257      visitorName = "XYZVisitor";
# Line 326 | Line 334 | namespace OpenMD {
334                  atomInfo->frc[1], atomInfo->frc[2]);
335          line += buffer;
336        }      
337 +      if (doElectricFields_ && atomInfo->hasElectricField) {
338 +        sprintf(buffer, "%15.8f%15.8f%15.8f", atomInfo->eField[0],
339 +                atomInfo->eField[1], atomInfo->eField[2]);
340 +        line += buffer;
341 +      }      
342        frame.push_back(line);
343      }    
344    }
# Line 338 | Line 351 | namespace OpenMD {
351      std::vector<std::string>::iterator i;
352      char buffer[1024];
353      
354 <    if (frame.size() == 0)
354 >    if (frame.empty())
355        std::cerr << "Current Frame does not contain any atoms" << std::endl;
356      
357      //total number of atoms  
# Line 391 | Line 404 | namespace OpenMD {
404    
405    void PrepareVisitor::internalVisit(Atom *atom) {
406      GenericData *data;
394    AtomData *   atomData;
407      
408      //if visited property is  existed, remove it
409      data = atom->getPropertyByName("VISITED");
# Line 404 | Line 416 | namespace OpenMD {
416      data = atom->getPropertyByName("ATOMDATA");
417  
418      if (data != NULL) {
419 <      atomData = dynamic_cast<AtomData *>(data);
419 >      AtomData* atomData = dynamic_cast<AtomData *>(data);
420  
421        if (atomData != NULL)
422          atom->removeProperty("ATOMDATA");
# Line 479 | Line 491 | namespace OpenMD {
491      std::string rbName;
492      std::vector<Atom *> myAtoms;
493      std::vector<Atom *>::iterator atomIter;
482    GenericData* data;
483    AtomData* atomData;
484    AtomInfo* atomInfo;
494      std::vector<AtomInfo *>::iterator i;
495 +    AtomData* atomData;
496  
497      rbName = rb->getType();
498      
499      if (waterTypeList.find(rbName) != waterTypeList.end()) {
500        myAtoms = rb->getAtoms();
501 <
501 >      
502        for( atomIter = myAtoms.begin(); atomIter != myAtoms.end();
503             ++atomIter ) {
504 <        data = (*atomIter)->getPropertyByName("ATOMDATA");
504 >        GenericData* data = (*atomIter)->getPropertyByName("ATOMDATA");
505          
506          if (data != NULL) {
507            atomData = dynamic_cast<AtomData *>(data);
# Line 501 | Line 511 | namespace OpenMD {
511          } else
512            continue;
513          
514 <        for( atomInfo = atomData->beginAtomInfo(i); atomInfo;
514 >        for( AtomInfo* atomInfo = atomData->beginAtomInfo(i); atomInfo;
515               atomInfo = atomData->nextAtomInfo(i) ) {
516            atomInfo->atomTypeName = trimmedName(atomInfo->atomTypeName);
517 <        } //end for(atomInfo)
518 <      }     //end for(atomIter)
519 <    }         //end if (waterTypeList.find(rbName) != waterTypeList.end())
517 >        }
518 >      }  
519 >    }
520    }
521  
522    std::string WaterTypeVisitor::trimmedName(const std::string&atomTypeName) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines