| 1 | 
+ | 
#define _FILE_OFFSET_BITS 64 | 
| 2 | 
+ | 
 | 
| 3 | 
  | 
#include <cstring> | 
| 4 | 
  | 
#include <iostream> | 
| 5 | 
  | 
#include <fstream> | 
| 72 | 
  | 
  char tempBuffer[BUFFERSIZE]; | 
| 73 | 
  | 
  char writeLine[BUFFERSIZE]; | 
| 74 | 
  | 
 | 
| 75 | 
< | 
  int i, j, which_node, done, which_atom, local_index; | 
| 75 | 
> | 
  int i; | 
| 76 | 
> | 
#ifdef IS_MPI | 
| 77 | 
> | 
  int j, which_node, done, which_atom, local_index; | 
| 78 | 
> | 
#else //is_mpi | 
| 79 | 
> | 
  int nAtoms = entry_plug->n_atoms; | 
| 80 | 
> | 
#endif //is_mpi | 
| 81 | 
> | 
 | 
| 82 | 
  | 
  double q[4]; | 
| 83 | 
  | 
  DirectionalAtom* dAtom; | 
| 76 | 
– | 
  int nAtoms = entry_plug->n_atoms; | 
| 84 | 
  | 
  Atom** atoms = entry_plug->atoms; | 
| 85 | 
+ | 
  double pos[3], vel[3]; | 
| 86 | 
  | 
     | 
| 87 | 
+ | 
   | 
| 88 | 
+ | 
  // write current frame to the eor file | 
| 89 | 
  | 
 | 
| 90 | 
+ | 
  this->writeFinal( currentTime ); | 
| 91 | 
+ | 
 | 
| 92 | 
  | 
#ifndef IS_MPI | 
| 93 | 
  | 
     | 
| 94 | 
  | 
  outFile << nAtoms << "\n"; | 
| 108 | 
  | 
     | 
| 109 | 
  | 
  for( i=0; i<nAtoms; i++ ){ | 
| 110 | 
  | 
       | 
| 111 | 
+ | 
    atoms[i]->getPos(pos); | 
| 112 | 
+ | 
    atoms[i]->getVel(vel); | 
| 113 | 
  | 
 | 
| 114 | 
  | 
    sprintf( tempBuffer, | 
| 115 | 
  | 
             "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", | 
| 116 | 
  | 
             atoms[i]->getType(), | 
| 117 | 
< | 
             atoms[i]->getX(), | 
| 118 | 
< | 
             atoms[i]->getY(), | 
| 119 | 
< | 
             atoms[i]->getZ(), | 
| 120 | 
< | 
             atoms[i]->get_vx(), | 
| 121 | 
< | 
             atoms[i]->get_vy(), | 
| 122 | 
< | 
             atoms[i]->get_vz()); | 
| 117 | 
> | 
             pos[0], | 
| 118 | 
> | 
             pos[1], | 
| 119 | 
> | 
             pos[2], | 
| 120 | 
> | 
             vel[0], | 
| 121 | 
> | 
             vel[1], | 
| 122 | 
> | 
             vel[2]); | 
| 123 | 
  | 
    strcpy( writeLine, tempBuffer ); | 
| 124 | 
  | 
 | 
| 125 | 
  | 
    if( atoms[i]->isDirectional() ){ | 
| 190 | 
  | 
        } | 
| 191 | 
  | 
        if (local_index != -1) { | 
| 192 | 
  | 
          //format the line | 
| 193 | 
+ | 
           | 
| 194 | 
+ | 
          atoms[local_index]->getPos(pos); | 
| 195 | 
+ | 
          atoms[local_index]->getVel(vel); | 
| 196 | 
+ | 
 | 
| 197 | 
  | 
          sprintf( tempBuffer, | 
| 198 | 
  | 
                   "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", | 
| 199 | 
  | 
                   atoms[local_index]->getType(), | 
| 200 | 
< | 
                   atoms[local_index]->getX(), | 
| 201 | 
< | 
                   atoms[local_index]->getY(), | 
| 202 | 
< | 
                   atoms[local_index]->getZ(), | 
| 203 | 
< | 
                   atoms[local_index]->get_vx(), | 
| 204 | 
< | 
                   atoms[local_index]->get_vy(), | 
| 205 | 
< | 
                   atoms[local_index]->get_vz()); // check here. | 
| 200 | 
> | 
                   pos[0], | 
| 201 | 
> | 
                   pos[1], | 
| 202 | 
> | 
                   pos[2], | 
| 203 | 
> | 
                   vel[0], | 
| 204 | 
> | 
                   vel[1], | 
| 205 | 
> | 
                   vel[2]); // check here. | 
| 206 | 
  | 
          strcpy( writeLine, tempBuffer ); | 
| 207 | 
  | 
           | 
| 208 | 
  | 
          if( atoms[local_index]->isDirectional() ){ | 
| 284 | 
  | 
      } | 
| 285 | 
  | 
      if (local_index != -1) { | 
| 286 | 
  | 
        //format the line | 
| 287 | 
+ | 
 | 
| 288 | 
+ | 
        atoms[local_index]->getPos(pos); | 
| 289 | 
+ | 
        atoms[local_index]->getVel(vel); | 
| 290 | 
+ | 
 | 
| 291 | 
  | 
        sprintf( tempBuffer, | 
| 292 | 
  | 
                 "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", | 
| 293 | 
  | 
                 atoms[local_index]->getType(), | 
| 294 | 
< | 
                 atoms[local_index]->getX(), | 
| 295 | 
< | 
                 atoms[local_index]->getY(), | 
| 296 | 
< | 
                 atoms[local_index]->getZ(), | 
| 297 | 
< | 
                 atoms[local_index]->get_vx(), | 
| 298 | 
< | 
                 atoms[local_index]->get_vy(), | 
| 299 | 
< | 
                 atoms[local_index]->get_vz()); // check here. | 
| 294 | 
> | 
                 pos[0], | 
| 295 | 
> | 
                 pos[1], | 
| 296 | 
> | 
                 pos[2], | 
| 297 | 
> | 
                 vel[0], | 
| 298 | 
> | 
                 vel[1], | 
| 299 | 
> | 
                 vel[2]); // check here. | 
| 300 | 
  | 
        strcpy( writeLine, tempBuffer ); | 
| 301 | 
  | 
         | 
| 302 | 
  | 
        if( atoms[local_index]->isDirectional() ){ | 
| 357 | 
  | 
 | 
| 358 | 
  | 
  double q[4]; | 
| 359 | 
  | 
  DirectionalAtom* dAtom; | 
| 338 | 
– | 
  int nAtoms = entry_plug->n_atoms; | 
| 360 | 
  | 
  Atom** atoms = entry_plug->atoms; | 
| 361 | 
< | 
  int i, j, which_node, done, game_over, which_atom, local_index; | 
| 361 | 
> | 
  int i; | 
| 362 | 
> | 
#ifdef IS_MPI | 
| 363 | 
> | 
  int j, which_node, done, which_atom, local_index; | 
| 364 | 
> | 
#else //is_mpi | 
| 365 | 
> | 
  int nAtoms = entry_plug->n_atoms; | 
| 366 | 
> | 
#endif //is_mpi | 
| 367 | 
  | 
   | 
| 368 | 
+ | 
  double pos[3], vel[3]; | 
| 369 | 
  | 
   | 
| 370 | 
  | 
#ifdef IS_MPI | 
| 371 | 
  | 
  if(worldRank == 0 ){ | 
| 412 | 
  | 
   | 
| 413 | 
  | 
  for( i=0; i<nAtoms; i++ ){ | 
| 414 | 
  | 
       | 
| 415 | 
+ | 
    atoms[i]->getPos(pos); | 
| 416 | 
+ | 
    atoms[i]->getVel(vel); | 
| 417 | 
+ | 
     | 
| 418 | 
  | 
    sprintf( tempBuffer, | 
| 419 | 
  | 
             "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", | 
| 420 | 
  | 
             atoms[i]->getType(), | 
| 421 | 
< | 
             atoms[i]->getX(), | 
| 422 | 
< | 
             atoms[i]->getY(), | 
| 423 | 
< | 
             atoms[i]->getZ(), | 
| 424 | 
< | 
             atoms[i]->get_vx(), | 
| 425 | 
< | 
             atoms[i]->get_vy(), | 
| 426 | 
< | 
             atoms[i]->get_vz()); | 
| 421 | 
> | 
             pos[0], | 
| 422 | 
> | 
             pos[1], | 
| 423 | 
> | 
             pos[2], | 
| 424 | 
> | 
             vel[0], | 
| 425 | 
> | 
             vel[1], | 
| 426 | 
> | 
             vel[2]); | 
| 427 | 
  | 
    strcpy( writeLine, tempBuffer ); | 
| 428 | 
  | 
 | 
| 429 | 
  | 
    if( atoms[i]->isDirectional() ){ | 
| 492 | 
  | 
        for (j=0; (j<mpiSim->getMyNlocal()) && (local_index < 0); j++) { | 
| 493 | 
  | 
          if (atoms[j]->getGlobalIndex() == which_atom) local_index = j; | 
| 494 | 
  | 
        } | 
| 495 | 
< | 
        if (local_index != -1) {         | 
| 495 | 
> | 
        if (local_index != -1) {     | 
| 496 | 
> | 
 | 
| 497 | 
> | 
          atoms[local_index]->getPos(pos); | 
| 498 | 
> | 
          atoms[local_index]->getVel(vel); | 
| 499 | 
> | 
           | 
| 500 | 
  | 
          sprintf( tempBuffer, | 
| 501 | 
  | 
                   "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", | 
| 502 | 
  | 
                   atoms[local_index]->getType(), | 
| 503 | 
< | 
                   atoms[local_index]->getX(), | 
| 504 | 
< | 
                   atoms[local_index]->getY(), | 
| 505 | 
< | 
                   atoms[local_index]->getZ(), | 
| 506 | 
< | 
                   atoms[local_index]->get_vx(), | 
| 507 | 
< | 
                   atoms[local_index]->get_vy(), | 
| 508 | 
< | 
                   atoms[local_index]->get_vz()); | 
| 503 | 
> | 
                   pos[0], | 
| 504 | 
> | 
                   pos[1], | 
| 505 | 
> | 
                   pos[2], | 
| 506 | 
> | 
                   vel[0], | 
| 507 | 
> | 
                   vel[1], | 
| 508 | 
> | 
                   vel[2]); | 
| 509 | 
  | 
          strcpy( writeLine, tempBuffer ); | 
| 510 | 
  | 
           | 
| 511 | 
  | 
          if( atoms[local_index]->isDirectional() ){ | 
| 585 | 
  | 
      } | 
| 586 | 
  | 
      if (local_index != -1) { | 
| 587 | 
  | 
 | 
| 588 | 
+ | 
        atoms[local_index]->getPos(pos); | 
| 589 | 
+ | 
        atoms[local_index]->getVel(vel); | 
| 590 | 
+ | 
 | 
| 591 | 
  | 
        //format the line | 
| 592 | 
  | 
        sprintf( tempBuffer, | 
| 593 | 
  | 
                 "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", | 
| 594 | 
  | 
                 atoms[local_index]->getType(), | 
| 595 | 
< | 
                 atoms[local_index]->getX(), | 
| 596 | 
< | 
                 atoms[local_index]->getY(), | 
| 597 | 
< | 
                 atoms[local_index]->getZ(), | 
| 598 | 
< | 
                 atoms[local_index]->get_vx(), | 
| 599 | 
< | 
                 atoms[local_index]->get_vy(), | 
| 600 | 
< | 
                 atoms[local_index]->get_vz()); // check here. | 
| 595 | 
> | 
                 pos[0], | 
| 596 | 
> | 
                 pos[1], | 
| 597 | 
> | 
                 pos[2], | 
| 598 | 
> | 
                 vel[0], | 
| 599 | 
> | 
                 vel[1], | 
| 600 | 
> | 
                 vel[2]); // check here. | 
| 601 | 
  | 
        strcpy( writeLine, tempBuffer ); | 
| 602 | 
  | 
         | 
| 603 | 
  | 
        if( atoms[local_index]->isDirectional() ){ |