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 |
|
|
708 |
|
} |
709 |
|
|
710 |
|
//fill globalGroupMembership |
711 |
< |
std::vector<int> globalGroupMembership(info->getNGlobalAtoms(), 0); |
711 |
> |
std::vector<int> globalGroupMembership(info->getNGlobalAtoms(), -1); |
712 |
|
for(mol = info->beginMolecule(mi); mol != NULL; mol = info->nextMolecule(mi)) { |
713 |
|
for (cg = mol->beginCutoffGroup(ci); cg != NULL; cg = mol->nextCutoffGroup(ci)) { |
714 |
|
|
718 |
|
|
719 |
|
} |
720 |
|
} |
721 |
< |
|
721 |
> |
|
722 |
|
#ifdef IS_MPI |
723 |
|
// Since the globalGroupMembership has been zero filled and we've only |
724 |
|
// poked values into the atoms we know, we can do an Allreduce |
727 |
|
// docs said we could. |
728 |
|
std::vector<int> tmpGroupMembership(info->getNGlobalAtoms(), 0); |
729 |
|
MPI_Allreduce(&globalGroupMembership[0], &tmpGroupMembership[0], nGlobalAtoms, |
730 |
< |
MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
730 |
> |
MPI_INT, MPI_MAX, MPI_COMM_WORLD); |
731 |
|
info->setGlobalGroupMembership(tmpGroupMembership); |
732 |
+ |
|
733 |
+ |
cerr << "ggm:\n"; |
734 |
+ |
for (int i = 0; i < tmpGroupMembership.size(); i++) |
735 |
+ |
cerr << "i = " << i << "\t ggm(i) = " << tmpGroupMembership[i] << "\n"; |
736 |
+ |
|
737 |
|
#else |
738 |
|
info->setGlobalGroupMembership(globalGroupMembership); |
739 |
|
#endif |
800 |
|
|
801 |
|
void SimCreator::loadCoordinates(SimInfo* info, const std::string& mdFileName) { |
802 |
|
Globals* simParams; |
803 |
+ |
|
804 |
|
simParams = info->getSimParams(); |
805 |
|
|
803 |
– |
|
806 |
|
DumpReader reader(info, mdFileName); |
807 |
|
int nframes = reader.getNFrames(); |
808 |
< |
|
808 |
> |
|
809 |
|
if (nframes > 0) { |
810 |
|
reader.readFrame(nframes - 1); |
811 |
|
} else { |
816 |
|
painCave.isFatal = 1; |
817 |
|
simError(); |
818 |
|
} |
817 |
– |
|
819 |
|
//copy the current snapshot to previous snapshot |
820 |
|
info->getSnapshotManager()->advance(); |
821 |
|
} |