--- trunk/OOPSE/libmdtools/DumpWriter.cpp 2003/03/28 21:45:03 436 +++ trunk/OOPSE/libmdtools/DumpWriter.cpp 2003/03/28 22:34:02 437 @@ -375,37 +375,47 @@ void DumpWriter::writeFinal(){ which_node = AtomToProcMap[i]; if (which_node == mpiSim->getMyNode()) { - - sprintf( tempBuffer, - "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", - atoms[i]->getType(), - atoms[i]->getX(), - atoms[i]->getY(), - atoms[i]->getZ(), - atoms[i]->get_vx(), - atoms[i]->get_vy(), - atoms[i]->get_vz()); - strcpy( writeLine, tempBuffer ); - - if( atoms[i]->isDirectional() ){ - - dAtom = (DirectionalAtom *)atoms[i]; - dAtom->getQ( q ); - - sprintf( tempBuffer, - "%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", - q[0], - q[1], - q[2], - q[3], - dAtom->getJx(), - dAtom->getJy(), - dAtom->getJz()); - strcat( writeLine, tempBuffer ); + + which_atom = i; + local_index=-1; + for (j=0; (jgetMyNlocal()) && (local_index < 0); j++) { + if (atoms[j]->getGlobalIndex() == which_atom) local_index = j; } - else - strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); - + if (local_index != -1) { + sprintf( tempBuffer, + "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", + atoms[local_index]->getType(), + atoms[local_index]->getX(), + atoms[local_index]->getY(), + atoms[local_index]->getZ(), + atoms[local_index]->get_vx(), + atoms[local_index]->get_vy(), + atoms[local_index]->get_vz()); + strcpy( writeLine, tempBuffer ); + + if( atoms[local_index]->isDirectional() ){ + + dAtom = (DirectionalAtom *)atoms[local_index]; + dAtom->getQ( q ); + + sprintf( tempBuffer, + "%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", + q[0], + q[1], + q[2], + q[3], + dAtom->getJx(), + dAtom->getJy(), + dAtom->getJz()); + strcat( writeLine, tempBuffer ); + } + else + strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); + } + else { + strcpy( writeLine, "ATOM NOT FOUND ON THIS PROCESSOR"); + } + } else { MPI::COMM_WORLD.Send(&i, 1, MPI_INT, which_node, TAKE_THIS_TAG_INT);