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 954 by tim, Wed May 10 01:44:48 2006 UTC vs.
Revision 1212 by xsun, Wed Jan 23 21:21:13 2008 UTC

# Line 68 | Line 68 | int main(int argc, char* argv[]){
68    
69    gengetopt_args_info args_info;
70    std::string dumpFileName;
71  std::string mdFileName;
71    std::string xyzFileName;
72    
73    //parse the command line option
# Line 84 | Line 83 | int main(int argc, char* argv[]){
83      exit(1);
84    }
85    
87  mdFileName = dumpFileName;
88  mdFileName = mdFileName.substr(0, mdFileName.rfind(".")) + ".md";
89
86    if (args_info.output_given){
87      xyzFileName = args_info.output_arg;
88    } else {
# Line 96 | Line 92 | int main(int argc, char* argv[]){
92    
93    //parse md file and set up the system
94    SimCreator creator;
95 <  SimInfo* info = creator.createSim(mdFileName, false);
95 >  SimInfo* info = creator.createSim(dumpFileName, false);
96    
97 <  
102 <  
97 >
98    //create visitor list
99    CompositeVisitor* compositeVisitor = new CompositeVisitor();
100      
# Line 122 | Line 117 | int main(int argc, char* argv[]){
117    GBLipidAtomVisitor* gbLipidVisitor = new GBLipidAtomVisitor(info);
118    compositeVisitor->addVisitor(gbLipidVisitor, 740);
119  
120 +  Ring5gbAtomVisitor* ring5Visitor = new Ring5gbAtomVisitor(info);
121 +  compositeVisitor->addVisitor(ring5Visitor, 730);
122 +
123 +  HeadAtomVisitor* headVisitor = new HeadAtomVisitor(info);
124 +  compositeVisitor->addVisitor(headVisitor, 720);
125 +
126    //create default atom visitor
127    DefaultAtomVisitor* defaultAtomVisitor = new DefaultAtomVisitor(info);
128    compositeVisitor->addVisitor(defaultAtomVisitor, 700);
# Line 152 | Line 153 | int main(int argc, char* argv[]){
153    
154    //create wrapping visitor
155    
156 <  if(args_info.periodicBox_flag){
157 <    WrappingVisitor* wrappingVisitor = new WrappingVisitor(info);
158 <    compositeVisitor->addVisitor(wrappingVisitor, 400);
159 <  }
156 >  //if(args_info.periodicBox_flag){
157 >  //  WrappingVisitor* wrappingVisitor = new WrappingVisitor(info);
158 >  //  compositeVisitor->addVisitor(wrappingVisitor, 400);
159 >  //}
160  
161    //create replicate visitor
162    if(args_info.repeatX_given > 0 || args_info.repeatY_given > 0 ||args_info.repeatY_given > 0){
# Line 175 | Line 176 | int main(int argc, char* argv[]){
176      
177    //create xyzVisitor
178    XYZVisitor* xyzVisitor;
179 +
180    if (args_info.selection_given) {
181      xyzVisitor = new XYZVisitor(info, args_info.selection_arg);
182    } else {
183      xyzVisitor = new XYZVisitor(info);
184    }
185 +
186 +  if(args_info.printPosOnly_flag){
187 +    bool posOnly = true;
188 +    xyzVisitor->setPosOnly(posOnly);
189 +  }
190 +
191    compositeVisitor->addVisitor(xyzVisitor, 200);
192    
193    std::cout << compositeVisitor->toString();
# Line 202 | Line 210 | int main(int argc, char* argv[]){
210    Molecule* mol;
211    StuntDouble* integrableObject;
212    RigidBody* rb;
213 +  Vector3d molCom;
214 +  Vector3d newMolCom;
215 +  Vector3d displacement;
216 +  Mat3x3d hmat;
217 +  Snapshot* currentSnapshot;
218        
219    for (int i = 0; i < nframes; i += args_info.frame_arg){
220      dumpReader->readFrame(i);
221 <    
221 >
222 >    //wrapping the molecule
223 >    if(args_info.periodicBox_flag) {
224 >      currentSnapshot = info->getSnapshotManager()->getCurrentSnapshot();    
225 >      for (mol = info->beginMolecule(miter); mol != NULL; mol = info->nextMolecule(miter)) {
226 >          molCom = mol->getCom();
227 >          newMolCom = molCom;
228 >          currentSnapshot->wrapVector(newMolCom);
229 >          displacement = newMolCom - molCom;
230 >        for (integrableObject = mol->beginIntegrableObject(iiter); integrableObject != NULL;
231 >             integrableObject = mol->nextIntegrableObject(iiter)) {  
232 >          integrableObject->setPos(integrableObject->getPos() + displacement);
233 >        }
234 >      }    
235 >    }
236      //update atoms of rigidbody
237      for (mol = info->beginMolecule(miter); mol != NULL; mol = info->nextMolecule(miter)) {
238        

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines