67 |
|
MakeStamps *the_stamps; |
68 |
|
Globals* the_globals; |
69 |
|
ExtendedSystem* the_extendedsystem; |
70 |
< |
int i, j; |
70 |
> |
int i, j, k, globalAtomIndex; |
71 |
|
|
72 |
|
// get the stamps and globals; |
73 |
|
the_stamps = stamps; |
298 |
|
simnfo->n_torsions = tot_torsions; |
299 |
|
simnfo->n_SRI = tot_SRI; |
300 |
|
simnfo->n_mol = tot_nmol; |
301 |
+ |
simnfo->molMembershipArray = new int[tot_atoms]; |
302 |
|
|
302 |
– |
|
303 |
|
#ifdef IS_MPI |
304 |
|
|
305 |
|
// divide the molecules among processors here. |
306 |
|
|
307 |
|
mpiSim = new mpiSimulation( simnfo ); |
308 |
|
|
309 |
– |
|
310 |
– |
|
309 |
|
globalIndex = mpiSim->divideLabor(); |
310 |
|
|
311 |
|
// set up the local variables |
322 |
|
local_bonds = 0; |
323 |
|
local_bends = 0; |
324 |
|
local_torsions = 0; |
325 |
+ |
globalAtomIndex = 0; |
326 |
+ |
|
327 |
+ |
|
328 |
|
for( i=0; i<n_components; i++ ){ |
329 |
|
|
330 |
|
for( j=0; j<components_nmol[i]; j++ ){ |
337 |
|
local_torsions += comp_stamps[i]->getNTorsions(); |
338 |
|
localMol++; |
339 |
|
} |
340 |
< |
allMol++; |
340 |
> |
for (k = 0; k < comp_stamps[i]->getNAtoms(); k++) { |
341 |
> |
simnfo->molMembershipArray[globalAtomIndex] = allMol; |
342 |
> |
globalAtomIndex++; |
343 |
> |
} |
344 |
> |
|
345 |
> |
allMol++; |
346 |
|
} |
347 |
|
} |
348 |
|
local_SRI = local_bonds + local_bends + local_torsions; |
349 |
|
|
350 |
+ |
if (worldRank != 0) { |
351 |
+ |
for (i =0; i < tot_atoms; i++){ |
352 |
+ |
std::cerr << "i = " << i << " molMembershipArray[i] = " << simnfo->molMembershipArray[i] << "\n"; |
353 |
+ |
} |
354 |
+ |
} |
355 |
|
|
356 |
|
simnfo->n_atoms = mpiSim->getMyNlocal(); |
357 |
|
|
404 |
|
#else // is_mpi |
405 |
|
|
406 |
|
molIndex = 0; |
407 |
+ |
globalAtomIndex = 0; |
408 |
|
for(i=0; i<n_components; i++){ |
409 |
|
for(j=0; j<components_nmol[i]; j++ ){ |
410 |
|
the_molecules[molIndex].setStampID( i ); |
411 |
|
the_molecules[molIndex].setMyIndex( molIndex ); |
412 |
|
the_molecules[molIndex].setGlobalIndex( molIndex ); |
413 |
+ |
for (k = 0; k < comp_stamps[i]->getNAtoms(); k++) { |
414 |
+ |
simnfo->molMembershipArray[globalAtomIndex] = molIndex; |
415 |
+ |
globalAtomIndex++; |
416 |
+ |
} |
417 |
|
molIndex++; |
418 |
|
} |
419 |
|
} |
503 |
|
|
504 |
|
makeMolecules(); |
505 |
|
simnfo->identArray = new int[simnfo->n_atoms]; |
490 |
– |
simnfo->molMembershipArray = new int[simnfo->n_atoms]; |
506 |
|
for(i=0; i<simnfo->n_atoms; i++){ |
507 |
|
simnfo->identArray[i] = the_atoms[i]->getIdent(); |
508 |
|
} |
494 |
– |
for(i=0; i< simnfo->n_mol; i++) { |
495 |
– |
the_molecules[i].atomicRollCall(simnfo->molMembershipArray); |
496 |
– |
} |
509 |
|
|
510 |
|
if (the_globals->getUseRF() ) { |
511 |
|
simnfo->useReactionField = 1; |