--- trunk/OOPSE/libmdtools/InitializeFromFile.cpp 2004/04/14 15:37:41 1108 +++ trunk/OOPSE/libmdtools/InitializeFromFile.cpp 2004/04/22 03:29:30 1129 @@ -92,7 +92,6 @@ void InitializeFromFile :: readInit( SimInfo* the_simn char *parseErr; vector integrableObjects; - vector::iterator iter; simnfo = the_simnfo; @@ -141,7 +140,7 @@ void InitializeFromFile :: readInit( SimInfo* the_simn integrableObjects = (simnfo->molecules[i]).getIntegrableObjects(); - for(iter = integrableObjects.begin(); iter!= integrableObjects.end(); iter++) + for(j = 0; j < integrableObjects.size(); j++){ eof_test = fgets(read_buffer, sizeof(read_buffer), c_in_file); if(eof_test == NULL){ @@ -154,15 +153,15 @@ void InitializeFromFile :: readInit( SimInfo* the_simn simError(); } - parseErr = parseDumpLine( read_buffer, *iter); + parseErr = parseDumpLine( read_buffer, integrableObjects[j]); if( parseErr != NULL ){ strcpy( painCave.errMsg, parseErr ); painCave.isFatal = 1; simError(); } + } } - // MPI Section of code.......... #else //IS_MPI @@ -176,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) { @@ -188,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", @@ -256,7 +257,7 @@ void InitializeFromFile :: readInit( SimInfo* the_simn if(haveError) nodeZeroError(); - parseDumpLine(read_buffer, integrableObjects[i]); + parseDumpLine(read_buffer, integrableObjects[j]); } @@ -265,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++){ @@ -295,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]; @@ -313,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++){ @@ -618,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);