--- trunk/OOPSE/libmdtools/InitializeFromFile.cpp 2003/03/27 01:49:45 417 +++ trunk/OOPSE/libmdtools/InitializeFromFile.cpp 2003/03/27 15:07:29 419 @@ -212,9 +212,9 @@ void InitializeFromFile :: read_xyz( SimInfo* the_entr MPI::COMM_WORLD.Send(read_buffer, BUFFERSIZE, MPI_CHAR, j, TAKE_THIS_TAG); } - + } else { - + done = 0; while (!done) { MPI::COMM_WORLD.Recv(read_buffer, BUFFERSIZE, MPI_CHAR, 0, @@ -225,6 +225,7 @@ void InitializeFromFile :: read_xyz( SimInfo* the_entr } else { MPI::COMM_WORLD.Recv(&which_atom, 1, MPI_INT, 0, TAKE_THIS_TAG, istatus); + parseErr = parseDumpLine( read_buffer, which_atom ); if( parseErr != NULL ){ strcpy( painCave.errMsg, parseErr ); @@ -238,7 +239,7 @@ char* InitializeFromFile::parseDumpLine(char* readLine #endif } -char* InitializeFromFile::parseDumpLine(char* readLine, int atomIndex){ +char* InitializeFromFile::parseDumpLine(char* readLine, int globalIndex){ char *foo; // the pointer to the current string token @@ -251,15 +252,26 @@ char* InitializeFromFile::parseDumpLine(char* readLine Atom **atoms = entry_plug->atoms; DirectionalAtom* dAtom; - int n_atoms; + int j, n_atoms, atomIndex; #ifdef IS_MPI n_atoms = mpiSim->getTotAtoms(); + atomIndex=-1; + for (j=0; j < mpiSim->getMyNlocal(); j++) { + if (atoms[j]->getGlobalIndex() == globalIndex) atomIndex = j; + } + if (atomIndex == -1) { + sprintf( painCave.errMsg, + "Initialize from file error. Atom at index %d " + "in file %s does not exist on processor %d .\n", + globalIndex, c_in_name, mpiSim->getMyNode() ); + return strdup( painCave.errMsg ); + } #else n_atoms = entry_plug->n_atoms; + atomIndex = globalIndex; #endif // is_mpi - // set the string tokenizer foo = strtok(readLine, " ,;\t");