26 |
|
} |
27 |
|
|
28 |
|
|
29 |
< |
void mpiSimulation::divideLabor(int nComponents, MoleculeStamp** compStamps, int* componentsNmol ){ |
30 |
< |
|
29 |
> |
void mpiSimulation::divideLabor( void ){ |
30 |
> |
|
31 |
> |
int nComponents; |
32 |
> |
MoleculeStamp** compStamps; |
33 |
> |
int* componentsNmol; |
34 |
> |
|
35 |
|
double numerator; |
36 |
|
double denominator; |
37 |
|
double precast; |
39 |
|
int nTarget; |
40 |
|
int molIndex, atomIndex, compIndex, compStart; |
41 |
|
int done; |
42 |
< |
int nLocal; |
42 |
> |
int nLocal, molLocal; |
43 |
|
int i; |
44 |
|
int smallDiff, bigDiff; |
45 |
|
|
46 |
|
int testSum; |
47 |
|
|
48 |
+ |
nComponents = entryPlug->nComponents; |
49 |
+ |
compStamps = entryPlug->compStamps; |
50 |
+ |
componentsNmol = entryPlug->componentsNmol; |
51 |
+ |
|
52 |
+ |
simTotAtoms = entryPlug->n_atoms; |
53 |
+ |
simTotBonds = entryPlug->n_bonds; |
54 |
+ |
simTotBends = entryPlug->n_bends; |
55 |
+ |
simTotTorsions = entryPlug->n_torsions; |
56 |
+ |
simTotSRI = entryPlug->n_SRI; |
57 |
+ |
simTotNmol = entryPlug->n_nmol; |
58 |
+ |
|
59 |
|
numerator = (double) entryPlug->n_atoms; |
60 |
|
denominator = (double) numberProcessors; |
61 |
|
precast = numerator / denominator; |
69 |
|
|
70 |
|
done = 0; |
71 |
|
nLocal = 0; |
72 |
+ |
molLocal = 0; |
73 |
|
|
74 |
|
if( i == myNode ){ |
75 |
|
myMolStart = molIndex; |
87 |
|
nLocal += compStamps[compIndex]->getNAtoms(); |
88 |
|
atomIndex += compStamps[compIndex]->getNAtoms(); |
89 |
|
molIndex++; |
90 |
+ |
molLocal++; |
91 |
|
|
92 |
|
if ( nLocal == nTarget ) done = 1; |
93 |
|
|
100 |
|
if( bigDiff < smallDiff ) done = 1; |
101 |
|
else{ |
102 |
|
molIndex--; |
103 |
+ |
molLocal--; |
104 |
|
atomIndex -= compStamps[compIndex]->getNAtoms(); |
105 |
|
nLocal -= compStamps[compIndex]->getNAtoms(); |
106 |
|
done = 1; |
112 |
|
myMolEnd = (molIndex - 1); |
113 |
|
myAtomEnd = (atomIndex - 1); |
114 |
|
myNlocal = nLocal; |
115 |
+ |
myMol = molLocal; |
116 |
|
} |
117 |
|
|
118 |
|
numerator = (double)( entryPlug->n_atoms - atomIndex ); |
126 |
|
myAtomStart = atomIndex; |
127 |
|
|
128 |
|
nLocal = 0; |
129 |
+ |
molLocal = 0; |
130 |
|
while( compIndex < nComponents ){ |
131 |
|
|
132 |
|
if( (molIndex-compStart) >= componentsNmol[compIndex] ){ |
138 |
|
nLocal += compStamps[compIndex]->getNAtoms(); |
139 |
|
atomIndex += compStamps[compIndex]->getNAtoms(); |
140 |
|
molIndex++; |
141 |
+ |
molLocal++; |
142 |
|
} |
143 |
|
|
144 |
|
myMolEnd = (molIndex - 1); |
145 |
|
myAtomEnd = (atomIndex - 1); |
146 |
< |
myNlocal = nLocal; |
146 |
> |
myNlocal = nLocal; |
147 |
> |
myMol = molLocal; |
148 |
|
} |
149 |
|
|
150 |
|
|
163 |
|
sprintf( checkPointMsg, |
164 |
|
"Successfully divided the molecules among the processors.\n" ); |
165 |
|
MPIcheckPoint(); |
166 |
+ |
|
167 |
+ |
// lets create the identity array |
168 |
|
} |