26 |
|
|
27 |
|
#endif // is_mpi |
28 |
|
|
29 |
< |
InitializeFromFile :: InitializeFromFile( char *in_name ){ |
29 |
> |
InitializeFromFile::InitializeFromFile( char *in_name ){ |
30 |
> |
|
31 |
|
#ifdef IS_MPI |
32 |
|
if (worldRank == 0) { |
33 |
|
#endif |
49 |
|
return; |
50 |
|
} |
51 |
|
|
52 |
< |
InitializeFromFile :: ~InitializeFromFile( ){ |
52 |
> |
InitializeFromFile::~InitializeFromFile( ){ |
53 |
|
#ifdef IS_MPI |
54 |
|
if (worldRank == 0) { |
55 |
|
#endif |
324 |
|
|
325 |
|
char *foo; // the pointer to the current string token |
326 |
|
|
327 |
< |
double rx, ry, rz; // position place holders |
328 |
< |
double vx, vy, vz; // velocity placeholders |
327 |
> |
double pos[3]; // position place holders |
328 |
> |
double vel[3]; // velocity placeholders |
329 |
|
double q[4]; // the quaternions |
330 |
|
double jx, jy, jz; // angular velocity placeholders; |
331 |
|
double qSqr, qLength; // needed to normalize the quaternion vector. |
378 |
|
c_in_name, n_atoms, atomIndex ); |
379 |
|
return strdup( painCave.errMsg ); |
380 |
|
} |
381 |
< |
rx = atof( foo ); |
381 |
> |
pos[0] = atof( foo ); |
382 |
|
|
383 |
|
foo = strtok(NULL, " ,;\t"); |
384 |
|
if(foo == NULL){ |
388 |
|
c_in_name, n_atoms, atomIndex ); |
389 |
|
return strdup( painCave.errMsg ); |
390 |
|
} |
391 |
< |
ry = atof( foo ); |
391 |
> |
pos[1] = atof( foo ); |
392 |
|
|
393 |
|
foo = strtok(NULL, " ,;\t"); |
394 |
|
if(foo == NULL){ |
398 |
|
c_in_name, n_atoms, atomIndex ); |
399 |
|
return strdup( painCave.errMsg ); |
400 |
|
} |
401 |
< |
rz = atof( foo ); |
401 |
> |
pos[2] = atof( foo ); |
402 |
|
|
403 |
|
|
404 |
|
// get the velocities |
411 |
|
c_in_name, n_atoms, atomIndex ); |
412 |
|
return strdup( painCave.errMsg ); |
413 |
|
} |
414 |
< |
vx = atof( foo ); |
414 |
> |
vel[0] = atof( foo ); |
415 |
|
|
416 |
|
foo = strtok(NULL, " ,;\t"); |
417 |
|
if(foo == NULL){ |
421 |
|
c_in_name, n_atoms, atomIndex ); |
422 |
|
return strdup( painCave.errMsg ); |
423 |
|
} |
424 |
< |
vy = atof( foo ); |
424 |
> |
vel[1] = atof( foo ); |
425 |
|
|
426 |
|
foo = strtok(NULL, " ,;\t"); |
427 |
|
if(foo == NULL){ |
431 |
|
c_in_name, n_atoms, atomIndex ); |
432 |
|
return strdup( painCave.errMsg ); |
433 |
|
} |
434 |
< |
vz = atof( foo ); |
434 |
> |
vel[2] = atof( foo ); |
435 |
|
|
436 |
|
|
437 |
|
// get the quaternions |
533 |
|
|
534 |
|
// add the positions and velocities to the atom |
535 |
|
|
536 |
< |
atoms[atomIndex]->setX( rx ); |
537 |
< |
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 ); |
536 |
> |
atoms[atomIndex]->setPos( pos ); |
537 |
> |
atoms[atomIndex]->setVel( vel ); |
538 |
|
|
539 |
|
return NULL; |
540 |
|
} |