161 |
|
#else // is_mpi |
162 |
|
|
163 |
|
/* code to find maximum tag value */ |
164 |
+ |
|
165 |
|
int *tagub, flag, MAXTAG; |
166 |
|
MPI_Attr_get(MPI_COMM_WORLD, MPI_TAG_UB, &tagub, &flag); |
167 |
|
if (flag) { |
228 |
|
MPI_Recv(MPIatomTypeString, MINIBUFFERSIZE, MPI_CHAR, which_node, |
229 |
|
myPotato, MPI_COMM_WORLD, &istatus); |
230 |
|
|
231 |
< |
strncpy(atomTypeString, MPIatomTypeString, MINIBUFFERSIZE); |
231 |
> |
//strncpy(atomTypeString, MPIatomTypeString, MINIBUFFERSIZE); |
232 |
|
|
233 |
|
// Null terminate the atomTypeString just in case: |
234 |
|
|
235 |
< |
atomTypeString[strlen(atomTypeString) - 1] = '\0'; |
236 |
< |
|
235 |
> |
//atomTypeString[strlen(atomTypeString) - 1] = '\0'; |
236 |
> |
atomTypeString = MPIatomTypeString; |
237 |
> |
|
238 |
|
myPotato++; |
239 |
|
|
240 |
|
MPI_Recv(&isDirectional, 1, MPI_INT, which_node, |
310 |
|
|
311 |
|
if(haveError) DieDieDie(); |
312 |
|
|
313 |
< |
// If we've survived to here, format the line: |
314 |
< |
|
315 |
< |
if (!isDirectional) { |
316 |
< |
|
317 |
< |
sprintf( tempBuffer, |
318 |
< |
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
319 |
< |
atomTypeString, |
320 |
< |
atomData6[0], |
321 |
< |
atomData6[1], |
322 |
< |
atomData6[2], |
323 |
< |
atomData6[3], |
324 |
< |
atomData6[4], |
325 |
< |
atomData6[5]); |
326 |
< |
|
327 |
< |
strcpy( writeLine, tempBuffer ); |
328 |
< |
strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); |
329 |
< |
|
330 |
< |
} else { |
331 |
< |
|
332 |
< |
sprintf( tempBuffer, |
333 |
< |
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", |
334 |
< |
atomTypeString, |
335 |
< |
atomData13[0], |
336 |
< |
atomData13[1], |
337 |
< |
atomData13[2], |
338 |
< |
atomData13[3], |
339 |
< |
atomData13[4], |
340 |
< |
atomData13[5], |
341 |
< |
atomData13[6], |
342 |
< |
atomData13[7], |
343 |
< |
atomData13[8], |
344 |
< |
atomData13[9], |
345 |
< |
atomData13[10], |
346 |
< |
atomData13[11], |
347 |
< |
atomData13[12]); |
348 |
< |
|
349 |
< |
strcat( writeLine, tempBuffer ); |
350 |
< |
|
349 |
< |
} |
313 |
> |
} |
314 |
> |
// If we've survived to here, format the line: |
315 |
> |
|
316 |
> |
if (!isDirectional) { |
317 |
> |
|
318 |
> |
sprintf( tempBuffer, |
319 |
> |
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
320 |
> |
atomTypeString, |
321 |
> |
atomData6[0], |
322 |
> |
atomData6[1], |
323 |
> |
atomData6[2], |
324 |
> |
atomData6[3], |
325 |
> |
atomData6[4], |
326 |
> |
atomData6[5]); |
327 |
> |
|
328 |
> |
strcpy( writeLine, tempBuffer ); |
329 |
> |
strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); |
330 |
> |
|
331 |
> |
} else { |
332 |
> |
|
333 |
> |
sprintf( tempBuffer, |
334 |
> |
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", |
335 |
> |
atomTypeString, |
336 |
> |
atomData13[0], |
337 |
> |
atomData13[1], |
338 |
> |
atomData13[2], |
339 |
> |
atomData13[3], |
340 |
> |
atomData13[4], |
341 |
> |
atomData13[5], |
342 |
> |
atomData13[6], |
343 |
> |
atomData13[7], |
344 |
> |
atomData13[8], |
345 |
> |
atomData13[9], |
346 |
> |
atomData13[10], |
347 |
> |
atomData13[11], |
348 |
> |
atomData13[12]); |
349 |
> |
|
350 |
> |
strcat( writeLine, tempBuffer ); |
351 |
|
|
351 |
– |
outFile << writeLine; |
352 |
– |
outFile.flush(); |
352 |
|
} |
353 |
+ |
|
354 |
+ |
outFile << writeLine; |
355 |
+ |
outFile.flush(); |
356 |
|
} |
357 |
+ |
|
358 |
|
|
359 |
|
outFile.flush(); |
360 |
|
sprintf( checkPointMsg, |
361 |
|
"Sucessfully took a dump.\n"); |
362 |
|
MPIcheckPoint(); |
363 |
< |
|
363 |
> |
delete[] potatoes; |
364 |
|
} else { |
365 |
|
|
366 |
|
// worldRank != 0, so I'm a remote node. |
384 |
|
MPI_Recv(&myPotato, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &istatus); |
385 |
|
|
386 |
|
} |
387 |
< |
|
388 |
< |
local_index=-1; |
387 |
> |
which_atom = i; |
388 |
> |
local_index=-1; |
389 |
|
for (j=0; (j<mpiSim->getMyNlocal()) && (local_index < 0); j++) { |
390 |
|
if (atoms[j]->getGlobalIndex() == which_atom) local_index = j; |
391 |
|
} |
662 |
|
MPI_Recv(MPIatomTypeString, MINIBUFFERSIZE, MPI_CHAR, which_node, |
663 |
|
myPotato, MPI_COMM_WORLD, &istatus); |
664 |
|
|
665 |
< |
strncpy(atomTypeString, MPIatomTypeString, MINIBUFFERSIZE); |
666 |
< |
|
664 |
< |
// Null terminate the atomTypeString just in case: |
665 |
< |
|
666 |
< |
atomTypeString[strlen(atomTypeString) - 1] = '\0'; |
667 |
< |
|
665 |
> |
atomTypeString = MPIatomTypeString; |
666 |
> |
|
667 |
|
myPotato++; |
668 |
|
|
669 |
|
MPI_Recv(&isDirectional, 1, MPI_INT, which_node, |
675 |
|
MPI_Recv(atomData13, 13, MPI_DOUBLE, which_node, |
676 |
|
myPotato, MPI_COMM_WORLD, &istatus); |
677 |
|
} else { |
678 |
+ |
printf("inside \n"); |
679 |
|
MPI_Recv(atomData6, 6, MPI_DOUBLE, which_node, |
680 |
|
myPotato, MPI_COMM_WORLD, &istatus); |
681 |
|
} |
740 |
|
|
741 |
|
if(haveError) DieDieDie(); |
742 |
|
|
743 |
< |
// If we've survived to here, format the line: |
744 |
< |
|
745 |
< |
if (!isDirectional) { |
743 |
> |
} |
744 |
|
|
747 |
– |
sprintf( tempBuffer, |
748 |
– |
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
749 |
– |
atomTypeString, |
750 |
– |
atomData6[0], |
751 |
– |
atomData6[1], |
752 |
– |
atomData6[2], |
753 |
– |
atomData6[3], |
754 |
– |
atomData6[4], |
755 |
– |
atomData6[5]); |
756 |
– |
|
757 |
– |
strcpy( writeLine, tempBuffer ); |
758 |
– |
strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); |
745 |
|
|
746 |
< |
} else { |
747 |
< |
|
748 |
< |
sprintf( tempBuffer, |
749 |
< |
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", |
750 |
< |
atomTypeString, |
751 |
< |
atomData13[0], |
752 |
< |
atomData13[1], |
753 |
< |
atomData13[2], |
754 |
< |
atomData13[3], |
755 |
< |
atomData13[4], |
756 |
< |
atomData13[5], |
757 |
< |
atomData13[6], |
758 |
< |
atomData13[7], |
759 |
< |
atomData13[8], |
760 |
< |
atomData13[9], |
761 |
< |
atomData13[10], |
762 |
< |
atomData13[11], |
763 |
< |
atomData13[12]); |
764 |
< |
|
765 |
< |
strcat( writeLine, tempBuffer ); |
766 |
< |
|
767 |
< |
} |
746 |
> |
// If we've survived to here, format the line: |
747 |
> |
|
748 |
> |
if (!isDirectional) { |
749 |
> |
|
750 |
> |
sprintf( tempBuffer, |
751 |
> |
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
752 |
> |
atomTypeString, |
753 |
> |
atomData6[0], |
754 |
> |
atomData6[1], |
755 |
> |
atomData6[2], |
756 |
> |
atomData6[3], |
757 |
> |
atomData6[4], |
758 |
> |
atomData6[5]); |
759 |
> |
|
760 |
> |
strcpy( writeLine, tempBuffer ); |
761 |
> |
strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); |
762 |
> |
|
763 |
> |
} else { |
764 |
> |
|
765 |
> |
sprintf( tempBuffer, |
766 |
> |
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", |
767 |
> |
atomTypeString, |
768 |
> |
atomData13[0], |
769 |
> |
atomData13[1], |
770 |
> |
atomData13[2], |
771 |
> |
atomData13[3], |
772 |
> |
atomData13[4], |
773 |
> |
atomData13[5], |
774 |
> |
atomData13[6], |
775 |
> |
atomData13[7], |
776 |
> |
atomData13[8], |
777 |
> |
atomData13[9], |
778 |
> |
atomData13[10], |
779 |
> |
atomData13[11], |
780 |
> |
atomData13[12]); |
781 |
> |
|
782 |
> |
strcat( writeLine, tempBuffer ); |
783 |
|
|
783 |
– |
finalOut << writeLine; |
784 |
– |
finalOut.flush(); |
784 |
|
} |
785 |
+ |
|
786 |
+ |
finalOut << writeLine; |
787 |
+ |
finalOut.flush(); |
788 |
|
} |
789 |
< |
|
789 |
> |
|
790 |
|
finalOut.flush(); |
791 |
|
sprintf( checkPointMsg, |
792 |
|
"Sucessfully took a dump.\n"); |
793 |
+ |
delete[] potatoes; |
794 |
+ |
|
795 |
|
MPIcheckPoint(); |
796 |
|
|
797 |
|
} else { |
817 |
|
MPI_Recv(&myPotato, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &istatus); |
818 |
|
|
819 |
|
} |
820 |
< |
|
820 |
> |
which_atom = i; |
821 |
|
local_index=-1; |
822 |
|
for (j=0; (j<mpiSim->getMyNlocal()) && (local_index < 0); j++) { |
823 |
|
if (atoms[j]->getGlobalIndex() == which_atom) local_index = j; |