73 |
|
|
74 |
|
MakeStamps *the_stamps; |
75 |
|
Globals* the_globals; |
76 |
< |
int i; |
76 |
> |
int i, j; |
77 |
|
|
78 |
|
// get the stamps and globals; |
79 |
|
the_stamps = stamps; |
161 |
|
#endif // is_mpi |
162 |
|
|
163 |
|
// make an array of molecule stamps that match the components used. |
164 |
+ |
// also extract the used stamps out into a separate linked list |
165 |
|
|
166 |
+ |
simnfo->nComponents = n_components; |
167 |
+ |
simnfo->componentsNmol = components_nmol; |
168 |
+ |
simnfo->compStamps = comp_stamps; |
169 |
+ |
simnfo->headStamp = new LinkedMolStamp(); |
170 |
+ |
|
171 |
+ |
char* id; |
172 |
+ |
LinkedMolStamp* headStamp = simnfo->headStamp; |
173 |
+ |
LinkedMolStamp* currentStamp = NULL; |
174 |
|
for( i=0; i<n_components; i++ ){ |
175 |
|
|
176 |
< |
comp_stamps[i] = |
177 |
< |
the_stamps->getMolecule( the_components[i]->getType() ); |
176 |
> |
id = the_components[i]->getType(); |
177 |
> |
comp_stamps[i] = NULL; |
178 |
> |
|
179 |
> |
// check to make sure the component isn't already in the list |
180 |
> |
|
181 |
> |
comp_stamps[i] = headStamp->match( id ); |
182 |
> |
if( comp_stamps[i] == NULL ){ |
183 |
> |
|
184 |
> |
// extract the component from the list; |
185 |
> |
|
186 |
> |
currentStamp = the_stamps->extractMolStamp( id ); |
187 |
> |
if( currentStamp == NULL ){ |
188 |
> |
sprintf( painCave.errMsg, |
189 |
> |
"SimSetup error: Component \"%s\" was not found in the " |
190 |
> |
"list of declared molecules\n" |
191 |
> |
id ); |
192 |
> |
painCave.isFatal = 1; |
193 |
> |
simError(); |
194 |
> |
} |
195 |
> |
|
196 |
> |
headStamp->add( currentStamp ); |
197 |
> |
comp_stamps[i] = headStamp->match( id ); |
198 |
> |
} |
199 |
|
} |
200 |
|
|
201 |
+ |
#ifdef IS_MPI |
202 |
+ |
strcpy( checkPointMsg, "Component stamps successfully extracted\n" ); |
203 |
+ |
MPIcheckPoint(); |
204 |
+ |
#endif // is_mpi |
205 |
+ |
|
206 |
|
|
207 |
|
|
208 |
+ |
|
209 |
|
// caclulate the number of atoms, bonds, bends and torsions |
210 |
|
|
211 |
|
tot_atoms = 0; |
213 |
|
tot_bends = 0; |
214 |
|
tot_torsions = 0; |
215 |
|
for( i=0; i<n_components; i++ ){ |
216 |
< |
|
217 |
< |
tot_atoms += components_nmol[i] * comp_stamps[i]->getNAtoms(); |
218 |
< |
tot_bonds += components_nmol[i] * comp_stamps[i]->getNBonds(); |
219 |
< |
tot_bends += components_nmol[i] * comp_stamps[i]->getNBends(); |
216 |
> |
|
217 |
> |
tot_atoms += components_nmol[i] * comp_stamps[i]->getNAtoms(); |
218 |
> |
tot_bonds += components_nmol[i] * comp_stamps[i]->getNBonds(); |
219 |
> |
tot_bends += components_nmol[i] * comp_stamps[i]->getNBends(); |
220 |
|
tot_torsions += components_nmol[i] * comp_stamps[i]->getNTorsions(); |
221 |
|
} |
222 |
|
|
234 |
|
|
235 |
|
// divide the molecules among processors here. |
236 |
|
|
237 |
< |
new mpiSimulation( simnfo ); |
237 |
> |
mpiSimulation* mpiSim = new mpiSimulation( simnfo ); |
238 |
|
|
239 |
< |
simnfo->mpiSim->divideLabor( n_components, comp_stamps, components_nmol ); |
239 |
> |
mpiSim->divideLabor(); |
240 |
> |
|
241 |
> |
// set up the local variables |
242 |
> |
|
243 |
> |
int localMol; |
244 |
> |
int local_atoms, local_bonds, local_bends, local_torsions, local_SRI; |
245 |
> |
|
246 |
> |
localMol = 0; |
247 |
> |
local_atoms = 0; |
248 |
> |
local_bonds = 0; |
249 |
> |
local_bends = 0; |
250 |
> |
local_torsions = 0; |
251 |
> |
for( i=0; i<n_components; i++ ){ |
252 |
> |
|
253 |
> |
for( j=0; j<components_nmol[i]; j++ ){ |
254 |
> |
|
255 |
> |
if( mpiSim->getMyMolStart() <= j && |
256 |
> |
j <= mpiSim->getMyMolEnd() ){ |
257 |
> |
|
258 |
> |
local_atoms += comp_stamps[i]->getNAtoms(); |
259 |
> |
local_bonds += comp_stamps[i]->getNBonds(); |
260 |
> |
local_bends += comp_stamps[i]->getNBends(); |
261 |
> |
local_torsions += comp_stamps[i]->getNTorsions(); |
262 |
> |
localMol++; |
263 |
> |
} |
264 |
> |
} |
265 |
> |
} |
266 |
|
|
267 |
+ |
|
268 |
+ |
|
269 |
+ |
simnfo->n_atoms = mpiSim->getMyNlocal(); |
270 |
+ |
|
271 |
+ |
|
272 |
|
#endif // is_mpi |
273 |
|
|
274 |
|
|
593 |
|
the_molecules[molIndex].setNMembers( nMemb ); |
594 |
|
the_molecules[molIndex].setStartAtom( molStart ); |
595 |
|
the_molecules[molIndex].setEndAtom( molEnd ); |
596 |
+ |
the_molecules[molIndex].setStampID( i ); |
597 |
|
molIndex++; |
598 |
|
|
599 |
|
} |