234 |
|
|
235 |
|
SimInfo* SimCreator::createSim(const std::string & mdFileName, |
236 |
|
bool loadInitCoords) { |
237 |
< |
|
237 |
> |
|
238 |
|
const int bufferSize = 65535; |
239 |
|
char buffer[bufferSize]; |
240 |
|
int lineNo = 0; |
369 |
|
} |
370 |
|
|
371 |
|
ff->parse(forcefieldFileName); |
372 |
– |
ff->setFortranForceOptions(); |
372 |
|
//create SimInfo |
373 |
|
SimInfo * info = new SimInfo(ff, simParams); |
374 |
|
|
386 |
|
//create the molecules |
387 |
|
createMolecules(info); |
388 |
|
|
390 |
– |
|
389 |
|
//allocate memory for DataStorage(circular reference, need to |
390 |
|
//break it) |
391 |
|
info->setSnapshotManager(new SimSnapshotManager(info)); |
411 |
|
|
412 |
|
if (loadInitCoords) |
413 |
|
loadCoordinates(info, mdFileName); |
416 |
– |
|
414 |
|
return info; |
415 |
|
} |
416 |
|
|
589 |
|
MPI_Bcast(&molToProcMap[0], nGlobalMols, MPI_INT, 0, MPI_COMM_WORLD); |
590 |
|
} |
591 |
|
|
592 |
+ |
cerr << "molToProcMap:\n"; |
593 |
+ |
for (int i = 0; i < molToProcMap.size(); i++) { |
594 |
+ |
cerr << "m = " << i << " mtpr[m] = " << molToProcMap[i] <<"\n"; |
595 |
+ |
} |
596 |
+ |
|
597 |
|
info->setMolToProcMap(molToProcMap); |
598 |
|
sprintf(checkPointMsg, |
599 |
|
"Successfully divided the molecules among the processors.\n"); |
713 |
|
} |
714 |
|
|
715 |
|
//fill globalGroupMembership |
716 |
< |
std::vector<int> globalGroupMembership(info->getNGlobalAtoms(), 0); |
716 |
> |
std::vector<int> globalGroupMembership(info->getNGlobalAtoms(), -1); |
717 |
|
for(mol = info->beginMolecule(mi); mol != NULL; mol = info->nextMolecule(mi)) { |
718 |
|
for (cg = mol->beginCutoffGroup(ci); cg != NULL; cg = mol->nextCutoffGroup(ci)) { |
719 |
|
|
723 |
|
|
724 |
|
} |
725 |
|
} |
726 |
< |
|
726 |
> |
|
727 |
|
#ifdef IS_MPI |
728 |
|
// Since the globalGroupMembership has been zero filled and we've only |
729 |
|
// poked values into the atoms we know, we can do an Allreduce |
732 |
|
// docs said we could. |
733 |
|
std::vector<int> tmpGroupMembership(info->getNGlobalAtoms(), 0); |
734 |
|
MPI_Allreduce(&globalGroupMembership[0], &tmpGroupMembership[0], nGlobalAtoms, |
735 |
< |
MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
735 |
> |
MPI_INT, MPI_MAX, MPI_COMM_WORLD); |
736 |
|
info->setGlobalGroupMembership(tmpGroupMembership); |
737 |
+ |
|
738 |
+ |
cerr << "ggm:\n"; |
739 |
+ |
for (int i = 0; i < tmpGroupMembership.size(); i++) |
740 |
+ |
cerr << "i = " << i << "\t ggm(i) = " << tmpGroupMembership[i] << "\n"; |
741 |
+ |
|
742 |
|
#else |
743 |
|
info->setGlobalGroupMembership(globalGroupMembership); |
744 |
|
#endif |
798 |
|
globalIO++; |
799 |
|
} |
800 |
|
} |
801 |
< |
|
801 |
> |
cerr << "ioi2io:\n"; |
802 |
> |
for (int i = 0; i < IOIndexToIntegrableObject.size(); i++) { |
803 |
> |
if (IOIndexToIntegrableObject[i] != NULL) { |
804 |
> |
cerr << "i = " << i << "globalIOindex = " << IOIndexToIntegrableObject[i]->getGlobalIntegrableObjectIndex() << "\n"; |
805 |
> |
} |
806 |
> |
} |
807 |
> |
|
808 |
|
info->setIOIndexToIntegrableObject(IOIndexToIntegrableObject); |
809 |
|
|
810 |
|
} |
811 |
|
|
812 |
|
void SimCreator::loadCoordinates(SimInfo* info, const std::string& mdFileName) { |
813 |
|
Globals* simParams; |
814 |
+ |
|
815 |
|
simParams = info->getSimParams(); |
816 |
|
|
803 |
– |
|
817 |
|
DumpReader reader(info, mdFileName); |
818 |
|
int nframes = reader.getNFrames(); |
819 |
< |
|
819 |
> |
|
820 |
|
if (nframes > 0) { |
821 |
|
reader.readFrame(nframes - 1); |
822 |
|
} else { |
827 |
|
painCave.isFatal = 1; |
828 |
|
simError(); |
829 |
|
} |
817 |
– |
|
830 |
|
//copy the current snapshot to previous snapshot |
831 |
|
info->getSnapshotManager()->advance(); |
832 |
|
} |