4 |
|
|
5 |
|
#ifdef IS_MPI |
6 |
|
#include <mpi.h> |
7 |
+ |
#include <mpi++.h> |
8 |
|
#include "mpiSimulation.hpp" |
9 |
|
#define TAKE_THIS_TAG 0 |
10 |
|
#endif //is_mpi |
12 |
|
#include "ReadWrite.hpp" |
13 |
|
#include "simError.h" |
14 |
|
|
14 |
– |
|
15 |
– |
|
16 |
– |
|
17 |
– |
|
15 |
|
DumpWriter::DumpWriter( SimInfo* the_entry_plug ){ |
16 |
|
|
17 |
|
entry_plug = the_entry_plug; |
65 |
|
char tempBuffer[BUFFERSIZE]; |
66 |
|
char writeLine[BUFFERSIZE]; |
67 |
|
|
68 |
< |
int i; |
68 |
> |
int i, j, which_node, done, game_over, which_atom; |
69 |
|
double q[4]; |
70 |
|
DirectionalAtom* dAtom; |
71 |
|
int nAtoms = entry_plug->n_atoms; |
120 |
|
|
121 |
|
#else // is_mpi |
122 |
|
|
123 |
< |
int masterIndex; |
124 |
< |
int nodeAtomsStart; |
125 |
< |
int nodeAtomsEnd; |
129 |
< |
int mpiErr; |
130 |
< |
int sendError; |
131 |
< |
int procIndex; |
132 |
< |
|
133 |
< |
MPI_Status istatus[MPI_STATUS_SIZE]; |
134 |
< |
|
135 |
< |
|
123 |
> |
MPI::Status istatus; |
124 |
> |
int *AtomToProcMap = mpiSim->getAtomToProcMap(); |
125 |
> |
|
126 |
|
// write out header and node 0's coordinates |
127 |
< |
|
127 |
> |
|
128 |
|
if( worldRank == 0 ){ |
129 |
|
outFile << mpiSim->getTotAtoms() << "\n"; |
130 |
< |
|
130 |
> |
|
131 |
|
outFile << currentTime << "\t" |
132 |
|
<< entry_plug->box_x << "\t" |
133 |
|
<< entry_plug->box_y << "\t" |
134 |
|
<< entry_plug->box_z << "\n"; |
135 |
< |
|
136 |
< |
masterIndex = 0; |
137 |
< |
for( i=0; i<nAtoms; i++ ){ |
135 |
> |
|
136 |
> |
for (i = 0 ; i < mpiSim->getTotAtoms(); i++ ) { |
137 |
> |
// Get the Node number which has this atom; |
138 |
|
|
139 |
< |
sprintf( tempBuffer, |
140 |
< |
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
141 |
< |
atoms[i]->getType(), |
142 |
< |
atoms[i]->getX(), |
143 |
< |
atoms[i]->getY(), |
144 |
< |
atoms[i]->getZ(), |
145 |
< |
atoms[i]->get_vx(), |
146 |
< |
atoms[i]->get_vy(), |
147 |
< |
atoms[i]->get_vz()); |
148 |
< |
strcpy( writeLine, tempBuffer ); |
139 |
> |
which_node = AtomToProcMap[i]; |
140 |
> |
|
141 |
> |
if (which_node == mpiSim->getMyNode()) { |
142 |
> |
|
143 |
> |
sprintf( tempBuffer, |
144 |
> |
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
145 |
> |
atoms[i]->getType(), |
146 |
> |
atoms[i]->getX(), |
147 |
> |
atoms[i]->getY(), |
148 |
> |
atoms[i]->getZ(), |
149 |
> |
atoms[i]->get_vx(), |
150 |
> |
atoms[i]->get_vy(), |
151 |
> |
atoms[i]->get_vz()); |
152 |
> |
strcpy( writeLine, tempBuffer ); |
153 |
|
|
154 |
< |
if( atoms[i]->isDirectional() ){ |
154 |
> |
if( atoms[i]->isDirectional() ){ |
155 |
|
|
156 |
< |
dAtom = (DirectionalAtom *)atoms[i]; |
157 |
< |
dAtom->getQ( q ); |
156 |
> |
dAtom = (DirectionalAtom *)atoms[i]; |
157 |
> |
dAtom->getQ( q ); |
158 |
|
|
159 |
< |
sprintf( tempBuffer, |
160 |
< |
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", |
161 |
< |
q[0], |
162 |
< |
q[1], |
163 |
< |
q[2], |
164 |
< |
q[3], |
165 |
< |
dAtom->getJx(), |
166 |
< |
dAtom->getJy(), |
167 |
< |
dAtom->getJz()); |
168 |
< |
strcat( writeLine, tempBuffer ); |
159 |
> |
sprintf( tempBuffer, |
160 |
> |
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", |
161 |
> |
q[0], |
162 |
> |
q[1], |
163 |
> |
q[2], |
164 |
> |
q[3], |
165 |
> |
dAtom->getJx(), |
166 |
> |
dAtom->getJy(), |
167 |
> |
dAtom->getJz()); |
168 |
> |
strcat( writeLine, tempBuffer ); |
169 |
> |
} |
170 |
> |
else |
171 |
> |
strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); |
172 |
> |
|
173 |
> |
} else { |
174 |
> |
|
175 |
> |
MPI::COMM_WORLD.Send(&i, 1, MPI_INT, which_node, TAKE_THIS_TAG); |
176 |
> |
MPI::COMM_WORLD.Recv(writeLine, BUFFERSIZE, MPI_CHAR, which_node, |
177 |
> |
TAKE_THIS_TAG, istatus); |
178 |
|
} |
179 |
< |
else |
177 |
< |
strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); |
178 |
< |
|
179 |
> |
|
180 |
|
outFile << writeLine; |
180 |
– |
masterIndex++; |
181 |
|
} |
182 |
– |
outFile.flush(); |
183 |
– |
} |
184 |
– |
|
185 |
– |
sprintf( checkPointMsg, |
186 |
– |
"Sucessfully wrote node 0's dump configuration.\n"); |
187 |
– |
MPIcheckPoint(); |
182 |
|
|
183 |
< |
for (procIndex = 1; procIndex < mpiSim->getNumberProcessors(); |
184 |
< |
procIndex++){ |
185 |
< |
|
186 |
< |
if( worldRank == 0 ){ |
193 |
< |
|
194 |
< |
mpiErr = MPI_Recv(&nodeAtomsStart,1,MPI_INT,procIndex, |
195 |
< |
TAKE_THIS_TAG,MPI_COMM_WORLD,istatus); |
196 |
< |
|
197 |
< |
mpiErr = MPI_Recv(&nodeAtomsEnd,1,MPI_INT,procIndex, |
198 |
< |
TAKE_THIS_TAG,MPI_COMM_WORLD, istatus); |
199 |
< |
|
200 |
< |
// Make sure where node 0 is writing to, matches where the |
201 |
< |
// receiving node expects it to be. |
202 |
< |
|
203 |
< |
if (masterIndex != nodeAtomsStart){ |
204 |
< |
sendError = 1; |
205 |
< |
mpiErr = MPI_Send(&sendError,1,MPI_INT,procIndex,TAKE_THIS_TAG, |
206 |
< |
MPI_COMM_WORLD); |
207 |
< |
sprintf(painCave.errMsg, |
208 |
< |
"DumpWriter error: atoms start index (%d) for " |
209 |
< |
"node %d not equal to master index (%d)", |
210 |
< |
nodeAtomsStart,procIndex,masterIndex ); |
211 |
< |
painCave.isFatal = 1; |
212 |
< |
simError(); |
213 |
< |
} |
214 |
< |
|
215 |
< |
sendError = 0; |
216 |
< |
mpiErr = MPI_Send(&sendError,1,MPI_INT,procIndex,TAKE_THIS_TAG, |
217 |
< |
MPI_COMM_WORLD); |
218 |
< |
|
219 |
< |
// recieve the nodes writeLines |
220 |
< |
|
221 |
< |
for ( i = nodeAtomsStart; i <= nodeAtomsEnd; i++){ |
222 |
< |
|
223 |
< |
mpiErr = MPI_Recv(writeLine,BUFFERSIZE,MPI_CHAR,procIndex, |
224 |
< |
TAKE_THIS_TAG,MPI_COMM_WORLD,istatus ); |
225 |
< |
|
226 |
< |
outFile << writeLine; |
227 |
< |
masterIndex++; |
228 |
< |
} |
183 |
> |
// kill everyone off: |
184 |
> |
game_over = -1; |
185 |
> |
for (j = 0; j < mpiSim->getNumberProcessors(); j++) { |
186 |
> |
MPI::COMM_WORLD.Send(&game_over, 1, MPI_INT, j, TAKE_THIS_TAG); |
187 |
|
} |
188 |
|
|
189 |
< |
else if( worldRank == procIndex ){ |
189 |
> |
} else { |
190 |
> |
|
191 |
> |
done = 0; |
192 |
> |
while (!done) { |
193 |
> |
MPI::COMM_WORLD.Recv(&which_atom, 1, MPI_INT, 0, |
194 |
> |
TAKE_THIS_TAG, istatus); |
195 |
|
|
196 |
< |
nodeAtomsStart = mpiSim->getMyAtomStart(); |
197 |
< |
nodeAtomsEnd = mpiSim->getMyAtomEnd(); |
196 |
> |
if (which_atom == -1) { |
197 |
> |
done=1; |
198 |
> |
continue; |
199 |
> |
} else { |
200 |
|
|
201 |
< |
mpiErr = MPI_Send(&nodeAtomsStart,1,MPI_INT,0,TAKE_THIS_TAG, |
237 |
< |
MPI_COMM_WORLD); |
238 |
< |
mpiErr = MPI_Send(&nodeAtomsEnd,1,MPI_INT,0,TAKE_THIS_TAG, |
239 |
< |
MPI_COMM_WORLD); |
240 |
< |
|
241 |
< |
sendError = -1; |
242 |
< |
mpiErr = MPI_Recv(&sendError,1,MPI_INT,0,TAKE_THIS_TAG, |
243 |
< |
MPI_COMM_WORLD, istatus); |
244 |
< |
|
245 |
< |
if (sendError) MPIcheckPoint(); |
246 |
< |
|
247 |
< |
// send current node's configuration line by line. |
248 |
< |
|
249 |
< |
for( i=0; i<nAtoms; i++ ){ |
250 |
< |
|
201 |
> |
//format the line |
202 |
|
sprintf( tempBuffer, |
203 |
|
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
204 |
< |
atoms[i]->getType(), |
205 |
< |
atoms[i]->getX(), |
206 |
< |
atoms[i]->getY(), |
207 |
< |
atoms[i]->getZ(), |
208 |
< |
atoms[i]->get_vx(), |
209 |
< |
atoms[i]->get_vy(), |
210 |
< |
atoms[i]->get_vz()); // check here. |
204 |
> |
atoms[which_atom]->getType(), |
205 |
> |
atoms[which_atom]->getX(), |
206 |
> |
atoms[which_atom]->getY(), |
207 |
> |
atoms[which_atom]->getZ(), |
208 |
> |
atoms[which_atom]->get_vx(), |
209 |
> |
atoms[which_atom]->get_vy(), |
210 |
> |
atoms[which_atom]->get_vz()); // check here. |
211 |
|
strcpy( writeLine, tempBuffer ); |
212 |
|
|
213 |
< |
if( atoms[i]->isDirectional() ){ |
213 |
> |
if( atoms[which_atom]->isDirectional() ){ |
214 |
|
|
215 |
< |
dAtom = (DirectionalAtom *)atoms[i]; |
215 |
> |
dAtom = (DirectionalAtom *)atoms[which_atom]; |
216 |
|
dAtom->getQ( q ); |
217 |
|
|
218 |
|
sprintf( tempBuffer, |
228 |
|
} |
229 |
|
else |
230 |
|
strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); |
231 |
< |
|
232 |
< |
mpiErr = MPI_Send(writeLine,BUFFERSIZE,MPI_CHAR,0,TAKE_THIS_TAG, |
233 |
< |
MPI_COMM_WORLD); |
231 |
> |
|
232 |
> |
MPI::COMM_WORLD.Send(writeLine, BUFFERSIZE, MPI_CHAR, 0, |
233 |
> |
TAKE_THIS_TAG); |
234 |
|
} |
235 |
|
} |
236 |
< |
|
237 |
< |
sprintf(checkPointMsg,"Node %d sent dump configuration.", |
238 |
< |
procIndex); |
239 |
< |
MPIcheckPoint(); |
240 |
< |
} |
290 |
< |
|
236 |
> |
} |
237 |
> |
outFile.flush(); |
238 |
> |
sprintf( checkPointMsg, |
239 |
> |
"Sucessfully took a dump.\n"); |
240 |
> |
MPIcheckPoint(); |
241 |
|
#endif // is_mpi |
242 |
|
} |
243 |
|
|
294 |
– |
|
295 |
– |
|
244 |
|
void DumpWriter::writeFinal(){ |
245 |
|
|
246 |
+ |
char finalName[500]; |
247 |
+ |
ofstream finalOut; |
248 |
|
|
249 |
|
const int BUFFERSIZE = 2000; |
250 |
< |
char tempBuffer[500]; |
251 |
< |
char writeLine[BUFFERSIZE]; |
302 |
< |
|
303 |
< |
char finalName[500]; |
250 |
> |
char tempBuffer[BUFFERSIZE]; |
251 |
> |
char writeLine[BUFFERSIZE]; |
252 |
|
|
305 |
– |
int i; |
253 |
|
double q[4]; |
254 |
|
DirectionalAtom* dAtom; |
255 |
|
int nAtoms = entry_plug->n_atoms; |
256 |
|
Atom** atoms = entry_plug->atoms; |
257 |
+ |
int i, j, which_node, done, game_over, which_atom; |
258 |
|
|
311 |
– |
ofstream finalOut; |
259 |
|
|
260 |
|
#ifdef IS_MPI |
261 |
|
if(worldRank == 0 ){ |
282 |
|
|
283 |
|
#endif //is_mpi |
284 |
|
|
285 |
< |
|
339 |
< |
|
285 |
> |
|
286 |
|
#ifndef IS_MPI |
287 |
|
|
288 |
|
finalOut << nAtoms << "\n"; |
290 |
|
finalOut << entry_plug->box_x << "\t" |
291 |
|
<< entry_plug->box_y << "\t" |
292 |
|
<< entry_plug->box_z << "\n"; |
293 |
< |
|
293 |
> |
|
294 |
|
for( i=0; i<nAtoms; i++ ){ |
295 |
|
|
296 |
|
sprintf( tempBuffer, |
326 |
|
finalOut << writeLine; |
327 |
|
} |
328 |
|
finalOut.flush(); |
329 |
+ |
finalOut.close(); |
330 |
|
|
331 |
|
#else // is_mpi |
332 |
+ |
|
333 |
+ |
MPI::Status istatus; |
334 |
+ |
int *AtomToProcMap = mpiSim->getAtomToProcMap(); |
335 |
|
|
386 |
– |
int masterIndex; |
387 |
– |
int nodeAtomsStart; |
388 |
– |
int nodeAtomsEnd; |
389 |
– |
int mpiErr; |
390 |
– |
int sendError; |
391 |
– |
int procIndex; |
392 |
– |
|
393 |
– |
MPI_Status istatus[MPI_STATUS_SIZE]; |
394 |
– |
|
395 |
– |
|
336 |
|
// write out header and node 0's coordinates |
337 |
< |
|
337 |
> |
|
338 |
|
if( worldRank == 0 ){ |
339 |
|
finalOut << mpiSim->getTotAtoms() << "\n"; |
340 |
< |
|
340 |
> |
|
341 |
|
finalOut << entry_plug->box_x << "\t" |
342 |
< |
<< entry_plug->box_y << "\t" |
343 |
< |
<< entry_plug->box_z << "\n"; |
342 |
> |
<< entry_plug->box_y << "\t" |
343 |
> |
<< entry_plug->box_z << "\n"; |
344 |
|
|
345 |
< |
masterIndex = 0; |
346 |
< |
|
407 |
< |
for( i=0; i<nAtoms; i++ ){ |
345 |
> |
for (i = 0 ; i < mpiSim->getTotAtoms(); i++ ) { |
346 |
> |
// Get the Node number which has this molecule: |
347 |
|
|
348 |
< |
sprintf( tempBuffer, |
349 |
< |
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
350 |
< |
atoms[i]->getType(), |
351 |
< |
atoms[i]->getX(), |
352 |
< |
atoms[i]->getY(), |
353 |
< |
atoms[i]->getZ(), |
354 |
< |
atoms[i]->get_vx(), |
355 |
< |
atoms[i]->get_vy(), |
356 |
< |
atoms[i]->get_vz()); |
357 |
< |
strcpy( writeLine, tempBuffer ); |
348 |
> |
which_node = AtomToProcMap[i]; |
349 |
> |
|
350 |
> |
if (which_node == mpiSim->getMyNode()) { |
351 |
> |
|
352 |
> |
sprintf( tempBuffer, |
353 |
> |
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
354 |
> |
atoms[i]->getType(), |
355 |
> |
atoms[i]->getX(), |
356 |
> |
atoms[i]->getY(), |
357 |
> |
atoms[i]->getZ(), |
358 |
> |
atoms[i]->get_vx(), |
359 |
> |
atoms[i]->get_vy(), |
360 |
> |
atoms[i]->get_vz()); |
361 |
> |
strcpy( writeLine, tempBuffer ); |
362 |
|
|
363 |
< |
if( atoms[i]->isDirectional() ){ |
363 |
> |
if( atoms[i]->isDirectional() ){ |
364 |
|
|
365 |
< |
dAtom = (DirectionalAtom *)atoms[i]; |
366 |
< |
dAtom->getQ( q ); |
365 |
> |
dAtom = (DirectionalAtom *)atoms[i]; |
366 |
> |
dAtom->getQ( q ); |
367 |
|
|
368 |
< |
sprintf( tempBuffer, |
369 |
< |
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", |
370 |
< |
q[0], |
371 |
< |
q[1], |
372 |
< |
q[2], |
373 |
< |
q[3], |
374 |
< |
dAtom->getJx(), |
375 |
< |
dAtom->getJy(), |
376 |
< |
dAtom->getJz()); |
377 |
< |
strcat( writeLine, tempBuffer ); |
368 |
> |
sprintf( tempBuffer, |
369 |
> |
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", |
370 |
> |
q[0], |
371 |
> |
q[1], |
372 |
> |
q[2], |
373 |
> |
q[3], |
374 |
> |
dAtom->getJx(), |
375 |
> |
dAtom->getJy(), |
376 |
> |
dAtom->getJz()); |
377 |
> |
strcat( writeLine, tempBuffer ); |
378 |
> |
} |
379 |
> |
else |
380 |
> |
strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); |
381 |
> |
|
382 |
> |
} else { |
383 |
> |
|
384 |
> |
MPI::COMM_WORLD.Send(&i, 1, MPI_INT, which_node, TAKE_THIS_TAG); |
385 |
> |
MPI::COMM_WORLD.Recv(writeLine, BUFFERSIZE, MPI_CHAR, which_node, |
386 |
> |
TAKE_THIS_TAG, istatus); |
387 |
|
} |
388 |
< |
else |
437 |
< |
strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); |
438 |
< |
|
388 |
> |
|
389 |
|
finalOut << writeLine; |
440 |
– |
masterIndex++; |
390 |
|
} |
442 |
– |
finalOut.flush(); |
443 |
– |
} |
391 |
|
|
392 |
< |
for (procIndex = 1; procIndex < mpiSim->getNumberProcessors(); |
393 |
< |
procIndex++){ |
394 |
< |
|
395 |
< |
if( worldRank == 0 ){ |
449 |
< |
|
450 |
< |
mpiErr = MPI_Recv(&nodeAtomsStart,1,MPI_INT,procIndex, |
451 |
< |
TAKE_THIS_TAG,MPI_COMM_WORLD,istatus); |
452 |
< |
|
453 |
< |
mpiErr = MPI_Recv(&nodeAtomsEnd,1,MPI_INT,procIndex, |
454 |
< |
TAKE_THIS_TAG,MPI_COMM_WORLD, istatus); |
455 |
< |
|
456 |
< |
// Make sure where node 0 is writing to, matches where the |
457 |
< |
// receiving node expects it to be. |
458 |
< |
|
459 |
< |
if (masterIndex != nodeAtomsStart){ |
460 |
< |
sendError = 1; |
461 |
< |
mpiErr = MPI_Send(&sendError,1,MPI_INT,procIndex,TAKE_THIS_TAG, |
462 |
< |
MPI_COMM_WORLD); |
463 |
< |
sprintf(painCave.errMsg, |
464 |
< |
"DumpWriter error: atoms start index (%d) for " |
465 |
< |
"node %d not equal to master index (%d)", |
466 |
< |
nodeAtomsStart,procIndex,masterIndex ); |
467 |
< |
painCave.isFatal = 1; |
468 |
< |
simError(); |
469 |
< |
} |
470 |
< |
|
471 |
< |
sendError = 0; |
472 |
< |
mpiErr = MPI_Send(&sendError,1,MPI_INT,procIndex,TAKE_THIS_TAG, |
473 |
< |
MPI_COMM_WORLD); |
474 |
< |
|
475 |
< |
// recieve the nodes writeLines |
476 |
< |
|
477 |
< |
for ( i = nodeAtomsStart; i <= nodeAtomsEnd; i++){ |
478 |
< |
|
479 |
< |
mpiErr = MPI_Recv(writeLine,BUFFERSIZE,MPI_CHAR,procIndex, |
480 |
< |
TAKE_THIS_TAG,MPI_COMM_WORLD,istatus ); |
481 |
< |
|
482 |
< |
finalOut << writeLine; |
483 |
< |
masterIndex++; |
484 |
< |
} |
485 |
< |
|
486 |
< |
finalOut.flush(); |
392 |
> |
// kill everyone off: |
393 |
> |
game_over = -1; |
394 |
> |
for (j = 0; j < mpiSim->getNumberProcessors(); j++) { |
395 |
> |
MPI::COMM_WORLD.Send(&game_over, 1, MPI_INT, j, TAKE_THIS_TAG); |
396 |
|
} |
397 |
|
|
398 |
< |
else if( worldRank == procIndex ){ |
398 |
> |
} else { |
399 |
> |
|
400 |
> |
done = 0; |
401 |
> |
while (!done) { |
402 |
> |
MPI::COMM_WORLD.Recv(&which_atom, 1, MPI_INT, 0, |
403 |
> |
TAKE_THIS_TAG, istatus); |
404 |
|
|
405 |
< |
nodeAtomsStart = mpiSim->getMyAtomStart(); |
406 |
< |
nodeAtomsEnd = mpiSim->getMyAtomEnd(); |
407 |
< |
|
408 |
< |
mpiErr = MPI_Send(&nodeAtomsStart,1,MPI_INT,0,TAKE_THIS_TAG, |
495 |
< |
MPI_COMM_WORLD); |
496 |
< |
mpiErr = MPI_Send(&nodeAtomsEnd,1,MPI_INT,0,TAKE_THIS_TAG, |
497 |
< |
MPI_COMM_WORLD); |
498 |
< |
|
499 |
< |
mpiErr = MPI_Recv(&sendError,1,MPI_INT,0,TAKE_THIS_TAG, |
500 |
< |
MPI_COMM_WORLD, istatus); |
501 |
< |
if (sendError) MPIcheckPoint(); |
405 |
> |
if (which_atom == -1) { |
406 |
> |
done=1; |
407 |
> |
continue; |
408 |
> |
} else { |
409 |
|
|
410 |
< |
// send current node's configuration line by line. |
504 |
< |
|
505 |
< |
for( i=0; i<nAtoms; i++ ){ |
506 |
< |
|
410 |
> |
//format the line |
411 |
|
sprintf( tempBuffer, |
412 |
|
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
413 |
< |
atoms[i]->getType(), |
414 |
< |
atoms[i]->getX(), |
415 |
< |
atoms[i]->getY(), |
416 |
< |
atoms[i]->getZ(), |
417 |
< |
atoms[i]->get_vx(), |
418 |
< |
atoms[i]->get_vy(), |
419 |
< |
atoms[i]->get_vz()); |
413 |
> |
atoms[which_atom]->getType(), |
414 |
> |
atoms[which_atom]->getX(), |
415 |
> |
atoms[which_atom]->getY(), |
416 |
> |
atoms[which_atom]->getZ(), |
417 |
> |
atoms[which_atom]->get_vx(), |
418 |
> |
atoms[which_atom]->get_vy(), |
419 |
> |
atoms[which_atom]->get_vz()); // check here. |
420 |
|
strcpy( writeLine, tempBuffer ); |
421 |
|
|
422 |
< |
if( atoms[i]->isDirectional() ){ |
422 |
> |
if( atoms[which_atom]->isDirectional() ){ |
423 |
|
|
424 |
< |
dAtom = (DirectionalAtom *)atoms[i]; |
424 |
> |
dAtom = (DirectionalAtom *)atoms[which_atom]; |
425 |
|
dAtom->getQ( q ); |
426 |
|
|
427 |
|
sprintf( tempBuffer, |
437 |
|
} |
438 |
|
else |
439 |
|
strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); |
440 |
< |
|
441 |
< |
mpiErr = MPI_Send(writeLine,BUFFERSIZE,MPI_CHAR,0,TAKE_THIS_TAG, |
442 |
< |
MPI_COMM_WORLD); |
440 |
> |
|
441 |
> |
MPI::COMM_WORLD.Send(writeLine, BUFFERSIZE, MPI_CHAR, 0, |
442 |
> |
TAKE_THIS_TAG); |
443 |
|
} |
444 |
|
} |
445 |
< |
|
446 |
< |
sprintf(checkPointMsg,"Node %d sent dump configuration.", |
447 |
< |
procIndex); |
448 |
< |
MPIcheckPoint(); |
449 |
< |
} |
445 |
> |
} |
446 |
> |
finalOut.flush(); |
447 |
> |
sprintf( checkPointMsg, |
448 |
> |
"Sucessfully took a dump.\n"); |
449 |
> |
MPIcheckPoint(); |
450 |
|
|
451 |
< |
if( worldRank == 0 ) finalOut.close(); |
548 |
< |
|
549 |
< |
|
451 |
> |
if( worldRank == 0 ) finalOut.close(); |
452 |
|
#endif // is_mpi |
453 |
|
} |