--- trunk/OOPSE/libmdtools/InitializeFromFile.cpp 2004/04/15 16:18:26 1113 +++ trunk/OOPSE/libmdtools/InitializeFromFile.cpp 2004/04/22 03:29:30 1129 @@ -175,7 +175,9 @@ void InitializeFromFile :: readInit( SimInfo* the_simn int *MolToProcMap = mpiSim->getMolToProcMap(); int localIndex; int nCurObj; + int nItems; + nTotObjs = simnfo->getTotIntegrableObjects(); haveError = 0; if (worldRank == 0) { @@ -187,12 +189,12 @@ void InitializeFromFile :: readInit( SimInfo* the_simn simError(); } - nTotObjs = atoi( read_buffer ); + nItems = atoi( read_buffer ); // Check to see that the number of integrable objects in the intial configuration file is the // same as declared in simBass. - if( nTotObjs != simnfo->getTotIntegrableObjects()){ + if( nTotObjs != nItems){ sprintf( painCave.errMsg, "Initialize from File error. %s n_atoms, %d, " "does not match the BASS file's n_atoms, %d.\n", @@ -255,7 +257,7 @@ void InitializeFromFile :: readInit( SimInfo* the_simn if(haveError) nodeZeroError(); - parseDumpLine(read_buffer, integrableObjects[i]); + parseDumpLine(read_buffer, integrableObjects[j]); } @@ -264,7 +266,7 @@ void InitializeFromFile :: readInit( SimInfo* the_simn else{ //molecule belongs to slave nodes - MPI_Recv(&nCurObj, 1, MPI_INT, 0, + MPI_Recv(&nCurObj, 1, MPI_INT, which_node, TAKE_THIS_TAG_INT, MPI_COMM_WORLD, &istatus); for(j=0; j < integrableObjects.size(); j++){ @@ -294,6 +296,17 @@ void InitializeFromFile :: readInit( SimInfo* the_simn } else{ //actions taken at slave nodes + + MPI_Bcast(read_buffer, BUFFERSIZE, MPI_CHAR, 0, MPI_COMM_WORLD); + + parseErr = parseCommentLine( read_buffer, simnfo); + + if( parseErr != NULL ){ + strcpy( painCave.errMsg, parseErr ); + haveError = 1; + simError(); + } + for (i=0 ; i < mpiSim->getTotNmol(); i++) { which_node = MolToProcMap[i]; @@ -312,8 +325,8 @@ void InitializeFromFile :: readInit( SimInfo* the_simn nCurObj = integrableObjects.size(); - MPI_Recv(&nCurObj, 1, MPI_INT, 0, - TAKE_THIS_TAG_INT, MPI_COMM_WORLD, &istatus); + MPI_Send(&nCurObj, 1, MPI_INT, 0, + TAKE_THIS_TAG_INT, MPI_COMM_WORLD); for(j = 0; j < integrableObjects.size(); j++){ @@ -617,7 +630,7 @@ char* InitializeFromFile::parseCommentLine(char* readL //push eta into SimInfo::properties which can be //retrieved by integrator later - //entry_plug->setBoxM( theBoxMat3 ); + DoubleArrayData* etaValue = new DoubleArrayData(); etaValue->setID(ETAVALUE_ID); etaValue->setData(eta, 9);