ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/brains/SimCreator.cpp
(Generate patch)

Comparing branches/development/src/brains/SimCreator.cpp (file contents):
Revision 1802 by gezelter, Thu Sep 13 14:10:11 2012 UTC vs.
Revision 1803 by gezelter, Wed Oct 3 14:20:07 2012 UTC

# Line 545 | Line 545 | namespace OpenMD {
545        nTarget = (int)(precast + 0.5);
546        
547        for(i = 0; i < nGlobalMols; i++) {
548 +
549          done = 0;
550          loops = 0;
551          
# Line 569 | Line 570 | namespace OpenMD {
570            // and be done with it.
571            
572            if (loops > 100) {
573 +
574              sprintf(painCave.errMsg,
575 <                    "I've tried 100 times to assign molecule %d to a "
576 <                    " processor, but can't find a good spot.\n"
577 <                    "I'm assigning it at random to processor %d.\n",
575 >                    "There have been 100 attempts to assign molecule %d to an\n"
576 >                    "\tunderworked processor, but there's no good place to\n"
577 >                    "\tleave it.  OpenMD is assigning it at random to processor %d.\n",
578                      i, which_proc);
579 <            
579 >          
580              painCave.isFatal = 0;
581 +            painCave.severity = OPENMD_INFO;
582              simError();
583              
584              molToProcMap[i] = which_proc;
# Line 620 | Line 623 | namespace OpenMD {
623        }
624        
625        delete myRandom;
626 <      
626 >
627        // Spray out this nonsense to all other processors:
628        MPI::COMM_WORLD.Bcast(&molToProcMap[0], nGlobalMols, MPI::INT, 0);
629      } else {
630        
631        // Listen to your marching orders from processor 0:
632        MPI::COMM_WORLD.Bcast(&molToProcMap[0], nGlobalMols, MPI::INT, 0);
633 +
634      }
635      
636      info->setMolToProcMap(molToProcMap);
# Line 792 | Line 796 | namespace OpenMD {
796      int beginRigidBodyIndex;
797      int beginCutoffGroupIndex;
798      int nGlobalAtoms = info->getNGlobalAtoms();
799 +    int nGlobalRigidBodies = info->getNGlobalRigidBodies();
800      
801      beginAtomIndex = 0;
802      //rigidbody's index begins right after atom's
# Line 867 | Line 872 | namespace OpenMD {
872   #endif
873      
874      //fill molMembership
875 <    std::vector<int> globalMolMembership(info->getNGlobalAtoms(), 0);
875 >    std::vector<int> globalMolMembership(info->getNGlobalAtoms() +
876 >                                         info->getNGlobalRigidBodies(), 0);
877      
878 <    for(mol = info->beginMolecule(mi); mol != NULL; mol = info->nextMolecule(mi)) {
878 >    for(mol = info->beginMolecule(mi); mol != NULL;
879 >        mol = info->nextMolecule(mi)) {
880        for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) {
881          globalMolMembership[atom->getGlobalIndex()] = mol->getGlobalIndex();
882        }
883 +      for (rb = mol->beginRigidBody(ri); rb != NULL;
884 +           rb = mol->nextRigidBody(ri)) {
885 +        globalMolMembership[rb->getGlobalIndex()] = mol->getGlobalIndex();
886 +      }
887      }
888      
889   #ifdef IS_MPI
890 <    std::vector<int> tmpMolMembership(info->getNGlobalAtoms(), 0);
890 >    std::vector<int> tmpMolMembership(info->getNGlobalAtoms() +
891 >                                      info->getNGlobalRigidBodies(), 0);
892      MPI::COMM_WORLD.Allreduce(&globalMolMembership[0], &tmpMolMembership[0],
893 <                              nGlobalAtoms,
893 >                              nGlobalAtoms + nGlobalRigidBodies,
894                                MPI::INT, MPI::SUM);
895      
896      info->setGlobalMolMembership(tmpMolMembership);
# Line 890 | Line 902 | namespace OpenMD {
902      // here the molecules are listed by their global indices.
903  
904      std::vector<int> nIOPerMol(info->getNGlobalMolecules(), 0);
905 <    for (mol = info->beginMolecule(mi); mol != NULL; mol = info->nextMolecule(mi)) {
905 >    for (mol = info->beginMolecule(mi); mol != NULL;
906 >         mol = info->nextMolecule(mi)) {
907        nIOPerMol[mol->getGlobalIndex()] = mol->getNIntegrableObjects();      
908      }
909      
# Line 911 | Line 924 | namespace OpenMD {
924      }
925      
926      std::vector<StuntDouble*> IOIndexToIntegrableObject(info->getNGlobalIntegrableObjects(), (StuntDouble*)NULL);
927 <    for (mol = info->beginMolecule(mi); mol != NULL; mol = info->nextMolecule(mi)) {
927 >    for (mol = info->beginMolecule(mi); mol != NULL;
928 >         mol = info->nextMolecule(mi)) {
929        int myGlobalIndex = mol->getGlobalIndex();
930        int globalIO = startingIOIndexForMol[myGlobalIndex];
931        for (StuntDouble* sd = mol->beginIntegrableObject(ioi); sd != NULL;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines