| 1 | 
  | 
#include <iostream> | 
| 2 | 
< | 
#include <cmath> | 
| 2 | 
> | 
#include <math.h> | 
| 3 | 
  | 
 | 
| 4 | 
  | 
#include <stdio.h> | 
| 5 | 
  | 
#include <stdlib.h> | 
| 26 | 
  | 
 | 
| 27 | 
  | 
#endif // is_mpi | 
| 28 | 
  | 
 | 
| 29 | 
< | 
InitializeFromFile :: InitializeFromFile( char *in_name ){ | 
| 29 | 
> | 
InitializeFromFile::InitializeFromFile( char *in_name ){ | 
| 30 | 
> | 
 | 
| 31 | 
  | 
#ifdef IS_MPI | 
| 32 | 
  | 
  if (worldRank == 0) { | 
| 33 | 
  | 
#endif | 
| 49 | 
  | 
  return;   | 
| 50 | 
  | 
} | 
| 51 | 
  | 
 | 
| 52 | 
< | 
InitializeFromFile :: ~InitializeFromFile( ){ | 
| 52 | 
> | 
InitializeFromFile::~InitializeFromFile( ){ | 
| 53 | 
  | 
#ifdef IS_MPI | 
| 54 | 
  | 
  if (worldRank == 0) { | 
| 55 | 
  | 
#endif | 
| 72 | 
  | 
 | 
| 73 | 
  | 
void InitializeFromFile :: readInit( SimInfo* the_simnfo ){ | 
| 74 | 
  | 
 | 
| 75 | 
< | 
  int i, j, done, which_node, which_atom; // loop counter | 
| 75 | 
> | 
  int i, j; | 
| 76 | 
> | 
   | 
| 77 | 
> | 
#ifdef IS_MPI | 
| 78 | 
> | 
  int done, which_node, which_atom; // loop counter | 
| 79 | 
> | 
#endif //is_mpi | 
| 80 | 
  | 
 | 
| 81 | 
  | 
  const int BUFFERSIZE = 2000; // size of the read buffer | 
| 82 | 
  | 
  int n_atoms; // the number of atoms | 
| 83 | 
  | 
  char read_buffer[BUFFERSIZE]; //the line buffer for reading  | 
| 79 | 
– | 
#ifdef IS_MPI | 
| 80 | 
– | 
  char send_buffer[BUFFERSIZE]; | 
| 81 | 
– | 
#endif | 
| 84 | 
  | 
 | 
| 85 | 
  | 
  char *eof_test; // ptr to see when we reach the end of the file  | 
| 86 | 
  | 
  char *parseErr; | 
| 87 | 
< | 
  int procIndex; | 
| 87 | 
> | 
 | 
| 88 | 
  | 
  double currTime; | 
| 89 | 
  | 
  double boxMat[9]; | 
| 90 | 
  | 
  double theBoxMat3[3][3]; | 
| 104 | 
  | 
 | 
| 105 | 
  | 
  n_atoms = atoi( read_buffer ); | 
| 106 | 
  | 
 | 
| 105 | 
– | 
  Atom **atoms = simnfo->atoms; | 
| 106 | 
– | 
  DirectionalAtom* dAtom; | 
| 107 | 
– | 
 | 
| 107 | 
  | 
  if( n_atoms != simnfo->n_atoms ){ | 
| 108 | 
  | 
    sprintf( painCave.errMsg, | 
| 109 | 
  | 
             "Initialize from File error. %s n_atoms, %d, " | 
| 179 | 
  | 
    eof_test = fgets(read_buffer, sizeof(read_buffer), c_in_file); | 
| 180 | 
  | 
    if( eof_test == NULL ){ | 
| 181 | 
  | 
      sprintf( painCave.errMsg, | 
| 182 | 
< | 
               "Error reading 1st line of %d \n ",c_in_name); | 
| 182 | 
> | 
               "Error reading 1st line of %s \n ",c_in_name); | 
| 183 | 
  | 
      haveError = 1; | 
| 184 | 
  | 
      simError(); | 
| 185 | 
  | 
    } | 
| 186 | 
  | 
     | 
| 187 | 
  | 
    n_atoms = atoi( read_buffer ); | 
| 188 | 
  | 
     | 
| 190 | 
– | 
    Atom **atoms = simnfo->atoms; | 
| 191 | 
– | 
    DirectionalAtom* dAtom; | 
| 192 | 
– | 
  | 
| 189 | 
  | 
    // Check to see that the number of atoms in the intial configuration file is the | 
| 190 | 
  | 
    // same as declared in simBass. | 
| 191 | 
  | 
     | 
| 328 | 
  | 
  Atom **atoms = simnfo->atoms; | 
| 329 | 
  | 
  DirectionalAtom* dAtom; | 
| 330 | 
  | 
   | 
| 331 | 
< | 
  int j, n_atoms, atomIndex; | 
| 331 | 
> | 
  int n_atoms, atomIndex; | 
| 332 | 
  | 
 | 
| 333 | 
  | 
#ifdef IS_MPI | 
| 334 | 
+ | 
  int j; | 
| 335 | 
+ | 
 | 
| 336 | 
  | 
  n_atoms = mpiSim->getTotAtoms(); | 
| 337 | 
  | 
  atomIndex=-1;         | 
| 338 | 
  | 
  for (j=0; j < mpiSim->getMyNlocal(); j++) { | 
| 541 | 
  | 
                                       double &time ){ | 
| 542 | 
  | 
 | 
| 543 | 
  | 
  char *foo; // the pointer to the current string token  | 
| 546 | 
– | 
  int j; | 
| 544 | 
  | 
 | 
| 545 | 
  | 
  // set the string tokenizer | 
| 546 | 
  | 
   |