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 |
|
|
227 |
|
simnfo->n_bends = tot_bends; |
228 |
|
simnfo->n_torsions = tot_torsions; |
229 |
|
simnfo->n_SRI = tot_SRI; |
230 |
+ |
simnfo->n_mol = tot_nmol; |
231 |
|
|
232 |
+ |
|
233 |
+ |
#ifdef IS_MPI |
234 |
+ |
|
235 |
|
// divide the molecules among processors here. |
236 |
+ |
|
237 |
+ |
new mpiSimulation( simnfo ); |
238 |
+ |
|
239 |
+ |
simnfo->mpiSim->divideLabor( n_components, comp_stamps, components_nmol ); |
240 |
|
|
241 |
+ |
#endif // is_mpi |
242 |
+ |
|
243 |
|
|
244 |
|
// create the atom and short range interaction arrays |
245 |
|
|
246 |
< |
Atom::createArrays(tot_atoms); |
247 |
< |
the_atoms = new Atom*[tot_atoms]; |
248 |
< |
the_molecules = new Molecule[tot_nmol]; |
246 |
> |
Atom::createArrays(simnfo->n_atoms); |
247 |
> |
the_atoms = new Atom*[simnfo->n_atoms]; |
248 |
> |
the_molecules = new Molecule[simnfo->n_mol]; |
249 |
|
|
250 |
|
|
251 |
< |
if( tot_SRI ){ |
252 |
< |
the_sris = new SRI*[tot_SRI]; |
253 |
< |
the_excludes = new ex_pair[tot_SRI]; |
251 |
> |
if( simnfo->n_SRI ){ |
252 |
> |
the_sris = new SRI*[simnfo->n_SRI]; |
253 |
> |
the_excludes = new ex_pair[simnfo->n_SRI]; |
254 |
|
} |
255 |
|
|
256 |
|
// set the arrays into the SimInfo object |
279 |
|
makeTorsions(); |
280 |
|
} |
281 |
|
|
236 |
– |
// makeMolecules(); |
282 |
|
|
283 |
|
// get some of the tricky things that may still be in the globals |
284 |
|
|
362 |
|
// delete fileInit; |
363 |
|
// } |
364 |
|
// else{ |
365 |
+ |
|
366 |
+ |
#ifdef IS_MPI |
367 |
+ |
|
368 |
+ |
// no init from bass |
369 |
+ |
|
370 |
+ |
sprintf( painCave.errMsg, |
371 |
+ |
"Cannot intialize a parallel simulation without an initial configuration file.\n" ); |
372 |
+ |
painCave.isFatal; |
373 |
+ |
simError(); |
374 |
+ |
|
375 |
+ |
#else |
376 |
|
|
377 |
|
initFromBass(); |
378 |
+ |
|
379 |
+ |
#endif // is_mpi |
380 |
|
|
381 |
|
#ifdef IS_MPI |
382 |
< |
strcpy( checkPointMsg, "initFromBass successfully created the lattice" ); |
382 |
> |
strcpy( checkPointMsg, "Successfully read in the initial configuration" ); |
383 |
|
MPIcheckPoint(); |
384 |
|
#endif // is_mpi |
385 |
|
|