212 |
|
MPI::COMM_WORLD.Send(read_buffer, BUFFERSIZE, MPI_CHAR, j, |
213 |
|
TAKE_THIS_TAG); |
214 |
|
} |
215 |
< |
|
215 |
> |
|
216 |
|
} else { |
217 |
< |
|
217 |
> |
|
218 |
|
done = 0; |
219 |
|
while (!done) { |
220 |
|
MPI::COMM_WORLD.Recv(read_buffer, BUFFERSIZE, MPI_CHAR, 0, |
225 |
|
} else { |
226 |
|
MPI::COMM_WORLD.Recv(&which_atom, 1, MPI_INT, 0, |
227 |
|
TAKE_THIS_TAG, istatus); |
228 |
+ |
|
229 |
|
parseErr = parseDumpLine( read_buffer, which_atom ); |
230 |
|
if( parseErr != NULL ){ |
231 |
|
strcpy( painCave.errMsg, parseErr ); |
239 |
|
#endif |
240 |
|
} |
241 |
|
|
242 |
< |
char* InitializeFromFile::parseDumpLine(char* readLine, int atomIndex){ |
242 |
> |
char* InitializeFromFile::parseDumpLine(char* readLine, int globalIndex){ |
243 |
|
|
244 |
|
char *foo; // the pointer to the current string token |
245 |
|
|
252 |
|
Atom **atoms = entry_plug->atoms; |
253 |
|
DirectionalAtom* dAtom; |
254 |
|
|
255 |
< |
int n_atoms; |
255 |
> |
int j, n_atoms, atomIndex; |
256 |
|
|
257 |
|
#ifdef IS_MPI |
258 |
|
n_atoms = mpiSim->getTotAtoms(); |
259 |
+ |
atomIndex=-1; |
260 |
+ |
for (j=0; j < mpiSim->getMyNlocal(); j++) { |
261 |
+ |
if (atoms[j]->getGlobalIndex() == globalIndex) atomIndex = j; |
262 |
+ |
} |
263 |
+ |
if (atomIndex == -1) { |
264 |
+ |
sprintf( painCave.errMsg, |
265 |
+ |
"Initialize from file error. Atom at index %d " |
266 |
+ |
"in file %s does not exist on processor %d .\n", |
267 |
+ |
globalIndex, c_in_name, mpiSim->getMyNode() ); |
268 |
+ |
return strdup( painCave.errMsg ); |
269 |
+ |
} |
270 |
|
#else |
271 |
|
n_atoms = entry_plug->n_atoms; |
272 |
+ |
atomIndex = globalIndex; |
273 |
|
#endif // is_mpi |
274 |
|
|
262 |
– |
|
275 |
|
// set the string tokenizer |
276 |
|
|
277 |
|
foo = strtok(readLine, " ,;\t"); |