| 108 | 
  | 
      } else { | 
| 109 | 
  | 
        //get stream size | 
| 110 | 
  | 
        commStatus = MPI_Bcast(&streamSize, 1, MPI_LONG, masterNode, MPI_COMM_WORLD);    | 
| 111 | 
< | 
                 | 
| 111 | 
> | 
 | 
| 112 | 
  | 
        char* buf = new char[streamSize]; | 
| 113 | 
  | 
        assert(buf); | 
| 114 | 
  | 
                 | 
| 116 | 
  | 
        commStatus = MPI_Bcast(buf, streamSize, MPI_CHAR, masterNode, MPI_COMM_WORLD);  | 
| 117 | 
  | 
                 | 
| 118 | 
  | 
        ppStream.str(buf); | 
| 119 | 
< | 
        delete buf; | 
| 119 | 
> | 
        delete [] buf; | 
| 120 | 
  | 
 | 
| 121 | 
  | 
      } | 
| 122 | 
  | 
#endif             | 
| 722 | 
  | 
    // to get the full globalGroupMembership array (We think). | 
| 723 | 
  | 
    // This would be prettier if we could use MPI_IN_PLACE like the MPI-2 | 
| 724 | 
  | 
    // docs said we could. | 
| 725 | 
< | 
    std::vector<int> tmpGroupMembership(nGlobalAtoms, 0); | 
| 725 | 
> | 
    std::vector<int> tmpGroupMembership(info->getNGlobalAtoms(), 0); | 
| 726 | 
  | 
    MPI_Allreduce(&globalGroupMembership[0], &tmpGroupMembership[0], nGlobalAtoms, | 
| 727 | 
  | 
                  MPI_INT, MPI_SUM, MPI_COMM_WORLD); | 
| 728 | 
  | 
    info->setGlobalGroupMembership(tmpGroupMembership); | 
| 734 | 
  | 
    std::vector<int> globalMolMembership(info->getNGlobalAtoms(), 0); | 
| 735 | 
  | 
     | 
| 736 | 
  | 
    for(mol = info->beginMolecule(mi); mol != NULL; mol = info->nextMolecule(mi)) { | 
| 737 | 
– | 
       | 
| 737 | 
  | 
      for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) { | 
| 738 | 
  | 
        globalMolMembership[atom->getGlobalIndex()] = mol->getGlobalIndex(); | 
| 739 | 
  | 
      } | 
| 740 | 
  | 
    } | 
| 741 | 
  | 
     | 
| 742 | 
  | 
#ifdef IS_MPI | 
| 743 | 
< | 
    std::vector<int> tmpMolMembership(nGlobalAtoms, 0); | 
| 743 | 
> | 
    std::vector<int> tmpMolMembership(info->getNGlobalAtoms(), 0); | 
| 744 | 
  | 
     | 
| 745 | 
  | 
    MPI_Allreduce(&globalMolMembership[0], &tmpMolMembership[0], nGlobalAtoms, | 
| 746 | 
  | 
                  MPI_INT, MPI_SUM, MPI_COMM_WORLD); | 
| 766 | 
  | 
    std::vector<int> numIntegrableObjectsPerMol = nIOPerMol; | 
| 767 | 
  | 
#endif     | 
| 768 | 
  | 
 | 
| 769 | 
< | 
 std::vector<int> startingIOIndexForMol(info->getNGlobalMolecules()); | 
| 770 | 
< | 
 | 
| 771 | 
< | 
int startingIndex = 0; | 
| 772 | 
< | 
 for (int i = 0; i < info->getNGlobalMolecules(); i++) { | 
| 773 | 
< | 
  startingIOIndexForMol[i] = startingIndex; | 
| 774 | 
< | 
  startingIndex += numIntegrableObjectsPerMol[i]; | 
| 775 | 
< | 
 } | 
| 776 | 
< | 
 | 
| 777 | 
< | 
 std::vector<StuntDouble*> IOIndexToIntegrableObject(info->getNGlobalIntegrableObjects(), (StuntDouble*)NULL); | 
| 778 | 
< | 
 for (mol = info->beginMolecule(mi); mol != NULL; mol = info->nextMolecule(mi)) { | 
| 769 | 
> | 
    std::vector<int> startingIOIndexForMol(info->getNGlobalMolecules()); | 
| 770 | 
> | 
     | 
| 771 | 
> | 
    int startingIndex = 0; | 
| 772 | 
> | 
    for (int i = 0; i < info->getNGlobalMolecules(); i++) { | 
| 773 | 
> | 
      startingIOIndexForMol[i] = startingIndex; | 
| 774 | 
> | 
      startingIndex += numIntegrableObjectsPerMol[i]; | 
| 775 | 
> | 
    } | 
| 776 | 
> | 
     | 
| 777 | 
> | 
    std::vector<StuntDouble*> IOIndexToIntegrableObject(info->getNGlobalIntegrableObjects(), (StuntDouble*)NULL); | 
| 778 | 
> | 
    for (mol = info->beginMolecule(mi); mol != NULL; mol = info->nextMolecule(mi)) { | 
| 779 | 
  | 
      int myGlobalIndex = mol->getGlobalIndex(); | 
| 780 | 
  | 
      int globalIO = startingIOIndexForMol[myGlobalIndex]; | 
| 781 | 
  | 
      for (StuntDouble* integrableObject = mol->beginIntegrableObject(ioi); integrableObject != NULL; | 
| 782 | 
  | 
           integrableObject = mol->nextIntegrableObject(ioi)) { | 
| 783 | 
< | 
            integrableObject->setGlobalIntegrableObjectIndex(globalIO); | 
| 784 | 
< | 
            IOIndexToIntegrableObject[globalIO] = integrableObject; | 
| 785 | 
< | 
            globalIO++; | 
| 783 | 
> | 
        integrableObject->setGlobalIntegrableObjectIndex(globalIO); | 
| 784 | 
> | 
        IOIndexToIntegrableObject[globalIO] = integrableObject; | 
| 785 | 
> | 
        globalIO++; | 
| 786 | 
  | 
      } | 
| 787 | 
  | 
    } | 
| 788 | 
< | 
 | 
| 789 | 
< | 
  info->setIOIndexToIntegrableObject(IOIndexToIntegrableObject); | 
| 790 | 
< | 
   | 
| 788 | 
> | 
     | 
| 789 | 
> | 
    info->setIOIndexToIntegrableObject(IOIndexToIntegrableObject); | 
| 790 | 
> | 
     | 
| 791 | 
  | 
  } | 
| 792 | 
  | 
   | 
| 793 | 
  | 
  void SimCreator::loadCoordinates(SimInfo* info, const std::string& mdFileName) { |