| 112 |
|
painCave.isFatal = 1; |
| 113 |
|
simError(); |
| 114 |
|
} |
| 115 |
– |
framePos.push_back(currPos); |
| 115 |
|
|
| 116 |
|
while( !feof( inFile ) ){ |
| 117 |
+ |
|
| 118 |
+ |
framePos.push_back(currPos); |
| 119 |
|
|
| 120 |
|
i = atoi(readBuffer); |
| 121 |
|
|
| 150 |
|
currPos = new fpos_t; |
| 151 |
|
fgetpos( inFile, currPos ); |
| 152 |
|
fgets( readBuffer, sizeof( readBuffer ), inFile ); |
| 152 |
– |
framePos.push_back(currPos); |
| 153 |
|
lineNum++; |
| 154 |
|
} |
| 155 |
|
|
| 198 |
|
eof_test = fgets(read_buffer, sizeof(read_buffer), inFile); |
| 199 |
|
if( eof_test == NULL ){ |
| 200 |
|
sprintf( painCave.errMsg, |
| 201 |
< |
"InitializeFromFile error: error reading 1st line of \"%s\"\n", |
| 201 |
> |
"DumpReader error: error reading 1st line of \"%s\"\n", |
| 202 |
|
inFileName.c_str() ); |
| 203 |
|
painCave.isFatal = 1; |
| 204 |
|
simError(); |
| 208 |
|
|
| 209 |
|
if( nTotObjs != simnfo->getTotIntegrableObjects() ){ |
| 210 |
|
sprintf( painCave.errMsg, |
| 211 |
< |
"Initialize from File error. %s n_atoms, %d, " |
| 211 |
> |
"DumpReader error. %s n_atoms, %d, " |
| 212 |
|
"does not match the BASS file's n_atoms, %d.\n", |
| 213 |
|
inFileName.c_str(), nTotObjs, simnfo->getTotIntegrableObjects()); |
| 214 |
|
painCave.isFatal = 1; |
| 273 |
|
int *MolToProcMap = mpiSim->getMolToProcMap(); |
| 274 |
|
int localIndex; |
| 275 |
|
int nCurObj; |
| 276 |
+ |
int nitems; |
| 277 |
|
|
| 278 |
+ |
nTotObjs = simnfo->getTotIntegrableObjects(); |
| 279 |
|
haveError = 0; |
| 280 |
|
if (worldRank == 0) { |
| 281 |
|
fsetpos(inFile, framePos[whichFrame]); |
| 288 |
|
simError(); |
| 289 |
|
} |
| 290 |
|
|
| 291 |
< |
nTotObjs = atoi( read_buffer ); |
| 291 |
> |
nitems = atoi( read_buffer ); |
| 292 |
|
|
| 293 |
|
// Check to see that the number of integrable objects in the intial configuration file is the |
| 294 |
|
// same as declared in simBass. |
| 295 |
|
|
| 296 |
< |
if( nTotObjs != simnfo->getTotIntegrableObjects()){ |
| 296 |
> |
if( nTotObjs != nitems){ |
| 297 |
|
sprintf( painCave.errMsg, |
| 298 |
< |
"Initialize from File error. %s n_atoms, %d, " |
| 298 |
> |
"DumpReadererror. %s n_atoms, %d, " |
| 299 |
|
"does not match the BASS file's n_atoms, %d.\n", |
| 300 |
|
inFileName.c_str(), nTotObjs, simnfo->getTotIntegrableObjects()); |
| 301 |
|
haveError= 1; |
| 356 |
|
|
| 357 |
|
if(haveError) nodeZeroError(); |
| 358 |
|
|
| 359 |
< |
parseDumpLine(read_buffer, integrableObjects[i]); |
| 359 |
> |
parseDumpLine(read_buffer, integrableObjects[j]); |
| 360 |
|
|
| 361 |
|
} |
| 362 |
|
|
| 365 |
|
else{ |
| 366 |
|
//molecule belongs to slave nodes |
| 367 |
|
|
| 368 |
< |
MPI_Recv(&nCurObj, 1, MPI_INT, 0, |
| 368 |
> |
MPI_Recv(&nCurObj, 1, MPI_INT, which_node, |
| 369 |
|
TAKE_THIS_TAG_INT, MPI_COMM_WORLD, &istatus); |
| 370 |
|
|
| 371 |
< |
for(j=0; j < integrableObjects.size(); j++){ |
| 371 |
> |
for(j=0; j < nCurObj; j++){ |
| 372 |
|
|
| 373 |
|
eof_test = fgets(read_buffer, sizeof(read_buffer), inFile); |
| 374 |
|
if(eof_test == NULL){ |
| 395 |
|
} |
| 396 |
|
else{ |
| 397 |
|
//actions taken at slave nodes |
| 398 |
+ |
MPI_Bcast(read_buffer, BUFFERSIZE, MPI_CHAR, 0, MPI_COMM_WORLD); |
| 399 |
+ |
|
| 400 |
+ |
parseErr = parseCommentLine( read_buffer, simnfo); |
| 401 |
+ |
|
| 402 |
+ |
if( parseErr != NULL ){ |
| 403 |
+ |
strcpy( painCave.errMsg, parseErr ); |
| 404 |
+ |
haveError = 1; |
| 405 |
+ |
simError(); |
| 406 |
+ |
} |
| 407 |
+ |
|
| 408 |
|
for (i=0 ; i < mpiSim->getTotNmol(); i++) { |
| 409 |
|
which_node = MolToProcMap[i]; |
| 410 |
|
|
| 423 |
|
|
| 424 |
|
nCurObj = integrableObjects.size(); |
| 425 |
|
|
| 426 |
< |
MPI_Recv(&nCurObj, 1, MPI_INT, 0, |
| 427 |
< |
TAKE_THIS_TAG_INT, MPI_COMM_WORLD, &istatus); |
| 426 |
> |
MPI_Send(&nCurObj, 1, MPI_INT, 0, |
| 427 |
> |
TAKE_THIS_TAG_INT, MPI_COMM_WORLD); |
| 428 |
|
|
| 429 |
|
for(j = 0; j < integrableObjects.size(); j++){ |
| 430 |
|
|
| 468 |
|
|
| 469 |
|
if( strcmp( foo, sd->getType() ) ){ |
| 470 |
|
sprintf( painCave.errMsg, |
| 471 |
< |
"Initialize from file error. Does not" |
| 471 |
> |
"DumpReader error. Does not" |
| 472 |
|
" match the BASS atom %s.\n", |
| 473 |
|
sd->getType() ); |
| 474 |
|
return strdup( painCave.errMsg ); |
| 744 |
|
int j, myStatus; |
| 745 |
|
|
| 746 |
|
myStatus = 0; |
| 747 |
< |
for (j = 0; j < mpiSim->getNumberProcessors(); j++) { |
| 747 |
> |
for (j = 0; j < mpiSim->getNprocessors(); j++) { |
| 748 |
|
MPI_Send( &myStatus, 1, MPI_INT, j, |
| 749 |
|
TAKE_THIS_TAG_INT, MPI_COMM_WORLD); |
| 750 |
|
} |
| 760 |
|
MPI_Finalize(); |
| 761 |
|
exit (0); |
| 762 |
|
} |
| 763 |
< |
#endif |
| 763 |
> |
#endif |