| 122 | 
  | 
   | 
| 123 | 
  | 
   | 
| 124 | 
  | 
  void RestReader :: readIdealCrystal(){ | 
| 125 | 
< | 
     | 
| 125 | 
> | 
         | 
| 126 | 
  | 
    int i; | 
| 127 | 
  | 
    unsigned int j; | 
| 128 | 
< | 
     | 
| 128 | 
> | 
 | 
| 129 | 
  | 
#ifdef IS_MPI | 
| 130 | 
  | 
    int done, which_node, which_atom; // loop counter | 
| 131 | 
  | 
#endif //is_mpi | 
| 260 | 
  | 
        simError(); | 
| 261 | 
  | 
      } | 
| 262 | 
  | 
 | 
| 263 | 
+ | 
      MPI_Bcast(read_buffer, BUFFERSIZE, MPI_CHAR, masterNode, MPI_COMM_WORLD); | 
| 264 | 
+ | 
 | 
| 265 | 
  | 
      for (i=0 ; i < info_->getNGlobalMolecules(); i++) { | 
| 266 | 
  | 
        int which_node = info_->getMolToProc(i); | 
| 267 | 
  | 
         | 
| 297 | 
  | 
            parseIdealLine(read_buffer, integrableObject); | 
| 298 | 
  | 
         | 
| 299 | 
  | 
          } | 
| 300 | 
+ | 
 | 
| 301 | 
  | 
        } else { | 
| 302 | 
  | 
          //molecule belongs to slave nodes | 
| 303 | 
  | 
           | 
| 304 | 
  | 
          MPI_Recv(&nCurObj, 1, MPI_INT, which_node, | 
| 305 | 
  | 
                   TAKE_THIS_TAG_INT, MPI_COMM_WORLD, &istatus); | 
| 306 | 
  | 
           | 
| 307 | 
< | 
          for(j=0; j < nCurObj; j++){ | 
| 307 | 
> | 
          for(j = 0; j < nCurObj; j++){ | 
| 308 | 
  | 
             | 
| 309 | 
  | 
            eof_test = fgets(read_buffer, sizeof(read_buffer), inIdealFile); | 
| 310 | 
  | 
            if(eof_test == NULL){ | 
| 323 | 
  | 
        } | 
| 324 | 
  | 
      } | 
| 325 | 
  | 
    } else { | 
| 326 | 
< | 
      //actions taken at slave nodes | 
| 326 | 
> | 
      //actions taken at slave nodes  | 
| 327 | 
> | 
      MPI_Bcast(read_buffer, BUFFERSIZE, MPI_CHAR, masterNode, MPI_COMM_WORLD); | 
| 328 | 
> | 
 | 
| 329 | 
  | 
      for (i=0 ; i < info_->getNGlobalMolecules(); i++) { | 
| 330 | 
< | 
        int which_node = info_->getMolToProc(i); | 
| 331 | 
< | 
         | 
| 330 | 
> | 
        int which_node = info_->getMolToProc(i);  | 
| 331 | 
> | 
 | 
| 332 | 
  | 
        if(which_node == worldRank){ | 
| 333 | 
  | 
          //molecule with global index i belongs to this processor | 
| 334 | 
  | 
           | 
| 369 | 
  | 
   | 
| 370 | 
  | 
  char* RestReader::parseIdealLine(char* readLine, StuntDouble* sd){ | 
| 371 | 
  | 
     | 
| 367 | 
– | 
    char *foo; // the pointer to the current string token | 
| 368 | 
– | 
     | 
| 372 | 
  | 
    RealType pos[3];        // position place holders | 
| 373 | 
  | 
    RealType q[4];          // the quaternions | 
| 374 | 
  | 
    RealType RfromQ[3][3];  // the rotation matrix  | 
| 600 | 
  | 
    int masterNode = 0; | 
| 601 | 
  | 
    int myStatus; // 1 = wakeup & success; 0 = error; -1 = AllDone | 
| 602 | 
  | 
    int haveError; | 
| 603 | 
< | 
    int index;     | 
| 603 | 
> | 
    int intObjIndex;     | 
| 604 | 
> | 
    int intObjIndexTransfer;     | 
| 605 | 
  | 
 | 
| 606 | 
  | 
    int nCurObj; | 
| 607 | 
  | 
    RealType angleTranfer; | 
| 627 | 
  | 
          tempZangs.push_back( atof(read_buffer) ); | 
| 628 | 
  | 
        eof_test = fgets(read_buffer, sizeof(read_buffer), inAngFile); | 
| 629 | 
  | 
      } | 
| 630 | 
< | 
       | 
| 630 | 
> | 
 | 
| 631 | 
  | 
      // Check to see that the number of integrable objects in the | 
| 632 | 
  | 
      // intial configuration file is the same as derived from the | 
| 633 | 
  | 
      // meta-data file. | 
| 642 | 
  | 
       | 
| 643 | 
  | 
      // At this point, node 0 has a tempZangs vector completed, and  | 
| 644 | 
  | 
      // everyone else has nada | 
| 641 | 
– | 
      index = 0; | 
| 645 | 
  | 
       | 
| 646 | 
  | 
      for (i=0 ; i < info_->getNGlobalMolecules(); i++) { | 
| 647 | 
  | 
        // Get the Node number which has this atom | 
| 648 | 
  | 
        which_node = info_->getMolToProc(i); | 
| 649 | 
  | 
         | 
| 650 | 
< | 
        if (worldRank == masterNode) { | 
| 650 | 
> | 
        if (which_node == masterNode) { | 
| 651 | 
  | 
          mol = info_->getMoleculeByGlobalIndex(i); | 
| 652 | 
< | 
           | 
| 652 | 
> | 
 | 
| 653 | 
  | 
          if(mol == NULL) { | 
| 654 | 
  | 
            strcpy(painCave.errMsg, "Molecule not found on node 0!"); | 
| 655 | 
  | 
            haveError = 1; | 
| 656 | 
  | 
            simError(); | 
| 657 | 
  | 
          } | 
| 658 | 
< | 
           | 
| 658 | 
> | 
 | 
| 659 | 
  | 
          for (integrableObject = mol->beginIntegrableObject(ii);  | 
| 660 | 
  | 
               integrableObject != NULL;  | 
| 661 | 
  | 
               integrableObject = mol->nextIntegrableObject(ii)){ | 
| 662 | 
< | 
             | 
| 663 | 
< | 
            integrableObject->setZangle(tempZangs[index]); | 
| 661 | 
< | 
            index++; | 
| 662 | 
> | 
            intObjIndex = integrableObject->getGlobalIndex(); | 
| 663 | 
> | 
            integrableObject->setZangle(tempZangs[intObjIndex]); | 
| 664 | 
  | 
          }      | 
| 665 | 
  | 
           | 
| 666 | 
  | 
        } else { | 
| 667 | 
  | 
          // I am MASTER OF THE UNIVERSE, but I don't own this molecule | 
| 668 | 
< | 
           | 
| 668 | 
> | 
          // listen for the number of integrableObjects in the molecule | 
| 669 | 
  | 
          MPI_Recv(&nCurObj, 1, MPI_INT, which_node, | 
| 670 | 
  | 
                   TAKE_THIS_TAG_INT, MPI_COMM_WORLD, &istatus); | 
| 671 | 
  | 
           | 
| 672 | 
< | 
          for(j=0; j < nCurObj; j++){             | 
| 673 | 
< | 
            angleTransfer = tempZangs[index]; | 
| 672 | 
> | 
          for(j=0; j < nCurObj; j++){            | 
| 673 | 
> | 
            // listen for which integrableObject we need to send the value for | 
| 674 | 
> | 
            MPI_Recv(&intObjIndexTransfer, 1, MPI_INT, which_node, | 
| 675 | 
> | 
                   TAKE_THIS_TAG_INT, MPI_COMM_WORLD, &istatus);  | 
| 676 | 
> | 
            angleTransfer = tempZangs[intObjIndexTransfer]; | 
| 677 | 
> | 
            // send the value to the node so it can initialize the object | 
| 678 | 
  | 
            MPI_Send(&angleTransfer, 1, MPI_REALTYPE, which_node,  | 
| 679 | 
  | 
                     TAKE_THIS_TAG_DOUBLE, MPI_COMM_WORLD);                | 
| 674 | 
– | 
            index++; | 
| 680 | 
  | 
          } | 
| 676 | 
– | 
           | 
| 681 | 
  | 
        } | 
| 682 | 
  | 
      } | 
| 683 | 
  | 
    } else { | 
| 700 | 
  | 
          } | 
| 701 | 
  | 
 | 
| 702 | 
  | 
          nCurObj = mol->getNIntegrableObjects(); | 
| 703 | 
< | 
         | 
| 703 | 
> | 
          // send the number of integrableObjects in the molecule | 
| 704 | 
  | 
          MPI_Send(&nCurObj, 1, MPI_INT, 0, | 
| 705 | 
  | 
                   TAKE_THIS_TAG_INT, MPI_COMM_WORLD); | 
| 706 | 
  | 
           | 
| 707 | 
  | 
          for (integrableObject = mol->beginIntegrableObject(ii);  | 
| 708 | 
  | 
               integrableObject != NULL;  | 
| 709 | 
  | 
               integrableObject = mol->nextIntegrableObject(ii)){ | 
| 710 | 
< | 
             | 
| 710 | 
> | 
            intObjIndexTransfer = integrableObject->getGlobalIndex(); | 
| 711 | 
> | 
            // send the global index of the integrableObject | 
| 712 | 
> | 
            MPI_Send(&intObjIndexTransfer, 1, MPI_INT, 0, | 
| 713 | 
> | 
                     TAKE_THIS_TAG_INT, MPI_COMM_WORLD); | 
| 714 | 
> | 
            // listen for the value we want to set locally | 
| 715 | 
  | 
            MPI_Recv(&angleTransfer, 1, MPI_REALTYPE, 0, | 
| 716 | 
  | 
                     TAKE_THIS_TAG_DOUBLE, MPI_COMM_WORLD, &istatus); | 
| 717 | 
  | 
 |