# | Line 26 | Line 26 | using namespace initFile; | |
---|---|---|
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 | |
# | Line 48 | Line 49 | InitializeFromFile :: InitializeFromFile( char *in_nam | |
49 | return; | |
50 | } | |
51 | ||
52 | < | InitializeFromFile :: ~InitializeFromFile( ){ |
52 | > | InitializeFromFile::~InitializeFromFile( ){ |
53 | #ifdef IS_MPI | |
54 | if (worldRank == 0) { | |
55 | #endif | |
# | Line 83 | Line 84 | void InitializeFromFile :: readInit( SimInfo* the_simn | |
84 | char *eof_test; // ptr to see when we reach the end of the file | |
85 | char *parseErr; | |
86 | int procIndex; | |
87 | + | double currTime; |
88 | double boxMat[9]; | |
89 | double theBoxMat3[3][3]; | |
90 | ||
# | Line 123 | Line 125 | void InitializeFromFile :: readInit( SimInfo* the_simn | |
125 | simError(); | |
126 | } | |
127 | ||
128 | < | parseErr = parseBoxLine( read_buffer, boxMat ); |
128 | > | parseErr = parseBoxLine( read_buffer, boxMat, currTime ); |
129 | if( parseErr != NULL ){ | |
130 | strcpy( painCave.errMsg, parseErr ); | |
131 | painCave.isFatal = 1; | |
# | Line 134 | Line 136 | void InitializeFromFile :: readInit( SimInfo* the_simn | |
136 | for(j=0;j<3;j++) theBoxMat3[i][j] = boxMat[3*j+i]; | |
137 | ||
138 | simnfo->setBoxM( theBoxMat3 ); | |
139 | + | simnfo->setTime( currTime ); |
140 | ||
141 | ||
142 | for( i=0; i < n_atoms; i++){ | |
# | Line 210 | Line 213 | void InitializeFromFile :: readInit( SimInfo* the_simn | |
213 | simError(); | |
214 | } | |
215 | ||
216 | < | parseErr = parseBoxLine( read_buffer, boxMat ); |
216 | > | parseErr = parseBoxLine( read_buffer, boxMat, currTime ); |
217 | if( parseErr != NULL ){ | |
218 | strcpy( painCave.errMsg, parseErr ); | |
219 | haveError = 1; | |
# | Line 218 | Line 221 | void InitializeFromFile :: readInit( SimInfo* the_simn | |
221 | } | |
222 | ||
223 | MPI_Bcast(boxMat, 9, MPI_DOUBLE, 0, MPI_COMM_WORLD ); | |
224 | + | MPI_Bcast(&currTime, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD ); |
225 | ||
226 | if(haveError) nodeZeroError(); | |
227 | ||
# | Line 272 | Line 276 | void InitializeFromFile :: readInit( SimInfo* the_simn | |
276 | } else { | |
277 | ||
278 | MPI_Bcast(boxMat, 9, MPI_DOUBLE, 0, MPI_COMM_WORLD); | |
279 | + | MPI_Bcast(&currTime, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); |
280 | ||
281 | done = 0; | |
282 | while (!done) { | |
# | Line 309 | Line 314 | void InitializeFromFile :: readInit( SimInfo* the_simn | |
314 | for(j=0;j<3;j++) theBoxMat3[i][j] = boxMat[3*j+i]; | |
315 | ||
316 | simnfo->setBoxM( theBoxMat3 ); | |
317 | + | simnfo->setTime( currTime ); |
318 | ||
319 | ||
320 | #endif | |
# | Line 318 | Line 324 | char* InitializeFromFile::parseDumpLine(char* readLine | |
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. | |
# | Line 372 | Line 378 | char* InitializeFromFile::parseDumpLine(char* readLine | |
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){ | |
# | Line 382 | Line 388 | char* InitializeFromFile::parseDumpLine(char* readLine | |
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){ | |
# | Line 392 | Line 398 | char* InitializeFromFile::parseDumpLine(char* readLine | |
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 | |
# | Line 405 | Line 411 | char* InitializeFromFile::parseDumpLine(char* readLine | |
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){ | |
# | Line 415 | Line 421 | char* InitializeFromFile::parseDumpLine(char* readLine | |
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){ | |
# | Line 425 | Line 431 | char* InitializeFromFile::parseDumpLine(char* readLine | |
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 | |
# | Line 527 | Line 533 | char* InitializeFromFile::parseDumpLine(char* readLine | |
533 | ||
534 | // add the positions and velocities to the atom | |
535 | ||
536 | < | atoms[atomIndex]->setX( rx ); |
537 | < | atoms[atomIndex]->setY( ry ); |
532 | < | atoms[atomIndex]->setZ( rz ); |
533 | < | |
534 | < | atoms[atomIndex]->set_vx( vx ); |
535 | < | atoms[atomIndex]->set_vy( vy ); |
536 | < | atoms[atomIndex]->set_vz( vz ); |
536 | > | atoms[atomIndex]->setPos( pos ); |
537 | > | atoms[atomIndex]->setVel( vel ); |
538 | ||
539 | return NULL; | |
540 | } | |
541 | ||
542 | ||
543 | < | char* InitializeFromFile::parseBoxLine(char* readLine, double boxMat[9]){ |
543 | > | char* InitializeFromFile::parseBoxLine(char* readLine, double boxMat[9], |
544 | > | double &time ){ |
545 | ||
546 | char *foo; // the pointer to the current string token | |
547 | int j; | |
# | Line 555 | Line 557 | char* InitializeFromFile::parseBoxLine(char* readLine, | |
557 | c_in_name ); | |
558 | return strdup( painCave.errMsg ); | |
559 | } | |
560 | < | simnfo->setTime( atof( foo ) ); |
560 | > | time = atof( foo ); |
561 | ||
562 | // get the Hx vector | |
563 |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |