| 65 | 
  | 
  char tempBuffer[BUFFERSIZE]; | 
| 66 | 
  | 
  char writeLine[BUFFERSIZE]; | 
| 67 | 
  | 
 | 
| 68 | 
< | 
  int i, j, which_node, done, game_over, which_atom; | 
| 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; | 
| 134 | 
  | 
            << entry_plug->box_z << "\n"; | 
| 135 | 
  | 
     | 
| 136 | 
  | 
    for (i = 0 ; i < mpiSim->getTotAtoms(); i++ ) { | 
| 137 | 
< | 
      // Get the Node number which has this molecule: | 
| 137 | 
> | 
      // Get the Node number which has this atom; | 
| 138 | 
  | 
       | 
| 139 | 
  | 
      which_node = AtomToProcMap[i];      | 
| 140 | 
  | 
       | 
| 191 | 
  | 
    done = 0; | 
| 192 | 
  | 
    while (!done) { | 
| 193 | 
  | 
      MPI::COMM_WORLD.Recv(&which_atom, 1, MPI_INT, 0,  | 
| 194 | 
< | 
                              TAKE_THIS_TAG, istatus); | 
| 195 | 
< | 
 | 
| 194 | 
> | 
                           TAKE_THIS_TAG, istatus); | 
| 195 | 
> | 
       | 
| 196 | 
  | 
      if (which_atom == -1) { | 
| 197 | 
  | 
        done=1; | 
| 198 | 
  | 
        continue; | 
| 199 | 
  | 
      } else { | 
| 200 | 
< | 
 | 
| 201 | 
< | 
        //format the line | 
| 202 | 
< | 
        sprintf( tempBuffer, | 
| 203 | 
< | 
                 "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", | 
| 204 | 
< | 
                 atoms[which_atom]->getType(), | 
| 205 | 
< | 
                 atoms[which_atom]->getX(), | 
| 206 | 
< | 
                 atoms[which_atom]->getY(), | 
| 207 | 
< | 
                 atoms[which_atom]->getZ(), | 
| 208 | 
< | 
                 atoms[which_atom]->get_vx(), | 
| 209 | 
< | 
                 atoms[which_atom]->get_vy(), | 
| 210 | 
< | 
                 atoms[which_atom]->get_vz()); // check here. | 
| 211 | 
< | 
        strcpy( writeLine, tempBuffer ); | 
| 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[which_atom]->isDirectional() ){ | 
| 218 | 
< | 
             | 
| 219 | 
< | 
          dAtom = (DirectionalAtom *)atoms[which_atom]; | 
| 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); | 
| 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 | 
  | 
  }   | 
| 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; | 
| 266 | 
> | 
  int i, j, which_node, done, game_over, which_atom, local_index; | 
| 267 | 
  | 
   | 
| 268 | 
  | 
   | 
| 269 | 
  | 
#ifdef IS_MPI | 
| 416 | 
  | 
        continue; | 
| 417 | 
  | 
      } else { | 
| 418 | 
  | 
 | 
| 419 | 
< | 
        //format the line | 
| 420 | 
< | 
        sprintf( tempBuffer, | 
| 421 | 
< | 
                 "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", | 
| 422 | 
< | 
                 atoms[which_atom]->getType(), | 
| 423 | 
< | 
                 atoms[which_atom]->getX(), | 
| 424 | 
< | 
                 atoms[which_atom]->getY(), | 
| 425 | 
< | 
                 atoms[which_atom]->getZ(), | 
| 426 | 
< | 
                 atoms[which_atom]->get_vx(), | 
| 427 | 
< | 
                 atoms[which_atom]->get_vy(), | 
| 428 | 
< | 
                 atoms[which_atom]->get_vz()); // check here. | 
| 429 | 
< | 
        strcpy( writeLine, tempBuffer ); | 
| 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 | 
> | 
          //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 | 
< | 
        if( atoms[which_atom]->isDirectional() ){ | 
| 437 | 
> | 
          if( atoms[local_index]->isDirectional() ){ | 
| 438 | 
> | 
             | 
| 439 | 
> | 
            dAtom = (DirectionalAtom *)atoms[local_index]; | 
| 440 | 
> | 
            dAtom->getQ( q ); | 
| 441 | 
  | 
             | 
| 442 | 
< | 
          dAtom = (DirectionalAtom *)atoms[which_atom]; | 
| 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 | 
< | 
        MPI::COMM_WORLD.Send(writeLine, BUFFERSIZE, MPI_CHAR, 0,  | 
| 460 | 
< | 
                             TAKE_THIS_TAG); | 
| 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 | 
  | 
    } | 
| 465 | 
< | 
  }   | 
| 465 | 
> | 
  } | 
| 466 | 
  | 
  finalOut.flush(); | 
| 467 | 
  | 
  sprintf( checkPointMsg, | 
| 468 | 
  | 
           "Sucessfully took a dump.\n"); |