| 305 |  | MPI_Type_commit(&mpiDirectionalStructType); | 
| 306 |  |  | 
| 307 |  | // *********************************************************************** | 
| 308 | < |  | 
| 308 | > |  | 
| 309 |  | if( worldRank == 0 ){ | 
| 310 |  | #endif | 
| 311 |  |  | 
| 399 |  | void WATER::readParams( void ){ | 
| 400 |  |  | 
| 401 |  | int identNum; | 
| 402 | + | int tempDirect0, tempDirect1; | 
| 403 |  |  | 
| 404 |  | atomStruct atomInfo; | 
| 405 |  | directionalStruct directionalInfo; | 
| 410 |  |  | 
| 411 |  | atomPos = new fpos_t; | 
| 412 |  | bigSigma = 0.0; | 
| 413 | < |  | 
| 413 | > |  | 
| 414 |  | #ifdef IS_MPI | 
| 415 |  | if( worldRank == 0 ){ | 
| 416 |  | #endif | 
| 421 |  | headDirectionalType = new LinkedDirectionalType; | 
| 422 |  |  | 
| 423 |  | fastForward( "AtomTypes", "initializeAtoms" ); | 
| 424 | < |  | 
| 424 | > |  | 
| 425 |  | // we are now at the AtomTypes section. | 
| 426 |  |  | 
| 427 |  | eof_test = fgets( readLine, sizeof(readLine), frcFile ); | 
| 429 |  |  | 
| 430 |  |  | 
| 431 |  | // read a line, and start parsing out the atom types | 
| 432 | < |  | 
| 432 | > |  | 
| 433 |  | if( eof_test == NULL ){ | 
| 434 |  | sprintf( painCave.errMsg, | 
| 435 |  | "Error in reading Atoms from force file at line %d.\n", | 
| 470 |  | } | 
| 471 |  |  | 
| 472 |  | #ifdef IS_MPI | 
| 473 | < |  | 
| 473 | > |  | 
| 474 |  | // send out the linked list to all the other processes | 
| 475 |  |  | 
| 476 |  | sprintf( checkPointMsg, | 
| 477 | < | "WATER atom structures read successfully." ); | 
| 477 | > | "WATER atom and directional structures read successfully." ); | 
| 478 |  | MPIcheckPoint(); | 
| 479 | < | currentAtomType = headAtomType->next; //skip the first element who is a place holder. | 
| 479 | > | currentAtomType = headAtomType->next; //skip the first element place holder | 
| 480 | > | currentDirectionalType = headDirectionalType->next; // same w/ directional | 
| 481 | > |  | 
| 482 |  | while( currentAtomType != NULL ){ | 
| 483 |  | currentAtomType->duplicate( atomInfo ); | 
| 484 | < |  | 
| 484 | > |  | 
| 485 |  | sendFrcStruct( &atomInfo, mpiAtomStructType ); | 
| 486 |  |  | 
| 487 |  | sprintf( checkPointMsg, | 
| 488 |  | "successfully sent WATER force type: \"%s\"\n", | 
| 489 |  | atomInfo.name ); | 
| 487 | – | MPIcheckPoint(); | 
| 490 |  |  | 
| 491 | + | if ( atomInfo.isDirectional ){ | 
| 492 | + | // send out the directional linked list to all the other processes | 
| 493 | + |  | 
| 494 | + | currentDirectionalType->duplicate( directionalInfo ); | 
| 495 | + | sendFrcStruct( &directionalInfo, mpiDirectionalStructType ); | 
| 496 | + |  | 
| 497 | + | sprintf( checkPointMsg, | 
| 498 | + | "successfully sent WATER directional type: \"%s\"\n", | 
| 499 | + | directionalInfo.name ); | 
| 500 | + | } | 
| 501 | + |  | 
| 502 | + | MPIcheckPoint(); | 
| 503 | + | tempDirect0 = atomInfo.isDirectional; | 
| 504 |  | currentAtomType = currentAtomType->next; | 
| 505 | + | if( tempDirect0 ) | 
| 506 | + | currentDirectionalType = currentDirectionalType->next; | 
| 507 |  | } | 
| 508 | < |  | 
| 508 | > |  | 
| 509 |  | atomInfo.last = 1; | 
| 510 |  | sendFrcStruct( &atomInfo, mpiAtomStructType ); | 
| 511 | < |  | 
| 512 | < | if ( atomInfo.isDirectional ){ | 
| 496 | < | // send out the linked list to all the other processes | 
| 497 | < |  | 
| 498 | < | sprintf( checkPointMsg, | 
| 499 | < | "WATER directional structures read successfully." ); | 
| 500 | < | MPIcheckPoint(); | 
| 501 | < |  | 
| 502 | < | currentDirectionalType = headDirectionalType->next; | 
| 503 | < | while( currentDirectionalType != NULL ){ | 
| 504 | < | currentDirectionalType->duplicate( directionalInfo ); | 
| 505 | < | sendFrcStruct( &directionalInfo, mpiDirectionalStructType ); | 
| 506 | < | currentDirectionalType = currentDirectionalType->next; | 
| 507 | < | } | 
| 508 | < | directionalInfo.last = 1; | 
| 511 | > | directionalInfo.last = 1; | 
| 512 | > | if ( atomInfo.isDirectional ) | 
| 513 |  | sendFrcStruct( &directionalInfo, mpiDirectionalStructType ); | 
| 510 | – | } | 
| 514 |  | } | 
| 515 | < |  | 
| 515 | > |  | 
| 516 |  | else{ | 
| 514 | – |  | 
| 517 |  | // listen for node 0 to send out the force params | 
| 518 |  |  | 
| 519 |  | MPIcheckPoint(); | 
| 520 |  |  | 
| 521 |  | headAtomType = new LinkedAtomType; | 
| 522 | < | receiveFrcStruct( &atomInfo, mpiAtomStructType ); | 
| 523 | < |  | 
| 522 | > | headDirectionalType = new LinkedDirectionalType; | 
| 523 | > | receiveFrcStruct( &atomInfo, mpiAtomStructType ); | 
| 524 | > |  | 
| 525 | > | if ( atomInfo.isDirectional ) | 
| 526 | > | receiveFrcStruct( &directionalInfo, mpiDirectionalStructType ); | 
| 527 | > |  | 
| 528 |  | while( !atomInfo.last ){ | 
| 529 | < |  | 
| 529 | > |  | 
| 530 |  | headAtomType->add( atomInfo ); | 
| 531 |  |  | 
| 532 |  | MPIcheckPoint(); | 
| 533 | < |  | 
| 533 | > |  | 
| 534 |  | receiveFrcStruct( &atomInfo, mpiAtomStructType ); | 
| 529 | – | } | 
| 535 |  |  | 
| 536 | < | if ( atomInfo.isDirectional ) { | 
| 532 | < | // listen for node 0 to send out the force params | 
| 533 | < |  | 
| 534 | < | MPIcheckPoint(); | 
| 535 | < |  | 
| 536 | < | headDirectionalType = new LinkedDirectionalType; | 
| 537 | < | receiveFrcStruct( &directionalInfo, mpiDirectionalStructType ); | 
| 538 | < | while( !directionalInfo.last ){ | 
| 539 | < |  | 
| 536 | > | if( atomInfo.isDirectional ){ | 
| 537 |  | headDirectionalType->add( directionalInfo ); | 
| 538 | + |  | 
| 539 |  | receiveFrcStruct( &directionalInfo, mpiDirectionalStructType ); | 
| 540 |  | } | 
| 543 | – |  | 
| 544 | – | sprintf( checkPointMsg, | 
| 545 | – | "WATER directional structures broadcast successfully." ); | 
| 546 | – | MPIcheckPoint(); | 
| 541 |  | } | 
| 542 |  | } | 
| 543 |  |  | 
| 630 |  |  | 
| 631 |  | #ifdef IS_MPI | 
| 632 |  | sprintf( checkPointMsg, | 
| 633 | < | "WATER atom structures successfully sent to fortran\n" ); | 
| 633 | > | "WATER atom and directional structures successfully" | 
| 634 | > | "sent to fortran\n" ); | 
| 635 |  | MPIcheckPoint(); | 
| 636 |  | #endif // is_mpi | 
| 637 |  |  | 
| 640 |  |  | 
| 641 |  | void WATER::initializeAtoms( int nAtoms, Atom** the_atoms ){ | 
| 642 |  |  | 
| 643 | < | int i,j; | 
| 643 | > | int i,j,k; | 
| 644 |  |  | 
| 645 |  | // initialize the atoms | 
| 646 |  | DirectionalAtom* dAtom; | 
| 647 |  | double inertialMat[3][3]; | 
| 648 |  |  | 
| 649 |  | for( i=0; i<nAtoms; i++ ){ | 
| 655 | – | fprintf(stderr, "flag 1\n"); | 
| 650 |  | currentAtomType = headAtomType->find( the_atoms[i]->getType() ); | 
| 657 | – | fprintf(stderr, "%s is the type\n", the_atoms[i]->getType()); | 
| 651 |  | if( currentAtomType == NULL ){ | 
| 652 |  | sprintf( painCave.errMsg, | 
| 653 |  | "AtomType error, %s not found in force file.\n", | 
| 655 |  | painCave.isFatal = 1; | 
| 656 |  | simError(); | 
| 657 |  | } | 
| 665 | – | fprintf(stderr, "flag 2\n"); | 
| 658 |  | if( currentAtomType->isLJ ) the_atoms[i]->setLJ(); | 
| 659 |  | if( currentAtomType->isCharge ) the_atoms[i]->setCharged(); | 
| 660 |  | the_atoms[i]->setMass( currentAtomType->mass ); | 
| 661 |  | the_atoms[i]->setIdent( currentAtomType->ident ); | 
| 662 | < | fprintf(stderr, "flag 3\n"); | 
| 662 | > |  | 
| 663 |  | if( bigSigma < currentAtomType->sigma ) bigSigma = currentAtomType->sigma; | 
| 664 |  |  | 
| 665 |  | if( currentAtomType->isDirectional ){ | 
| 674 | – | fprintf(stderr, "flag 4\n"); | 
| 666 |  | currentDirectionalType = | 
| 667 |  | headDirectionalType->find( the_atoms[i]->getType() ); | 
| 677 | – | fprintf(stderr, "%s is the type\n", the_atoms[i]->getType()); | 
| 668 |  | if( currentDirectionalType == NULL ){ | 
| 669 |  | sprintf( painCave.errMsg, | 
| 670 |  | "DirectionalType error, %s not found in force file.\n", | 
| 674 |  | } | 
| 675 |  |  | 
| 676 |  | // zero out the moments of inertia matrix | 
| 677 | < | for( i=0; i<3; i++ ) | 
| 678 | < | for( j=0; j<3; j++ ) | 
| 679 | < | inertialMat[i][j] = 0.0; | 
| 677 | > | for( j=0; j<3; j++ ) | 
| 678 | > | for( k=0; k<3; k++ ) | 
| 679 | > | inertialMat[j][k] = 0.0; | 
| 680 |  |  | 
| 681 |  | // load the force file moments of inertia | 
| 682 |  | inertialMat[0][0] = currentDirectionalType->Ixx; | 
| 683 |  | inertialMat[1][1] = currentDirectionalType->Iyy; | 
| 684 |  | inertialMat[2][2] = currentDirectionalType->Izz; | 
| 685 | < | fprintf(stderr, "Let's try pointing to isDirectional\n"); | 
| 696 | < | fprintf(stderr, "%i what is this\n",the_atoms[i]->isDirectional()); | 
| 685 | > |  | 
| 686 |  | dAtom = (DirectionalAtom *) the_atoms[i]; | 
| 698 | – | fprintf(stderr, "%i is isDipole\n", currentDirectionalType->isDipole); | 
| 687 |  | dAtom->setHasDipole( currentDirectionalType->isDipole ); | 
| 688 |  | dAtom->setMu( currentDirectionalType->dipole ); | 
| 701 | – | fprintf(stderr, "flag 5\n"); | 
| 689 |  | dAtom->setMu( currentDirectionalType->dipole ); | 
| 690 | < | fprintf(stderr,"flag 6\n"); | 
| 690 | > |  | 
| 691 |  | // if it's sticky then it's an SSD type | 
| 692 |  | dAtom->setSSD( currentDirectionalType->isSticky ); | 
| 693 |  | dAtom->setJx( 0.0 ); | 
| 694 |  | dAtom->setJy( 0.0 ); | 
| 695 |  | dAtom->setJz( 0.0 ); | 
| 696 |  | dAtom->setI( inertialMat ); | 
| 697 | < | fprintf(stderr, "flag 7\n"); | 
| 697 | > |  | 
| 698 |  | entry_plug->n_dipoles++; | 
| 712 | – | fprintf(stderr, "flag 8\n"); | 
| 699 |  | } | 
| 700 |  | else{ | 
| 701 |  | sprintf( painCave.errMsg, |