| 17 |
|
entryPlug = the_entryPlug; |
| 18 |
|
mpiPlug = new mpiSimData; |
| 19 |
|
|
| 20 |
< |
MPI_Comm_size(MPI_COMM_WORLD, &(mpiPlug->numberProcessors) ); |
| 20 |
> |
MPI_Comm_size(MPI_COMM_WORLD, &(mpiPlug->nProcessors) ); |
| 21 |
|
mpiPlug->myNode = worldRank; |
| 22 |
|
|
| 23 |
|
MolToProcMap = new int[entryPlug->n_mol]; |
| 65 |
|
nComponents = entryPlug->nComponents; |
| 66 |
|
compStamps = entryPlug->compStamps; |
| 67 |
|
componentsNmol = entryPlug->componentsNmol; |
| 68 |
< |
AtomsPerProc = new int[mpiPlug->numberProcessors]; |
| 68 |
> |
AtomsPerProc = new int[mpiPlug->nProcessors]; |
| 69 |
|
|
| 70 |
|
mpiPlug->nAtomsGlobal = entryPlug->n_atoms; |
| 71 |
|
mpiPlug->nBondsGlobal = entryPlug->n_bonds; |
| 73 |
|
mpiPlug->nTorsionsGlobal = entryPlug->n_torsions; |
| 74 |
|
mpiPlug->nSRIGlobal = entryPlug->n_SRI; |
| 75 |
|
mpiPlug->nMolGlobal = entryPlug->n_mol; |
| 76 |
+ |
mpiPlug->nGroupsGlobal = entryPlug->ngroup; |
| 77 |
|
|
| 78 |
|
myRandom = new randomSPRNG( baseSeed ); |
| 79 |
|
|
| 80 |
|
a = 3.0 * (double)mpiPlug->nMolGlobal / (double)mpiPlug->nAtomsGlobal; |
| 81 |
|
|
| 82 |
|
// Initialize things that we'll send out later: |
| 83 |
< |
for (i = 0; i < mpiPlug->numberProcessors; i++ ) { |
| 83 |
> |
for (i = 0; i < mpiPlug->nProcessors; i++ ) { |
| 84 |
|
AtomsPerProc[i] = 0; |
| 85 |
|
} |
| 86 |
|
for (i = 0; i < mpiPlug->nMolGlobal; i++ ) { |
| 95 |
|
|
| 96 |
|
if (mpiPlug->myNode == 0) { |
| 97 |
|
numerator = (double) entryPlug->n_atoms; |
| 98 |
< |
denominator = (double) mpiPlug->numberProcessors; |
| 98 |
> |
denominator = (double) mpiPlug->nProcessors; |
| 99 |
|
precast = numerator / denominator; |
| 100 |
|
nTarget = (int)( precast + 0.5 ); |
| 101 |
|
|
| 120 |
|
|
| 121 |
|
// Pick a processor at random |
| 122 |
|
|
| 123 |
< |
which_proc = (int) (myRandom->getRandom() * mpiPlug->numberProcessors); |
| 123 |
> |
which_proc = (int) (myRandom->getRandom() * mpiPlug->nProcessors); |
| 124 |
|
|
| 125 |
|
// How many atoms does this processor have? |
| 126 |
|
|
| 204 |
|
MPI_Bcast(MolComponentType, mpiPlug->nMolGlobal, |
| 205 |
|
MPI_INT, 0, MPI_COMM_WORLD); |
| 206 |
|
|
| 207 |
< |
MPI_Bcast(AtomsPerProc, mpiPlug->numberProcessors, |
| 207 |
> |
MPI_Bcast(AtomsPerProc, mpiPlug->nProcessors, |
| 208 |
|
MPI_INT, 0, MPI_COMM_WORLD); |
| 209 |
|
} else { |
| 210 |
|
|
| 219 |
|
MPI_Bcast(MolComponentType, mpiPlug->nMolGlobal, |
| 220 |
|
MPI_INT, 0, MPI_COMM_WORLD); |
| 221 |
|
|
| 222 |
< |
MPI_Bcast(AtomsPerProc, mpiPlug->numberProcessors, |
| 222 |
> |
MPI_Bcast(AtomsPerProc, mpiPlug->nProcessors, |
| 223 |
|
MPI_INT, 0, MPI_COMM_WORLD); |
| 224 |
|
|
| 225 |
|
|
| 269 |
|
"Successfully divided the molecules among the processors.\n" ); |
| 270 |
|
MPIcheckPoint(); |
| 271 |
|
|
| 272 |
< |
mpiPlug->myNMol = nmol_local; |
| 273 |
< |
mpiPlug->myNlocal = natoms_local; |
| 272 |
> |
mpiPlug->nMolLocal = nmol_local; |
| 273 |
> |
mpiPlug->nAtomsLocal = natoms_local; |
| 274 |
|
|
| 275 |
< |
globalAtomIndex.resize(mpiPlug->myNlocal); |
| 275 |
> |
globalAtomIndex.resize(mpiPlug->nAtomsLocal); |
| 276 |
|
globalToLocalAtom.resize(mpiPlug->nAtomsGlobal); |
| 277 |
|
local_index = 0; |
| 278 |
|
for (i = 0; i < mpiPlug->nAtomsGlobal; i++) { |
| 287 |
|
globalToLocalAtom[i] = -1; |
| 288 |
|
} |
| 289 |
|
|
| 290 |
< |
globalMolIndex.resize(mpiPlug->myNMol); |
| 290 |
> |
globalMolIndex.resize(mpiPlug->nMolLocal); |
| 291 |
|
globalToLocalMol.resize(mpiPlug->nMolGlobal); |
| 292 |
|
|
| 293 |
|
local_index = 0; |
| 307 |
|
void mpiSimulation::mpiRefresh( void ){ |
| 308 |
|
|
| 309 |
|
int isError, i; |
| 310 |
< |
int *globalIndex = new int[mpiPlug->myNlocal]; |
| 310 |
> |
int *globalIndex = new int[mpiPlug->nAtomsLocal]; |
| 311 |
|
|
| 312 |
|
// Fortran indexing needs to be increased by 1 in order to get the 2 languages to |
| 313 |
|
// not barf |
| 314 |
|
|
| 315 |
< |
for(i=0; i<mpiPlug->myNlocal; i++) globalIndex[i] = entryPlug->atoms[i]->getGlobalIndex()+1; |
| 315 |
> |
for(i=0; i<mpiPlug->nAtomsLocal; i++) globalIndex[i] = entryPlug->atoms[i]->getGlobalIndex()+1; |
| 316 |
|
|
| 317 |
|
|
| 318 |
|
isError = 0; |