| 26 |
|
|
| 27 |
|
#endif // is_mpi |
| 28 |
|
|
| 29 |
< |
InitializeFromFile :: InitializeFromFile( char *in_name ){ |
| 29 |
> |
InitializeFromFile::InitializeFromFile( char *in_name ){ |
| 30 |
> |
|
| 31 |
> |
std::cerr << "Hello from Initialize from file.\n"; |
| 32 |
> |
|
| 33 |
|
#ifdef IS_MPI |
| 34 |
|
if (worldRank == 0) { |
| 35 |
|
#endif |
| 51 |
|
return; |
| 52 |
|
} |
| 53 |
|
|
| 54 |
< |
InitializeFromFile :: ~InitializeFromFile( ){ |
| 54 |
> |
InitializeFromFile::~InitializeFromFile( ){ |
| 55 |
|
#ifdef IS_MPI |
| 56 |
|
if (worldRank == 0) { |
| 57 |
|
#endif |
| 326 |
|
|
| 327 |
|
char *foo; // the pointer to the current string token |
| 328 |
|
|
| 329 |
< |
double rx, ry, rz; // position place holders |
| 330 |
< |
double vx, vy, vz; // velocity placeholders |
| 329 |
> |
double pos[3]; // position place holders |
| 330 |
> |
double vel[3]; // velocity placeholders |
| 331 |
|
double q[4]; // the quaternions |
| 332 |
|
double jx, jy, jz; // angular velocity placeholders; |
| 333 |
|
double qSqr, qLength; // needed to normalize the quaternion vector. |
| 380 |
|
c_in_name, n_atoms, atomIndex ); |
| 381 |
|
return strdup( painCave.errMsg ); |
| 382 |
|
} |
| 383 |
< |
rx = atof( foo ); |
| 383 |
> |
pos[0] = atof( foo ); |
| 384 |
|
|
| 385 |
|
foo = strtok(NULL, " ,;\t"); |
| 386 |
|
if(foo == NULL){ |
| 390 |
|
c_in_name, n_atoms, atomIndex ); |
| 391 |
|
return strdup( painCave.errMsg ); |
| 392 |
|
} |
| 393 |
< |
ry = atof( foo ); |
| 393 |
> |
pos[1] = atof( foo ); |
| 394 |
|
|
| 395 |
|
foo = strtok(NULL, " ,;\t"); |
| 396 |
|
if(foo == NULL){ |
| 400 |
|
c_in_name, n_atoms, atomIndex ); |
| 401 |
|
return strdup( painCave.errMsg ); |
| 402 |
|
} |
| 403 |
< |
rz = atof( foo ); |
| 403 |
> |
pos[2] = atof( foo ); |
| 404 |
|
|
| 405 |
|
|
| 406 |
|
// get the velocities |
| 413 |
|
c_in_name, n_atoms, atomIndex ); |
| 414 |
|
return strdup( painCave.errMsg ); |
| 415 |
|
} |
| 416 |
< |
vx = atof( foo ); |
| 416 |
> |
vel[0] = atof( foo ); |
| 417 |
|
|
| 418 |
|
foo = strtok(NULL, " ,;\t"); |
| 419 |
|
if(foo == NULL){ |
| 423 |
|
c_in_name, n_atoms, atomIndex ); |
| 424 |
|
return strdup( painCave.errMsg ); |
| 425 |
|
} |
| 426 |
< |
vy = atof( foo ); |
| 426 |
> |
vel[1] = atof( foo ); |
| 427 |
|
|
| 428 |
|
foo = strtok(NULL, " ,;\t"); |
| 429 |
|
if(foo == NULL){ |
| 433 |
|
c_in_name, n_atoms, atomIndex ); |
| 434 |
|
return strdup( painCave.errMsg ); |
| 435 |
|
} |
| 436 |
< |
vz = atof( foo ); |
| 436 |
> |
vel[2] = atof( foo ); |
| 437 |
|
|
| 438 |
|
|
| 439 |
|
// get the quaternions |
| 535 |
|
|
| 536 |
|
// add the positions and velocities to the atom |
| 537 |
|
|
| 538 |
< |
atoms[atomIndex]->setX( rx ); |
| 539 |
< |
atoms[atomIndex]->setY( ry ); |
| 537 |
< |
atoms[atomIndex]->setZ( rz ); |
| 538 |
< |
|
| 539 |
< |
atoms[atomIndex]->set_vx( vx ); |
| 540 |
< |
atoms[atomIndex]->set_vy( vy ); |
| 541 |
< |
atoms[atomIndex]->set_vz( vz ); |
| 538 |
> |
atoms[atomIndex]->setPos( pos ); |
| 539 |
> |
atoms[atomIndex]->setVel( vel ); |
| 540 |
|
|
| 541 |
|
return NULL; |
| 542 |
|
} |