545 |
|
nTarget = (int)(precast + 0.5); |
546 |
|
|
547 |
|
for(i = 0; i < nGlobalMols; i++) { |
548 |
+ |
|
549 |
|
done = 0; |
550 |
|
loops = 0; |
551 |
|
|
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; |
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); |
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 |
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); |
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 |
|
|
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; |