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

Comparing trunk/src/applications/dump2Xyz/Dump2XYZ.cpp (file contents):
Revision 1474 by gezelter, Wed Jul 21 14:29:14 2010 UTC vs.
Revision 1782 by gezelter, Wed Aug 22 02:28:28 2012 UTC

# Line 36 | Line 36
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).                        
39 > * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40 > * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
42  
43   #include <iostream>
# Line 63 | Line 64 | using namespace OpenMD;
64  
65   using namespace OpenMD;
66  
67 + using namespace std;
68   int main(int argc, char* argv[]){
69    
68  //register force fields
69  registerForceFields();
70  
70    gengetopt_args_info args_info;
71 <  std::string dumpFileName;
72 <  std::string xyzFileName;
73 <  bool printVel;
74 <  bool printFrc;
75 <  bool printVec;
76 <  bool printChrg;
71 >  string dumpFileName;
72 >  string xyzFileName;
73 >
74 >  bool printVel(false);
75 >  bool printFrc(false);
76 >  bool printVec(false);
77 >  bool printChrg(false);
78    
79    //parse the command line option
80    if (cmdline_parser (argc, argv, &args_info) != 0) {
# Line 85 | Line 85 | int main(int argc, char* argv[]){
85    if (args_info.input_given){
86      dumpFileName = args_info.input_arg;
87    } else {
88 <    std::cerr << "Does not have input file name" << std::endl;
88 >    cerr << "Does not have input file name" << endl;
89      exit(1);
90    }
91    
# Line 138 | Line 138 | int main(int argc, char* argv[]){
138    if (args_info.basetype_flag) {
139      AtomNameVisitor* atomNameVisitor = new AtomNameVisitor(info);
140      compositeVisitor->addVisitor(atomNameVisitor, 550);    
141 <    std::cout << compositeVisitor->toString();
141 >    cout << compositeVisitor->toString();
142    }
143    
144    //create ZconsVisitor
# Line 180 | Line 180 | int main(int argc, char* argv[]){
180                                                         args_info.refsele_arg),
181                                   250);
182    } else if (args_info.refsele_given || args_info.originsele_given) {
183 <    std::cerr << "Both of --refsele and --originsele should appear by pair"
184 <              << std::endl;
183 >    cerr << "Both of --refsele and --originsele should appear by pair"
184 >         << endl;
185      exit(1);
186    }
187    
# Line 220 | Line 220 | int main(int argc, char* argv[]){
220    DumpReader* dumpReader = new DumpReader(info, dumpFileName);
221    int nframes = dumpReader->getNFrames();
222    
223 <  std::ofstream xyzStream(xyzFileName.c_str());
223 >  ofstream xyzStream(xyzFileName.c_str());
224    
225    SimInfo::MoleculeIterator miter;
226    Molecule::IntegrableObjectIterator  iiter;
227    Molecule::RigidBodyIterator rbIter;
228    Molecule* mol;
229 <  StuntDouble* integrableObject;
229 >  StuntDouble* sd;
230    RigidBody* rb;
231    Vector3d molCom;
232    Vector3d newMolCom;
# Line 244 | Line 244 | int main(int argc, char* argv[]){
244        currentSnapshot = info->getSnapshotManager()->getCurrentSnapshot();    
245        for (mol = info->beginMolecule(miter); mol != NULL;
246             mol = info->nextMolecule(miter)) {
247 <          molCom = mol->getCom();
248 <          newMolCom = molCom;
249 <          currentSnapshot->wrapVector(newMolCom);
250 <          displacement = newMolCom - molCom;
251 <        for (integrableObject = mol->beginIntegrableObject(iiter);
252 <             integrableObject != NULL;
253 <             integrableObject = mol->nextIntegrableObject(iiter)) {  
254 <          integrableObject->setPos(integrableObject->getPos() + displacement);
247 >        
248 >        molCom = mol->getCom();
249 >        newMolCom = molCom;
250 >        currentSnapshot->wrapVector(newMolCom);
251 >        displacement = newMolCom - molCom;
252 >
253 >        for (sd = mol->beginIntegrableObject(iiter); sd != NULL;
254 >             sd = mol->nextIntegrableObject(iiter)) {  
255 >
256 >          sd->setPos(sd->getPos() + displacement);
257 >          
258          }
259        }    
260      }
261 +
262      //update atoms of rigidbody
263      for (mol = info->beginMolecule(miter); mol != NULL;
264           mol = info->nextMolecule(miter)) {
# Line 262 | Line 266 | int main(int argc, char* argv[]){
266        //change the positions of atoms which belong to the rigidbodies
267        for (rb = mol->beginRigidBody(rbIter); rb != NULL;
268             rb = mol->nextRigidBody(rbIter)) {
269 +
270          rb->updateAtoms();
271          if (printVel) rb->updateAtomVel();
272 +
273        }
274      }
275      
276      //prepare visit
277      for (mol = info->beginMolecule(miter); mol != NULL;
278           mol = info->nextMolecule(miter)) {
279 <      for (integrableObject = mol->beginIntegrableObject(iiter);
280 <           integrableObject != NULL;
281 <           integrableObject = mol->nextIntegrableObject(iiter)) {
282 <        integrableObject->accept(prepareVisitor);
279 >
280 >      for (sd = mol->beginIntegrableObject(iiter); sd != NULL;
281 >           sd = mol->nextIntegrableObject(iiter)) {
282 >
283 >        sd->accept(prepareVisitor);
284 >
285        }
286      }
287      
# Line 284 | Line 292 | int main(int argc, char* argv[]){
292      //visit stuntdouble
293      for (mol = info->beginMolecule(miter); mol != NULL;
294           mol = info->nextMolecule(miter)) {
295 <      for (integrableObject = mol->beginIntegrableObject(iiter);
296 <           integrableObject != NULL;
297 <           integrableObject = mol->nextIntegrableObject(iiter)) {
298 <        integrableObject->accept(compositeVisitor);
295 >
296 >      for (sd = mol->beginIntegrableObject(iiter); sd != NULL;
297 >           sd = mol->nextIntegrableObject(iiter)) {
298 >
299 >        sd->accept(compositeVisitor);
300 >
301        }
302      }
303      

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines