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 378 by mmeineke, Fri Mar 21 17:42:12 2003 UTC vs.
Revision 419 by gezelter, Thu Mar 27 15:07:29 2003 UTC

# Line 4 | Line 4
4  
5   #ifdef IS_MPI
6   #include <mpi.h>
7 + #include <mpi++.h>
8   #include "mpiSimulation.hpp"
9   #define TAKE_THIS_TAG 0
10   #endif //is_mpi
# Line 11 | Line 12
12   #include "ReadWrite.hpp"
13   #include "simError.h"
14  
14
15
16
17
15   DumpWriter::DumpWriter( SimInfo* the_entry_plug ){
16  
17    entry_plug = the_entry_plug;
# Line 68 | Line 65 | void DumpWriter::writeDump( double currentTime ){
65    char tempBuffer[BUFFERSIZE];
66    char writeLine[BUFFERSIZE];
67  
68 <  int i;
68 >  int i, j, which_node, done, game_over, which_atom, local_index;
69    double q[4];
70    DirectionalAtom* dAtom;
71    int nAtoms = entry_plug->n_atoms;
# Line 123 | Line 120 | void DumpWriter::writeDump( double currentTime ){
120  
121   #else // is_mpi
122  
123 <  int masterIndex;
124 <  int nodeAtomsStart;
125 <  int nodeAtomsEnd;
129 <  int mpiErr;
130 <  int sendError;
131 <  int procIndex;
132 <    
133 <  MPI_Status istatus[MPI_STATUS_SIZE];
134 <
135 <    
123 >  MPI::Status istatus;
124 >  int *AtomToProcMap = mpiSim->getAtomToProcMap();
125 >  
126    // write out header and node 0's coordinates
127 <
127 >  
128    if( worldRank == 0 ){
129      outFile << mpiSim->getTotAtoms() << "\n";
130 <      
130 >    
131      outFile << currentTime << "\t"
132              << entry_plug->box_x << "\t"
133              << entry_plug->box_y << "\t"
134              << entry_plug->box_z << "\n";
135 <
136 <    masterIndex = 0;
137 <    for( i=0; i<nAtoms; i++ ){
135 >    
136 >    for (i = 0 ; i < mpiSim->getTotAtoms(); i++ ) {
137 >      // Get the Node number which has this atom;
138        
139 <      sprintf( tempBuffer,
140 <               "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t",
141 <               atoms[i]->getType(),
142 <               atoms[i]->getX(),
143 <               atoms[i]->getY(),
144 <               atoms[i]->getZ(),
145 <               atoms[i]->get_vx(),
146 <               atoms[i]->get_vy(),
147 <               atoms[i]->get_vz());
148 <      strcpy( writeLine, tempBuffer );
139 >      which_node = AtomToProcMap[i];    
140 >      
141 >      if (which_node == mpiSim->getMyNode()) {
142 >        
143 >        sprintf( tempBuffer,
144 >                 "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t",
145 >                 atoms[i]->getType(),
146 >                 atoms[i]->getX(),
147 >                 atoms[i]->getY(),
148 >                 atoms[i]->getZ(),
149 >                 atoms[i]->get_vx(),
150 >                 atoms[i]->get_vy(),
151 >                 atoms[i]->get_vz());
152 >        strcpy( writeLine, tempBuffer );
153          
154 <      if( atoms[i]->isDirectional() ){
154 >        if( atoms[i]->isDirectional() ){
155            
156 <        dAtom = (DirectionalAtom *)atoms[i];
157 <        dAtom->getQ( q );
156 >          dAtom = (DirectionalAtom *)atoms[i];
157 >          dAtom->getQ( q );
158            
159 <        sprintf( tempBuffer,
160 <                 "%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
161 <                 q[0],
162 <                 q[1],
163 <                 q[2],
164 <                 q[3],
165 <                 dAtom->getJx(),
166 <                 dAtom->getJy(),
167 <                 dAtom->getJz());
168 <        strcat( writeLine, tempBuffer );
159 >          sprintf( tempBuffer,
160 >                   "%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
161 >                   q[0],
162 >                   q[1],
163 >                   q[2],
164 >                   q[3],
165 >                   dAtom->getJx(),
166 >                   dAtom->getJy(),
167 >                   dAtom->getJz());
168 >          strcat( writeLine, tempBuffer );
169 >        }
170 >        else
171 >          strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" );      
172 >        
173 >      } else {
174 >        
175 >        MPI::COMM_WORLD.Send(&i, 1, MPI_INT, which_node, TAKE_THIS_TAG);
176 >        MPI::COMM_WORLD.Recv(writeLine, BUFFERSIZE, MPI_CHAR, which_node,
177 >                                TAKE_THIS_TAG, istatus);
178        }
179 <      else
177 <        strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" );
178 <        
179 >      
180        outFile << writeLine;
180      masterIndex++;
181      }
182    outFile.flush();
183  }
184
185  sprintf( checkPointMsg,
186           "Sucessfully wrote node 0's dump configuration.\n");
187  MPIcheckPoint();
182      
183 <  for (procIndex = 1; procIndex < mpiSim->getNumberProcessors();
184 <       procIndex++){
185 <
186 <    if( worldRank == 0 ){
193 <      
194 <      mpiErr = MPI_Recv(&nodeAtomsStart,1,MPI_INT,procIndex,
195 <                        TAKE_THIS_TAG,MPI_COMM_WORLD,istatus);
196 <      
197 <      mpiErr = MPI_Recv(&nodeAtomsEnd,1,MPI_INT,procIndex,
198 <                        TAKE_THIS_TAG,MPI_COMM_WORLD, istatus);
199 <      
200 <      // Make sure where node 0 is writing to, matches where the
201 <      // receiving node expects it to be.
202 <      
203 <      if (masterIndex != nodeAtomsStart){
204 <        sendError = 1;
205 <        mpiErr = MPI_Send(&sendError,1,MPI_INT,procIndex,TAKE_THIS_TAG,
206 <                          MPI_COMM_WORLD);
207 <        sprintf(painCave.errMsg,
208 <                "DumpWriter error: atoms start index (%d) for "
209 <                "node %d not equal to master index (%d)",
210 <                nodeAtomsStart,procIndex,masterIndex );
211 <        painCave.isFatal = 1;
212 <        simError();
213 <      }
214 <      
215 <      sendError = 0;
216 <      mpiErr = MPI_Send(&sendError,1,MPI_INT,procIndex,TAKE_THIS_TAG,
217 <                        MPI_COMM_WORLD);
218 <      
219 <      // recieve the nodes writeLines
220 <      
221 <      for ( i = nodeAtomsStart; i <= nodeAtomsEnd; i++){
222 <        
223 <        mpiErr = MPI_Recv(writeLine,BUFFERSIZE,MPI_CHAR,procIndex,
224 <                          TAKE_THIS_TAG,MPI_COMM_WORLD,istatus );
225 <        
226 <        outFile << writeLine;
227 <        masterIndex++;
228 <      }
183 >    // kill everyone off:
184 >    game_over = -1;
185 >    for (j = 0; j < mpiSim->getNumberProcessors(); j++) {      
186 >      MPI::COMM_WORLD.Send(&game_over, 1, MPI_INT, j, TAKE_THIS_TAG);
187      }
188  
189 <    else if( worldRank == procIndex ){
190 <
191 <      nodeAtomsStart = mpiSim->getMyAtomStart();
192 <      nodeAtomsEnd = mpiSim->getMyAtomEnd();
193 <
194 <      mpiErr = MPI_Send(&nodeAtomsStart,1,MPI_INT,0,TAKE_THIS_TAG,
195 <                        MPI_COMM_WORLD);
196 <      mpiErr = MPI_Send(&nodeAtomsEnd,1,MPI_INT,0,TAKE_THIS_TAG,
197 <                        MPI_COMM_WORLD);
198 <        
199 <      sendError = -1;
200 <      mpiErr = MPI_Recv(&sendError,1,MPI_INT,0,TAKE_THIS_TAG,
201 <                        MPI_COMM_WORLD, istatus);
202 <
203 <      if (sendError) MPIcheckPoint();
204 <
205 <      // send current node's configuration line by line.
206 <
207 <      for( i=0; i<nAtoms; i++ ){
208 <
209 <        sprintf( tempBuffer,
210 <                 "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t",
211 <                 atoms[i]->getType(),
212 <                 atoms[i]->getX(),
213 <                 atoms[i]->getY(),
214 <                 atoms[i]->getZ(),
215 <                 atoms[i]->get_vx(),
258 <                 atoms[i]->get_vy(),
259 <                 atoms[i]->get_vz()); // check here.
260 <        strcpy( writeLine, tempBuffer );
189 >  } else {
190 >    
191 >    done = 0;
192 >    while (!done) {
193 >      MPI::COMM_WORLD.Recv(&which_atom, 1, MPI_INT, 0,
194 >                           TAKE_THIS_TAG, istatus);
195 >      
196 >      if (which_atom == -1) {
197 >        done=1;
198 >        continue;
199 >      } else {
200 >        local_index=-1;        
201 >        for (j=0; j < mpiSim->getMyNlocal(); j++) {
202 >          if (atoms[j]->getGlobalIndex() == which_atom) local_index = j;
203 >        }
204 >        if (local_index != -1) {
205 >          //format the line
206 >          sprintf( tempBuffer,
207 >                   "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t",
208 >                   atoms[local_index]->getType(),
209 >                   atoms[local_index]->getX(),
210 >                   atoms[local_index]->getY(),
211 >                   atoms[local_index]->getZ(),
212 >                   atoms[local_index]->get_vx(),
213 >                   atoms[local_index]->get_vy(),
214 >                   atoms[local_index]->get_vz()); // check here.
215 >          strcpy( writeLine, tempBuffer );
216            
217 <        if( atoms[i]->isDirectional() ){
218 <            
219 <          dAtom = (DirectionalAtom *)atoms[i];
220 <          dAtom->getQ( q );
221 <            
222 <          sprintf( tempBuffer,
223 <                   "%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
224 <                   q[0],
225 <                   q[1],
226 <                   q[2],
227 <                   q[3],
228 <                   dAtom->getJx(),
229 <                   dAtom->getJy(),
230 <                   dAtom->getJz());
231 <          strcat( writeLine, tempBuffer );
232 <        }
233 <        else
234 <          strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" );
235 <          
236 <        mpiErr = MPI_Send(writeLine,BUFFERSIZE,MPI_CHAR,0,TAKE_THIS_TAG,
237 <                          MPI_COMM_WORLD);
217 >          if( atoms[local_index]->isDirectional() ){
218 >            
219 >            dAtom = (DirectionalAtom *)atoms[local_index];
220 >            dAtom->getQ( q );
221 >            
222 >            sprintf( tempBuffer,
223 >                     "%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
224 >                     q[0],
225 >                     q[1],
226 >                     q[2],
227 >                     q[3],
228 >                     dAtom->getJx(),
229 >                     dAtom->getJy(),
230 >                     dAtom->getJz());
231 >            strcat( writeLine, tempBuffer );
232 >          }
233 >          else
234 >            strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" );
235 >          
236 >          MPI::COMM_WORLD.Send(writeLine, BUFFERSIZE, MPI_CHAR, 0,
237 >                               TAKE_THIS_TAG);
238 >        } else {
239 >          strcpy( writeLine, "ATOM NOT FOUND ON THIS PROCESSOR");
240 >          MPI::COMM_WORLD.Send(writeLine, BUFFERSIZE, MPI_CHAR, 0,
241 >                               TAKE_THIS_TAG);
242 >        }
243        }
244      }
245 <      
246 <    sprintf(checkPointMsg,"Node %d sent dump configuration.",
247 <            procIndex);
248 <    MPIcheckPoint();
249 <  }
290 <    
245 >  }  
246 >  outFile.flush();
247 >  sprintf( checkPointMsg,
248 >           "Sucessfully took a dump.\n");
249 >  MPIcheckPoint();
250   #endif // is_mpi
251   }
252  
294
295
253   void DumpWriter::writeFinal(){
254  
255 +  char finalName[500];
256 +  ofstream finalOut;
257  
258    const int BUFFERSIZE = 2000;
259 <  char tempBuffer[500];
260 <  char writeLine[BUFFERSIZE];
302 <  
303 <  char finalName[500];
259 >  char tempBuffer[BUFFERSIZE];
260 >  char writeLine[BUFFERSIZE];  
261  
305  int i;
262    double q[4];
263    DirectionalAtom* dAtom;
264    int nAtoms = entry_plug->n_atoms;
265    Atom** atoms = entry_plug->atoms;
266 +  int i, j, which_node, done, game_over, which_atom, local_index;
267    
311  ofstream finalOut;
268    
269   #ifdef IS_MPI
270    if(worldRank == 0 ){
# Line 335 | Line 291 | void DumpWriter::writeFinal(){
291    
292   #endif //is_mpi
293  
294 <    
339 <
294 >  
295   #ifndef IS_MPI
296      
297    finalOut << nAtoms << "\n";
# Line 344 | Line 299 | void DumpWriter::writeFinal(){
299    finalOut << entry_plug->box_x << "\t"
300             << entry_plug->box_y << "\t"
301             << entry_plug->box_z << "\n";
302 <    
302 >  
303    for( i=0; i<nAtoms; i++ ){
304        
305      sprintf( tempBuffer,
# Line 380 | Line 335 | void DumpWriter::writeFinal(){
335      finalOut << writeLine;
336    }
337    finalOut.flush();
338 +  finalOut.close();
339  
340   #else // is_mpi
341 +  
342 +  MPI::Status istatus;
343 +  int *AtomToProcMap = mpiSim->getAtomToProcMap();
344  
386  int masterIndex;
387  int nodeAtomsStart;
388  int nodeAtomsEnd;
389  int mpiErr;
390  int sendError;
391  int procIndex;
392    
393  MPI_Status istatus[MPI_STATUS_SIZE];
394
395    
345    // write out header and node 0's coordinates
346 <
346 >  
347    if( worldRank == 0 ){
348      finalOut << mpiSim->getTotAtoms() << "\n";
349 <      
349 >    
350      finalOut << entry_plug->box_x << "\t"
351 <             << entry_plug->box_y << "\t"
352 <             << entry_plug->box_z << "\n";
351 >            << entry_plug->box_y << "\t"
352 >            << entry_plug->box_z << "\n";
353      
354 <    masterIndex = 0;
355 <    
407 <    for( i=0; i<nAtoms; i++ ){
354 >    for (i = 0 ; i < mpiSim->getTotAtoms(); i++ ) {
355 >      // Get the Node number which has this molecule:
356        
357 <      sprintf( tempBuffer,
358 <               "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t",
359 <               atoms[i]->getType(),
360 <               atoms[i]->getX(),
361 <               atoms[i]->getY(),
362 <               atoms[i]->getZ(),
363 <               atoms[i]->get_vx(),
364 <               atoms[i]->get_vy(),
365 <               atoms[i]->get_vz());
366 <      strcpy( writeLine, tempBuffer );
357 >      which_node = AtomToProcMap[i];    
358 >      
359 >      if (which_node == mpiSim->getMyNode()) {
360 >        
361 >        sprintf( tempBuffer,
362 >                 "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t",
363 >                 atoms[i]->getType(),
364 >                 atoms[i]->getX(),
365 >                 atoms[i]->getY(),
366 >                 atoms[i]->getZ(),
367 >                 atoms[i]->get_vx(),
368 >                 atoms[i]->get_vy(),
369 >                 atoms[i]->get_vz());
370 >        strcpy( writeLine, tempBuffer );
371          
372 <      if( atoms[i]->isDirectional() ){
372 >        if( atoms[i]->isDirectional() ){
373            
374 <        dAtom = (DirectionalAtom *)atoms[i];
375 <        dAtom->getQ( q );
374 >          dAtom = (DirectionalAtom *)atoms[i];
375 >          dAtom->getQ( q );
376            
377 <        sprintf( tempBuffer,
378 <                 "%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
379 <                 q[0],
380 <                 q[1],
381 <                 q[2],
382 <                 q[3],
383 <                 dAtom->getJx(),
384 <                 dAtom->getJy(),
385 <                 dAtom->getJz());
386 <        strcat( writeLine, tempBuffer );
377 >          sprintf( tempBuffer,
378 >                   "%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
379 >                   q[0],
380 >                   q[1],
381 >                   q[2],
382 >                   q[3],
383 >                   dAtom->getJx(),
384 >                   dAtom->getJy(),
385 >                   dAtom->getJz());
386 >          strcat( writeLine, tempBuffer );
387 >        }
388 >        else
389 >          strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" );      
390 >        
391 >      } else {
392 >        
393 >        MPI::COMM_WORLD.Send(&i, 1, MPI_INT, which_node, TAKE_THIS_TAG);
394 >        MPI::COMM_WORLD.Recv(writeLine, BUFFERSIZE, MPI_CHAR, which_node,
395 >                                TAKE_THIS_TAG, istatus);
396        }
397 <      else
437 <        strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" );
438 <        
397 >      
398        finalOut << writeLine;
440      masterIndex++;
399      }
442    finalOut.flush();
443  }
400      
401 <  for (procIndex = 1; procIndex < mpiSim->getNumberProcessors();
402 <       procIndex++){
403 <
404 <    if( worldRank == 0 ){
449 <        
450 <      mpiErr = MPI_Recv(&nodeAtomsStart,1,MPI_INT,procIndex,
451 <                        TAKE_THIS_TAG,MPI_COMM_WORLD,istatus);
452 <
453 <      mpiErr = MPI_Recv(&nodeAtomsEnd,1,MPI_INT,procIndex,
454 <                        TAKE_THIS_TAG,MPI_COMM_WORLD, istatus);
455 <        
456 <      // Make sure where node 0 is writing to, matches where the
457 <      // receiving node expects it to be.
458 <        
459 <      if (masterIndex != nodeAtomsStart){
460 <        sendError = 1;
461 <        mpiErr = MPI_Send(&sendError,1,MPI_INT,procIndex,TAKE_THIS_TAG,
462 <                          MPI_COMM_WORLD);
463 <        sprintf(painCave.errMsg,
464 <                "DumpWriter error: atoms start index (%d) for "
465 <                "node %d not equal to master index (%d)",
466 <                nodeAtomsStart,procIndex,masterIndex );
467 <        painCave.isFatal = 1;
468 <        simError();
469 <      }
470 <        
471 <      sendError = 0;
472 <      mpiErr = MPI_Send(&sendError,1,MPI_INT,procIndex,TAKE_THIS_TAG,
473 <                        MPI_COMM_WORLD);
474 <
475 <      // recieve the nodes writeLines
476 <
477 <      for ( i = nodeAtomsStart; i <= nodeAtomsEnd; i++){
478 <          
479 <        mpiErr = MPI_Recv(writeLine,BUFFERSIZE,MPI_CHAR,procIndex,
480 <                          TAKE_THIS_TAG,MPI_COMM_WORLD,istatus );
481 <
482 <        finalOut << writeLine;
483 <        masterIndex++;
484 <      }
485 <
486 <      finalOut.flush();
401 >    // kill everyone off:
402 >    game_over = -1;
403 >    for (j = 0; j < mpiSim->getNumberProcessors(); j++) {
404 >      MPI::COMM_WORLD.Send(&game_over, 1, MPI_INT, j, TAKE_THIS_TAG);
405      }
406  
407 <    else if( worldRank == procIndex ){
407 >  } else {
408 >    
409 >    done = 0;
410 >    while (!done) {
411 >      MPI::COMM_WORLD.Recv(&which_atom, 1, MPI_INT, 0,
412 >                           TAKE_THIS_TAG, istatus);
413  
414 <      nodeAtomsStart = mpiSim->getMyAtomStart();
415 <      nodeAtomsEnd = mpiSim->getMyAtomEnd();
416 <        
417 <      mpiErr = MPI_Send(&nodeAtomsStart,1,MPI_INT,0,TAKE_THIS_TAG,
495 <                        MPI_COMM_WORLD);
496 <      mpiErr = MPI_Send(&nodeAtomsEnd,1,MPI_INT,0,TAKE_THIS_TAG,
497 <                        MPI_COMM_WORLD);
498 <        
499 <      mpiErr = MPI_Recv(&sendError,1,MPI_INT,0,TAKE_THIS_TAG,
500 <                        MPI_COMM_WORLD, istatus);
501 <      if (sendError) MPIcheckPoint();
414 >      if (which_atom == -1) {
415 >        done=1;
416 >        continue;
417 >      } else {
418  
419 <      // send current node's configuration line by line.
419 >        local_index=-1;        
420 >        for (j=0; j < mpiSim->getMyNlocal(); j++) {
421 >          if (atoms[j]->getGlobalIndex() == which_atom) local_index = j;
422 >        }
423 >        if (local_index != -1) {
424  
425 <      for( i=0; i<nAtoms; i++ ){
425 >          //format the line
426 >          sprintf( tempBuffer,
427 >                   "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t",
428 >                   atoms[local_index]->getType(),
429 >                   atoms[local_index]->getX(),
430 >                   atoms[local_index]->getY(),
431 >                   atoms[local_index]->getZ(),
432 >                   atoms[local_index]->get_vx(),
433 >                   atoms[local_index]->get_vy(),
434 >                   atoms[local_index]->get_vz()); // check here.
435 >          strcpy( writeLine, tempBuffer );
436            
437 <        sprintf( tempBuffer,
438 <                 "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t",
439 <                 atoms[i]->getType(),
440 <                 atoms[i]->getX(),
511 <                 atoms[i]->getY(),
512 <                 atoms[i]->getZ(),
513 <                 atoms[i]->get_vx(),
514 <                 atoms[i]->get_vy(),
515 <                 atoms[i]->get_vz());
516 <        strcpy( writeLine, tempBuffer );
517 <          
518 <        if( atoms[i]->isDirectional() ){
437 >          if( atoms[local_index]->isDirectional() ){
438 >            
439 >            dAtom = (DirectionalAtom *)atoms[local_index];
440 >            dAtom->getQ( q );
441              
442 <          dAtom = (DirectionalAtom *)atoms[i];
443 <          dAtom->getQ( q );
444 <            
445 <          sprintf( tempBuffer,
446 <                   "%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
447 <                   q[0],
448 <                   q[1],
449 <                   q[2],
450 <                   q[3],
451 <                   dAtom->getJx(),
452 <                   dAtom->getJy(),
453 <                   dAtom->getJz());
454 <          strcat( writeLine, tempBuffer );
455 <        }
456 <        else
457 <          strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" );
458 <          
459 <        mpiErr = MPI_Send(writeLine,BUFFERSIZE,MPI_CHAR,0,TAKE_THIS_TAG,
460 <                          MPI_COMM_WORLD);
442 >            sprintf( tempBuffer,
443 >                     "%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
444 >                     q[0],
445 >                     q[1],
446 >                     q[2],
447 >                     q[3],
448 >                     dAtom->getJx(),
449 >                     dAtom->getJy(),
450 >                     dAtom->getJz());
451 >            strcat( writeLine, tempBuffer );
452 >          }
453 >          else
454 >            strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" );
455 >          
456 >          MPI::COMM_WORLD.Send(writeLine, BUFFERSIZE, MPI_CHAR, 0,
457 >                               TAKE_THIS_TAG);
458 >        } else {
459 >          strcpy( writeLine, "ATOM NOT FOUND ON THIS PROCESSOR");
460 >          MPI::COMM_WORLD.Send(writeLine, BUFFERSIZE, MPI_CHAR, 0,
461 >                               TAKE_THIS_TAG);
462 >        }
463        }
464      }
541      
542    sprintf(checkPointMsg,"Node %d sent dump configuration.",
543            procIndex);
544    MPIcheckPoint();
465    }
466 +  finalOut.flush();
467 +  sprintf( checkPointMsg,
468 +           "Sucessfully took a dump.\n");
469 +  MPIcheckPoint();
470  
471 <  if( worldRank == 0 ) finalOut.close();
548 <
549 <    
471 >  if( worldRank == 0 ) finalOut.close();    
472   #endif // is_mpi
473   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines