ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/DumpWriter.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/DumpWriter.cpp (file contents):
Revision 1198 by tim, Thu May 27 00:48:12 2004 UTC vs.
Revision 1252 by gezelter, Mon Jun 7 14:26:33 2004 UTC

# Line 170 | Line 170 | void DumpWriter::writeFrame( vector<ofstream*>& outFil
170    char tempBuffer[BUFFERSIZE];  
171    char writeLine[BUFFERSIZE];
172  
173 <  int i, k;
173 >  int i;
174 >  unsigned int k;
175  
176   #ifdef IS_MPI
177    
# Line 294 | Line 295 | void DumpWriter::writeFrame( vector<ofstream*>& outFil
295        }
296        else
297          strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" );
298 +    
299 +      for(k = 0; k < outFile.size(); k++)
300 +        *outFile[k] << writeLine;      
301      }
302  
299    
300    for(k = 0; k < outFile.size(); k++)
301      *outFile[k] << writeLine;
303   }
304  
305   #else // is_mpi
# Line 325 | Line 326 | void DumpWriter::writeFrame( vector<ofstream*>& outFil
326  
327      // Node 0 needs a list of the magic potatoes for each processor;
328  
329 <    nProc = mpiSim->getNprocessors();
329 >    nProc = mpiSim->getNProcessors();
330      potatoes = new int[nProc];
331  
332      //write out the comment lines
# Line 353 | Line 354 | void DumpWriter::writeFrame( vector<ofstream*>& outFil
354  
355      currentIndex = 0;
356  
357 <    for (i = 0 ; i < mpiSim->getTotNmol(); i++ ) {
357 >    for (i = 0 ; i < mpiSim->getNMolGlobal(); i++ ) {
358        
359        // Get the Node number which has this atom;
360        
# Line 404 | Line 405 | void DumpWriter::writeFrame( vector<ofstream*>& outFil
405              isDirectional = 1;
406            else
407              isDirectional = 0;
408 +          
409 +          // If we've survived to here, format the line:
410              
411 <        }
411 >          if (!isDirectional) {
412 >        
413 >            sprintf( writeLine,
414 >                 "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t",
415 >                 atomTypeString,
416 >                 atomData[0],
417 >                 atomData[1],
418 >                 atomData[2],
419 >                 atomData[3],
420 >                 atomData[4],
421 >                 atomData[5]);
422 >        
423 >           strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" );
424 >        
425 >          }
426 >          else {
427 >        
428 >                sprintf( writeLine,
429 >                         "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
430 >                         atomTypeString,
431 >                         atomData[0],
432 >                         atomData[1],
433 >                         atomData[2],
434 >                         atomData[3],
435 >                         atomData[4],
436 >                         atomData[5],
437 >                         atomData[6],
438 >                         atomData[7],
439 >                         atomData[8],
440 >                         atomData[9],
441 >                         atomData[10],
442 >                         atomData[11],
443 >                         atomData[12]);
444 >            
445 >          }
446 >          
447 >          for(k = 0; k < outFile.size(); k++)
448 >            *outFile[k] << writeLine;            
449 >
450 >        }// end for(int l =0)
451          potatoes[which_node] = myPotato;
452  
453 <      } else {
453 >      }
454 >      else {
455          
456          haveError = 0;
457          
# Line 453 | Line 496 | void DumpWriter::writeFrame( vector<ofstream*>& outFil
496                atomData[12] = ji[2];
497              }
498              
499 <        }
499 >            // If we've survived to here, format the line:
500 >            
501 >            if (!isDirectional) {
502 >        
503 >              sprintf( writeLine,
504 >                 "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t",
505 >                 atomTypeString,
506 >                 atomData[0],
507 >                 atomData[1],
508 >                 atomData[2],
509 >                 atomData[3],
510 >                 atomData[4],
511 >                 atomData[5]);
512 >        
513 >             strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" );
514 >        
515 >            }
516 >            else {
517 >        
518 >                sprintf( writeLine,
519 >                         "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
520 >                         atomTypeString,
521 >                         atomData[0],
522 >                         atomData[1],
523 >                         atomData[2],
524 >                         atomData[3],
525 >                         atomData[4],
526 >                         atomData[5],
527 >                         atomData[6],
528 >                         atomData[7],
529 >                         atomData[8],
530 >                         atomData[9],
531 >                         atomData[10],
532 >                         atomData[11],
533 >                         atomData[12]);
534 >              
535 >            }
536 >            
537 >            for(k = 0; k < outFile.size(); k++)
538 >              *outFile[k] << writeLine;
539 >            
540 >            
541 >        }//end for(iter = integrableObject.begin())
542          
543        currentIndex++;
544        }
545 <      // If we've survived to here, format the line:
546 <      
462 <      if (!isDirectional) {
463 <        
464 <        sprintf( writeLine,
465 <                 "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t",
466 <                 atomTypeString,
467 <                 atomData[0],
468 <                 atomData[1],
469 <                 atomData[2],
470 <                 atomData[3],
471 <                 atomData[4],
472 <                 atomData[5]);
473 <        
474 <        strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" );
475 <        
476 <      } else {
477 <        
478 <        sprintf( writeLine,
479 <                 "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
480 <                 atomTypeString,
481 <                 atomData[0],
482 <                 atomData[1],
483 <                 atomData[2],
484 <                 atomData[3],
485 <                 atomData[4],
486 <                 atomData[5],
487 <                 atomData[6],
488 <                 atomData[7],
489 <                 atomData[8],
490 <                 atomData[9],
491 <                 atomData[10],
492 <                 atomData[11],
493 <                 atomData[12]);
494 <        
495 <      }
496 <      
497 <      for(k = 0; k < outFile.size(); k++)
498 <        *outFile[k] << writeLine;
499 <    }
545 >
546 >    }//end for(i = 0; i < mpiSim->getNmol())
547      
548      for(k = 0; k < outFile.size(); k++)
549        outFile[k]->flush();
# Line 517 | Line 564 | void DumpWriter::writeFrame( vector<ofstream*>& outFil
564      myPotato = 0;
565      currentIndex = 0;
566      
567 <    for (i = 0 ; i < mpiSim->getTotNmol(); i++ ) {
567 >    for (i = 0 ; i < mpiSim->getNMolGlobal(); i++ ) {
568        
569        // Am I the node which has this integrableObject?
570        

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines