513 |
|
} |
514 |
|
} |
515 |
|
|
516 |
+ |
//fill globalGroupMembership |
517 |
|
std::vector<int> globalGroupMembership(info->getNGlobalAtoms(), 0); |
518 |
|
for(mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) { |
519 |
|
for (cg = mol->beginCutoffGroup(ci); cg != NULL; cg = mol->nextCutoffGroup(ci)) { |
524 |
|
|
525 |
|
} |
526 |
|
} |
527 |
< |
|
527 |
> |
|
528 |
> |
#ifdef IS_MPI |
529 |
|
// Since the globalGroupMembership has been zero filled and we've only |
530 |
|
// poked values into the atoms we know, we can do an Allreduce |
531 |
|
// to get the full globalGroupMembership array (We think). |
536 |
|
info->getGlobalGroupMembershipPointer(), |
537 |
|
info->getNGlobalAtoms(), |
538 |
|
MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
539 |
+ |
#else |
540 |
+ |
std::copy(globalGroupMembership.begin(), globalGroupMembership.end(), |
541 |
+ |
info->getGlobalGroupMembershipPointer()); |
542 |
+ |
#endif |
543 |
|
|
544 |
|
//fill molMembership |
545 |
|
std::vector<int> globalMolMembership(info->getNGlobalAtoms(), 0); |
550 |
|
globalMolMembership[atom->getGlobalIndex()] = mol->getGlobalIndex(); |
551 |
|
} |
552 |
|
|
553 |
+ |
#ifdef IS_MPI |
554 |
|
MPI_Allreduce(&globalMolMembership[0], |
555 |
|
info->getGlobalMolMembershipPointer(), |
556 |
|
info->getNGlobalAtoms(), |
557 |
|
MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
558 |
< |
|
559 |
< |
} |
560 |
< |
|
554 |
< |
|
555 |
< |
void SimCreator::initFortran(SimInfo* info) { |
556 |
< |
info->update(); |
557 |
< |
|
558 |
< |
std::vector<AtomType*> atomTypes; |
559 |
< |
std::vector<AtomType*>::iterator i; |
560 |
< |
std::vector<double> cutoffRadius; |
561 |
< |
ForceField* ff; |
562 |
< |
|
563 |
< |
//get the unique atom types |
564 |
< |
atomTypes = info->getUniqueAtomTypes(); |
565 |
< |
|
566 |
< |
ff = info->getForceField(); |
567 |
< |
|
568 |
< |
//query the max cutoff radius among these atom types |
569 |
< |
for (i = atomTypes.begin(); i != atomTypes.end(); ++i) { |
570 |
< |
cutoffRadius.push_back(ff->(*i)); |
571 |
< |
} |
572 |
< |
|
573 |
< |
double maxCutoffRadius = std::max_element(cutoffRadius.begin(), cutoffRadius.end()); |
574 |
< |
|
575 |
< |
#ifdef IS_MPI |
576 |
< |
//pick the max cutoff radius among the processors |
558 |
> |
#else |
559 |
> |
std::copy(globalMolMembership.begin(), globalMolMembership.end(), |
560 |
> |
info->getGlobalMolMembershipPointer()); |
561 |
|
#endif |
562 |
|
|
579 |
– |
|
580 |
– |
|
563 |
|
} |
564 |
|
|
565 |
|
void SimCreator::loadCoordinates(SimInfo* info) { |
579 |
|
if (nframes > 0) { |
580 |
|
reader.readFrame(info, nframes - 1); |
581 |
|
} else { |
582 |
< |
//invalid initial coordinate file |
582 |
> |
//invalid initial coordinate file |
583 |
|
sprintf(painCave.errMsg, "Initial configuration file %s should at least contain one frame\n", |
584 |
|
globals->getInitialConfig()); |
585 |
|
painCave.isFatal = 1; |