| 1 |
+ |
#define _FILE_OFFSET_BITS 64 |
| 2 |
+ |
|
| 3 |
|
#include <cstring> |
| 4 |
|
#include <iostream> |
| 5 |
|
#include <fstream> |
| 72 |
|
char tempBuffer[BUFFERSIZE]; |
| 73 |
|
char writeLine[BUFFERSIZE]; |
| 74 |
|
|
| 75 |
< |
int i, j, which_node, done, which_atom, local_index; |
| 75 |
> |
int i; |
| 76 |
> |
#ifdef IS_MPI |
| 77 |
> |
int j, which_node, done, which_atom, local_index; |
| 78 |
> |
#else //is_mpi |
| 79 |
> |
int nAtoms = entry_plug->n_atoms; |
| 80 |
> |
#endif //is_mpi |
| 81 |
> |
|
| 82 |
|
double q[4]; |
| 83 |
|
DirectionalAtom* dAtom; |
| 76 |
– |
int nAtoms = entry_plug->n_atoms; |
| 84 |
|
Atom** atoms = entry_plug->atoms; |
| 85 |
+ |
double pos[3], vel[3]; |
| 86 |
|
|
| 87 |
|
|
| 88 |
|
#ifndef IS_MPI |
| 104 |
|
|
| 105 |
|
for( i=0; i<nAtoms; i++ ){ |
| 106 |
|
|
| 107 |
+ |
atoms[i]->getPos(pos); |
| 108 |
+ |
atoms[i]->getVel(vel); |
| 109 |
|
|
| 110 |
|
sprintf( tempBuffer, |
| 111 |
|
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
| 112 |
|
atoms[i]->getType(), |
| 113 |
< |
atoms[i]->getX(), |
| 114 |
< |
atoms[i]->getY(), |
| 115 |
< |
atoms[i]->getZ(), |
| 116 |
< |
atoms[i]->get_vx(), |
| 117 |
< |
atoms[i]->get_vy(), |
| 118 |
< |
atoms[i]->get_vz()); |
| 113 |
> |
pos[0], |
| 114 |
> |
pos[1], |
| 115 |
> |
pos[2], |
| 116 |
> |
vel[0], |
| 117 |
> |
vel[1], |
| 118 |
> |
vel[2]); |
| 119 |
|
strcpy( writeLine, tempBuffer ); |
| 120 |
|
|
| 121 |
|
if( atoms[i]->isDirectional() ){ |
| 186 |
|
} |
| 187 |
|
if (local_index != -1) { |
| 188 |
|
//format the line |
| 189 |
+ |
|
| 190 |
+ |
atoms[local_index]->getPos(pos); |
| 191 |
+ |
atoms[local_index]->getVel(vel); |
| 192 |
+ |
|
| 193 |
|
sprintf( tempBuffer, |
| 194 |
|
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
| 195 |
|
atoms[local_index]->getType(), |
| 196 |
< |
atoms[local_index]->getX(), |
| 197 |
< |
atoms[local_index]->getY(), |
| 198 |
< |
atoms[local_index]->getZ(), |
| 199 |
< |
atoms[local_index]->get_vx(), |
| 200 |
< |
atoms[local_index]->get_vy(), |
| 201 |
< |
atoms[local_index]->get_vz()); // check here. |
| 196 |
> |
pos[0], |
| 197 |
> |
pos[1], |
| 198 |
> |
pos[2], |
| 199 |
> |
vel[0], |
| 200 |
> |
vel[1], |
| 201 |
> |
vel[2]); // check here. |
| 202 |
|
strcpy( writeLine, tempBuffer ); |
| 203 |
|
|
| 204 |
|
if( atoms[local_index]->isDirectional() ){ |
| 280 |
|
} |
| 281 |
|
if (local_index != -1) { |
| 282 |
|
//format the line |
| 283 |
+ |
|
| 284 |
+ |
atoms[local_index]->getPos(pos); |
| 285 |
+ |
atoms[local_index]->getVel(vel); |
| 286 |
+ |
|
| 287 |
|
sprintf( tempBuffer, |
| 288 |
|
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
| 289 |
|
atoms[local_index]->getType(), |
| 290 |
< |
atoms[local_index]->getX(), |
| 291 |
< |
atoms[local_index]->getY(), |
| 292 |
< |
atoms[local_index]->getZ(), |
| 293 |
< |
atoms[local_index]->get_vx(), |
| 294 |
< |
atoms[local_index]->get_vy(), |
| 295 |
< |
atoms[local_index]->get_vz()); // check here. |
| 290 |
> |
pos[0], |
| 291 |
> |
pos[1], |
| 292 |
> |
pos[2], |
| 293 |
> |
vel[0], |
| 294 |
> |
vel[1], |
| 295 |
> |
vel[2]); // check here. |
| 296 |
|
strcpy( writeLine, tempBuffer ); |
| 297 |
|
|
| 298 |
|
if( atoms[local_index]->isDirectional() ){ |
| 353 |
|
|
| 354 |
|
double q[4]; |
| 355 |
|
DirectionalAtom* dAtom; |
| 338 |
– |
int nAtoms = entry_plug->n_atoms; |
| 356 |
|
Atom** atoms = entry_plug->atoms; |
| 357 |
< |
int i, j, which_node, done, game_over, which_atom, local_index; |
| 357 |
> |
int i; |
| 358 |
> |
#ifdef IS_MPI |
| 359 |
> |
int j, which_node, done, which_atom, local_index; |
| 360 |
> |
#else //is_mpi |
| 361 |
> |
int nAtoms = entry_plug->n_atoms; |
| 362 |
> |
#endif //is_mpi |
| 363 |
|
|
| 364 |
+ |
double pos[3], vel[3]; |
| 365 |
|
|
| 366 |
|
#ifdef IS_MPI |
| 367 |
|
if(worldRank == 0 ){ |
| 408 |
|
|
| 409 |
|
for( i=0; i<nAtoms; i++ ){ |
| 410 |
|
|
| 411 |
+ |
atoms[i]->getPos(pos); |
| 412 |
+ |
atoms[i]->getVel(vel); |
| 413 |
+ |
|
| 414 |
|
sprintf( tempBuffer, |
| 415 |
|
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
| 416 |
|
atoms[i]->getType(), |
| 417 |
< |
atoms[i]->getX(), |
| 418 |
< |
atoms[i]->getY(), |
| 419 |
< |
atoms[i]->getZ(), |
| 420 |
< |
atoms[i]->get_vx(), |
| 421 |
< |
atoms[i]->get_vy(), |
| 422 |
< |
atoms[i]->get_vz()); |
| 417 |
> |
pos[0], |
| 418 |
> |
pos[1], |
| 419 |
> |
pos[2], |
| 420 |
> |
vel[0], |
| 421 |
> |
vel[1], |
| 422 |
> |
vel[2]); |
| 423 |
|
strcpy( writeLine, tempBuffer ); |
| 424 |
|
|
| 425 |
|
if( atoms[i]->isDirectional() ){ |
| 488 |
|
for (j=0; (j<mpiSim->getMyNlocal()) && (local_index < 0); j++) { |
| 489 |
|
if (atoms[j]->getGlobalIndex() == which_atom) local_index = j; |
| 490 |
|
} |
| 491 |
< |
if (local_index != -1) { |
| 491 |
> |
if (local_index != -1) { |
| 492 |
> |
|
| 493 |
> |
atoms[local_index]->getPos(pos); |
| 494 |
> |
atoms[local_index]->getVel(vel); |
| 495 |
> |
|
| 496 |
|
sprintf( tempBuffer, |
| 497 |
|
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
| 498 |
|
atoms[local_index]->getType(), |
| 499 |
< |
atoms[local_index]->getX(), |
| 500 |
< |
atoms[local_index]->getY(), |
| 501 |
< |
atoms[local_index]->getZ(), |
| 502 |
< |
atoms[local_index]->get_vx(), |
| 503 |
< |
atoms[local_index]->get_vy(), |
| 504 |
< |
atoms[local_index]->get_vz()); |
| 499 |
> |
pos[0], |
| 500 |
> |
pos[1], |
| 501 |
> |
pos[2], |
| 502 |
> |
vel[0], |
| 503 |
> |
vel[1], |
| 504 |
> |
vel[2]); |
| 505 |
|
strcpy( writeLine, tempBuffer ); |
| 506 |
|
|
| 507 |
|
if( atoms[local_index]->isDirectional() ){ |
| 581 |
|
} |
| 582 |
|
if (local_index != -1) { |
| 583 |
|
|
| 584 |
+ |
atoms[local_index]->getPos(pos); |
| 585 |
+ |
atoms[local_index]->getVel(vel); |
| 586 |
+ |
|
| 587 |
|
//format the line |
| 588 |
|
sprintf( tempBuffer, |
| 589 |
|
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
| 590 |
|
atoms[local_index]->getType(), |
| 591 |
< |
atoms[local_index]->getX(), |
| 592 |
< |
atoms[local_index]->getY(), |
| 593 |
< |
atoms[local_index]->getZ(), |
| 594 |
< |
atoms[local_index]->get_vx(), |
| 595 |
< |
atoms[local_index]->get_vy(), |
| 596 |
< |
atoms[local_index]->get_vz()); // check here. |
| 591 |
> |
pos[0], |
| 592 |
> |
pos[1], |
| 593 |
> |
pos[2], |
| 594 |
> |
vel[0], |
| 595 |
> |
vel[1], |
| 596 |
> |
vel[2]); // check here. |
| 597 |
|
strcpy( writeLine, tempBuffer ); |
| 598 |
|
|
| 599 |
|
if( atoms[local_index]->isDirectional() ){ |