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 436 by chuckv, Fri Mar 28 21:45:03 2003 UTC vs.
Revision 437 by chuckv, Fri Mar 28 22:34:02 2003 UTC

# Line 375 | Line 375 | void DumpWriter::writeFinal(){
375        which_node = AtomToProcMap[i];    
376        
377        if (which_node == mpiSim->getMyNode()) {
378 <        
379 <        sprintf( tempBuffer,
380 <                 "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t",
381 <                 atoms[i]->getType(),
382 <                 atoms[i]->getX(),
383 <                 atoms[i]->getY(),
384 <                 atoms[i]->getZ(),
385 <                 atoms[i]->get_vx(),
386 <                 atoms[i]->get_vy(),
387 <                 atoms[i]->get_vz());
388 <        strcpy( writeLine, tempBuffer );
389 <        
390 <        if( atoms[i]->isDirectional() ){
391 <          
392 <          dAtom = (DirectionalAtom *)atoms[i];
393 <          dAtom->getQ( q );
394 <          
395 <          sprintf( tempBuffer,
396 <                   "%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
397 <                   q[0],
398 <                   q[1],
399 <                   q[2],
400 <                   q[3],
401 <                   dAtom->getJx(),
402 <                   dAtom->getJy(),
403 <                   dAtom->getJz());
404 <          strcat( writeLine, tempBuffer );
378 >
379 >        which_atom = i;
380 >        local_index=-1;        
381 >        for (j=0; (j<mpiSim->getMyNlocal()) && (local_index < 0); j++) {
382 >          if (atoms[j]->getGlobalIndex() == which_atom) local_index = j;
383          }
384 <        else
385 <          strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" );      
386 <        
384 >        if (local_index != -1) {        
385 >          sprintf( tempBuffer,
386 >                   "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t",
387 >                   atoms[local_index]->getType(),
388 >                   atoms[local_index]->getX(),
389 >                   atoms[local_index]->getY(),
390 >                   atoms[local_index]->getZ(),
391 >                   atoms[local_index]->get_vx(),
392 >                   atoms[local_index]->get_vy(),
393 >                   atoms[local_index]->get_vz());
394 >          strcpy( writeLine, tempBuffer );
395 >          
396 >          if( atoms[local_index]->isDirectional() ){
397 >            
398 >            dAtom = (DirectionalAtom *)atoms[local_index];
399 >            dAtom->getQ( q );
400 >            
401 >            sprintf( tempBuffer,
402 >                     "%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
403 >                     q[0],
404 >                     q[1],
405 >                     q[2],
406 >                     q[3],
407 >                     dAtom->getJx(),
408 >                     dAtom->getJy(),
409 >                     dAtom->getJz());
410 >            strcat( writeLine, tempBuffer );
411 >          }
412 >          else
413 >            strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" );      
414 >        }
415 >        else {
416 >          strcpy( writeLine, "ATOM NOT FOUND ON THIS PROCESSOR");
417 >        }
418 >    
419        } else {
420          
421          MPI::COMM_WORLD.Send(&i, 1, MPI_INT, which_node, TAKE_THIS_TAG_INT);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines