--- trunk/mdtools/md_code/InitializeFromFile.cpp 2002/12/13 21:17:00 212 +++ trunk/mdtools/md_code/InitializeFromFile.cpp 2003/01/30 20:03:37 254 @@ -11,6 +11,9 @@ #include "ReadWrite.hpp" #include "simError.h" +#ifdef IS_MPI +#include "mpiSimulation.hpp" +#endif // is_mpi InitializeFromFile :: InitializeFromFile( char *in_name ){ #ifdef IS_MPI @@ -68,11 +71,11 @@ void InitializeFromFile :: read_xyz( SimInfo* the_entr char *eof_test; // ptr to see when we reach the end of the file char *parseErr; + int procIndex; + entry_plug = the_entry_plug; - entry_plug = the_entry_plug - #ifndef IS_MPI eof_test = fgets(read_buffer, sizeof(read_buffer), c_in_file); if( eof_test == NULL ){ @@ -158,7 +161,7 @@ void InitializeFromFile :: read_xyz( SimInfo* the_entr // Check to see that the number of atoms in the intial configuration file is the // same as declared in simBass. - if( n_atoms != entry_plug->mpiSim->getTotAtoms() ){ + if( n_atoms != mpiSim->getTotAtoms() ){ sprintf( painCave.errMsg, "Initialize from File error. %s n_atoms, %d, " "does not match the BASS file's n_atoms, %d.\n", @@ -179,7 +182,7 @@ void InitializeFromFile :: read_xyz( SimInfo* the_entr // Read Proc 0 share of the xyz file... masterIndex = 0; - for( i=0; i <= entry_plug->mpiSim->getMyAtomEnd(); i++){ + for( i=0; i <= mpiSim->getMyAtomEnd(); i++){ eof_test = fgets(read_buffer, sizeof(read_buffer), c_in_file); if(eof_test == NULL){ @@ -204,9 +207,9 @@ void InitializeFromFile :: read_xyz( SimInfo* the_entr sprintf(checkPointMsg, "Node 0 has successfully read positions from input file."); - mpiCheckPoint(); + MPIcheckPoint(); - for (procIndex = 1; procIndex < entryPlug->mpiSim->getNumberProcessors(); + for (procIndex = 1; procIndex < mpiSim->getNumberProcessors(); procIndex++){ if (worldRank == 0) { @@ -230,7 +233,7 @@ void InitializeFromFile :: read_xyz( SimInfo* the_entr sendError = 0; mpiErr = MPI_Send(&sendError,1,MPI_INT,procIndex,MPI_ANY_TAG,MPI_COMM_WORLD); - for ( i = nodeAtomStart; i <= nodeAtomEnd, i++){ + for ( i = nodeAtomsStart; i <= nodeAtomsEnd; i++){ eof_test = fgets(read_buffer, sizeof(read_buffer), c_in_file); if(eof_test == NULL){ @@ -249,7 +252,7 @@ void InitializeFromFile :: read_xyz( SimInfo* the_entr mpiErr = MPI_Send(read_buffer,BUFFERSIZE,MPI_CHAR,procIndex,MPI_ANY_TAG,MPI_COMM_WORLD); mpiErr = MPI_Recv(&sendError,1,MPI_INT,procIndex,MPI_ANY_TAG,MPI_COMM_WORLD, istatus); - if (sendError) mpiCheckpoint(); + if (sendError) MPIcheckPoint(); masterIndex++; } @@ -257,21 +260,21 @@ void InitializeFromFile :: read_xyz( SimInfo* the_entr else if(worldRank == procIndex){ - nodeAtomStart = entry_plug->mpiSim->getMyAtomStart(); - nodeAtomEnd = entry_plug->mpiSim->getMyAtomEnd(); + nodeAtomsStart = mpiSim->getMyAtomStart(); + nodeAtomsEnd = mpiSim->getMyAtomEnd(); mpiErr = MPI_Send(&nodeAtomsStart,1,MPI_INT,0,MPI_ANY_TAG,MPI_COMM_WORLD); mpiErr = MPI_Send(&nodeAtomsEnd,1,MPI_INT,0,MPI_ANY_TAG,MPI_COMM_WORLD); mpiErr = MPI_Recv(&sendError,1,MPI_INT,0,MPI_ANY_TAG,MPI_COMM_WORLD, istatus); - if (sendError) mpiCheckpoint(); + if (sendError) MPIcheckPoint(); - for ( i = 0; i < entry_plug->n_atoms, i++){ + for ( i = 0; i < entry_plug->n_atoms; i++){ mpiErr = MPI_Recv(&read_buffer,BUFFERSIZE,MPI_CHAR,0,MPI_ANY_TAG,MPI_COMM_WORLD, istatus); - if(!strcmp(read_buffer, "ERROR")) mpiCheckPoint(); + if(!strcmp(read_buffer, "ERROR")) MPIcheckPoint(); parseErr = parseDumpLine( read_buffer, i ); if( parseErr != NULL ){ @@ -288,14 +291,14 @@ void InitializeFromFile :: read_xyz( SimInfo* the_entr } } sprintf(checkPointMsg,"Node %d received initial configuration.",procIndex); - mpiCheckPoint(); + MPIcheckPoint(); } #endif } -char* IntitializeFromFile::parseDumpLine(char* readLine, int atomIndex){ +char* InitializeFromFile::parseDumpLine(char* readLine, int atomIndex){ char *foo; // the pointer to the current string token @@ -311,10 +314,10 @@ char* IntitializeFromFile::parseDumpLine(char* readLin int n_atoms; #ifdef IS_MPI - n_atoms = entry_plug->mpiSim->getTotAtoms(); + n_atoms = mpiSim->getTotAtoms(); #else n_atoms = entry_plug->n_atoms; -#endi // is_mpi +#endif // is_mpi // set the string tokenizer